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