From 5bb0c0596765dd5dd1973b7fc2d1e830bca3e345 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Tue, 18 Nov 2014 12:02:10 +0100 Subject: sss_client: Work around glibc bug glibc is inconsistent with how it treats and returns NSS_STATUS_UNAVAIL. The sss nss plugin is present in nsswitch by default on some platforms due to glibc caching and problem with long living applications (e.g. GNOME). But sssd needn't be configuread and it cause problems in some programs. In this situation, the SSSD nss plugin should behave as if it was functioning but had no data even thought sssd is not running. The errors have to be passed from nss plugin up to the user with minimal moidiffication. Thanks to Stephen Gallagher for initial patch. Resolves: https://fedorahosted.org/sssd/ticket/2439 Reviewed-by: Jakub Hrozek --- src/sss_client/common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/sss_client') diff --git a/src/sss_client/common.c b/src/sss_client/common.c index ebe783aba..7c4bb7ab8 100644 --- a/src/sss_client/common.c +++ b/src/sss_client/common.c @@ -724,7 +724,12 @@ enum nss_status sss_nss_make_request(enum sss_cli_command cmd, ret = sss_cli_check_socket(errnop, SSS_NSS_SOCKET_NAME); if (ret != SSS_STATUS_SUCCESS) { +#ifdef NONSTANDARD_SSS_NSS_BEHAVIOUR + errno = 0; + return NSS_STATUS_NOTFOUND; +#else return NSS_STATUS_UNAVAIL; +#endif } ret = sss_cli_make_request_nochecks(cmd, rd, repbuf, replen, errnop); @@ -735,7 +740,12 @@ enum nss_status sss_nss_make_request(enum sss_cli_command cmd, return NSS_STATUS_SUCCESS; case SSS_STATUS_UNAVAIL: default: +#ifdef NONSTANDARD_SSS_NSS_BEHAVIOUR + errno = 0; + return NSS_STATUS_NOTFOUND; +#else return NSS_STATUS_UNAVAIL; +#endif } } -- cgit