]> jfr.im git - solanum.git/blobdiff - src/reslib.c
Merge pull request #53 from ShadowNinja/clarify_U+R
[solanum.git] / src / reslib.c
index 4f2c57030ac817e4a00c7e0730fab0b31084b5b1..e3a643cbb426d0799588101cc7fb87cb8339bb2a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 1985, 1993
  *    The Regents of the University of California.  All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
 /*
  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- * 
+ *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies, and that
  * the name of Digital Equipment Corporation not be used in advertising or
  * publicity pertaining to distribution of the document or software without
  * specific, written prior permission.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
@@ -68,7 +64,7 @@
  * SOFTWARE.
  */
 
-/* Original copyright ISC as above. 
+/* Original copyright ISC as above.
  * Code modified specifically for ircd use from the following orginal files
  * in bind ...
  *
@@ -76,7 +72,7 @@
  * ns_name.c
  * ns_netint.c
  * res_init.c
- * 
+ *
  * - Dianora
  */
 
@@ -86,8 +82,8 @@
 #include "ircd.h"
 #include "res.h"
 #include "reslib.h"
-#include "irc_string.h"
-#include "sprintf_irc.h"
+#include "match.h"
+#include "logger.h"
 
 #define NS_TYPE_ELT             0x40 /* EDNS0 extended label type */
 #define DNS_LABELTYPE_BITSTRING 0x41
@@ -98,7 +94,7 @@
 
 struct rb_sockaddr_storage irc_nsaddr_list[IRCD_MAXNS];
 int irc_nscount = 0;
-char irc_domain[HOSTLEN + 1];
+char irc_domain[IRCD_RES_HOSTLEN + 1];
 
 static const char digitvalue[256] = {
   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*16*/
@@ -131,7 +127,7 @@ static int irc_ns_name_compress(const char *src, unsigned char *dst, size_t dsts
     const unsigned char **dnptrs, const unsigned char **lastdnptr);
 static int irc_dn_find(const unsigned char *, const unsigned char *, const unsigned char * const *,
                        const unsigned char * const *);
-static int irc_encode_bitsring(const char **, const char *, unsigned char **, unsigned char **, 
+static int irc_encode_bitsring(const char **, const char *, unsigned char **, unsigned char **,
                                const char *);
 static int irc_ns_name_uncompress(const unsigned char *, const unsigned char *,
                                   const unsigned char *, char *, size_t);
@@ -141,7 +137,7 @@ static int irc_ns_name_unpack(const unsigned char *, const unsigned char *,
 static int irc_ns_name_ntop(const char *, char *, size_t);
 static int irc_ns_name_skip(const unsigned char **, const unsigned char *);
 static int mklower(int ch);
-  
+
 int
 irc_res_init(void)
 {
@@ -209,7 +205,7 @@ parse_resvconf(void)
       *p = '\0';  /* take the first word */
 
     if (irccmp(opt, "domain") == 0)
-      strlcpy(irc_domain, arg, sizeof(irc_domain));
+      rb_strlcpy(irc_domain, arg, sizeof(irc_domain));
     else if (irccmp(opt, "nameserver") == 0)
       add_nameserver(arg);
   }
@@ -409,7 +405,7 @@ irc_ns_name_ntop(const char *src, char *dst, size_t dstsiz)
                        }
                        *dn++ = '.';
                }
-               if ((l = labellen((unsigned char*)(cp - 1))) < 0) {
+               if ((l = labellen((const unsigned char*)(cp - 1))) < 0) {
                        errno = EMSGSIZE; /* XXX */
                        return(-1);
                }
@@ -430,7 +426,7 @@ irc_ns_name_ntop(const char *src, char *dst, size_t dstsiz)
                                errno = EMSGSIZE;
                                return(-1);
                        }
-                       dn += m; 
+                       dn += m;
                        continue;
                }
                for ((void)NULL; l > 0; l--) {
@@ -615,7 +611,7 @@ special(int ch)
 
 static int
 labellen(const unsigned char *lp)
-{                               
+{
   int bitlen;
   unsigned char l = *lp;
 
@@ -1125,7 +1121,7 @@ irc_dn_find(const unsigned char *domain, const unsigned char *msg,
  *   *  convert this character to lower case if it's upper case.
  *    */
 static int
-mklower(int ch) 
+mklower(int ch)
 {
   if (ch >= 0x41 && ch <= 0x5A)
     return(ch + 0x20);