# -*- coding: utf-8 -*-
# $Id: auth.py 1634 2013-04-12 15:36:36Z amelung $
#
# Copyright (c) 2007-2011 Otto-von-Guericke-Universität Magdeburg
#
# This file is part of ECSpooler.
#
#import md5
#import shelve
#import os
import time
import logging
try:
import crypt
except ImportError, ierr:
crypt = None
try:
import hashlib
except ImportError:
# this will prevent dictionary attacks
# authorization levels
class UserAuthMD5():
"""
md5 encrypted passwords
"""
"""
@param: userFile Absolute path to a file containing usernames and
md5 encrypted passwords
"""
"""
@param: args A dictionary with keys and values for username and encrypted password
@param: level
@return: True if username and password are correct, otherwise False
"""
try:
return False
# do some parameter testing
"Missing or invalid 'username'"
"Missing or invalid 'password'"
except AssertionError, err:
return False
"""
@return: True if username and password are correct, otherwise False
"""
if not ans:
'dictionary attacks' % USER_AUTH_FAIL_SLEEP)
return ans
"""
@return: A list with all usernames
"""
"""
@return: A dictionary containing username-password pairs
"""
lines = []
usrdb = {}
try:
#LOG.debug("Added user '%s'" % username)
return usrdb
# -- --------------------------------------------------------------------------
if __name__ == '__main__':
# testing UserAuthMD5
#print md5.md5('Asdf,.').hexdigest()