diff options
Diffstat (limited to 'lib/libc/resolv/res_debug.c')
-rw-r--r-- | lib/libc/resolv/res_debug.c | 139 |
1 files changed, 77 insertions, 62 deletions
diff --git a/lib/libc/resolv/res_debug.c b/lib/libc/resolv/res_debug.c index 2ed234e..80b5b94 100644 --- a/lib/libc/resolv/res_debug.c +++ b/lib/libc/resolv/res_debug.c @@ -10,10 +10,6 @@ * 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. @@ -95,8 +91,10 @@ #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.5 2005/07/28 07:38:11 marka Exp $"; +static const char rcsid[] = "$Id: res_debug.c,v 1.3.2.5.4.6 2005/07/28 07:43:22 marka Exp $"; #endif /* LIBC_SCCS and not lint */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); #include "port_before.h" @@ -130,7 +128,7 @@ static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.5 2005/07/28 07:38:11 ma extern const char *_res_opcodes[]; extern const char *_res_sectioncodes[]; -/*% +/* * Print the current options. */ void @@ -223,7 +221,7 @@ do_section(const res_state statp, free(buf); } -/*% +/* * Print the contents of a query. * This is intended to be primarily a debugging routine. */ @@ -318,8 +316,7 @@ p_cdname(const u_char *cp, const u_char *msg, FILE *file) { return (p_cdnname(cp, msg, PACKETSZ, file)); } -/*% - * Return a fully-qualified domain name from a compressed name (with +/* Return a fully-qualified domain name from a compressed name (with length supplied). */ const u_char * @@ -335,7 +332,7 @@ p_fqnname(cp, msg, msglen, name, namelen) return (NULL); newlen = strlen(name); if (newlen == 0 || name[newlen - 1] != '.') { - if (newlen + 1 >= namelen) /*%< Lack space for final dot */ + if (newlen + 1 >= namelen) /* Lack space for final dot */ return (NULL); else strcpy(name + newlen, "."); @@ -357,7 +354,7 @@ p_fqname(const u_char *cp, const u_char *msg, FILE *file) { return (n); } -/*% +/* * Names of RR classes and qclasses. Classes and qclasses are the same, except * that C_ANY is a qclass but not a class. (You can ask for records of class * C_ANY, but you can't have any records of that class in the database.) @@ -373,10 +370,10 @@ const struct res_sym __p_class_syms[] = { {C_IN, (char *)0, (char *)0} }; -/*% +/* * Names of message sections. */ -const struct res_sym __p_default_section_syms[] = { +static const struct res_sym __p_default_section_syms[] = { {ns_s_qd, "QUERY", (char *)0}, {ns_s_an, "ANSWER", (char *)0}, {ns_s_ns, "AUTHORITY", (char *)0}, @@ -384,7 +381,7 @@ const struct res_sym __p_default_section_syms[] = { {0, (char *)0, (char *)0} }; -const struct res_sym __p_update_section_syms[] = { +static const struct res_sym __p_update_section_syms[] = { {S_ZONE, "ZONE", (char *)0}, {S_PREREQ, "PREREQUISITE", (char *)0}, {S_UPDATE, "UPDATE", (char *)0}, @@ -410,7 +407,7 @@ const struct res_sym __p_cert_syms[] = { {0, NULL, NULL} }; -/*% +/* * Names of RR types and qtypes. Types and qtypes are the same, except * that T_ANY is a qtype but not a type. (You can ask for records of type * T_ANY, but you can't have any records of that type in the database.) @@ -468,7 +465,7 @@ const struct res_sym __p_type_syms[] = { {0, NULL, NULL} }; -/*% +/* * Names of DNS rcodes. */ const struct res_sym __p_rcode_syms[] = { @@ -501,7 +498,7 @@ sym_ston(const struct res_sym *syms, const char *name, int *success) { } if (success) *success = 0; - return (syms->number); /*%< The default value. */ + return (syms->number); /* The default value. */ } const char * @@ -516,7 +513,7 @@ sym_ntos(const struct res_sym *syms, int number, int *success) { } } - sprintf(unname, "%d", number); /*%< XXX nonreentrant */ + sprintf(unname, "%d", number); /* XXX nonreentrant */ if (success) *success = 0; return (unname); @@ -533,13 +530,13 @@ sym_ntop(const struct res_sym *syms, int number, int *success) { return (syms->humanname); } } - sprintf(unname, "%d", number); /*%< XXX nonreentrant */ + sprintf(unname, "%d", number); /* XXX nonreentrant */ if (success) *success = 0; return (unname); } -/*% +/* * Return a string for the type. */ const char * @@ -557,7 +554,7 @@ p_type(int type) { return (typebuf); } -/*% +/* * Return a string for the type. */ const char * @@ -575,7 +572,7 @@ p_section(int section, int opcode) { return (sym_ntos(symbols, section, (int *)0)); } -/*% +/* * Return a mnemonic for class. */ const char * @@ -593,7 +590,7 @@ p_class(int class) { return (classbuf); } -/*% +/* * Return a mnemonic for an option */ const char * @@ -615,7 +612,7 @@ p_option(u_long option) { case RES_INSECURE2: return "insecure2"; case RES_NOALIASES: return "noaliases"; case RES_USE_INET6: return "inet6"; -#ifdef RES_USE_EDNS0 /*%< KAME extension */ +#ifdef RES_USE_EDNS0 /* KAME extension */ case RES_USE_EDNS0: return "edns0"; #endif #ifdef RES_USE_DNAME @@ -636,7 +633,7 @@ p_option(u_long option) { } } -/*% +/* * Return a mnemonic for a time to live. */ const char * @@ -648,7 +645,7 @@ p_time(u_int32_t value) { return (nbuf); } -/*% +/* * Return a string for the rcode. */ const char * @@ -656,7 +653,7 @@ p_rcode(int rcode) { return (sym_ntos(__p_rcode_syms, rcode, (int *)0)); } -/*% +/* * Return a string for a res_sockaddr_union. */ const char * @@ -683,7 +680,7 @@ p_sockun(union res_sockaddr_union u, char *buf, size_t size) { return (buf); } -/*% +/* * routines to convert between on-the-wire RR format and zone file format. * Does not contain conversion to/from decimal degrees; divide or multiply * by 60*60*1000 for that. @@ -692,7 +689,7 @@ p_sockun(union res_sockaddr_union u, char *buf, size_t size) { static unsigned int poweroften[10] = {1, 10, 100, 1000, 10000, 100000, 1000000,10000000,100000000,1000000000}; -/*% takes an XeY precision/size value, returns a string representation. */ +/* takes an XeY precision/size value, returns a string representation. */ static const char * precsize_ntoa(prec) u_int8_t prec; @@ -710,7 +707,7 @@ precsize_ntoa(prec) return (retbuf); } -/*% converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer. */ +/* converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer. */ static u_int8_t precsize_aton(const char **strptr) { unsigned int mval = 0, cmval = 0; @@ -724,7 +721,7 @@ precsize_aton(const char **strptr) { while (isdigit((unsigned char)*cp)) mval = mval * 10 + (*cp++ - '0'); - if (*cp == '.') { /*%< centimeters */ + if (*cp == '.') { /* centimeters */ cp++; if (isdigit((unsigned char)*cp)) { cmval = (*cp++ - '0') * 10; @@ -750,7 +747,7 @@ precsize_aton(const char **strptr) { return (retval); } -/*% converts ascii lat/lon to unsigned encoded 32-bit number. moves pointer. */ +/* converts ascii lat/lon to unsigned encoded 32-bit number. moves pointer. */ static u_int32_t latlon2ul(const char **latlonstrptr, int *which) { const char *cp; @@ -780,7 +777,7 @@ latlon2ul(const char **latlonstrptr, int *which) { while (isdigit((unsigned char)*cp)) secs = secs * 10 + (*cp++ - '0'); - if (*cp == '.') { /*%< decimal seconds */ + if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit((unsigned char)*cp)) { secsfrac = (*cp++ - '0') * 100; @@ -793,7 +790,7 @@ latlon2ul(const char **latlonstrptr, int *which) { } } - while (!isspace((unsigned char)*cp)) /*%< if any trailing garbage */ + while (!isspace((unsigned char)*cp)) /* if any trailing garbage */ cp++; while (isspace((unsigned char)*cp)) @@ -814,29 +811,30 @@ latlon2ul(const char **latlonstrptr, int *which) { - secsfrac; break; default: - retval = 0; /*%< invalid value -- indicates error */ + retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': - *which = 1; /*%< latitude */ + *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': - *which = 2; /*%< longitude */ + *which = 2; /* longitude */ break; default: - *which = 0; /*%< error */ + *which = 0; /* error */ break; } - cp++; /*%< skip the hemisphere */ - while (!isspace((unsigned char)*cp)) /*%< if any trailing garbage */ + cp++; /* skip the hemisphere */ + + while (!isspace((unsigned char)*cp)) /* if any trailing garbage */ cp++; - while (isspace((unsigned char)*cp)) /*%< move to next field */ + while (isspace((unsigned char)*cp)) /* move to next field */ cp++; *latlonstrptr = cp; @@ -844,8 +842,7 @@ latlon2ul(const char **latlonstrptr, int *which) { return (retval); } -/*% - * converts a zone file representation in a string to an RDATA on-the-wire +/* converts a zone file representation in a string to an RDATA on-the-wire * representation. */ int loc_aton(ascii, binary) @@ -858,9 +855,9 @@ loc_aton(ascii, binary) u_int32_t latit = 0, longit = 0, alt = 0; u_int32_t lltemp1 = 0, lltemp2 = 0; int altmeters = 0, altfrac = 0, altsign = 1; - u_int8_t hp = 0x16; /*%< default = 1e6 cm = 10000.00m = 10km */ - u_int8_t vp = 0x13; /*%< default = 1e3 cm = 10.00m */ - u_int8_t siz = 0x12; /*%< default = 1e2 cm = 1.00m */ + u_int8_t hp = 0x16; /* default = 1e6 cm = 10000.00m = 10km */ + u_int8_t vp = 0x13; /* default = 1e3 cm = 10.00m */ + u_int8_t siz = 0x12; /* default = 1e2 cm = 1.00m */ int which1 = 0, which2 = 0; cp = ascii; @@ -871,18 +868,18 @@ loc_aton(ascii, binary) lltemp2 = latlon2ul(&cp, &which2); switch (which1 + which2) { - case 3: /*%< 1 + 2, the only valid combination */ - if ((which1 == 1) && (which2 == 2)) { /*%< normal case */ + case 3: /* 1 + 2, the only valid combination */ + if ((which1 == 1) && (which2 == 2)) { /* normal case */ latit = lltemp1; longit = lltemp2; - } else if ((which1 == 2) && (which2 == 1)) { /*%< reversed */ + } else if ((which1 == 2) && (which2 == 1)) { /* reversed */ longit = lltemp1; latit = lltemp2; - } else { /*%< some kind of brokenness */ + } else { /* some kind of brokenness */ return (0); } break; - default: /*%< we didn't get one of each */ + default: /* we didn't get one of each */ return (0); } @@ -898,7 +895,7 @@ loc_aton(ascii, binary) while (isdigit((unsigned char)*cp)) altmeters = altmeters * 10 + (*cp++ - '0'); - if (*cp == '.') { /*%< decimal meters */ + if (*cp == '.') { /* decimal meters */ cp++; if (isdigit((unsigned char)*cp)) { altfrac = (*cp++ - '0') * 10; @@ -910,7 +907,7 @@ loc_aton(ascii, binary) alt = (10000000 + (altsign * (altmeters * 100 + altfrac))); - while (!isspace((unsigned char)*cp) && (cp < maxcp)) /*%< if trailing garbage or m */ + while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */ cp++; while (isspace((unsigned char)*cp) && (cp < maxcp)) @@ -921,7 +918,7 @@ loc_aton(ascii, binary) siz = precsize_aton(&cp); - while (!isspace((unsigned char)*cp) && (cp < maxcp)) /*%< if trailing garbage or m */ + while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */ cp++; while (isspace((unsigned char)*cp) && (cp < maxcp)) @@ -932,7 +929,7 @@ loc_aton(ascii, binary) hp = precsize_aton(&cp); - while (!isspace((unsigned char)*cp) && (cp < maxcp)) /*%< if trailing garbage or m */ + while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */ cp++; while (isspace((unsigned char)*cp) && (cp < maxcp)) @@ -946,7 +943,7 @@ loc_aton(ascii, binary) defaults: bcp = binary; - *bcp++ = (u_int8_t) 0; /*%< version byte */ + *bcp++ = (u_int8_t) 0; /* version byte */ *bcp++ = siz; *bcp++ = hp; *bcp++ = vp; @@ -954,10 +951,10 @@ loc_aton(ascii, binary) PUTLONG(longit,bcp); PUTLONG(alt,bcp); - return (16); /*%< size of RR in octets */ + return (16); /* size of RR in octets */ } -/*% takes an on-the-wire LOC RR and formats it in a human readable format. */ +/* takes an on-the-wire LOC RR and formats it in a human readable format. */ const char * loc_ntoa(binary, ascii) const u_char *binary; @@ -1004,7 +1001,7 @@ loc_ntoa(binary, ascii) longval = (templ - ((unsigned)1<<31)); GETLONG(templ, cp); - if (templ < referencealt) { /*%< below WGS 84 spheroid */ + if (templ < referencealt) { /* below WGS 84 spheroid */ altval = referencealt - templ; altsign = "-"; } else { @@ -1067,7 +1064,7 @@ loc_ntoa(binary, ascii) } -/*% Return the number of DNS hierarchy levels in the name. */ +/* Return the number of DNS hierarchy levels in the name. */ int dn_count_labels(const char *name) { int i, len, count; @@ -1092,7 +1089,8 @@ dn_count_labels(const char *name) { return (count); } -/*% + +/* * Make dates expressed in seconds-since-Jan-1-1970 easy to read. * SIG records are required to be printed like this, by the Secure DNS RFC. */ @@ -1162,4 +1160,21 @@ res_nametotype(const char *buf, int *successp) { return (result); } -/*! \file */ +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include <resolv.h>. + */ +#undef fp_resstat +__weak_reference(__fp_resstat, fp_resstat); +#undef p_fqnname +__weak_reference(__p_fqnname, p_fqnname); +#undef sym_ston +__weak_reference(__sym_ston, sym_ston); +#undef sym_ntos +__weak_reference(__sym_ntos, sym_ntos); +#undef sym_ntop +__weak_reference(__sym_ntop, sym_ntop); +#undef dn_count_labels +__weak_reference(__dn_count_labels, dn_count_labels); +#undef p_secstodate +__weak_reference(__p_secstodate, p_secstodate); |