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