From fb7fbb6605c88fef770cba4ed4972dbb1212b8d7 Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 7 Nov 1999 19:15:36 +0000 Subject: [PATCH] + * Reads /etc/resolv-adns.conf if it exists. @@ -22,6 +22,7 @@ + * Reads /etc/resolv-adns.conf if it exists. --- changelog | 1 + src/adns.h | 18 ++++++++++-------- src/setup.c | 14 ++++++++------ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/changelog b/changelog index 6f688d5..a408e67 100644 --- a/changelog +++ b/changelog @@ -22,6 +22,7 @@ adns (0.6) unstable; urgency=high * New fanftest test program from Tony Finch (ignored by `make install'). * Declare flags parameters as enums again, not ints. * New adnsresfilter general-purpose number->name mapping filter program. + * Reads /etc/resolv-adns.conf if it exists. -- diff --git a/src/adns.h b/src/adns.h index bc20a70..feb9f9d 100644 --- a/src/adns.h +++ b/src/adns.h @@ -345,12 +345,13 @@ int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags, /* Configuration: * adns_init reads /etc/resolv.conf, which is expected to be (broadly - * speaking) in the format expected by libresolv. adns_init_strcfg - * is instead passed a string which is interpreted as if it were the - * contents of resolv.conf. In general, configuration which is set - * later overrides any that is set earlier. + * speaking) in the format expected by libresolv, and then + * /etc/resolv-adns.conf if it exists. adns_init_strcfg is instead + * passed a string which is interpreted as if it were the contents of + * resolv.conf or resolv-adns.conf. In general, configuration which + * is set later overrides any that is set earlier. * - * Standard directives understood in resolv.conf: + * Standard directives understood in resolv[-adns].conf: * * nameserver
* Must be followed by the IP address of a nameserver. Several @@ -383,7 +384,7 @@ int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags, * Each option consists of an option name, followed by optionally * a colon and a value. Options are listed below. * - * Non-standard directives understood in resolv.conf: + * Non-standard directives understood in resolv[-adns].conf: * * clearnameservers * Clears the list of nameservers, so that further nameserver lines @@ -392,7 +393,8 @@ int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags, * include * The specified file will be read. * - * Additionally, adns will ignore lines in resolv.conf which start with a #. + * Additionally, adns will ignore lines in resolv[-adns].conf which + * start with a #. * * Standard options understood: * @@ -421,7 +423,7 @@ int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags, * each case there is both a FOO and an ADNS_FOO; the latter is * interpreted later so that it can override the former. Unless * otherwise stated, environment variables are interpreted after - * resolv.conf is read, in the order they are listed here. + * resolv[-adns].conf are read, in the order they are listed here. * * RES_CONF, ADNS_RES_CONF * A filename, whose contets are in the format of resolv.conf. diff --git a/src/setup.c b/src/setup.c index e19a705..ac88c33 100644 --- a/src/setup.c +++ b/src/setup.c @@ -39,7 +39,7 @@ #include "internal.h" -static void readconfig(adns_state ads, const char *filename); +static void readconfig(adns_state ads, const char *filename, int warnmissing); static void addserver(adns_state ads, struct in_addr addr) { int i; @@ -264,7 +264,7 @@ static void ccf_include(adns_state ads, const char *fn, int lno, const char *buf configparseerr(ads,fn,lno,"`include' directive with no filename"); return; } - readconfig(ads,buf); + readconfig(ads,buf,1); } static const struct configcommandinfo { @@ -399,13 +399,14 @@ static const char *instrum_getenv(adns_state ads, const char *envvar) { return value; } -static void readconfig(adns_state ads, const char *filename) { +static void readconfig(adns_state ads, const char *filename, int warnmissing) { getline_ctx gl_ctx; gl_ctx.file= fopen(filename,"r"); if (!gl_ctx.file) { if (errno == ENOENT) { - adns__debug(ads,-1,0,"configuration file `%s' does not exist",filename); + if (warnmissing) + adns__debug(ads,-1,0,"configuration file `%s' does not exist",filename); return; } saveerr(ads,errno); @@ -434,7 +435,7 @@ static void readconfigenv(adns_state ads, const char *envvar) { return; } filename= instrum_getenv(ads,envvar); - if (filename) readconfig(ads,filename); + if (filename) readconfig(ads,filename,1); } static void readconfigenvtext(adns_state ads, const char *envvar) { @@ -535,7 +536,8 @@ int adns_init(adns_state *ads_r, adns_initflags flags, FILE *diagfile) { ccf_options(ads,"RES_OPTIONS",-1,res_options); ccf_options(ads,"ADNS_RES_OPTIONS",-1,adns_res_options); - readconfig(ads,"/etc/resolv.conf"); + readconfig(ads,"/etc/resolv.conf",1); + readconfig(ads,"/etc/resolv-adns.conf",0); readconfigenv(ads,"RES_CONF"); readconfigenv(ads,"ADNS_RES_CONF"); -- 2.30.2