Beispiel #1
0
 def get_password(self) -> str:
     password = super().get_password()
     if not password:
         return password
     if password.find(b"\n") >= 0 or password.find(b"\r") >= 0:
         log.warn("Warning: newline found in password data")
         log.warn(" this is usually a mistake")
     return password
Beispiel #2
0
 def get_password(self) -> str:
     password = FileAuthenticatorBase.get_password(self)
     if not password:
         return password
     if password.find(b"\n")>=0 or password.find(b"\r")>=0:
         log.warn("Warning: newline found in password data")
         log.warn(" this is usually a mistake")
     return password
Beispiel #3
0
 def authenticate_hmac(self, challenge_response, client_salt=None):
     log("authenticate_hmac(%r, %r)", challenge_response, client_salt)
     self.sessions = None
     if not self.salt:
         log.error(
             "Error: illegal challenge response received - salt cleared or unset"
         )
         return None
     #ensure this salt does not get re-used:
     salt = self.get_response_salt(client_salt)
     entry = self.get_auth_info()
     if entry is None:
         log.warn("Warning: authentication failed")
         log.warn(" no password for '%s' in '%s'", self.username,
                  self.password_filename)
         return None
     log("authenticate: auth-info(%s)=%s", self.username, entry)
     fpassword, uid, gid, displays, env_options, session_options = entry
     log("multifile authenticate_hmac password='******', hex(salt)=%s",
         fpassword, hexstr(salt))
     if not verify_digest(self.digest, fpassword, salt, challenge_response):
         log.warn("Warning: %s challenge for '%s' does not match",
                  self.digest, self.username)
         return False
     self.sessions = uid, gid, displays, env_options, session_options
     return True
Beispiel #4
0
 def authenticate_hmac(self, challenge_response, client_salt=None):
     if not self.salt:
         log.error("Error: illegal challenge response received - salt cleared or unset")
         return None
     salt = self.get_response_salt(client_salt)
     password = self.get_password()
     log("authenticate_hmac() get_password()=%s", obsc(password))
     if not password:
         log.warn("Warning: authentication failed")
         log.warn(" no password for '%s' in '%s'", self.username, self.password_filename)
         return False
     if not verify_digest(self.digest, password, salt, challenge_response):
         log.warn("Warning: %s challenge for '%s' does not match", self.digest, self.username)
         return False
     return True