[BACK]Return to res_init.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / resolv

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libc/resolv/res_init.c between version 1.8.4.2 and 1.8.4.2.2.1

version 1.8.4.2, 2007/05/17 21:25:18 version 1.8.4.2.2.1, 2011/01/23 21:52:34
Line 74 
Line 74 
 #if defined(LIBC_SCCS) && !defined(lint)  #if defined(LIBC_SCCS) && !defined(lint)
 #ifdef notdef  #ifdef notdef
 static const char sccsid[] = "@(#)res_init.c    8.1 (Berkeley) 6/7/93";  static const char sccsid[] = "@(#)res_init.c    8.1 (Berkeley) 6/7/93";
 static const char rcsid[] = "Id: res_init.c,v 1.16.18.5 2006/08/30 23:23:13 marka Exp";  static const char rcsid[] = "Id: res_init.c,v 1.16.18.7 2007/07/09 01:52:58 mar
   ka Exp";
 #else  #else
 __RCSID("$NetBSD$");  __RCSID("$NetBSD$");
 #endif  #endif
Line 122  __weak_alias(res_setservers,__res_setser
Line 123  __weak_alias(res_setservers,__res_setser
   
 /*% Options.  Should all be left alone. */  /*% Options.  Should all be left alone. */
 #ifndef DEBUG  #ifndef DEBUG
   #define RESOLVSORT
 #define DEBUG  #define DEBUG
 #endif  #endif
   
Line 131  __weak_alias(res_setservers,__res_setser
Line 133  __weak_alias(res_setservers,__res_setser
   
 static void res_setoptions __P((res_state, const char *, const char *));  static void res_setoptions __P((res_state, const char *, const char *));
   
   #ifdef RESOLVSORT
 static const char sort_mask[] = "/&";  static const char sort_mask[] = "/&";
 #define ISSORTMASK(ch) (strchr(sort_mask, ch) != NULL)  #define ISSORTMASK(ch) (strchr(sort_mask, ch) != NULL)
 static u_int32_t net_mask __P((struct in_addr));  static u_int32_t net_mask __P((struct in_addr));
   #endif
   
 #if !defined(isascii)   /*%< XXX - could be a function */  #if !defined(isascii)   /*%< XXX - could be a function */
 # define isascii(c) (!(c & 0200))  # define isascii(c) (!(c & 0200))
Line 181  __res_vinit(res_state statp, int preinit
Line 185  __res_vinit(res_state statp, int preinit
         int nserv = 0;    /*%< number of nameserver records read from file */          int nserv = 0;    /*%< number of nameserver records read from file */
         int haveenv = 0;          int haveenv = 0;
         int havesearch = 0;          int havesearch = 0;
   #ifdef RESOLVSORT
         int nsort = 0;          int nsort = 0;
         char *net;          char *net;
   #endif
         int dots;          int dots;
         union res_sockaddr_union u[2];          union res_sockaddr_union u[2];
           int maxns = MAXNS;
   
           RES_SET_H_ERRNO(statp, 0);
           if (statp->_u._ext.ext != NULL)
                   res_ndestroy(statp);
   
         if (!preinit) {          if (!preinit) {
                 statp->retrans = RES_TIMEOUT;                  statp->retrans = RES_TIMEOUT;
Line 235  __res_vinit(res_state statp, int preinit
Line 246  __res_vinit(res_state statp, int preinit
                 statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr;                  statp->_u._ext.ext->nsaddrs[0].sin = statp->nsaddr;
                 strcpy(statp->_u._ext.ext->nsuffix, "ip6.arpa");                  strcpy(statp->_u._ext.ext->nsuffix, "ip6.arpa");
                 strcpy(statp->_u._ext.ext->nsuffix2, "ip6.int");                  strcpy(statp->_u._ext.ext->nsuffix2, "ip6.int");
         } else          } else {
                 return (-1);                  /*
                   * Historically res_init() rarely, if at all, failed.
                   * Examples and applications exist which do not check
                   * our return code.  Furthermore several applications
                   * simply call us to get the systems domainname.  So
                   * rather then immediately fail here we store the
                   * failure, which is returned later, in h_errno.  And
                   * prevent the collection of 'nameserver' information
                   * by setting maxns to 0.  Thus applications that fail
                   * to check our return code wont be able to make
                   * queries anyhow.
                   */
                   RES_SET_H_ERRNO(statp, NETDB_INTERNAL);
                   maxns = 0;
           }
   #ifdef RESOLVSORT
         statp->nsort = 0;          statp->nsort = 0;
   #endif
         res_setservers(statp, u, nserv);          res_setservers(statp, u, nserv);
   
 #ifdef  SOLARIS2  #ifdef  SOLARIS2
Line 255  __res_vinit(res_state statp, int preinit
Line 282  __res_vinit(res_state statp, int preinit
                                 buf[0] = '.';                                  buf[0] = '.';
                         cp = strchr(buf, '.');                          cp = strchr(buf, '.');
                         cp = (cp == NULL) ? buf : (cp + 1);                          cp = (cp == NULL) ? buf : (cp + 1);
                         if (strlen(cp) >= sizeof(statp->defdname))                          strncpy(statp->defdname, cp,
                                 goto freedata;                                  sizeof(statp->defdname) - 1);
                         strcpy(statp->defdname, cp);                          statp->defdname[sizeof(statp->defdname) - 1] = '\0';
                 }                  }
         }          }
 #endif  /* SOLARIS2 */  #endif  /* SOLARIS2 */
Line 363  __res_vinit(res_state statp, int preinit
Line 390  __res_vinit(res_state statp, int preinit
                     continue;                      continue;
                 }                  }
                 /* read nameservers to query */                  /* read nameservers to query */
                 if (MATCH(buf, "nameserver") && nserv < MAXNS) {                  if (MATCH(buf, "nameserver") && nserv < maxns) {
                     struct addrinfo hints, *ai;                      struct addrinfo hints, *ai;
                     char sbuf[NI_MAXSERV];                      char sbuf[NI_MAXSERV];
                     const size_t minsiz =                      const size_t minsiz =
Line 397  __res_vinit(res_state statp, int preinit
Line 424  __res_vinit(res_state statp, int preinit
                     }                      }
                     continue;                      continue;
                 }                  }
   #ifdef RESOLVSORT
                 if (MATCH(buf, "sortlist")) {                  if (MATCH(buf, "sortlist")) {
                     struct in_addr a;                      struct in_addr a;
   
Line 439  __res_vinit(res_state statp, int preinit
Line 467  __res_vinit(res_state statp, int preinit
                     }                      }
                     continue;                      continue;
                 }                  }
   #endif
                 if (MATCH(buf, "options")) {                  if (MATCH(buf, "options")) {
                     res_setoptions(statp, buf + sizeof("options") - 1, "conf");                      res_setoptions(statp, buf + sizeof("options") - 1, "conf");
                     continue;                      continue;
Line 446  __res_vinit(res_state statp, int preinit
Line 475  __res_vinit(res_state statp, int preinit
             }              }
             if (nserv > 0)              if (nserv > 0)
                 statp->nscount = nserv;                  statp->nscount = nserv;
   #ifdef RESOLVSORT
             statp->nsort = nsort;              statp->nsort = nsort;
   #endif
             (void) fclose(fp);              (void) fclose(fp);
         }          }
 /*  /*
Line 495  __res_vinit(res_state statp, int preinit
Line 526  __res_vinit(res_state statp, int preinit
         if ((cp = getenv("RES_OPTIONS")) != NULL)          if ((cp = getenv("RES_OPTIONS")) != NULL)
                 res_setoptions(statp, cp, "env");                  res_setoptions(statp, cp, "env");
         statp->options |= RES_INIT;          statp->options |= RES_INIT;
         return (0);          return (statp->res_h_errno);
   
 #ifdef  SOLARIS2  
  freedata:  
         if (statp->_u._ext.ext != NULL) {  
                 free(statp->_u._ext.ext);  
                 statp->_u._ext.ext = NULL;  
         }  
         return (-1);  
 #endif  
 }  }
   
 static void  static void
Line 636  res_setoptions(res_state statp, const ch
Line 658  res_setoptions(res_state statp, const ch
         }          }
 }  }
   
   #ifdef RESOLVSORT
 /* XXX - should really support CIDR which means explicit masks always. */  /* XXX - should really support CIDR which means explicit masks always. */
 static u_int32_t  static u_int32_t
 net_mask(in)            /*!< XXX - should really use system's version of this  */  net_mask(in)            /*!< XXX - should really use system's version of this  */
Line 649  net_mask(in)  /*!< XXX - should really u
Line 672  net_mask(in)  /*!< XXX - should really u
                 return (htonl(IN_CLASSB_NET));                  return (htonl(IN_CLASSB_NET));
         return (htonl(IN_CLASSC_NET));          return (htonl(IN_CLASSC_NET));
 }  }
   #endif
   
 u_int  u_int
 res_randomid(void) {  res_randomid(void) {

Legend:
Removed from v.1.8.4.2  
changed lines
  Added in v.1.8.4.2.2.1

CVSweb <webmaster@jp.NetBSD.org>