Blame SOURCES/0018-Issue-4789-Temporary-password-rules-are-not-enforce-.patch

e4a41f
From e7fdfe527a5f72674fe4b577a0555cabf8ec73a5 Mon Sep 17 00:00:00 2001
e4a41f
From: tbordaz <tbordaz@redhat.com>
e4a41f
Date: Mon, 7 Jun 2021 11:23:35 +0200
e4a41f
Subject: [PATCH] Issue 4789 - Temporary password rules are not enforce with
e4a41f
 local password policy (#4790)
e4a41f
e4a41f
Bug description:
e4a41f
	When allocating a password policy structure (new_passwdPolicy)
e4a41f
        it is initialized with the local policy definition or
e4a41f
	the global one. If it exists a local policy entry, the TPR
e4a41f
        attributes (passwordTPRMaxUse, passwordTPRDelayValidFrom and
e4a41f
        passwordTPRDelayExpireAt) are not taken into account.
e4a41f
e4a41f
Fix description:
e4a41f
	Take into account TPR attributes to initialize the policy
e4a41f
e4a41f
relates: https://github.com/389ds/389-ds-base/issues/4789
e4a41f
e4a41f
Reviewed by: Simon Pichugin, William Brown
e4a41f
e4a41f
Platforms tested: F34
e4a41f
---
e4a41f
 ldap/servers/slapd/pw.c | 12 ++++++++++++
e4a41f
 1 file changed, 12 insertions(+)
e4a41f
e4a41f
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
e4a41f
index 2a167c8f1..7680df41d 100644
e4a41f
--- a/ldap/servers/slapd/pw.c
e4a41f
+++ b/ldap/servers/slapd/pw.c
e4a41f
@@ -2356,6 +2356,18 @@ new_passwdPolicy(Slapi_PBlock *pb, const char *dn)
e4a41f
                     if ((sval = attr_get_present_values(attr))) {
e4a41f
                         pwdpolicy->pw_dict_path = (char *)slapi_value_get_string(*sval);
e4a41f
                     }
e4a41f
+                } else if (!strcasecmp(attr_name, CONFIG_PW_TPR_MAXUSE)) {
e4a41f
+                    if ((sval = attr_get_present_values(attr))) {
e4a41f
+                        pwdpolicy->pw_tpr_maxuse = slapi_value_get_int(*sval);
e4a41f
+                    }
e4a41f
+                } else if (!strcasecmp(attr_name, CONFIG_PW_TPR_DELAY_EXPIRE_AT)) {
e4a41f
+                    if ((sval = attr_get_present_values(attr))) {
e4a41f
+                        pwdpolicy->pw_tpr_delay_expire_at = slapi_value_get_int(*sval);
e4a41f
+                    }
e4a41f
+                } else if (!strcasecmp(attr_name, CONFIG_PW_TPR_DELAY_VALID_FROM)) {
e4a41f
+                    if ((sval = attr_get_present_values(attr))) {
e4a41f
+                        pwdpolicy->pw_tpr_delay_valid_from = slapi_value_get_int(*sval);
e4a41f
+                    }
e4a41f
                 }
e4a41f
             } /* end of for() loop */
e4a41f
             if (pw_entry) {
e4a41f
-- 
e4a41f
2.31.1
e4a41f