diff options
Diffstat (limited to 'lib/libc/nameser')
-rw-r--r-- | lib/libc/nameser/Makefile.inc | 8 | ||||
-rw-r--r-- | lib/libc/nameser/Symbol.map | 31 | ||||
-rw-r--r-- | lib/libc/nameser/ns_print.c | 42 | ||||
-rw-r--r-- | lib/libc/nameser/ns_samedomain.c | 55 |
4 files changed, 95 insertions, 41 deletions
diff --git a/lib/libc/nameser/Makefile.inc b/lib/libc/nameser/Makefile.inc new file mode 100644 index 0000000..05b4f55 --- /dev/null +++ b/lib/libc/nameser/Makefile.inc @@ -0,0 +1,8 @@ +# $FreeBSD$ + +# nameser sources +.PATH: ${.CURDIR}/nameser + +SRCS+= ns_name.c ns_netint.c ns_parse.c ns_print.c ns_samedomain.c ns_ttl.c + +SYM_MAPS+= ${.CURDIR}/nameser/Symbol.map diff --git a/lib/libc/nameser/Symbol.map b/lib/libc/nameser/Symbol.map new file mode 100644 index 0000000..190a59f --- /dev/null +++ b/lib/libc/nameser/Symbol.map @@ -0,0 +1,31 @@ +/* + * $FreeBSD$ + */ + +FBSD_1.0 { + __ns_makecanon; + __ns_msg_getflag; + __ns_name_ntol; + __ns_name_ntop; + __ns_name_pton; + __ns_name_unpack; + __ns_name_pack; + __ns_name_uncompress; + __ns_name_compress; + __ns_name_rollback; + __ns_name_skip; + __ns_get16; + __ns_get32; + __ns_put16; + __ns_put32; + __ns_initparse; + __ns_parserr; + _ns_flagdata; + __ns_samedomain; + __ns_samename; + __ns_skiprr; + __ns_sprintrr; + __ns_sprintrrf; + __ns_format_ttl; + __ns_parse_ttl; +}; diff --git a/lib/libc/nameser/ns_print.c b/lib/libc/nameser/ns_print.c index 0679ba4..ca595a7 100644 --- a/lib/libc/nameser/ns_print.c +++ b/lib/libc/nameser/ns_print.c @@ -16,8 +16,10 @@ */ #ifndef lint -static const char rcsid[] = "$Id: ns_print.c,v 1.6.18.4 2005/04/27 05:01:09 sra Exp $"; +static const char rcsid[] = "$Id: ns_print.c,v 1.3.2.1.4.7 2004/09/16 07:01:12 marka Exp $"; #endif +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); /* Import. */ @@ -30,8 +32,13 @@ static const char rcsid[] = "$Id: ns_print.c,v 1.6.18.4 2005/04/27 05:01:09 sra #include <arpa/nameser.h> #include <arpa/inet.h> +#ifdef _LIBC +#include <assert.h> +#define INSIST(cond) assert(cond) +#else #include <isc/assertions.h> #include <isc/dst.h> +#endif #include <errno.h> #include <resolv.h> #include <string.h> @@ -69,11 +76,12 @@ static int addtab(size_t len, size_t target, int spaced, /* Public. */ -/*% +/* + * int + * ns_sprintrr(handle, rr, name_ctx, origin, buf, buflen) * Convert an RR to presentation format. - * * return: - *\li Number of characters written to buf, or -1 (check errno). + * Number of characters written to buf, or -1 (check errno). */ int ns_sprintrr(const ns_msg *handle, const ns_rr *rr, @@ -89,11 +97,13 @@ ns_sprintrr(const ns_msg *handle, const ns_rr *rr, return (n); } -/*% +/* + * int + * ns_sprintrrf(msg, msglen, name, class, type, ttl, rdata, rdlen, + * name_ctx, origin, buf, buflen) * Convert the fields of an RR into presentation format. - * * return: - *\li Number of characters written to buf, or -1 (check errno). + * Number of characters written to buf, or -1 (check errno). */ int ns_sprintrrf(const u_char *msg, size_t msglen, @@ -454,7 +464,11 @@ ns_sprintrrf(const u_char *msg, size_t msglen, goto formerr; /* Key flags, Protocol, Algorithm. */ +#ifndef _LIBC key_id = dst_s_dns_key_id(rdata, edata-rdata); +#else + key_id = 0; +#endif keyflags = ns_get16(rdata); rdata += NS_INT16SZ; protocol = *rdata++; algorithm = *rdata++; @@ -642,10 +656,10 @@ ns_sprintrrf(const u_char *msg, size_t msglen, T(len = addname(msg, msglen, &rdata, origin, &buf, &buflen)); T(addstr(" ", 1, &buf, &buflen)); - rdata += 8; /*%< time */ + rdata += 8; /* time */ n = ns_get16(rdata); rdata += INT16SZ; - rdata += n; /*%< sig */ - n = ns_get16(rdata); rdata += INT16SZ; /*%< original id */ + rdata += n; /* sig */ + n = ns_get16(rdata); rdata += INT16SZ; /* original id */ sprintf(buf, "%d", ns_get16(rdata)); rdata += INT16SZ; addlen(strlen(buf), &buf, &buflen); @@ -732,7 +746,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen, /* Private. */ -/*% +/* * size_t * prune_origin(name, origin) * Find out if the name is at or under the current origin. @@ -765,7 +779,7 @@ prune_origin(const char *name, const char *origin) { return (name - oname); } -/*% +/* * int * charstr(rdata, edata, buf, buflen) * Format a <character-string> into the presentation buffer. @@ -821,7 +835,7 @@ addname(const u_char *msg, size_t msglen, n = dn_expand(msg, msg + msglen, *pp, *buf, *buflen); if (n < 0) - goto enospc; /*%< Guess. */ + goto enospc; /* Guess. */ newlen = prune_origin(*buf, origin); if (**buf == '\0') { goto root; @@ -893,5 +907,3 @@ addtab(size_t len, size_t target, int spaced, char **buf, size_t *buflen) { } return (spaced); } - -/*! \file */ diff --git a/lib/libc/nameser/ns_samedomain.c b/lib/libc/nameser/ns_samedomain.c index a720f6a..f532e8b 100644 --- a/lib/libc/nameser/ns_samedomain.c +++ b/lib/libc/nameser/ns_samedomain.c @@ -16,8 +16,10 @@ */ #ifndef lint -static const char rcsid[] = "$Id: ns_samedomain.c,v 1.5.18.1 2005/04/27 05:01:09 sra Exp $"; +static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.2.4.2 2004/03/16 12:34:17 marka Exp $"; #endif +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); #include "port_before.h" @@ -28,22 +30,21 @@ static const char rcsid[] = "$Id: ns_samedomain.c,v 1.5.18.1 2005/04/27 05:01:09 #include "port_after.h" -/*% +/* + * int + * ns_samedomain(a, b) * Check whether a name belongs to a domain. - * * Inputs: - *\li a - the domain whose ancestory is being verified - *\li b - the potential ancestor we're checking against - * + * a - the domain whose ancestory is being verified + * b - the potential ancestor we're checking against * Return: - *\li boolean - is a at or below b? - * + * boolean - is a at or below b? * Notes: - *\li Trailing dots are first removed from name and domain. + * Trailing dots are first removed from name and domain. * Always compare complete subdomains, not only whether the * domain name is the trailing string of the given name. * - *\li "host.foobar.top" lies in "foobar.top" and in "top" and in "" + * "host.foobar.top" lies in "foobar.top" and in "top" and in "" * but NOT in "bar.top" */ @@ -141,39 +142,42 @@ ns_samedomain(const char *a, const char *b) { return (strncasecmp(cp, b, lb) == 0); } -/*% +#ifndef _LIBC +/* + * int + * ns_subdomain(a, b) * is "a" a subdomain of "b"? */ int ns_subdomain(const char *a, const char *b) { return (ns_samename(a, b) != 1 && ns_samedomain(a, b)); } +#endif -/*% +/* + * int + * ns_makecanon(src, dst, dstsize) * make a canonical copy of domain name "src" - * * notes: - * \code * foo -> foo. * foo. -> foo. * foo.. -> foo. * foo\. -> foo\.. * foo\\. -> foo\\. - * \endcode */ int ns_makecanon(const char *src, char *dst, size_t dstsize) { size_t n = strlen(src); - if (n + sizeof "." > dstsize) { /*%< Note: sizeof == 2 */ + if (n + sizeof "." > dstsize) { /* Note: sizeof == 2 */ errno = EMSGSIZE; return (-1); } strcpy(dst, src); - while (n >= 1U && dst[n - 1] == '.') /*%< Ends in "." */ - if (n >= 2U && dst[n - 2] == '\\' && /*%< Ends in "\." */ - (n < 3U || dst[n - 3] != '\\')) /*%< But not "\\." */ + while (n >= 1U && dst[n - 1] == '.') /* Ends in "." */ + if (n >= 2U && dst[n - 2] == '\\' && /* Ends in "\." */ + (n < 3U || dst[n - 3] != '\\')) /* But not "\\." */ break; else dst[--n] = '\0'; @@ -182,13 +186,14 @@ ns_makecanon(const char *src, char *dst, size_t dstsize) { return (0); } -/*% +/* + * int + * ns_samename(a, b) * determine whether domain name "a" is the same as domain name "b" - * * return: - *\li -1 on error - *\li 0 if names differ - *\li 1 if names are the same + * -1 on error + * 0 if names differ + * 1 if names are the same */ int @@ -203,5 +208,3 @@ ns_samename(const char *a, const char *b) { else return (0); } - -/*! \file */ |