andykimpe / rpms / 389-ds-base

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

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

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