directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lucasthei...@apache.org
Subject svn commit: r1561208 - /directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Date Fri, 24 Jan 2014 22:03:11 GMT
Author: lucastheisen
Date: Fri Jan 24 22:03:10 2014
New Revision: 1561208

URL: http://svn.apache.org/r1561208
Log:
DIRSERVER-1948: NPE in AuthenticationInterceptor when password policy is in place and user
does not have a pwdChangedTime

Modified:
    directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java

Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1561208&r1=1561207&r2=1561208&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
(original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Fri Jan 24 22:03:10 2014
@@ -142,6 +142,8 @@ public class AuthenticationInterceptor e
     private AttributeType AT_PWD_LAST_SUCCESS;
 
     private AttributeType AT_PWD_GRACE_USE_TIME;
+    
+    private AttributeType AT_CREATE_TIMESTAMP;
 
     /** a container to hold all the ppolicies */
     private PpolicyConfigContainer pwdPolicyContainer;
@@ -1325,6 +1327,16 @@ public class AuthenticationInterceptor e
     }
 
 
+    private AttributeType getCreateTimestampAttributeType() throws LdapException 
+    {
+        if ( AT_CREATE_TIMESTAMP == null ) 
+        {
+            AT_CREATE_TIMESTAMP = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.CREATE_TIMESTAMP_AT
);
+        }
+        return AT_CREATE_TIMESTAMP;
+    }
+
+
     private int getPwdTimeBeforeExpiry( Entry userEntry, PasswordPolicyConfiguration policyConfig
)
         throws LdapException
     {
@@ -1341,6 +1353,10 @@ public class AuthenticationInterceptor e
         }
 
         Attribute pwdChangedTimeAt = userEntry.get( AT_PWD_CHANGED_TIME );
+        if ( pwdChangedTimeAt == null ) 
+        {
+            pwdChangedTimeAt = userEntry.get( getCreateTimestampAttributeType() );
+        }
         long changedTime = DateUtils.getDate( pwdChangedTimeAt.getString() ).getTime();
 
         long currentTime = DateUtils.getDate( DateUtils.getGeneralizedTime() ).getTime();



Mime
View raw message