[PATCH] s3-libads: Use the configured LDAP page size.

Jeremy Allison jra at samba.org
Tue Jun 23 18:20:24 MDT 2015


On Tue, Jun 23, 2015 at 04:01:13PM -0700, Justin Maggard wrote:
> 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 (defaults to 1024).
> 
> Signed-off-by: Justin Maggard <jmaggard at netgear.com>

Reviewed-by: Jeremy Allison <jra at samba.org>

Can I get a second Team reviewer ?

>  source3/libads/ads_struct.c | 6 +++---
>  source3/libads/ldap_utils.c | 4 +++-
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c
> index 30d433e..6c77339 100644
> --- a/source3/libads/ads_struct.c
> +++ b/source3/libads/ads_struct.c
> @@ -162,9 +162,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,
> -	 * we will drop it by half we get a timeout.   */
> -	ads->config.ldap_page_size     = 1000;
> +	/* Start with the configured page size when the connection is new,
> +	 * we will drop it by half if we get a timeout.   */
> +	ads->config.ldap_page_size     = lp_ldap_page_size();
>  
>  	return ads;
>  }
> diff --git a/source3/libads/ldap_utils.c b/source3/libads/ldap_utils.c
> index 157f694..a4adbc0 100644
> --- a/source3/libads/ldap_utils.c
> +++ b/source3/libads/ldap_utils.c
> @@ -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));
> -- 
> 2.4.4


More information about the samba-technical mailing list