krbpasswordexpiration conversion to number of second since epoch failed
because now we get datetime object instead of string.

https://fedorahosted.org/freeipa/ticket/4339
--
Petr Vobornik
From e0c7e6525e3bb30050aae9440e698d84b5b7d7b1 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Wed, 7 May 2014 15:41:41 +0200
Subject: [PATCH] rpcserver: login_password datetime fix in expiration check

krbpasswordexpiration conversion to number of second since epoch failed
because now we get datetime object instead of string.

https://fedorahosted.org/freeipa/ticket/4339
---
 ipaserver/rpcserver.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
index 821eed22630269d2adceb0a4ffe75181e81cf91a..d9f4e6c66cadd25d1a7ced4718e738bbede47bef 100644
--- a/ipaserver/rpcserver.py
+++ b/ipaserver/rpcserver.py
@@ -960,12 +960,13 @@ class login_password(Backend, KerberosSession, HTTP_Status):
                 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():
+                        exp = time.mktime(expiration.timetuple())
+                        if exp <= time.time():
                             reason = 'password-expired'
                     except ValueError, v:
-                        self.error('Unable to convert %s to a time string'
-                            % expiration)
+                        self.error(
+                            'Unable to convert %s to time in seconds since epoch'
+                            % str(expiration))
 
             except Exception:
                 # It doesn't really matter how we got here but the user's
-- 
1.9.0

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to