Changeset 3179 for pykota/branches

Show
Ignore:
Timestamp:
05/29/07 11:12:17 (17 years ago)
Author:
jerome
Message:

Special DB auth seems to work fine with clear text passwords.

Location:
pykota/branches/specialauth
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • pykota/branches/specialauth/bin/pknotify

    r3144 r3179  
    3838    hasPAM = 1 
    3939 
    40 from pykota.tool import Tool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
     40from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
    4141 
    4242__doc__ = N_("""pknotify v%(__version__)s (c) %(__years__)s %(__author__)s 
     
    157157    __str__ = __repr__ 
    158158     
    159 class PyKotaNotify(Tool) :         
     159class PyKotaNotify(PyKotaTool) :         
    160160    """A class for pknotify.""" 
    161161    def sanitizeMessage(self, msg) : 
     
    176176        return response 
    177177 
    178     def checkAuth(self, username, password) :     
    179         """Checks if we could authenticate an username with a password.""" 
     178    def checkAuthPAM(self, username, password) :     
     179        """Checks if we could authenticate an username with a password through PAM.""" 
    180180        if not hasPAM :     
    181181            raise PyKotaToolError, _("You MUST install PyPAM for this functionnality to work !") 
     
    200200            self.dropPriv()     
    201201            return retcode 
     202             
     203    def checkAuthDB(self, username, password) :     
     204        """Checks if we could authenticate an username with a password through PyKota's DB with clear text passwords.""" 
     205        user = self.storage.getUser(username) 
     206        if user.Exists : 
     207            if password == user.Password : 
     208                return True 
     209        return False         
     210         
     211    def checkAuth(self, username, password) :     
     212        """Checks if we could authenticate an username with a password through PyKota's DB.""" 
     213        return self.checkAuthDB(username, password) 
    202214             
    203215    def alarmHandler(self, signum, frame) :         
     
    372384        retcode = -1 
    373385         
     386    try : 
     387        notifier.storage.close() 
     388    except (TypeError, NameError, AttributeError) :     
     389        pass 
     390         
    374391    sys.exit(retcode)     
  • pykota/branches/specialauth/pykota/storage.py

    r3133 r3179  
    7171        self.LifeTimePaid = None 
    7272        self.Email = None 
     73        self.Password = None 
    7374        self.OverCharge = 1.0 
    7475        self.Payments = [] # TODO : maybe handle this smartly for SQL, for now just don't retrieve them 
  • pykota/branches/specialauth/pykota/storages/sql.py

    r3165 r3179  
    3636        user.LifeTimePaid = record.get("lifetimepaid") 
    3737        user.Email = record.get("email") 
     38        user.Password = record.get("password") 
    3839        user.Description = self.databaseToUserCharset(record.get("description")) 
    3940        user.OverCharge = record.get("overcharge", 1.0) 
  • pykota/branches/specialauth/pykota/version.py

    r3162 r3179  
    2222# 
    2323 
    24 __version__ = "1.26alpha5_unofficial" 
     24__version__ = "1.26alpha5_specialauth_unofficial" 
    2525 
    2626__doc__ = "PyKota : a complete Printing Quota Solution for CUPS."