From nsswitch/wins.c: NSS_STATUS _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he, char *buffer, size_t buflen, int *h_errnop); NSS_STATUS _nss_wins_gethostbyname2_r(const char *name, int af, struct hostent *he, char *buffer, size_t buflen, int *h_errnop); These prototypes miss the int *errnop argument. This was originally reported as a glibc bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20612
Created attachment 12495 [details] patch for 4.5
Created attachment 12497 [details] patch for 4.4
I think you need to set both *h_errnop and *errnop on all errors. h_errno == NETDB_INTERNAL basically means “look at errno”, but there are some more specific error codes as well.
Comment on attachment 12497 [details] patch for 4.4 needs the h_errnop updates
Comment on attachment 12495 [details] patch for 4.5 needs the h_errnop updates
Created attachment 12503 [details] patch for 4.4
Created attachment 12504 [details] patch for 4.5
Karolin, please add the patches to the relevant branches. Thanks!
Florian, thanks for the report!!
Pushed to autobuild-v4-{5,4-}test.
(In reply to Karolin Seeger from comment #10) Pushed to both branches. Closing out bug report. Thanks!
Hi, It looks like this has broken something. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825380#15 The herrno == NETDB_INTERNAL (of _nss_wins_gethostbyname_r, when ip==NULL), leads to EAI_SYSTEM (http://sources.debian.net/src/glibc/2.24-5/sysdeps/posix/getaddrinfo.c/?hl=317#L266). Maybe it should be *h_errnop = HOST_NOT_FOUND?
(In reply to Mathieu Parent from comment #12) and also *errnop = ENOENT
Created attachment 12657 [details] patch for master Can you try with this patch? It should apply to 4.5 and 4.5 too.
(In reply to Andreas Schneider from comment #14) Quoting original reporter: "That patch seems to have resolved the System error issue.". My question: Why don't you set *errnop =? (additional question: is this nss API documented somewhere?)
> My question: Why don't you set *errnop =? (additional question: is this nss API > documented somewhere?) It seems that glibc doesn't that it in that case, because it isn't an 'error' but a 'good' return value. The documentation is the glibc code :(
The glibc manual has some documentation: https://www.gnu.org/software/libc/manual/html_node/NSS-Module-Internals.html The master sources in Git have some crucial fixes: git clone https://sourceware.org/git/glibc.git These changes to not reflect implementation changes, the documentation was simply wrong before. Regarding which error code to return, this entirely depends on the kind failure. Is the entry just missing? Or is the service unavailable? Is the lack of service just temporary, or persistent?
Created attachment 12683 [details] additional patch for 4.5
Created attachment 12684 [details] additional patch for 4.4
Reassigning to Karolin for inclusion in 4.5.next, 4.4.next.
(In reply to Jeremy Allison from comment #20) Pushed to autobuild-v4-{4,5}-test.
(In reply to Karolin Seeger from comment #21) Pushed to both branches. Closing out bug report. Thanks!
*** Bug 11775 has been marked as a duplicate of this bug. ***