1 From 9456b0eee753d9fd368347b6974a2f6f8d941d4f Mon Sep 17 00:00:00 2001
2 From: Kam Nasim <kam.nasim@windriver.com>
3 Date: Tue, 11 Apr 2017 17:23:03 -0400
4 Subject: [PATCH] rootdn should not bypass ppolicy
7 servers/slapd/overlays/ppolicy.c | 11 +++++++++--
8 1 file changed, 9 insertions(+), 2 deletions(-)
10 diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c
11 index b446deb..fa79872 100644
12 --- a/servers/slapd/overlays/ppolicy.c
13 +++ b/servers/slapd/overlays/ppolicy.c
14 @@ -1905,7 +1905,8 @@ ppolicy_modify( Operation *op, SlapReply *rs )
15 for(p=tl; p; p=p->next, hsize++); /* count history size */
18 - if (be_isroot( op )) goto do_modify;
19 + /* WRS UPDATE: Run ppolicy for all user password modify ops */
20 + //if (be_isroot( op )) goto do_modify;
22 /* NOTE: according to draft-behera-ldap-password-policy
23 * pwdAllowUserChange == FALSE must only prevent pwd changes
24 @@ -2009,7 +2010,13 @@ ppolicy_modify( Operation *op, SlapReply *rs )
27 bv = newpw.bv_val ? &newpw : &addmod->sml_values[0];
28 - if (pp.pwdCheckQuality > 0) {
31 + * If this is a rootDN op and this is the first password
32 + * then bypass password policies as this is a new account
35 + if (pp.pwdCheckQuality > 0 && !(be_isroot( op ) && !pa)) {
37 rc = check_password_quality( bv, &pp, &pErr, e, (char **)&txt );
38 if (rc != LDAP_SUCCESS) {