-
Notifications
You must be signed in to change notification settings - Fork 103
Issue 6092 - passwordHistory is not updated with a pre-hashed password #6093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Bug description: passwordHistory is not updated by with a pre-hashed password Fix description: During a mod replace of the userpassword attribute, if an encoded password value is detected, both pw_history and allow_hashed_pw are enabled, get the present entry values which are used to uddate the password history. Relates: 389ds#6092 Reviewed by:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although the fix works, I wonder if a better place to retrieve old_pwd is not
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index a20984e0b..0dde945af 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -1234,7 +1234,7 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
* If this mod is being performed by a password administrator/rootDN,
* just return success.
*/
- if (pw_is_pwp_admin(pb, pwpolicy, PWP_ADMIN_OR_ROOTDN)) {
+ if (pw_is_pwp_admin(pb, pwpolicy, PWP_ADMIN_OR_ROOTDN) || config_get_allow_hashed_pw()) {
if (!SLAPI_IS_MOD_DELETE(mod->mod_op) && pwpolicy->pw_history) {
/* Updating pw history, get the old password */
get_old_pw(pb, &sdn, old_pw);
IIUC, in the scenario where a regular user is changing their password to a non hashed value. If we capture old_pw here, we return before we do any pw policy, min age or syntax checks. Currently, when a regular user is changing their password to a non hashed value the old_pw is retrieved during syntax checking, after we do pw policy, min age checks. In the case of a regular user changing their password to a hashed value, I thought it was best to follow the same sequence and capture old_pw during syntax checking, but only when an encoded password value is detected. |
| if (e == NULL) { | ||
| return -1; | ||
| } | ||
| attr = attrlist_find(e->e_attrs, SLAPI_USERPWD_ATTR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to use the same code as get_old_pw else it may crash (if there is userpassword or empty value)
| /* We want to skip syntax checking since this is a pre-hashed password. But if the user | ||
| * has thrown caution to wind and allowed hashed passwords, we capture the history | ||
| */ | ||
| if (config_get_allow_hashed_pw() && pwpolicy->pw_history) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As old_pwd will be set (but may be not) you need to initialize it to NULL
You are right. This suggestion was wrong ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
#6093) Bug description: passwordHistory is not updated by with a pre-hashed password Fix description: During a mod replace of the userpassword attribute, if an encoded password value is detected and both pw_history and allow_hashed_pw are enabled, get the present entry values which are used to update the password history. Relates: #6092 Reviewed by: @tbordaz (Thank you)
#6093) Bug description: passwordHistory is not updated by with a pre-hashed password Fix description: During a mod replace of the userpassword attribute, if an encoded password value is detected and both pw_history and allow_hashed_pw are enabled, get the present entry values which are used to update the password history. Relates: #6092 Reviewed by: @tbordaz (Thank you)
#6093) Bug description: passwordHistory is not updated by with a pre-hashed password Fix description: During a mod replace of the userpassword attribute, if an encoded password value is detected and both pw_history and allow_hashed_pw are enabled, get the present entry values which are used to update the password history. Relates: #6092 Reviewed by: @tbordaz (Thank you)
#6093) Bug description: passwordHistory is not updated by with a pre-hashed password Fix description: During a mod replace of the userpassword attribute, if an encoded password value is detected and both pw_history and allow_hashed_pw are enabled, get the present entry values which are used to update the password history. Relates: #6092 Reviewed by: @tbordaz (Thank you)
#6093) Bug description: passwordHistory is not updated by with a pre-hashed password Fix description: During a mod replace of the userpassword attribute, if an encoded password value is detected and both pw_history and allow_hashed_pw are enabled, get the present entry values which are used to update the password history. Relates: #6092 Reviewed by: @tbordaz (Thank you)
#6093) Bug description: passwordHistory is not updated by with a pre-hashed password Fix description: During a mod replace of the userpassword attribute, if an encoded password value is detected and both pw_history and allow_hashed_pw are enabled, get the present entry values which are used to update the password history. Relates: #6092 Reviewed by: @tbordaz (Thank you)
#6093) Bug description: passwordHistory is not updated by with a pre-hashed password Fix description: During a mod replace of the userpassword attribute, if an encoded password value is detected and both pw_history and allow_hashed_pw are enabled, get the present entry values which are used to update the password history. Relates: #6092 Reviewed by: @tbordaz (Thank you)
#6093) Bug description: passwordHistory is not updated by with a pre-hashed password Fix description: During a mod replace of the userpassword attribute, if an encoded password value is detected and both pw_history and allow_hashed_pw are enabled, get the present entry values which are used to update the password history. Relates: #6092 Reviewed by: @tbordaz (Thank you)
#6093) Bug description: passwordHistory is not updated by with a pre-hashed password Fix description: During a mod replace of the userpassword attribute, if an encoded password value is detected and both pw_history and allow_hashed_pw are enabled, get the present entry values which are used to update the password history. Relates: #6092 Reviewed by: @tbordaz (Thank you)
Bug description: passwordHistory is not updated with a pre-hashed password
Fix description: During a mod replace of the userpassword attribute, if an encoded password value is detected, both pw_history and allow_hashed_pw are enabled, get the present entry values which are used to uddate the password history.
Relates: #6092
Reviewed by: