Re: [PATCH] Test for ldap connectivity during lookup_ldap initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/08/17 05:15, Oscar Salvador wrote:
> Right now we are just checking and parsing the ldap's configuration
> in lookup_init() function, and if everything goes well we return a zero
> value indicating that everything worked fine.
> 
> This has a problem, because in the case we set ldap method in
> /etc/nsswitch.conf, configuration parsing goes fine but ldap is not working,
> we will return a zero value in lookup_init() function, so autofs will move on,
> but then we will return NSS_STATUS_UNAVAIL in lookup_read_master() function
> once do_reconnect() fails, and because of this autofs will not be able to
> reread the maps.

Umm ... I can't see a check in the current upstream NIS code?

> 
> NIS already handles this by testing for server connectivity during initialization.
> This patch does the same thing for LDAP.
> 
> Signed-off-by: Oscar Salvador <osalvador@xxxxxxxx>
> Signed-off-by: Jeff Mahoney <jeffm@xxxxxxxx>
> ---
>  modules/lookup_ldap.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
> index 98701e5..29a67a5 100644
> --- a/modules/lookup_ldap.c
> +++ b/modules/lookup_ldap.c
> @@ -1681,6 +1681,7 @@ static int do_init(const char *mapfmt,
>  		   int argc, const char *const *argv,
>  		   struct lookup_context *ctxt, unsigned int reinit)
>  {
> +	struct ldap_conn conn;
>  	unsigned int is_amd_format;
>  	int ret;
>  
> @@ -1810,6 +1811,12 @@ static int do_init(const char *mapfmt,
>  		}
>  	}
>  
> +	memset(&conn, 0, sizeof(struct ldap_conn));
> +	ret = do_reconnect (LOGOPT_ANY, &conn, ctxt);
> +	if (ret != NSS_STATUS_SUCCESS)
> +		return 1;
> +
> +	unbind_ldap_connection(LOGOPT_ANY, &conn, ctxt);
>  	return ret;
>  }
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe autofs" in



[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux