diff options
Diffstat (limited to 'usr/src/lib/libresolv2/common/resolv/res_comp.c')
-rw-r--r-- | usr/src/lib/libresolv2/common/resolv/res_comp.c | 89 |
1 files changed, 46 insertions, 43 deletions
diff --git a/usr/src/lib/libresolv2/common/resolv/res_comp.c b/usr/src/lib/libresolv2/common/resolv/res_comp.c index a0a3d9abb2..59d5acc8ca 100644 --- a/usr/src/lib/libresolv2/common/resolv/res_comp.c +++ b/usr/src/lib/libresolv2/common/resolv/res_comp.c @@ -1,8 +1,9 @@ /* - * Copyright 2003 by Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ + /* * Copyright (c) 1985, 1993 * The Regents of the University of California. All rights reserved. @@ -57,27 +58,25 @@ */ /* + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (c) 1996-1999 by Internet Software Consortium. * * 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. * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #if defined(LIBC_SCCS) && !defined(lint) static const char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93"; -static const char rcsid[] = "$Id: res_comp.c,v 8.16 2002/08/07 03:47:34 marka Exp $"; +static const char rcsid[] = "$Id: res_comp.c,v 1.5 2005/07/28 06:51:50 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -92,20 +91,21 @@ static const char rcsid[] = "$Id: res_comp.c,v 8.16 2002/08/07 03:47:34 marka Ex #include <unistd.h> #include "port_after.h" -#ifdef ORIGINAL_ISC_CODE -#else +#ifndef ORIGINAL_ISC_CODE #pragma weak __dn_skipname = dn_skipname #pragma weak __res_dnok = res_dnok #pragma weak __res_hnok = res_hnok #pragma weak __res_mailok = res_mailok #pragma weak __res_ownok = res_ownok #endif /* ORIGINAL_ISC_CODE */ -/* + +/*% * Expand compressed domain name 'src' to full domain name. - * 'msg' is a pointer to the begining of the message, - * 'eom' points to the first location after the message, - * 'dst' is a pointer to a buffer of size 'dstsiz' for the result. - * Return size of compressed name or -1 if there was an error. + * + * \li 'msg' is a pointer to the begining of the message, + * \li 'eom' points to the first location after the message, + * \li 'dst' is a pointer to a buffer of size 'dstsiz' for the result. + * \li Return size of compressed name or -1 if there was an error. */ int dn_expand(const u_char *msg, const u_char *eom, const u_char *src, @@ -118,10 +118,11 @@ dn_expand(const u_char *msg, const u_char *eom, const u_char *src, return (n); } -/* +/*% * Pack domain name 'exp_dn' in presentation form into 'comp_dn'. - * Return the size of the compressed name or -1. - * 'length' is the size of the array pointed to by 'comp_dn'. + * + * \li Return the size of the compressed name or -1. + * \li 'length' is the size of the array pointed to by 'comp_dn'. */ int dn_comp(const char *src, u_char *dst, int dstsiz, @@ -132,7 +133,8 @@ dn_comp(const char *src, u_char *dst, int dstsiz, (const u_char **)lastdnptr)); } -/* + +/*% * Skip over a compressed domain name. Return the size or -1. */ int @@ -144,11 +146,9 @@ dn_skipname(const u_char *ptr, const u_char *eom) { return (ptr - saveptr); } -/* +/*% * Verify that a domain name uses an acceptable character set. - */ - -/* + * * Note the conspicuous absence of ctype macros in these definitions. On * non-ASCII hosts, we can't depend on string literals or ctype macros to * tell us anything about network-format data. The rest of the BIND system @@ -176,7 +176,7 @@ dn_skipname(const u_char *ptr, const u_char *eom) { int res_hnok(const char *dn) { - int ppch = '\0', pch = PERIOD, ch = *dn++; + int pch = PERIOD, ch = *dn++; while (ch != '\0') { int nch = *dn++; @@ -193,12 +193,12 @@ res_hnok(const char *dn) { if (!middlechar(ch)) return (0); } - ppch = pch, pch = ch, ch = nch; + pch = ch, ch = nch; } return (1); } -/* +/*% * hostname-like (A, MX, WKS) owners can have "*" as their first label * but must otherwise be as a host name. */ @@ -213,7 +213,7 @@ res_ownok(const char *dn) { return (res_hnok(dn)); } -/* +/*% * SOA RNAMEs and RP RNAMEs can have any printable character in their first * label, but the rest of the name has to look like a host name. */ @@ -241,8 +241,8 @@ res_mailok(const char *dn) { return (0); } -/* - * This function is quite liberal, since RFC 1034's character sets are only +/*% + * This function is quite liberal, since RFC1034's character sets are only * recommendations. */ int @@ -256,7 +256,7 @@ res_dnok(const char *dn) { } #ifdef BIND_4_COMPAT -/* +/*% * This module must export the following externally-visible symbols: * ___putlong * ___putshort @@ -264,17 +264,18 @@ res_dnok(const char *dn) { * __getshort * Note that one _ comes from C and the others come from us. */ -#ifdef ORIGINAL_ISC_CODE -#else -#ifdef __putlong -#undef __putlong + +#ifdef SOLARIS2 +#ifdef __putlong +#undef __putlong #endif -#ifdef __putshort -#undef __putshort +#ifdef __putshort +#undef __putshort #endif -#pragma weak putlong = __putlong -#pragma weak putshort = __putshort -#endif /* ORIGINAL_ISC_CODE */ +#pragma weak putlong = __putlong +#pragma weak putshort = __putshort +#endif /* SOLARIS2 */ + void __putlong(u_int32_t src, u_char *dst) { ns_put32(src, dst); } void __putshort(u_int16_t src, u_char *dst) { ns_put16(src, dst); } #ifndef __ultrix__ @@ -282,3 +283,5 @@ u_int32_t _getlong(const u_char *src) { return (ns_get32(src)); } u_int16_t _getshort(const u_char *src) { return (ns_get16(src)); } #endif /*__ultrix__*/ #endif /*BIND_4_COMPAT*/ + +/*! \file */ |