I only have Solaris (8/9/10) servers to play with, but according to
the manpage for resolver(4):
The current domain name
is defined by the hostname if not specified in the configuration file; it
can be overridden by the environment variable LOCALDOMAIN. This environ-
ment variable may contain several blank-separated tokens if you wish to
override the ``search list'' on a per-process basis. This is similar to
the search command in the configuration file. Another environment vari-
able (``RES_OPTIONS'') can be set to override certain internal resolver
options which are otherwise set by changing fields in the statp / _res
structure or are inherited from the configuration file's options command.
The syntax of the ``RES_OPTIONS'' environment variable is explained in
resolver(5). Initialization normally occurs on the first call to one of
the other resolver routines.
I would imagine that only OS resolver routines would be able to use
these variables, as opposed to tools like nslookup and dig. Why the
aversion to using resolv.conf? Just want to use these variables for
the halibut?
--
--Greg Chavez
--
I double-checked the code and our local libc.* files, and I was wrong
yesterday. They do appear to be compiled into the running versions of
the resolver library, on Red Hat Linux, at least..
How had you been trying to make them work?
--
Joe Yao
-----------------------------------------------------------------------
This message is not an official statement of OSIS Center policies.
By setting, for example, $LOCALDOMAIN to a subdomain not in the client's
search order and using ping to test the client's resolver.
However, on Solaris and (RedHat) Linux it's starting to look like an nscd
issue.
???? AFAIK, 'nscd' doesn't run on RHL.
!!ps -ef | grep 'nsc[d]'
Nope.
I also tried same here, and despite the strings being in the libc.so
[redirected], nothing changed when doing [e.g.] a 'ping':
bash$ LOCALDOMAIN="somebody.else" ping ns1
[get local "ns1" response]
I would have to trace this down a bit, but I suspect that many programs
don't actually use the BIND resolver routines. This may be a legacy
thing.
I compiled the following program and ran it twice:
bash$ ./gethost_test
[shows local host]
bash$ LOCALDOMAIN="somebody.else" ./gethost_test
[shows "somebody else"'s host]
So it IS in there!
=========================== gethost_test.c ============================
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <netdb.h>
#define NUL '\0'
#define DIRC '/'
#define FLAGC '-'
char *myname = "gethost_test";
static char default_host[] = "ns1";
char *ip2str(unsigned char *addr);
int main(int argc, char **argv, char **envp)
{
char *cp;
extern int h_errno;
struct hostent *gp;
if (argc > 0) {
cp = strrchr(*argv, DIRC);
if (cp == (char *) NULL) {
myname = *argv;
} else {
myname = ++cp;
}
}
gp = gethostbyname(default_host);
if (gp == (struct hostent *) NULL) {
herror(myname);
return(1);
}
if (gp->h_name == (char *) NULL) {
fprintf(stderr, "%s: found no name matching \"%s\".\n",
myname, default_host);
return(1);
}
printf("%s == %s\n", gp->h_name, ip2str(gp->h_addr));
return(0);
}
char *ip2str(unsigned char *addr)
{
static char buffer[16];
sprintf(buffer, "%u.%u.%u.%u",
addr[0], addr[1], addr[2], addr[3]);
return(buffer);
}
=======================================================================