FW: Winbindd timeout on unreacheable domains

Lin Li linl at xandros.com
Thu Feb 19 15:01:27 GMT 2004


Lin Li wrote:

> In fact I have logged a bug (#704) for this. It's doing 
> ads_try_connect(). My solution is to use ldap_init() instead of 
> ldap_open() and set a small timeout using ldap_set_option(). Here is 
> my patch (I'm using 3.0.0) and it works in my test.
> -------------------------------------
> +       struct timeval timeout;
>
>        if (!server || !*server) {
>                return False;
> @@ -58,11 +59,15 @@
>        /* this copes with inet_ntoa brokenness */
>        srv = strdup(server);
>
> -       ads->ld = ldap_open(srv, port);
> +       ads->ld = ldap_init(srv, port);
>        if (!ads->ld) {
>                free(srv);
>                return False;
>        }
> +
> +       timeout.tv_sec = 15;
> +       timeout.tv_usec = 0;
> +       ldap_set_option(ads->ld, LDAP_OPT_NETWORK_TIMEOUT, &timeout);
>        ads->ldap_port = port;
>        ads->ldap_ip = *interpret_addr2(srv);
>        free(srv);
> -------------------------------------
>
> Thanks,
> Lin
>
Sorry, the patch is for source/libads/ldap.c

Thanks,
Lin

-- 
Xandros Corporation
Simple. Powerful. Linux.
Visit us at http://www.xandros.com




More information about the samba-technical mailing list