chiark / gitweb /
+ * Reads /etc/resolv-adns.conf if it exists.
authorian <ian>
Sun, 7 Nov 1999 19:15:36 +0000 (19:15 +0000)
committerian <ian>
Sun, 7 Nov 1999 19:15:36 +0000 (19:15 +0000)
@@ -22,6 +22,7 @@
+  * Reads /etc/resolv-adns.conf if it exists.

changelog
src/adns.h
src/setup.c

index 6f688d504724fb1b606c8a835c52c9b7248d7047..a408e67a17ccf2c58c919d01631fdf45ca4ab4fc 100644 (file)
--- 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.
 
  --
 
index bc20a70d797ed325f0b994246f6670808b9d01fb..feb9f9db276a61583342c5d908818e5ec1d8934b 100644 (file)
@@ -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 <address>
  *   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 <filename>
  *   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.
index e19a70536b2753a62debb6268492010e8c9b0551..ac88c33f6f79d15528102895013033cebdb3b99d 100644 (file)
@@ -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");