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.

Files:
1 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)