mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
05.33.2006 77f20a44a73bc404678940faf43bbf30a671c4c2
Update the password policy state management code to properly return a value of
-1 when attempting to get the last login time for a user when it isn't possible
to do so for some reason. Even though the documentation said it would return
-1 in this case, it was actually returning the creation timestamp for the
entry.

OpenDS Issue Number: 1055
1 files modified
50 ■■■■■ changed files
opends/src/server/org/opends/server/core/PasswordPolicyState.java 50 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/PasswordPolicyState.java
@@ -1917,12 +1917,11 @@
        {
          debugMessage(DebugLogCategory.PASSWORD_POLICY, DebugLogSeverity.INFO,
                       CLASS_NAME, "getLastLoginTime",
                       "Returning creation time of " + createTime +
                       " for user " + userDNString + " because no last login " +
                       "time will be maintained.");
                       "Returning -1 for user " + userDNString +
                       " because no last login time will be maintained.");
        }
        lastLoginTime = createTime;
        lastLoginTime = -1;
        return lastLoginTime;
      }
@@ -1933,12 +1932,11 @@
        {
          debugMessage(DebugLogCategory.PASSWORD_POLICY, DebugLogSeverity.INFO,
                       CLASS_NAME, "getLastLoginTime",
                       "Returning creation time of " + createTime +
                       " for user " + userDNString + " because no last login " +
                       "time value exists.");
                       "Returning -1 for user " + userDNString +
                       " because no last login time value exists.");
        }
        lastLoginTime = createTime;
        lastLoginTime = -1;
        return lastLoginTime;
      }
@@ -2003,17 +2001,28 @@
              debugMessage(DebugLogCategory.PASSWORD_POLICY,
                           DebugLogSeverity.WARNING,
                           CLASS_NAME, "getLastLoginTime",
                           "Returning creation time of " + createTime +
                           " for user " + userDNString + " because the last " +
                           "login time value " + valueString +
                           "Returning -1 for user " + userDNString +
                           " because the last login time value " + valueString +
                           "could not be parsed using any known format.");
            }
            lastLoginTime = createTime;
            lastLoginTime = -1;
            return lastLoginTime;
          }
        }
      }
      // We shouldn't get here.
      if (debug)
      {
        debugMessage(DebugLogCategory.PASSWORD_POLICY, DebugLogSeverity.WARNING,
                     CLASS_NAME, "getLastLoginTime",
                     "Returning -1 for user " + userDNString +
                     " because even though there appears to be a last " +
                     "login time value we couldn't decipher it.");
      }
      return -1;
    }
    if (debug)
@@ -2143,14 +2152,15 @@
      {
        if (lastLoginTime > lockTime)
        {
        if (debug)
        {
          debugMessage(DebugLogCategory.PASSWORD_POLICY, DebugLogSeverity.INFO,
                       CLASS_NAME, "lockedDueToIdleInterval",
                       "Returning false for user " + userDNString +
                       " because the last login time is in an acceptable " +
                         "window.");
        }
          if (debug)
          {
            debugMessage(DebugLogCategory.PASSWORD_POLICY,
                         DebugLogSeverity.INFO, CLASS_NAME,
                         "lockedDueToIdleInterval",
                         "Returning false for user " + userDNString +
                         " because the last login time is in an acceptable " +
                           "window.");
          }
          isIdleLocked = ConditionResult.FALSE;
          return false;