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

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