Example #1
0
 def check(username, password):
     debug("PAM check(%s, [..])", username)
     auth = PAM.pam()
     auth.start(PAM_SERVICE)
     auth.set_item(PAM.PAM_USER, username)
     conv = PAM_conv(password)
     auth.set_item(PAM.PAM_CONV, conv.pam_conv_password)
     try:
         auth.authenticate()
         return    True
         #auth.acct_mgmt()
     except PAM.error, resp:
         log.error("PAM.authenticate() error: %s", resp)
         return    False
Example #2
0
 def check(username, password):
     debug("pam check(%s, [..])", username)
     return pam.authenticate(username, password)
Example #3
0
        auth.start(PAM_SERVICE)
        auth.set_item(PAM.PAM_USER, username)
        conv = PAM_conv(password)
        auth.set_item(PAM.PAM_CONV, conv.pam_conv_password)
        try:
            auth.authenticate()
            return    True
            #auth.acct_mgmt()
        except PAM.error, resp:
            log.error("PAM.authenticate() error: %s", resp)
            return    False
        except Exception, e:
            log.error("PAM.authenticate() internal error: %s", e)
            return    False
except Exception, e:
    debug("PAM module not available: %s", e)

try:
    from xpra.server.auth import pam
    assert pam
    def check(username, password):
        debug("pam check(%s, [..])", username)
        return pam.authenticate(username, password)
except:
    debug("pam module not available: %s", e)


if check is None:
    raise ImportError("cannot use pam_auth without a pam python module")