| | |
| | | // make sure that's OK. |
| | | if (oldPassword == null) |
| | | { |
| | | if (selfChange && pwPolicyState.requireCurrentPassword()) |
| | | if (selfChange && pwPolicyState.getPolicy().requireCurrentPassword()) |
| | | { |
| | | operation.setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | |
| | |
| | | |
| | | // If it is a self password change and we don't allow that, then reject |
| | | // the request. |
| | | if (selfChange && (! pwPolicyState.allowUserPasswordChanges())) |
| | | if (selfChange && |
| | | (! pwPolicyState.getPolicy().allowUserPasswordChanges())) |
| | | { |
| | | if (pwPolicyRequested) |
| | | { |
| | |
| | | |
| | | // If we require secure password changes and the connection isn't secure, |
| | | // then reject the request. |
| | | if (pwPolicyState.requireSecurePasswordChanges() && |
| | | if (pwPolicyState.getPolicy().requireSecurePasswordChanges() && |
| | | (! operation.getClientConnection().isSecure())) |
| | | { |
| | | if (oldPassword == null) |
| | |
| | | // If the user's password is expired and it's a self-change request, then |
| | | // see if that's OK. |
| | | if ((selfChange && pwPolicyState.isPasswordExpired() && |
| | | (! pwPolicyState.allowExpiredPasswordChanges()))) |
| | | (! pwPolicyState.getPolicy().allowExpiredPasswordChanges()))) |
| | | { |
| | | if (pwPolicyRequested) |
| | | { |
| | |
| | | // by an internal operation or during synchronization, so we don't |
| | | // need to check for those cases. |
| | | isPreEncoded = true; |
| | | if (! pwPolicyState.allowPreEncodedPasswords()) |
| | | if (! pwPolicyState.getPolicy().allowPreEncodedPasswords()) |
| | | { |
| | | if (oldPassword == null) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | if (selfChange || (! pwPolicyState.skipValidationForAdministrators())) |
| | | if (selfChange || |
| | | (! pwPolicyState.getPolicy().skipValidationForAdministrators())) |
| | | { |
| | | HashSet<ByteString> clearPasswords; |
| | | if (oldPassword == null) |
| | |
| | | // If the current password was provided, then remove all matching values |
| | | // from the user's entry and replace them with the new password. |
| | | // Otherwise replace all password values. |
| | | AttributeType attrType = pwPolicyState.getPasswordAttribute(); |
| | | AttributeType attrType = pwPolicyState.getPolicy().getPasswordAttribute(); |
| | | List<Modification> modList = new ArrayList<Modification>(); |
| | | if (oldPassword != null) |
| | | { |
| | |
| | | pwPolicyState.getPasswordValues(); |
| | | LinkedHashSet<AttributeValue> deleteValues = |
| | | new LinkedHashSet<AttributeValue>(existingValues.size()); |
| | | if (pwPolicyState.usesAuthPasswordSyntax()) |
| | | if (pwPolicyState.getPolicy().usesAuthPasswordSyntax()) |
| | | { |
| | | for (AttributeValue v : existingValues) |
| | | { |
| | |
| | | UserPasswordSyntax.decodeUserPassword(v.getStringValue()); |
| | | PasswordStorageScheme scheme = |
| | | DirectoryServer.getPasswordStorageScheme( |
| | | toLowerCase(components[0].toString())); |
| | | toLowerCase(components[0])); |
| | | if (scheme == null) |
| | | { |
| | | // The password is encoded using an unknown scheme. Remove it |
| | |
| | | } |
| | | else |
| | | { |
| | | pwPolicyState.setMustChangePassword(pwPolicyState.forceChangeOnReset()); |
| | | pwPolicyState.setMustChangePassword( |
| | | pwPolicyState.getPolicy().forceChangeOnReset()); |
| | | } |
| | | |
| | | |
| | |
| | | ModifyOperation modifyOperation = |
| | | internalConnection.processModify(userDN, modList); |
| | | ResultCode resultCode = modifyOperation.getResultCode(); |
| | | if (resultCode != resultCode.SUCCESS) |
| | | if (resultCode != ResultCode.SUCCESS) |
| | | { |
| | | operation.setResultCode(resultCode); |
| | | operation.setErrorMessage(modifyOperation.getErrorMessage()); |