/*
* 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
* SOFTWARE.
*/
-/* Original copyright ISC as above.
+/* Original copyright ISC as above.
* Code modified specifically for ircd use from the following orginal files
* in bind ...
*
* ns_name.c
* ns_netint.c
* res_init.c
- *
+ *
* - Dianora
*/
#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
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*/
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);
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)
{
*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);
}
}
*dn++ = '.';
}
- if ((l = labellen((unsigned char*)(cp - 1))) < 0) {
+ if ((l = labellen((const unsigned char*)(cp - 1))) < 0) {
errno = EMSGSIZE; /* XXX */
return(-1);
}
errno = EMSGSIZE;
return(-1);
}
- dn += m;
+ dn += m;
continue;
}
for ((void)NULL; l > 0; l--) {
static int
labellen(const unsigned char *lp)
-{
+{
int bitlen;
unsigned char l = *lp;
* * 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);