Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import sys
- import socket
- import logging
- logging.basicConfig(filename="/tmp/squid_auth.log", level=logging.DEBUG)
- """USAGE:The function returns True if the user and passwd match False otherwise"""
- def matchpasswd(login,passwd):
- # Write your own function definition.
- # Use mysql, files, /etc/passwd or some service or whatever you want
- logging.warning((login,passwd))
- return True
- while True:
- # read a line from stdin
- line = sys.stdin.readline()
- # remove '\n' from line
- line = line.strip()
- # extract username and password from line
- username = line[:line.find(' ')]
- password = line[line.find(' ')+1:]
- if matchpasswd(username, password):
- sys.stdout.write('OK\n')
- else:
- sys.stdout.write('ERR\n')
- # Flush the output to stdout.
- sys.stdout.flush()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement