summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/res_comp.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/net/res_comp.c')
-rw-r--r--lib/libc/net/res_comp.c100
1 files changed, 26 insertions, 74 deletions
diff --git a/lib/libc/net/res_comp.c b/lib/libc/net/res_comp.c
index 6250f8f..a78a798 100644
--- a/lib/libc/net/res_comp.c
+++ b/lib/libc/net/res_comp.c
@@ -1,9 +1,7 @@
-/*
- * ++Copyright++ 1985, 1993
- * -
+/*-
* Copyright (c) 1985, 1993
- * The Regents of the University of California. All rights reserved.
- *
+ * 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:
@@ -14,12 +12,12 @@
* 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.
+ * 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
@@ -33,14 +31,14 @@
* SUCH DAMAGE.
* -
* 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
@@ -55,7 +53,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
-static char rcsid[] = "$Id: res_comp.c,v 8.3 1995/12/06 20:34:50 vixie Exp $";
+static char rcsid[] = "$Id: res_comp.c,v 1.2 1994/09/25 02:12:32 pst Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -66,12 +64,8 @@ static char rcsid[] = "$Id: res_comp.c,v 8.3 1995/12/06 20:34:50 vixie Exp $";
#include <resolv.h>
#include <ctype.h>
-#if defined(BSD) && (BSD >= 199103)
-# include <unistd.h>
-# include <string.h>
-#else
-# include "../conf/portability.h"
-#endif
+#include <unistd.h>
+#include <string.h>
static int dn_find __P((u_char *exp_dn, u_char *msg,
u_char **dnptrs, u_char **lastdnptr));
@@ -101,7 +95,7 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length)
/*
* fetch next label in domain name
*/
- while (n = *cp++) {
+ while ((n = *cp++)) {
/*
* Check for indirection
*/
@@ -116,14 +110,14 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length)
return (-1);
checked += n + 1;
while (--n >= 0) {
- if (((c = *cp++) == '.') || (c == '\\')) {
+ if ((c = *cp++) == '.') {
if (dn + n + 2 >= eom)
return (-1);
*dn++ = '\\';
}
*dn++ = c;
if (cp >= eomorig) /* out of range */
- return (-1);
+ return(-1);
}
break;
@@ -132,7 +126,7 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length)
len = cp - comp_dn + 1;
cp = msg + (((n & 0x3f) << 8) | (*cp & 0xff));
if (cp < msg || cp >= eomorig) /* out of range */
- return (-1);
+ return(-1);
checked += 2;
/*
* Check for loops in the compressed name;
@@ -268,12 +262,12 @@ __dn_skipname(comp_dn, eom)
cp++;
break;
default: /* illegal type */
- return (-1);
+ return -1;
}
break;
}
if (cp > eom)
- return (-1);
+ return -1;
return (cp - comp_dn);
}
@@ -304,7 +298,7 @@ dn_find(exp_dn, msg, dnptrs, lastdnptr)
for (cpp = dnptrs; cpp < lastdnptr; cpp++) {
dn = exp_dn;
sp = cp = *cpp;
- while (n = *cp++) {
+ while ((n = *cp++)) {
/*
* check for indirection
*/
@@ -324,12 +318,11 @@ dn_find(exp_dn, msg, dnptrs, lastdnptr)
continue;
goto next;
- case INDIR_MASK: /* indirection */
- cp = msg + (((n & 0x3f) << 8) | *cp);
- break;
-
default: /* illegal type */
return (-1);
+
+ case INDIR_MASK: /* indirection */
+ cp = msg + (((n & 0x3f) << 8) | *cp);
}
}
if (*dn == '\0')
@@ -340,7 +333,11 @@ dn_find(exp_dn, msg, dnptrs, lastdnptr)
}
/*
- * Routines to insert/extract short/long's.
+ * Routines to insert/extract short/long's. Must account for byte
+ * order and non-alignment problems. This code at least has the
+ * advantage of being portable.
+ *
+ * used by sendmail.
*/
u_int16_t
@@ -353,18 +350,6 @@ _getshort(msgp)
return (u);
}
-#ifdef NeXT
-/*
- * nExt machines have some funky library conventions, which we must maintain.
- */
-u_int16_t
-res_getshort(msgp)
- register const u_char *msgp;
-{
- return (_getshort(msgp));
-}
-#endif
-
u_int32_t
_getlong(msgp)
register const u_char *msgp;
@@ -394,36 +379,3 @@ __putlong(l, msgp)
{
PUTLONG(l, msgp);
}
-
-#ifdef ultrix
-/* ultrix 4.0 had some icky packaging in its libc.a. alias for it here.
- * there is more gunk of this kind over in res_debug.c.
- */
-#undef putshort
-void
-#if defined(__STDC__) || defined(__cplusplus)
-putshort(register u_short s, register u_char *msgp)
-#else
-putshort(s, msgp)
- register u_short s;
- register u_char *msgp;
-#endif
-{
- __putshort(s, msgp);
-}
-#undef putlong
-void
-putlong(l, msgp)
- register u_int32_t l;
- register u_char *msgp;
-{
- __putlong(l, msgp);
-}
-
-#undef dn_skipname
-dn_skipname(comp_dn, eom)
- const u_char *comp_dn, *eom;
-{
- return (__dn_skipname(comp_dn, eom));
-}
-#endif /* Ultrix 4.0 hackery */
OpenPOWER on IntegriCloud