s3-libads: Use the configured LDAP page size.
authorJustin Maggard <jmaggard10@gmail.com>
Thu, 14 Jan 2016 00:25:34 +0000 (16:25 -0800)
committerVolker Lendecke <vl@samba.org>
Fri, 15 Jan 2016 02:59:16 +0000 (03:59 +0100)
We already allow the user to configure LDAP page size, and use it in pdb_ldap.
But then we hard-code the initial LDAP page size value to 1000 in ads_init, so
it doesn't take effect there.  So let's use the configured LDAP page size value
in ads_init also, which defaults to 1000.

Signed-off-by: Justin Maggard <jmaggard@netgear.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jan 15 03:59:16 CET 2016 on sn-devel-144

source3/libads/ads_struct.c
source3/libads/ldap_utils.c

index 27af4d6c7556a98762993ae1ab076d5212fe6a28..0dc7b11d4002623873a639501ed99fd7f9a5798a 100644 (file)
@@ -154,9 +154,9 @@ ADS_STRUCT *ads_init(const char *realm,
 
        ads->auth.flags = wrap_flags;
 
-       /* Start with a page size of 1000 when the connection is new,
+       /* Start with the configured page size when the connection is new,
         * we will drop it by half we get a timeout.   */
-       ads->config.ldap_page_size     = 1000;
+       ads->config.ldap_page_size     = lp_ldap_page_size();
 
        return ads;
 }
index 157f69454218bbd99900c95ea1205d888cc9cd0d..a4adbc09524bcf74c3ce0af40c6fdcacbad48ea1 100644 (file)
@@ -85,7 +85,9 @@ static ADS_STATUS ads_do_search_retry_internal(ADS_STRUCT *ads, const char *bind
 
        while (--count) {
 
-               if (NT_STATUS_EQUAL(ads_ntstatus(status), NT_STATUS_IO_TIMEOUT) && ads->config.ldap_page_size >= 250) {
+               if (NT_STATUS_EQUAL(ads_ntstatus(status), NT_STATUS_IO_TIMEOUT) &&
+                   ads->config.ldap_page_size >= (lp_ldap_page_size() / 4) &&
+                   lp_ldap_page_size() > 4) {
                        int new_page_size = (ads->config.ldap_page_size / 2);
                        DEBUG(1, ("Reducing LDAP page size from %d to %d due to IO_TIMEOUT\n",
                                  ads->config.ldap_page_size, new_page_size));