amoralej / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 years ago
Clone
Blob Blame History Raw
From 1ec56936d29985a55f9529c1ea3e71056557b3ff Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Fri, 1 Sep 2017 09:24:55 -0400
Subject: [PATCH] Ticket 49370 - local password policies should use the same
 defaults as the global policy

Description:  When a local password policy (subtree/user) is created it does not use
              the same defaults as the global policy.  This causes inconsistent behavior.

https://pagure.io/389-ds-base/issue/49370

Reviewed by: firstyear(Thanks!)
---
 ldap/servers/slapd/pw.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 378d148..19a863a 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -1768,6 +1768,27 @@ new_passwdPolicy(Slapi_PBlock *pb, const char *dn)
 				goto done;
 			}
 
+			/* Set the default values */
+			pwdpolicy->pw_mintokenlength = SLAPD_DEFAULT_PW_MINTOKENLENGTH;
+			pwdpolicy->pw_minlength = SLAPD_DEFAULT_PW_MINLENGTH;
+			pwdpolicy->pw_mindigits = SLAPD_DEFAULT_PW_MINDIGITS;
+			pwdpolicy->pw_minalphas = SLAPD_DEFAULT_PW_MINALPHAS;
+			pwdpolicy->pw_minuppers = SLAPD_DEFAULT_PW_MINUPPERS;
+			pwdpolicy->pw_minlowers = SLAPD_DEFAULT_PW_MINLOWERS;
+			pwdpolicy->pw_minspecials = SLAPD_DEFAULT_PW_MINSPECIALS;
+			pwdpolicy->pw_min8bit = SLAPD_DEFAULT_PW_MIN8BIT;
+			pwdpolicy->pw_maxrepeats = SLAPD_DEFAULT_PW_MAXREPEATS;
+			pwdpolicy->pw_mincategories = SLAPD_DEFAULT_PW_MINCATEGORIES;
+			pwdpolicy->pw_mintokenlength = SLAPD_DEFAULT_PW_MINTOKENLENGTH;
+			pwdpolicy->pw_maxage = SLAPD_DEFAULT_PW_MAXAGE;
+			pwdpolicy->pw_minage = SLAPD_DEFAULT_PW_MINAGE;
+			pwdpolicy->pw_warning = SLAPD_DEFAULT_PW_WARNING;
+			pwdpolicy->pw_inhistory = SLAPD_DEFAULT_PW_INHISTORY;
+			pwdpolicy->pw_maxfailure = SLAPD_DEFAULT_PW_MAXFAILURE;
+			pwdpolicy->pw_lockduration = SLAPD_DEFAULT_PW_LOCKDURATION;
+			pwdpolicy->pw_resetfailurecount = SLAPD_DEFAULT_PW_RESETFAILURECOUNT;
+			pwdpolicy->pw_gracelimit = SLAPD_DEFAULT_PW_GRACELIMIT;
+
 			/* set the default passwordLegacyPolicy setting */
 			pwdpolicy->pw_is_legacy = 1;
 
-- 
2.9.5