The resolver library does a pretty acceptable set of domain

suffix attempts before failing. No need to try again by hand,
particularly when it fills your log with failures because
localhost.example.com..example.com fails to resolve. Also improve the
log message that helped find this error.

There is still (maybe) an uninitialised pointer problem here, but in a
month of testing I haven't triggered it.
This commit is contained in:
Mark Murray 2002-09-20 20:09:27 +00:00
parent 492d981b7a
commit 15b23bddd9

View File

@ -176,7 +176,7 @@ yp_send_dns_query(char *name, int type)
n = res_mkquery(QUERY,name,C_IN,type,NULL,0,NULL,buf,sizeof(buf));
if (n <= 0) {
yp_error("res_mkquery failed");
yp_error("res_mkquery failed for %s type %d", name, type);
return(0);
}
@ -386,24 +386,7 @@ yp_run_dnsq(void)
hent = __dns_getanswer(buf, rval, q->name, q->type);
/*
* If the lookup failed, try appending one of the domains
* from resolv.conf. If we have no domains to test, the
* query has failed.
*/
if (hent == NULL) {
if ((h_errno == TRY_AGAIN || h_errno == NO_RECOVERY)
&& q->domain && *q->domain) {
snprintf(retrybuf, sizeof(retrybuf), "%s.%s",
q->name, *q->domain);
if (debug)
yp_error("retrying with: %s", retrybuf);
q->id = yp_send_dns_query(retrybuf, q->type);
q->ttl = DEF_TTL;
q->domain++;
return;
}
} else {
if (hent != NULL) {
if (q->type == T_PTR) {
hent->h_addr = (char *)&q->addr.s_addr;
hent->h_length = sizeof(struct in_addr);