andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

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

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