ldap/servers/slapd/pw.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
New commits:
commit 802224f2846900c870a780fe7608782792806d85
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Sat Jul 30 16:56:57 2016 -0700
Ticket #48943 - When fine-grained policy is applied, a sub-tree has a priority over a
user while changing password
Description: If the user entry has a pwdpolicysubentry, the configuration
in the pwpolicy should be the strongest and respected. If the entry does
not have it, it retrieves the pwpolicy from the CoS Cache, which is the
current behaviour.
https://fedorahosted.org/389/ticket/48943
Reviewed by wibrown(a)redhat.com (Thank you, William!!)
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 498afd4..6b865ec 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -1777,9 +1777,17 @@ new_passwdPolicy(Slapi_PBlock *pb, const char *dn)
attribute in the target entry itself. */
} else {
if ( (e = get_entry( pb, dn )) != NULL ) {
- rc = slapi_vattr_values_get(e, "pwdpolicysubentry", &values,
- &type_name_disposition, &actual_type_name,
- SLAPI_VIRTUALATTRS_REQUEST_POINTERS, &attr_free_flags);
+ Slapi_Attr* attr = NULL;
+ rc = slapi_entry_attr_find(e, "pwdpolicysubentry", &attr);
+ if (attr && (0 == rc)) {
+ /* If the entry has pwdpolicysubentry, use the PwPolicy. */
+ values = valueset_dup(&attr->a_present_values);
+ } else {
+ /* Otherwise, retrieve the policy from CoS Cache */
+ rc = slapi_vattr_values_get(e, "pwdpolicysubentry", &values,
+ &type_name_disposition, &actual_type_name,
+ SLAPI_VIRTUALATTRS_REQUEST_POINTERS, &attr_free_flags);
+ }
if (rc) {
values = NULL;
}