andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From c94324bfa2c6dcabff2820f43679b092d9e2da39 Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Fri, 14 Nov 2014 16:57:41 -0500
dc8c34
Subject: [PATCH 273/305] Ticket 47952 - PasswordAdminDN attribute is not
dc8c34
 properly returned to client
dc8c34
dc8c34
Bug Description:  Searching for "passwordAdminDN" in "cn=config" returns a
dc8c34
                  garbage value.  The internal value is stored in a Slapi_DN,
dc8c34
                  but the pointer to the struct is returned instead of calling
dc8c34
                  the "get function".
dc8c34
dc8c34
Fix Description:  Create a get function for passwordAdminDN setting, and set the
dc8c34
                  config_get_and_set table entry so that we always call the
dc8c34
                  "get function"
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47952
dc8c34
dc8c34
Reviewed by: rmeggins(Thanks!)
dc8c34
dc8c34
(cherry picked from commit c6e10746945262015d0080c7dd0e82b6c7130920)
dc8c34
dc8c34
Conflicts:
dc8c34
	ldap/servers/slapd/libglobs.c
dc8c34
dc8c34
(cherry picked from commit 4fb2902d7c62d5da3afc082a16f9f9d5b2cdd693)
dc8c34
---
dc8c34
 ldap/servers/slapd/libglobs.c   | 21 +++++++++++++++++----
dc8c34
 ldap/servers/slapd/proto-slap.h |  1 +
dc8c34
 2 files changed, 18 insertions(+), 4 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
dc8c34
index 63093e1..79ca2bd 100644
dc8c34
--- a/ldap/servers/slapd/libglobs.c
dc8c34
+++ b/ldap/servers/slapd/libglobs.c
dc8c34
@@ -397,6 +397,10 @@ static struct config_get_and_set {
dc8c34
 		NULL, 0,
dc8c34
 		(void**)&global_slapdFrontendConfig.pw_policy.pw_gracelimit,
dc8c34
 		CONFIG_INT, NULL, DEFAULT_PW_GRACELIMIT},
dc8c34
+	{CONFIG_PW_ADMIN_DN_ATTRIBUTE, config_set_pw_admin_dn,
dc8c34
+		NULL, 0,
dc8c34
+		NULL,
dc8c34
+		CONFIG_STRING, (ConfigGetFunc)config_get_pw_admin_dn, ""},
dc8c34
 	{CONFIG_ACCESSLOG_LOGROTATIONSYNCENABLED_ATTRIBUTE, NULL,
dc8c34
 		log_set_rotationsync_enabled, SLAPD_ACCESS_LOG,
dc8c34
 		(void**)&global_slapdFrontendConfig.accesslog_rotationsync_enabled,
dc8c34
@@ -421,10 +425,6 @@ static struct config_get_and_set {
dc8c34
 		NULL, 0,
dc8c34
 		(void**)&global_slapdFrontendConfig.pwpolicy_local,
dc8c34
 		CONFIG_ON_OFF, NULL, &init_pwpolicy_local},
dc8c34
-	{CONFIG_PW_ADMIN_DN_ATTRIBUTE, config_set_pw_admin_dn,
dc8c34
-		NULL, 0,
dc8c34
-		(void**)&global_slapdFrontendConfig.pw_policy.pw_admin,
dc8c34
-		CONFIG_STRING, NULL, ""},
dc8c34
 	{CONFIG_AUDITLOG_MAXLOGDISKSPACE_ATTRIBUTE, NULL,
dc8c34
 		log_set_maxdiskspace, SLAPD_AUDIT_LOG,
dc8c34
 		(void**)&global_slapdFrontendConfig.auditlog_maxdiskspace,
dc8c34
@@ -4447,6 +4447,19 @@ config_get_pagedsizelimit() {
dc8c34
 }
dc8c34
 
dc8c34
 char *
dc8c34
+config_get_pw_admin_dn()
dc8c34
+{
dc8c34
+    slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
dc8c34
+    char *retVal;
dc8c34
+
dc8c34
+    CFG_LOCK_READ(slapdFrontendConfig);
dc8c34
+    retVal = slapi_ch_strdup(slapi_sdn_get_dn(slapdFrontendConfig->pw_policy.pw_admin));
dc8c34
+    CFG_UNLOCK_READ(slapdFrontendConfig);
dc8c34
+
dc8c34
+    return retVal;
dc8c34
+}
dc8c34
+
dc8c34
+char *
dc8c34
 config_get_pw_storagescheme() {
dc8c34
   slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
dc8c34
   char *retVal = 0;
dc8c34
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
dc8c34
index 76489ab..ce09260 100644
dc8c34
--- a/ldap/servers/slapd/proto-slap.h
dc8c34
+++ b/ldap/servers/slapd/proto-slap.h
dc8c34
@@ -489,6 +489,7 @@ int config_get_groupevalnestlevel();
dc8c34
 struct berval **config_get_defaultreferral();
dc8c34
 char *config_get_userat();
dc8c34
 int config_get_timelimit();
dc8c34
+char *config_get_pw_admin_dn();
dc8c34
 char* config_get_useroc();
dc8c34
 char *config_get_accesslog();
dc8c34
 char *config_get_errorlog();
dc8c34
-- 
dc8c34
1.9.3
dc8c34