[223] in Hesiod

home help back first fref pref prev next nref lref last post

res_init not getting called

daemon@ATHENA.MIT.EDU (Greg Wohletz)
Fri Jul 29 03:44:49 1994

To: hesiod@MIT.EDU
Cc: bind-workers@vix.com
Date: Thu, 28 Jul 1994 18:13:32 -0700
From: Greg Wohletz <greg@duke.CS.UNLV.EDU>

A combination of resolver (4.9.3-BETA9) and OS upgrades (Ultrix 4.4)
had caused our hesiod queries (that had been working fine for several
years) to start acting flakey.  Further investigation found that
for some reason the want recursion (or whatever) flag wasn't being
set in the query sent to the nameserver, so unless the data was already
cached the lookup would fail.  Anyway after messing with the problem
I found that if I called res_init before calling hes_resolve things
working correctly (don't ask how I came to try that).

Anyway after steping through some of the code with gdb I noticed that
res_init seemed to be being called late in the game, as if hesiod was
someone entering the resolver library at a point where it doesn't check the
RES_INIT flag.

Anyway to make a long story short the following patch to resolve.c
caused everything to start working again.  As to why this wasn't a problem
before I do not know.

I'll leave discussion regarding weather or not this fix is really needed or
appropriate to those who understand the two libraries better than I...

*** resolve.c.orig      Thu Jul 28 18:02:44 1994
--- resolve.c   Thu Jul 28 17:58:08 1994
***************
*** 149,154 ****
--- 149,156 ----
      register int res_retrans = _res.retrans;
      register int res_retry = _res.retry;
  
+     if ((_res.options & RES_INIT) == 0 && res_init() == -1)
+       return((nsmsg_t *)NULL);
  #ifdef DEBUG
      if (_res.options & RES_DEBUG)
          printf("_resolve: class = %d, type = %d\n", class, type);

home help back first fref pref prev next nref lref last post