summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2014-05-07 15:41:41 +0200
committerPetr Vobornik <pvoborni@redhat.com>2014-05-26 13:08:34 +0200
commit1e96475a77280bbdc883c66e0dc451ef0559c5fb (patch)
treef288f581fca6055e684381e939e5520348cb508d
parent988b2cebf4bf6657eb50f5ecc57bd39425739b8b (diff)
downloadfreeipa-1e96475a77280bbdc883c66e0dc451ef0559c5fb.tar.gz
freeipa-1e96475a77280bbdc883c66e0dc451ef0559c5fb.tar.xz
freeipa-1e96475a77280bbdc883c66e0dc451ef0559c5fb.zip
rpcserver: login_password datetime fix in expiration check
krbpasswordexpiration conversion to time failed because now we get datetime object instead of string. https://fedorahosted.org/freeipa/ticket/4339 Reviewed-By: Tomas Babej <tbabej@redhat.com>
-rw-r--r--ipaserver/rpcserver.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
index 821eed226..edce23654 100644
--- a/ipaserver/rpcserver.py
+++ b/ipaserver/rpcserver.py
@@ -28,7 +28,6 @@ from xmlrpclib import Fault
import os
import datetime
import urlparse
-import time
import json
from ipalib import plugable, errors
@@ -959,13 +958,8 @@ class login_password(Backend, KerberosSession, HTTP_Status):
['krbpasswordexpiration'])
if 'krbpasswordexpiration' in entry_attrs:
expiration = entry_attrs['krbpasswordexpiration'][0]
- try:
- exp = time.strptime(expiration, '%Y%m%d%H%M%SZ')
- if exp <= time.gmtime():
- reason = 'password-expired'
- except ValueError, v:
- self.error('Unable to convert %s to a time string'
- % expiration)
+ if expiration <= datetime.datetime.now():
+ reason = 'password-expired'
except Exception:
# It doesn't really matter how we got here but the user's