Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-integ / recipes-support / openldap / files / rootdn-should-not-bypass-ppolicy.patch
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
5
6 ---
7  servers/slapd/overlays/ppolicy.c | 11 +++++++++--
8  1 file changed, 9 insertions(+), 2 deletions(-)
9
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 */
16         }
17
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;
21
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 )
25         }
26
27         bv = newpw.bv_val ? &newpw : &addmod->sml_values[0];
28 -       if (pp.pwdCheckQuality > 0) {
29 +
30 +       /* WRS UPDATE:
31 +        * If this is a rootDN op and this is the first password
32 +        * then bypass password policies as this is a new account
33 +        * creation
34 +        */
35 +       if (pp.pwdCheckQuality > 0 && !(be_isroot( op ) && !pa)) {
36
37                 rc = check_password_quality( bv, &pp, &pErr, e, (char **)&txt );
38                 if (rc != LDAP_SUCCESS) {
39 --
40 1.9.1
41