diff options
author | Alexander Bokovoy <abokovoy@redhat.com> | 2015-02-25 10:08:39 +0200 |
---|---|---|
committer | Alexander Bokovoy <abokovoy@redhat.com> | 2015-03-26 10:46:53 +0200 |
commit | dd1d44730f2724986f820151d6ec2a49f6e52ddf (patch) | |
tree | 2d3e276fad7262e7493b3f6b885536d437fa7dba | |
parent | 44c97a46a1920f6db18b8c90b396a94a653d755c (diff) | |
download | slapi-nis-dd1d44730f2724986f820151d6ec2a49f6e52ddf.tar.gz slapi-nis-dd1d44730f2724986f820151d6ec2a49f6e52ddf.tar.xz slapi-nis-dd1d44730f2724986f820151d6ec2a49f6e52ddf.zip |
Make sure default buffer for nsswitch operations is big enough
By default initial buffer sizes for getgrent/getgrnam/... functions
are way small for large groups in Active Directory so make sure
we have something reasonable for groups with hundreds or thousands members.
-rw-r--r-- | src/back-sch.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/back-sch.c b/src/back-sch.c index d0ed323..dd6f92d 100644 --- a/src/back-sch.c +++ b/src/back-sch.c @@ -1448,10 +1448,7 @@ backend_search_cb(Slapi_PBlock *pb) /* If during search of some sets we staged additional lookups, perform them. */ if (cbdata.staged != NULL) { /* Allocate buffer to be used for getpwnam_r/getgrnam_r requests */ - cbdata.nsswitch_buffer_len = MAX(sysconf(_SC_GETPW_R_SIZE_MAX), sysconf(_SC_GETGR_R_SIZE_MAX)); - if (cbdata.nsswitch_buffer_len == -1) { - cbdata.nsswitch_buffer_len = 16384; - } + cbdata.nsswitch_buffer_len = MAX(16384, MAX(sysconf(_SC_GETPW_R_SIZE_MAX), sysconf(_SC_GETGR_R_SIZE_MAX))); cbdata.nsswitch_buffer = malloc(cbdata.nsswitch_buffer_len); /* Go over the list of staged requests and retrieve entries. * It is important to perform the retrieval *without* holding any locks to the map cache */ |