added gnutls backend and moved backend code into new files
[ircu2.10.12-pk.git] / ircd / ircd_reslib.c
index f20a129e25806db0f5214862b5692a15af4b093a..b637273292835010f8c3ea5785ee24bf39d84e14 100644 (file)
@@ -69,7 +69,7 @@
  */
 
 /* Original copyright ISC as above. 
- * Code modified specifically for ircd use from the following orginal files
+ * Code modified specifically for ircd use from the following original files
  * in bind ...
  *
  * res_comp.c
 /** Array of nameserver addresses. */
 struct irc_sockaddr irc_nsaddr_list[IRCD_MAXNS];
 /** Number of nameservers in #irc_nsaddr_list. */
-int irc_nscount = 0;
+int irc_nscount;
 /** Local domain to use as a search suffix. */
 char irc_domain[HOSTLEN + 1];
 
@@ -130,7 +130,6 @@ static const char digitvalue[256] = {
 };
 
 static int parse_resvconf(void);
-static void add_nameserver(char *arg);
 
 /** Array of decimal digits, indexed by value. */
 static const char digits[] = "0123456789";
@@ -152,8 +151,7 @@ static int mklower(int ch);
 int
 irc_res_init(void)
 {
-  irc_nscount = 0;
-  return(parse_resvconf());
+  return (irc_nscount == 0) ? parse_resvconf() : 0;
 }
 
 /** Read resolver configuration file for domain and nameserver lines.
@@ -187,7 +185,7 @@ parse_resvconf(void)
       continue;
 
     p = input;
-    /* skip until something thats not a space is seen */
+    /* skip until something that's not a space is seen */
     while (IsSpace(*p))
       p++;
     /* if at this point, have a '\0' then continue */
@@ -223,13 +221,13 @@ parse_resvconf(void)
 /** Add a resolver to #irc_nsaddr_list.
  * @param[in] arg Dotted quad or IPv6 text form of nameserver address.
  */
-static void
-add_nameserver(char *arg)
+void
+add_nameserver(const char *arg)
 {
   struct irc_sockaddr res;
 
   /* Done max number of nameservers? */
-  if ((irc_nscount + 1) >= IRCD_MAXNS)
+  if (irc_nscount >= IRCD_MAXNS)
     return;
 
   /* Failure converting from numeric string? */
@@ -243,7 +241,7 @@ add_nameserver(char *arg)
 /**
  * Expand compressed domain name to full domain name.
  * Like irc_ns_name_uncompress(), but checks for a well-formed result.
- * @param[in] msg Pointer to the begining of the message.
+ * @param[in] msg Pointer to the beginning of the message.
  * @param[in] eom First location after the message.
  * @param[in] src Pointer to where to starting decoding.
  * @param[out] dst Output buffer.
@@ -263,7 +261,7 @@ irc_dn_expand(const unsigned char *msg, const unsigned char *eom,
 
 /**
  * Expand compressed domain name to full domain name.
- * @param[in] msg Pointer to the begining of the message.
+ * @param[in] msg Pointer to the beginning of the message.
  * @param[in] eom First location after the message.
  * @param[in] src Pointer to where to starting decoding.
  * @param[out] dst Output buffer.
@@ -286,7 +284,7 @@ irc_ns_name_uncompress(const unsigned char *msg, const unsigned char *eom,
 
 /**
  * Unpack compressed domain name to uncompressed form.
- * @param[in] msg Pointer to the begining of the message.
+ * @param[in] msg Pointer to the beginning of the message.
  * @param[in] eom First location after the message.
  * @param[in] src Pointer to where to starting decoding.
  * @param[out] dst Output buffer.
@@ -648,7 +646,7 @@ labellen(const unsigned char *lp)
       return((bitlen + 7 ) / 8 + 1);
     }
 
-    return(-1); /* unknwon ELT */
+    return(-1); /* unknown ELT */
   }
 
   return(l);
@@ -1012,7 +1010,7 @@ irc_encode_bitsring(const char **bp, const char *end, unsigned char **labelp,
         if (beg_blen == NULL) {
 
           if (c == '0') {
-            /* blen never begings with 0 */
+            /* blen never begins with 0 */
             return(EINVAL);
           }
           beg_blen = cp;