Advertisement
Guest User

Untitled

a guest
May 15th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import sys
  4. import socket
  5. import logging
  6. logging.basicConfig(filename="/tmp/squid_auth.log", level=logging.DEBUG)
  7.  
  8. """USAGE:The function returns True if the user and passwd match False otherwise"""
  9. def matchpasswd(login,passwd):
  10. # Write your own function definition.
  11. # Use mysql, files, /etc/passwd or some service or whatever you want
  12. logging.warning((login,passwd))
  13. return True
  14.  
  15. while True:
  16. # read a line from stdin
  17. line = sys.stdin.readline()
  18. # remove '\n' from line
  19. line = line.strip()
  20. # extract username and password from line
  21. username = line[:line.find(' ')]
  22. password = line[line.find(' ')+1:]
  23.  
  24. if matchpasswd(username, password):
  25. sys.stdout.write('OK\n')
  26. else:
  27. sys.stdout.write('ERR\n')
  28. # Flush the output to stdout.
  29. sys.stdout.flush()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement