Skip to content
Snippets Groups Projects
Commit 77df33a1 authored by Howard Chu's avatar Howard Chu
Browse files

Fix crash on modify if userpassword didn't exist yet

parent f3236825
No related branches found
No related tags found
No related merge requests found
...@@ -1571,39 +1571,41 @@ ppolicy_modify( Operation *op, SlapReply *rs ) ...@@ -1571,39 +1571,41 @@ ppolicy_modify( Operation *op, SlapReply *rs )
} }
} }
/* if (pa) {
* Last check - the password history.
*/
if (slap_passwd_check( op->o_conn, pa, bv, &txt ) == LDAP_SUCCESS) {
/* /*
* This is bad - it means that the user is attempting * Last check - the password history.
* to set the password to the same as the old one.
*/ */
rs->sr_err = LDAP_CONSTRAINT_VIOLATION; if (slap_passwd_check( op->o_conn, pa, bv, &txt ) == LDAP_SUCCESS) {
rs->sr_text = "Password is not being changed from existing value"; /*
pErr = PP_passwordInHistory; * This is bad - it means that the user is attempting
goto return_results; * to set the password to the same as the old one.
} */
rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
if (pp.pwdInHistory < 1) goto do_modify; rs->sr_text = "Password is not being changed from existing value";
pErr = PP_passwordInHistory;
/* goto return_results;
* Iterate through the password history, and fail on any }
* password matches.
*/ if (pp.pwdInHistory < 1) goto do_modify;
at = *pa;
at.a_vals = cr; /*
cr[1].bv_val = NULL; * Iterate through the password history, and fail on any
for(p=tl; p; p=p->next) { * password matches.
cr[0] = p->pw; */
rc = slap_passwd_check( op->o_conn, &at, bv, &txt ); at = *pa;
at.a_vals = cr;
if (rc != LDAP_SUCCESS) continue; cr[1].bv_val = NULL;
for(p=tl; p; p=p->next) {
rs->sr_err = LDAP_CONSTRAINT_VIOLATION; cr[0] = p->pw;
rs->sr_text = "Password is in history of old passwords"; rc = slap_passwd_check( op->o_conn, &at, bv, &txt );
pErr = PP_passwordInHistory;
goto return_results; if (rc != LDAP_SUCCESS) continue;
rs->sr_err = LDAP_CONSTRAINT_VIOLATION;
rs->sr_text = "Password is in history of old passwords";
pErr = PP_passwordInHistory;
goto return_results;
}
} }
do_modify: do_modify:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment