Blob Blame History Raw
From e37431f50e8d4bfc7015d9a00b58a9b9e77f1c79 Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@redhat.com>
Date: Thu, 2 Jul 2015 16:44:09 -0700
Subject: [PATCH 5/7] Ticket #48214 - ldapsearch on nsslapd-maxbersize returns
 0 instead of current value

Description: If nsslapd-maxbersize is not explicitely set in cn=config
or the value is 0, the default value is assigned.  Internally, it was.
But ldapsearch did not return the default value.

https://fedorahosted.org/389/ticket/48214

Reviewed by rmeggins@redhat.com (Thank you, Rich!)

(cherry picked from commit 7d0689aaadfa66a8f8a481b0c1bb70b2465c4986)
(cherry picked from commit b83c2554fad0bb2a08055c5105bcfa4c9d44af8f)
---
 ldap/servers/slapd/libglobs.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 24de4f3..a3c4243 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -821,7 +821,7 @@ static struct config_get_and_set {
 	{CONFIG_MAXBERSIZE_ATTRIBUTE, config_set_maxbersize,
 		NULL, 0,
 		(void**)&global_slapdFrontendConfig.maxbersize,
-		CONFIG_INT, NULL, DEFAULT_MAX_BERSIZE},
+		CONFIG_INT, NULL, STRINGIFYDEFINE(DEFAULT_MAXBERSIZE)},
 	{CONFIG_MAXSASLIOSIZE_ATTRIBUTE, config_set_maxsasliosize,
 		NULL, 0,
 		(void**)&global_slapdFrontendConfig.maxsasliosize,
@@ -1540,6 +1540,7 @@ FrontendConfig_init () {
   init_cn_uses_dn_syntax_in_dns = cfg->cn_uses_dn_syntax_in_dns = LDAP_OFF;
   init_global_backend_local = LDAP_OFF;
   cfg->maxsimplepaged_per_conn = DEFAULT_MAXSIMPLEPAGED_PER_CONN;
+  cfg->maxbersize = DEFAULT_MAXBERSIZE;
 #ifdef ENABLE_NUNC_STANS
   init_enable_nunc_stans = cfg->enable_nunc_stans = LDAP_OFF;
 #endif
@@ -5713,6 +5714,9 @@ config_set_maxbersize( const char *attrname, char *value, char *errorbuf, int ap
 	return retVal;
   }
 
+  if (size == 0) {
+    size = DEFAULT_MAXBERSIZE;
+  }
   CFG_LOCK_WRITE(slapdFrontendConfig);
 
   slapdFrontendConfig->maxbersize = size;
@@ -5728,8 +5732,9 @@ config_get_maxbersize()
     slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 
     maxbersize = slapdFrontendConfig->maxbersize;
-    if(maxbersize==0)
+    if (maxbersize == 0) {
         maxbersize = DEFAULT_MAXBERSIZE;
+    }
 
     return maxbersize;
 }
-- 
1.9.3