Fixed to cope with a None handler passed in tests

This commit is contained in:
David Blockow
2015-12-08 15:50:54 +10:30
parent e59b3f3ab1
commit d512ee9f65

View File

@@ -236,7 +236,10 @@ class PAMAuthenticator(LocalAuthenticator):
try:
pamela.authenticate(username, data['password'], service=self.service)
except pamela.PAMError as e:
self.log.warn("PAM Authentication failed (@%s): %s", handler.request.remote_ip, e)
if handler is not None:
self.log.warn("PAM Authentication failed (@%s): %s", handler.request.remote_ip, e)
else:
self.log.warn("PAM Authentication failed: %s", e)
else:
return username