- de-lint
- add NetBSD rcsid.
This commit is contained in:
parent
a8846ff30b
commit
fd00db407e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ns_name.c,v 1.1.1.1 2004/05/20 20:01:31 christos Exp $ */
|
||||
/* $NetBSD: ns_name.c,v 1.2 2004/05/20 20:35:05 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
@ -17,8 +17,13 @@
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#ifdef notdef
|
||||
static const char rcsid[] = "Id: ns_name.c,v 1.3.2.4.4.1 2004/03/09 08:33:44 marka Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: ns_name.c,v 1.2 2004/05/20 20:35:05 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "port_before.h"
|
||||
@ -134,7 +139,7 @@ ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
|
||||
errno = EINVAL;
|
||||
return(-1);
|
||||
}
|
||||
if ((m = decode_bitstring((const char **)&cp, dn, eom)) < 0)
|
||||
if ((m = decode_bitstring((const char **)(void *)&cp, dn, eom)) < 0)
|
||||
{
|
||||
errno = EMSGSIZE;
|
||||
return(-1);
|
||||
@ -142,7 +147,7 @@ ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
|
||||
dn += m;
|
||||
continue;
|
||||
}
|
||||
for ((void)NULL; l > 0; l--) {
|
||||
for (; l > 0; l--) {
|
||||
c = *cp++;
|
||||
if (special(c)) {
|
||||
if (dn + 1 >= eom) {
|
||||
@ -216,8 +221,8 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz)
|
||||
}
|
||||
if ((e = encode_bitsring(&src,
|
||||
cp + 2,
|
||||
(char **)&label,
|
||||
(char **)&bp,
|
||||
(char **)(void *)&label,
|
||||
(char **)(void *)&bp,
|
||||
(const char *)eom))
|
||||
!= 0) {
|
||||
errno = e;
|
||||
@ -362,7 +367,7 @@ ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz)
|
||||
errno = EMSGSIZE;
|
||||
return (-1);
|
||||
}
|
||||
for ((void)NULL; l > 0; l--) {
|
||||
for (; l > 0; l--) {
|
||||
c = *cp++;
|
||||
if (isupper(c))
|
||||
*dn++ = tolower(c);
|
||||
@ -414,7 +419,7 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
|
||||
}
|
||||
checked += l + 1;
|
||||
*dstp++ = n;
|
||||
memcpy(dstp, srcp, l);
|
||||
memcpy(dstp, srcp, (size_t)l);
|
||||
dstp += l;
|
||||
srcp += l;
|
||||
break;
|
||||
@ -487,7 +492,7 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
|
||||
if (dnptrs != NULL) {
|
||||
if ((msg = *dnptrs++) != NULL) {
|
||||
for (cpp = dnptrs; *cpp != NULL; cpp++)
|
||||
(void)NULL;
|
||||
;
|
||||
lpp = cpp; /* end of list to search */
|
||||
}
|
||||
} else
|
||||
@ -527,7 +532,7 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
|
||||
if (dstp + 1 >= eob) {
|
||||
goto cleanup;
|
||||
}
|
||||
*dstp++ = (l >> 8) | NS_CMPRSFLGS;
|
||||
*dstp++ = ((u_int32_t)l >> 8) | NS_CMPRSFLGS;
|
||||
*dstp++ = l % 256;
|
||||
return (dstp - dst);
|
||||
}
|
||||
@ -548,7 +553,7 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
|
||||
if (dstp + 1 + n >= eob) {
|
||||
goto cleanup;
|
||||
}
|
||||
memcpy(dstp, srcp, n + 1);
|
||||
memcpy(dstp, srcp, (size_t)(n + 1));
|
||||
srcp += n + 1;
|
||||
dstp += n + 1;
|
||||
} while (n != 0);
|
||||
@ -607,7 +612,7 @@ ns_name_compress(const char *src, u_char *dst, size_t dstsiz,
|
||||
|
||||
if (ns_name_pton(src, tmp, sizeof tmp) == -1)
|
||||
return (-1);
|
||||
return (ns_name_pack(tmp, dst, dstsiz, dnptrs, lastdnptr));
|
||||
return (ns_name_pack(tmp, dst, (int)dstsiz, dnptrs, lastdnptr));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -762,7 +767,7 @@ dn_find(const u_char *domain, const u_char *msg,
|
||||
if (n != *dn++)
|
||||
goto next;
|
||||
|
||||
for ((void)NULL; n > 0; n--)
|
||||
for (; n > 0; n--)
|
||||
if (mklower(*dn++) !=
|
||||
mklower(*cp++))
|
||||
goto next;
|
||||
@ -823,7 +828,7 @@ decode_bitstring(const char **cpp, char *dn, const char *eom)
|
||||
} else if (b > 0) {
|
||||
tc = *cp++;
|
||||
i = SPRINTF((dn, "%1x",
|
||||
((tc >> 4) & 0x0f) & (0x0f << (4 - b))));
|
||||
(((u_int32_t)tc >> 4) & 0x0f) & (0x0f << (4 - b))));
|
||||
if (i < 0)
|
||||
return (-1);
|
||||
dn += i;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ns_parse.c,v 1.1.1.1 2004/05/20 20:01:31 christos Exp $ */
|
||||
/* $NetBSD: ns_parse.c,v 1.2 2004/05/20 20:35:05 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
@ -17,8 +17,13 @@
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#ifdef notdef
|
||||
static const char rcsid[] = "Id: ns_parse.c,v 1.3.2.1.4.1 2004/03/09 08:33:44 marka Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: ns_parse.c,v 1.2 2004/05/20 20:35:05 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Import. */
|
||||
@ -42,7 +47,7 @@ static void setsection(ns_msg *msg, ns_sect sect);
|
||||
|
||||
/* Macros. */
|
||||
|
||||
#define RETERR(err) do { errno = (err); return (-1); } while (0)
|
||||
#define RETERR(err) do { errno = (err); return (-1); } while (/*NOTREACHED*//*CONSTCOND*/0)
|
||||
|
||||
/* Public. */
|
||||
|
||||
@ -67,14 +72,14 @@ struct _ns_flagdata _ns_flagdata[16] = {
|
||||
};
|
||||
|
||||
int ns_msg_getflag(ns_msg handle, int flag) {
|
||||
return(((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift);
|
||||
return((u_int32_t)((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift);
|
||||
}
|
||||
|
||||
int
|
||||
ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {
|
||||
const u_char *optr = ptr;
|
||||
|
||||
for ((void)NULL; count > 0; count--) {
|
||||
for (; count > 0; count--) {
|
||||
int b, rdlength;
|
||||
|
||||
b = dn_skipname(ptr, eom);
|
||||
@ -134,10 +139,9 @@ ns_initparse(const u_char *msg, int msglen, ns_msg *handle) {
|
||||
int
|
||||
ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
|
||||
int b;
|
||||
int tmp;
|
||||
|
||||
/* Make section right. */
|
||||
if ((tmp = section) < 0 || section >= ns_s_max)
|
||||
if (section < 0 || section >= ns_s_max)
|
||||
RETERR(ENODEV);
|
||||
if (section != handle->_sect)
|
||||
setsection(handle, section);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ns_print.c,v 1.1.1.1 2004/05/20 20:01:31 christos Exp $ */
|
||||
/* $NetBSD: ns_print.c,v 1.2 2004/05/20 20:35:05 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
@ -17,8 +17,13 @@
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#ifdef notdef
|
||||
static const char rcsid[] = "Id: ns_print.c,v 1.3.2.1.4.4 2004/03/17 01:13:36 marka Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: ns_print.c,v 1.2 2004/05/20 20:35:05 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Import. */
|
||||
@ -67,7 +72,7 @@ static int addtab(size_t len, size_t target, int spaced,
|
||||
do { \
|
||||
if ((x) < 0) \
|
||||
return (-1); \
|
||||
} while (0)
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
/* Public. */
|
||||
|
||||
@ -119,24 +124,24 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
* Owner.
|
||||
*/
|
||||
if (name_ctx != NULL && ns_samename(name_ctx, name) == 1) {
|
||||
T(addstr("\t\t\t", 3, &buf, &buflen));
|
||||
T(addstr("\t\t\t", (size_t)3, &buf, &buflen));
|
||||
} else {
|
||||
len = prune_origin(name, origin);
|
||||
if (*name == '\0') {
|
||||
goto root;
|
||||
} else if (len == 0) {
|
||||
T(addstr("@\t\t\t", 4, &buf, &buflen));
|
||||
T(addstr("@\t\t\t", (size_t)4, &buf, &buflen));
|
||||
} else {
|
||||
T(addstr(name, len, &buf, &buflen));
|
||||
T(addstr(name, (size_t)len, &buf, &buflen));
|
||||
/* Origin not used or not root, and no trailing dot? */
|
||||
if (((origin == NULL || origin[0] == '\0') ||
|
||||
(origin[0] != '.' && origin[1] != '\0' &&
|
||||
name[len] == '\0')) && name[len - 1] != '.') {
|
||||
root:
|
||||
T(addstr(".", 1, &buf, &buflen));
|
||||
T(addstr(".", (size_t)1, &buf, &buflen));
|
||||
len++;
|
||||
}
|
||||
T(spaced = addtab(len, 24, spaced, &buf, &buflen));
|
||||
T(spaced = addtab((size_t)len, 24, spaced, &buf, &buflen));
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,12 +149,12 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
* TTL, Class, Type.
|
||||
*/
|
||||
T(x = ns_format_ttl(ttl, buf, buflen));
|
||||
addlen(x, &buf, &buflen);
|
||||
addlen((size_t)x, &buf, &buflen);
|
||||
len = SPRINTF((tmp, " %s %s", p_class(class), p_type(type)));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
if (rdlen == 0U)
|
||||
return (buf - obuf);
|
||||
T(spaced = addtab(x + len, 16, spaced, &buf, &buflen));
|
||||
T(spaced = addtab((size_t)(x + len), (size_t)16, spaced, &buf, &buflen));
|
||||
|
||||
/*
|
||||
* RData.
|
||||
@ -179,7 +184,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
if (len == 0)
|
||||
goto formerr;
|
||||
rdata += len;
|
||||
T(addstr(" ", 1, &buf, &buflen));
|
||||
T(addstr(" ", (size_t)1, &buf, &buflen));
|
||||
|
||||
|
||||
/* Second word, optional in ISDN records. */
|
||||
@ -197,11 +202,11 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
|
||||
/* Server name. */
|
||||
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
T(addstr(" ", 1, &buf, &buflen));
|
||||
T(addstr(" ", (size_t)1, &buf, &buflen));
|
||||
|
||||
/* Administrator name. */
|
||||
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
T(addstr(" (\n", 3, &buf, &buflen));
|
||||
T(addstr(" (\n", (size_t)3, &buf, &buflen));
|
||||
spaced = 0;
|
||||
|
||||
if ((edata - rdata) != 5*NS_INT32SZ)
|
||||
@ -209,48 +214,48 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
|
||||
/* Serial number. */
|
||||
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
||||
T(addstr("\t\t\t\t\t", 5, &buf, &buflen));
|
||||
T(addstr("\t\t\t\t\t", (size_t)5, &buf, &buflen));
|
||||
len = SPRINTF((tmp, "%lu", t));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(spaced = addtab(len, 16, spaced, &buf, &buflen));
|
||||
T(addstr("; serial\n", 9, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
T(spaced = addtab((size_t)len, (size_t)16, spaced, &buf, &buflen));
|
||||
T(addstr("; serial\n", (size_t)9, &buf, &buflen));
|
||||
spaced = 0;
|
||||
|
||||
/* Refresh interval. */
|
||||
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
||||
T(addstr("\t\t\t\t\t", 5, &buf, &buflen));
|
||||
T(addstr("\t\t\t\t\t", (size_t)5, &buf, &buflen));
|
||||
T(len = ns_format_ttl(t, buf, buflen));
|
||||
addlen(len, &buf, &buflen);
|
||||
T(spaced = addtab(len, 16, spaced, &buf, &buflen));
|
||||
T(addstr("; refresh\n", 10, &buf, &buflen));
|
||||
addlen((size_t)len, &buf, &buflen);
|
||||
T(spaced = addtab((size_t)len, (size_t)16, spaced, &buf, &buflen));
|
||||
T(addstr("; refresh\n", (size_t)10, &buf, &buflen));
|
||||
spaced = 0;
|
||||
|
||||
/* Retry interval. */
|
||||
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
||||
T(addstr("\t\t\t\t\t", 5, &buf, &buflen));
|
||||
T(addstr("\t\t\t\t\t", (size_t)5, &buf, &buflen));
|
||||
T(len = ns_format_ttl(t, buf, buflen));
|
||||
addlen(len, &buf, &buflen);
|
||||
T(spaced = addtab(len, 16, spaced, &buf, &buflen));
|
||||
T(addstr("; retry\n", 8, &buf, &buflen));
|
||||
addlen((size_t)len, &buf, &buflen);
|
||||
T(spaced = addtab((size_t)len, (size_t)16, spaced, &buf, &buflen));
|
||||
T(addstr("; retry\n", (size_t)8, &buf, &buflen));
|
||||
spaced = 0;
|
||||
|
||||
/* Expiry. */
|
||||
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
||||
T(addstr("\t\t\t\t\t", 5, &buf, &buflen));
|
||||
T(addstr("\t\t\t\t\t", (size_t)5, &buf, &buflen));
|
||||
T(len = ns_format_ttl(t, buf, buflen));
|
||||
addlen(len, &buf, &buflen);
|
||||
T(spaced = addtab(len, 16, spaced, &buf, &buflen));
|
||||
T(addstr("; expiry\n", 9, &buf, &buflen));
|
||||
addlen((size_t)len, &buf, &buflen);
|
||||
T(spaced = addtab((size_t)len, (size_t)16, spaced, &buf, &buflen));
|
||||
T(addstr("; expiry\n", (size_t)9, &buf, &buflen));
|
||||
spaced = 0;
|
||||
|
||||
/* Minimum TTL. */
|
||||
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
||||
T(addstr("\t\t\t\t\t", 5, &buf, &buflen));
|
||||
T(addstr("\t\t\t\t\t", (size_t)5, &buf, &buflen));
|
||||
T(len = ns_format_ttl(t, buf, buflen));
|
||||
addlen(len, &buf, &buflen);
|
||||
T(addstr(" )", 2, &buf, &buflen));
|
||||
T(spaced = addtab(len, 16, spaced, &buf, &buflen));
|
||||
T(addstr("; minimum\n", 10, &buf, &buflen));
|
||||
addlen((size_t)len, &buf, &buflen);
|
||||
T(addstr(" )", (size_t)2, &buf, &buflen));
|
||||
T(spaced = addtab((size_t)len, (size_t)16, spaced, &buf, &buflen));
|
||||
T(addstr("; minimum\n", (size_t)10, &buf, &buflen));
|
||||
|
||||
break;
|
||||
}
|
||||
@ -267,7 +272,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
t = ns_get16(rdata);
|
||||
rdata += NS_INT16SZ;
|
||||
len = SPRINTF((tmp, "%u ", t));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
|
||||
/* Target. */
|
||||
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
@ -285,11 +290,11 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
t = ns_get16(rdata);
|
||||
rdata += NS_INT16SZ;
|
||||
len = SPRINTF((tmp, "%u ", t));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
|
||||
/* Name1. */
|
||||
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
T(addstr(" ", 1, &buf, &buflen));
|
||||
T(addstr(" ", (size_t)1, &buf, &buflen));
|
||||
|
||||
/* Name2. */
|
||||
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
@ -311,14 +316,14 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
goto formerr;
|
||||
rdata += len;
|
||||
if (rdata < edata)
|
||||
T(addstr(" ", 1, &buf, &buflen));
|
||||
T(addstr(" ", (size_t)1, &buf, &buflen));
|
||||
}
|
||||
break;
|
||||
|
||||
case ns_t_nsap: {
|
||||
char t[2+255*3];
|
||||
|
||||
(void) inet_nsap_ntoa(rdlen, rdata, t);
|
||||
(void) inet_nsap_ntoa((int)rdlen, rdata, t);
|
||||
T(addstr(t, strlen(t), &buf, &buflen));
|
||||
break;
|
||||
}
|
||||
@ -350,21 +355,21 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
order = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||
preference = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||
len = SPRINTF((t, "%u %u ", order, preference));
|
||||
T(addstr(t, len, &buf, &buflen));
|
||||
T(addstr(t, (size_t)len, &buf, &buflen));
|
||||
|
||||
/* Flags. */
|
||||
T(len = charstr(rdata, edata, &buf, &buflen));
|
||||
if (len == 0)
|
||||
goto formerr;
|
||||
rdata += len;
|
||||
T(addstr(" ", 1, &buf, &buflen));
|
||||
T(addstr(" ", (size_t)1, &buf, &buflen));
|
||||
|
||||
/* Service. */
|
||||
T(len = charstr(rdata, edata, &buf, &buflen));
|
||||
if (len == 0)
|
||||
goto formerr;
|
||||
rdata += len;
|
||||
T(addstr(" ", 1, &buf, &buflen));
|
||||
T(addstr(" ", (size_t)1, &buf, &buflen));
|
||||
|
||||
/* Regexp. */
|
||||
T(len = charstr(rdata, edata, &buf, &buflen));
|
||||
@ -373,7 +378,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
if (len == 0)
|
||||
goto formerr;
|
||||
rdata += len;
|
||||
T(addstr(" ", 1, &buf, &buflen));
|
||||
T(addstr(" ", (size_t)1, &buf, &buflen));
|
||||
|
||||
/* Server. */
|
||||
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
@ -392,7 +397,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
weight = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||
port = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||
len = SPRINTF((t, "%u %u %u ", priority, weight, port));
|
||||
T(addstr(t, len, &buf, &buflen));
|
||||
T(addstr(t, (size_t)len, &buf, &buflen));
|
||||
|
||||
/* Server. */
|
||||
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
@ -403,7 +408,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
case ns_t_rp:
|
||||
/* Name1. */
|
||||
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
T(addstr(" ", 1, &buf, &buflen));
|
||||
T(addstr(" ", (size_t)1, &buf, &buflen));
|
||||
|
||||
/* Name2. */
|
||||
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
@ -423,7 +428,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
|
||||
/* Protocol. */
|
||||
len = SPRINTF((tmp, " %u ( ", *rdata));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
rdata += NS_INT8SZ;
|
||||
|
||||
/* Bit map. */
|
||||
@ -434,19 +439,19 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
do {
|
||||
if (c & 0200) {
|
||||
if (lcnt == 0) {
|
||||
T(addstr("\n\t\t\t\t", 5,
|
||||
T(addstr("\n\t\t\t\t", (size_t)5,
|
||||
&buf, &buflen));
|
||||
lcnt = 10;
|
||||
spaced = 0;
|
||||
}
|
||||
len = SPRINTF((tmp, "%d ", n));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
lcnt--;
|
||||
}
|
||||
c <<= 1;
|
||||
} while (++n & 07);
|
||||
}
|
||||
T(addstr(")", 1, &buf, &buflen));
|
||||
T(addstr(")", (size_t)1, &buf, &buflen));
|
||||
|
||||
break;
|
||||
}
|
||||
@ -467,35 +472,35 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
algorithm = *rdata++;
|
||||
len = SPRINTF((tmp, "0x%04x %u %u",
|
||||
keyflags, protocol, algorithm));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
|
||||
/* Public key data. */
|
||||
len = b64_ntop(rdata, edata - rdata,
|
||||
len = b64_ntop(rdata, (size_t)(edata - rdata),
|
||||
base64_key, sizeof base64_key);
|
||||
if (len < 0)
|
||||
goto formerr;
|
||||
if (len > 15) {
|
||||
T(addstr(" (", 2, &buf, &buflen));
|
||||
T(addstr(" (", (size_t)2, &buf, &buflen));
|
||||
leader = "\n\t\t";
|
||||
spaced = 0;
|
||||
} else
|
||||
leader = " ";
|
||||
for (n = 0; n < len; n += 48) {
|
||||
T(addstr(leader, strlen(leader), &buf, &buflen));
|
||||
T(addstr(base64_key + n, MIN(len - n, 48),
|
||||
T(addstr(base64_key + n, (size_t)MIN(len - n, 48),
|
||||
&buf, &buflen));
|
||||
}
|
||||
if (len > 15)
|
||||
T(addstr(" )", 2, &buf, &buflen));
|
||||
T(addstr(" )", (size_t)2, &buf, &buflen));
|
||||
n = SPRINTF((tmp, " ; key_tag= %u", key_id));
|
||||
T(addstr(tmp, n, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)n, &buf, &buflen));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ns_t_sig: {
|
||||
char base64_key[NS_MD5RSA_MAX_BASE64];
|
||||
u_int type, algorithm, labels, footprint;
|
||||
u_int typ, algorithm, labels, footprint;
|
||||
const char *leader;
|
||||
u_long t;
|
||||
int n;
|
||||
@ -504,39 +509,39 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
goto formerr;
|
||||
|
||||
/* Type covered, Algorithm, Label count, Original TTL. */
|
||||
type = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||
typ = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||
algorithm = *rdata++;
|
||||
labels = *rdata++;
|
||||
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
||||
len = SPRINTF((tmp, "%s %d %d %lu ",
|
||||
p_type(type), algorithm, labels, t));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
p_type((int)typ), algorithm, labels, t));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
if (labels > (u_int)dn_count_labels(name))
|
||||
goto formerr;
|
||||
|
||||
/* Signature expiry. */
|
||||
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
||||
len = SPRINTF((tmp, "%s ", p_secstodate(t)));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
|
||||
/* Time signed. */
|
||||
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
||||
len = SPRINTF((tmp, "%s ", p_secstodate(t)));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
|
||||
/* Signature Footprint. */
|
||||
footprint = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||
len = SPRINTF((tmp, "%u ", footprint));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
|
||||
/* Signer's name. */
|
||||
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
|
||||
/* Signature. */
|
||||
len = b64_ntop(rdata, edata - rdata,
|
||||
len = b64_ntop(rdata, (size_t)(edata - rdata),
|
||||
base64_key, sizeof base64_key);
|
||||
if (len > 15) {
|
||||
T(addstr(" (", 2, &buf, &buflen));
|
||||
T(addstr(" (", (size_t)2, &buf, &buflen));
|
||||
leader = "\n\t\t";
|
||||
spaced = 0;
|
||||
} else
|
||||
@ -545,11 +550,11 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
goto formerr;
|
||||
for (n = 0; n < len; n += 48) {
|
||||
T(addstr(leader, strlen(leader), &buf, &buflen));
|
||||
T(addstr(base64_key + n, MIN(len - n, 48),
|
||||
T(addstr(base64_key + n, (size_t)MIN(len - n, 48),
|
||||
&buf, &buflen));
|
||||
}
|
||||
if (len > 15)
|
||||
T(addstr(" )", 2, &buf, &buflen));
|
||||
T(addstr(" )", (size_t)2, &buf, &buflen));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -564,7 +569,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
for (c = 0; c < n*8; c++)
|
||||
if (NS_NXT_BIT_ISSET(c, rdata)) {
|
||||
len = SPRINTF((tmp, " %s", p_type(c)));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -573,27 +578,28 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
u_int c_type, key_tag, alg;
|
||||
int n;
|
||||
unsigned int siz;
|
||||
char base64_cert[8192], tmp[40];
|
||||
char base64_cert[8192], tmp1[40];
|
||||
const char *leader;
|
||||
|
||||
c_type = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||
key_tag = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||
alg = (u_int) *rdata++;
|
||||
|
||||
len = SPRINTF((tmp, "%d %d %d ", c_type, key_tag, alg));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
len = SPRINTF((tmp1, "%d %d %d ", c_type, key_tag, alg));
|
||||
T(addstr(tmp1, (size_t)len, &buf, &buflen));
|
||||
siz = (edata-rdata)*4/3 + 4; /* "+4" accounts for trailing \0 */
|
||||
if (siz > sizeof(base64_cert) * 3/4) {
|
||||
const char *str = "record too long to print";
|
||||
T(addstr(str, strlen(str), &buf, &buflen));
|
||||
}
|
||||
else {
|
||||
len = b64_ntop(rdata, edata-rdata, base64_cert, siz);
|
||||
len = b64_ntop(rdata, (size_t)(edata-rdata),
|
||||
base64_cert, siz);
|
||||
|
||||
if (len < 0)
|
||||
goto formerr;
|
||||
else if (len > 15) {
|
||||
T(addstr(" (", 2, &buf, &buflen));
|
||||
T(addstr(" (", (size_t)2, &buf, &buflen));
|
||||
leader = "\n\t\t";
|
||||
spaced = 0;
|
||||
}
|
||||
@ -603,11 +609,11 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
for (n = 0; n < len; n += 48) {
|
||||
T(addstr(leader, strlen(leader),
|
||||
&buf, &buflen));
|
||||
T(addstr(base64_cert + n, MIN(len - n, 48),
|
||||
T(addstr(base64_cert + n, (size_t)MIN(len - n, 48),
|
||||
&buf, &buflen));
|
||||
}
|
||||
if (len > 15)
|
||||
T(addstr(" )", 2, &buf, &buflen));
|
||||
T(addstr(" )", (size_t)2, &buf, &buflen));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -619,17 +625,17 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
|
||||
/* Algorithm name. */
|
||||
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
T(addstr(" ", 1, &buf, &buflen));
|
||||
T(addstr(" ", (size_t)1, &buf, &buflen));
|
||||
|
||||
/* Inception. */
|
||||
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
||||
len = SPRINTF((tmp, "%s ", p_secstodate(t)));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
|
||||
/* Experation. */
|
||||
t = ns_get32(rdata); rdata += NS_INT32SZ;
|
||||
len = SPRINTF((tmp, "%s ", p_secstodate(t)));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
|
||||
/* Mode , Error, Key Size. */
|
||||
/* Priority, Weight, Port. */
|
||||
@ -637,7 +643,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
err = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||
keysize = ns_get16(rdata); rdata += NS_INT16SZ;
|
||||
len = SPRINTF((tmp, "%u %u %u ", mode, err, keysize));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
|
||||
/* XXX need to dump key, print otherdata length & other data */
|
||||
break;
|
||||
@ -648,7 +654,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
int n;
|
||||
|
||||
T(len = addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
T(addstr(" ", 1, &buf, &buflen));
|
||||
T(addstr(" ", (size_t)1, &buf, &buflen));
|
||||
rdata += 8; /* time */
|
||||
n = ns_get16(rdata); rdata += INT16SZ;
|
||||
rdata += n; /* sig */
|
||||
@ -666,7 +672,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
/* prefix length */
|
||||
if (rdlen == 0U) goto formerr;
|
||||
len = SPRINTF((tmp, "%d ", *rdata));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
pbit = *rdata;
|
||||
if (pbit > 128) goto formerr;
|
||||
pbyte = (pbit & ~7) / 8;
|
||||
@ -686,7 +692,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
if (pbit == 0)
|
||||
break;
|
||||
if (rdata >= edata) goto formerr;
|
||||
T(addstr(" ", 1, &buf, &buflen));
|
||||
T(addstr(" ", (size_t)1, &buf, &buflen));
|
||||
T(addname(msg, msglen, &rdata, origin, &buf, &buflen));
|
||||
|
||||
break;
|
||||
@ -694,7 +700,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
|
||||
case ns_t_opt: {
|
||||
len = SPRINTF((tmp, "%u bytes", class));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -710,7 +716,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
char *p;
|
||||
|
||||
len = SPRINTF((tmp, "\\# %u (\t; %s", edata - rdata, comment));
|
||||
T(addstr(tmp, len, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)len, &buf, &buflen));
|
||||
while (rdata < edata) {
|
||||
p = tmp;
|
||||
p += SPRINTF((p, "\n\t"));
|
||||
@ -718,10 +724,10 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
n = MIN(16, edata - rdata);
|
||||
for (m = 0; m < n; m++)
|
||||
p += SPRINTF((p, "%02x ", rdata[m]));
|
||||
T(addstr(tmp, p - tmp, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)(p - tmp), &buf, &buflen));
|
||||
if (n < 16) {
|
||||
T(addstr(")", 1, &buf, &buflen));
|
||||
T(addtab(p - tmp + 1, 48, spaced, &buf, &buflen));
|
||||
T(addstr(")", (size_t)1, &buf, &buflen));
|
||||
T(addtab((size_t)(p - tmp + 1), (size_t)48, spaced, &buf, &buflen));
|
||||
}
|
||||
p = tmp;
|
||||
p += SPRINTF((p, "; "));
|
||||
@ -729,7 +735,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
|
||||
*p++ = (isascii(rdata[m]) && isprint(rdata[m]))
|
||||
? rdata[m]
|
||||
: '.';
|
||||
T(addstr(tmp, p - tmp, &buf, &buflen));
|
||||
T(addstr(tmp, (size_t)(p - tmp), &buf, &buflen));
|
||||
rdata += n;
|
||||
}
|
||||
return (buf - obuf);
|
||||
@ -788,7 +794,7 @@ charstr(const u_char *rdata, const u_char *edata, char **buf, size_t *buflen) {
|
||||
size_t save_buflen = *buflen;
|
||||
char *save_buf = *buf;
|
||||
|
||||
if (addstr("\"", 1, buf, buflen) < 0)
|
||||
if (addstr("\"", (size_t)1, buf, buflen) < 0)
|
||||
goto enospc;
|
||||
if (rdata < edata) {
|
||||
int n = *rdata;
|
||||
@ -797,16 +803,16 @@ charstr(const u_char *rdata, const u_char *edata, char **buf, size_t *buflen) {
|
||||
rdata++;
|
||||
while (n-- > 0) {
|
||||
if (strchr("\n\"\\", *rdata) != NULL)
|
||||
if (addstr("\\", 1, buf, buflen) < 0)
|
||||
if (addstr("\\", (size_t)1, buf, buflen) < 0)
|
||||
goto enospc;
|
||||
if (addstr((const char *)rdata, 1,
|
||||
if (addstr((const char *)rdata, (size_t)1,
|
||||
buf, buflen) < 0)
|
||||
goto enospc;
|
||||
rdata++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (addstr("\"", 1, buf, buflen) < 0)
|
||||
if (addstr("\"", (size_t)1, buf, buflen) < 0)
|
||||
goto enospc;
|
||||
return (rdata - odata);
|
||||
enospc:
|
||||
@ -825,7 +831,7 @@ addname(const u_char *msg, size_t msglen,
|
||||
char *save_buf = *buf;
|
||||
int n;
|
||||
|
||||
n = dn_expand(msg, msg + msglen, *pp, *buf, *buflen);
|
||||
n = dn_expand(msg, msg + msglen, *pp, *buf, (int)*buflen);
|
||||
if (n < 0)
|
||||
goto enospc; /* Guess. */
|
||||
newlen = prune_origin(*buf, origin);
|
||||
@ -886,11 +892,11 @@ addtab(size_t len, size_t target, int spaced, char **buf, size_t *buflen) {
|
||||
int t;
|
||||
|
||||
if (spaced || len >= target - 1) {
|
||||
T(addstr(" ", 2, buf, buflen));
|
||||
T(addstr(" ", (size_t)2, buf, buflen));
|
||||
spaced = 1;
|
||||
} else {
|
||||
for (t = (target - len - 1) / 8; t >= 0; t--)
|
||||
if (addstr("\t", 1, buf, buflen) < 0) {
|
||||
if (addstr("\t", (size_t)1, buf, buflen) < 0) {
|
||||
*buflen = save_buflen;
|
||||
*buf = save_buf;
|
||||
return (-1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ns_samedomain.c,v 1.1.1.1 2004/05/20 20:01:31 christos Exp $ */
|
||||
/* $NetBSD: ns_samedomain.c,v 1.2 2004/05/20 20:35:05 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
@ -17,8 +17,13 @@
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#ifdef notdef
|
||||
static const char rcsid[] = "Id: ns_samedomain.c,v 1.1.2.2.4.2 2004/03/16 12:34:17 marka Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: ns_samedomain.c,v 1.2 2004/05/20 20:35:05 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "port_before.h"
|
||||
@ -30,6 +35,7 @@ static const char rcsid[] = "Id: ns_samedomain.c,v 1.1.2.2.4.2 2004/03/16 12:34:
|
||||
|
||||
#include "port_after.h"
|
||||
|
||||
#ifndef _LIBC
|
||||
/*
|
||||
* int
|
||||
* ns_samedomain(a, b)
|
||||
@ -151,6 +157,7 @@ int
|
||||
ns_subdomain(const char *a, const char *b) {
|
||||
return (ns_samename(a, b) != 1 && ns_samedomain(a, b));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* int
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ns_ttl.c,v 1.1.1.1 2004/05/20 20:01:31 christos Exp $ */
|
||||
/* $NetBSD: ns_ttl.c,v 1.2 2004/05/20 20:35:05 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
@ -17,8 +17,13 @@
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#ifdef notdef
|
||||
static const char rcsid[] = "Id: ns_ttl.c,v 1.1.206.1 2004/03/09 08:33:45 marka Exp";
|
||||
#else
|
||||
__RCSID("$NetBSD: ns_ttl.c,v 1.2 2004/05/20 20:35:05 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Import. */
|
||||
@ -46,7 +51,7 @@ static int fmt1(int t, char s, char **buf, size_t *buflen);
|
||||
|
||||
/* Macros. */
|
||||
|
||||
#define T(x) if ((x) < 0) return (-1); else (void)NULL
|
||||
#define T(x) if ((x) < 0) return (-1); else
|
||||
|
||||
/* Public. */
|
||||
|
||||
@ -95,6 +100,7 @@ ns_format_ttl(u_long src, char *dst, size_t dstlen) {
|
||||
return (dst - odst);
|
||||
}
|
||||
|
||||
#ifndef _LIBC
|
||||
int
|
||||
ns_parse_ttl(const char *src, u_long *dst) {
|
||||
u_long ttl, tmp;
|
||||
@ -118,10 +124,10 @@ ns_parse_ttl(const char *src, u_long *dst) {
|
||||
if (islower(ch))
|
||||
ch = toupper(ch);
|
||||
switch (ch) {
|
||||
case 'W': tmp *= 7;
|
||||
case 'D': tmp *= 24;
|
||||
case 'H': tmp *= 60;
|
||||
case 'M': tmp *= 60;
|
||||
case 'W': tmp *= 7; /*FALLTHROUGH*/
|
||||
case 'D': tmp *= 24; /*FALLTHROUGH*/
|
||||
case 'H': tmp *= 60; /*FALLTHROUGH*/
|
||||
case 'M': tmp *= 60; /*FALLTHROUGH*/
|
||||
case 'S': break;
|
||||
default: goto einval;
|
||||
}
|
||||
@ -143,6 +149,7 @@ ns_parse_ttl(const char *src, u_long *dst) {
|
||||
errno = EINVAL;
|
||||
return (-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Private. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user