Blame SOURCES/slapi-nis-nss-Make-sure-default-buffer-for-nsswitch-operations-is-.patch

94cced
From 92c4f4942547730efdca83501d130906eb07aeb0 Mon Sep 17 00:00:00 2001
94cced
From: Alexander Bokovoy <abokovoy@redhat.com>
94cced
Date: Wed, 25 Feb 2015 10:08:39 +0200
94cced
Subject: [PATCH 3/3] Make sure default buffer for nsswitch operations is big
94cced
 enough
94cced
94cced
By default initial buffer sizes for getgrent/getgrnam/... functions
94cced
are way small for large groups in Active Directory so make sure
94cced
we have something reasonable for groups with hundreds or thousands members.
94cced
---
94cced
 src/back-sch.c | 5 +----
94cced
 1 file changed, 1 insertion(+), 4 deletions(-)
94cced
94cced
diff --git a/src/back-sch.c b/src/back-sch.c
94cced
index 2388d2f..a4ae016 100644
94cced
--- a/src/back-sch.c
94cced
+++ b/src/back-sch.c
94cced
@@ -1443,10 +1443,7 @@ backend_search_cb(Slapi_PBlock *pb)
94cced
 	/* If during search of some sets we staged additional lookups, perform them. */
94cced
 	if (cbdata.staged != NULL) {
94cced
 		/* Allocate buffer to be used for getpwnam_r/getgrnam_r requests */
94cced
-		cbdata.nsswitch_buffer_len = MAX(sysconf(_SC_GETPW_R_SIZE_MAX), sysconf(_SC_GETGR_R_SIZE_MAX));
94cced
-		if (cbdata.nsswitch_buffer_len == -1) {
94cced
-			cbdata.nsswitch_buffer_len = 16384;
94cced
-		}
94cced
+		cbdata.nsswitch_buffer_len = MAX(16384, MAX(sysconf(_SC_GETPW_R_SIZE_MAX), sysconf(_SC_GETGR_R_SIZE_MAX)));
94cced
 		cbdata.nsswitch_buffer = malloc(cbdata.nsswitch_buffer_len);
94cced
 		/* Go over the list of staged requests and retrieve entries.
94cced
 		 * It is important to perform the retrieval *without* holding any locks to the map cache */
94cced
-- 
94cced
2.1.0
94cced