This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[BZ #15890][PATCH] Initialize res_hconf in nscd


Hi,

res_hconf is not initialized in aicache.c, due to which queries that
get resolved from /etc/hosts return only IPv4 results for AF_UNSPEC
when queried via nscd.  This persists till the entry is pruned after
TTL or the cache is invalidated.  Attached patch fixes this.  Tested
on x86_64.  OK to commit?

Siddhesh

	[BZ #15890]
	* nscd/aicache.c: Include res_hconf.h.
	(addhstaiX): Initialize res_hconf.

diff --git a/nscd/aicache.c b/nscd/aicache.c
index 0461b83..dceb4d6 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -25,6 +25,7 @@
 #include <time.h>
 #include <unistd.h>
 #include <sys/mman.h>
+#include <resolv/res_hconf.h>
 
 #include "dbg_log.h"
 #include "nscd.h"
@@ -100,6 +101,9 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
     no_more = __nss_database_lookup ("hosts", NULL,
 				     "dns [!UNAVAIL=return] files", &nip);
 
+  /* Initialize configurations.  */
+  if (__builtin_expect (!_res_hconf.initialized, 0))
+    _res_hconf_init ();
   if (__res_maybe_init (&_res, 0) == -1)
     no_more = 1;
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]