2 * ++Copyright++ 1985, 1988, 1993
4 * Copyright (c) 1985, 1988, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 4. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * Portions Copyright (c) 1993 by Digital Equipment Corporation.
33 * Permission to use, copy, modify, and distribute this software for any
34 * purpose with or without fee is hereby granted, provided that the above
35 * copyright notice and this permission notice appear in all copies, and that
36 * the name of Digital Equipment Corporation not be used in advertising or
37 * publicity pertaining to distribution of the document or software without
38 * specific, written prior permission.
40 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
41 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
42 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
43 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
44 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
45 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
46 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
52 #if defined(LIBC_SCCS) && !defined(lint)
53 static char sccsid
[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
54 static char rcsid
[] = "$Id$";
55 #endif /* LIBC_SCCS and not lint */
57 #include <sys/types.h>
58 #include <sys/param.h>
59 #include <sys/socket.h>
60 #include <netinet/in.h>
61 #include <arpa/inet.h>
62 #include <arpa/nameser.h>
77 #define MULTI_PTRS_ARE_ALIASES 1 /* XXX - experimental */
79 #if defined(BSD) && (BSD >= 199103) && defined(AF_INET6)
83 # include "../conf/portability.h"
86 #if defined(USE_OPTIONS_H)
87 # include <../conf/options.h>
91 # define SPRINTF(x) strlen(sprintf/**/x)
93 # define SPRINTF(x) ((size_t)sprintf x)
99 static const char AskedForGot
[] =
100 "gethostby*.getanswer: asked for \"%s\", got \"%s\"";
102 static char *h_addr_ptrs
[MAXADDRS
+ 1];
104 static struct hostent host
;
105 static char *host_aliases
[MAXALIASES
];
106 static char hostbuf
[8*1024];
107 static u_char host_addr
[16]; /* IPv4 or IPv6 */
108 static FILE *hostf
= NULL
;
109 static int stayopen
= 0;
111 static void map_v4v6_address
__P((const char *src
, char *dst
));
112 static void map_v4v6_hostent
__P((struct hostent
*hp
, char **bp
, int *len
));
115 extern void addrsort
__P((char **, int));
119 #define MAXPACKET PACKETSZ
121 #define MAXPACKET 65536
124 /* As per RFC 1034 and 1035 a host name cannot exceed 255 octets in length. */
125 #ifdef MAXHOSTNAMELEN
126 # undef MAXHOSTNAMELEN
128 #define MAXHOSTNAMELEN 256
132 u_char buf
[MAXPACKET
];
150 if (_res
.options
& RES_DEBUG
) {
158 # define dprintf(msg, num) /*nada*/
161 #define BOUNDED_INCR(x) \
165 __set_h_errno (NO_RECOVERY); \
170 #define BOUNDS_CHECK(ptr, count) \
172 if ((ptr) + (count) > eom) { \
173 __set_h_errno (NO_RECOVERY); \
179 static struct hostent
*
180 getanswer(answer
, anslen
, qname
, qtype
)
181 const querybuf
*answer
;
186 register const HEADER
*hp
;
187 register const u_char
*cp
;
189 const u_char
*eom
, *erdata
;
190 char *bp
, **ap
, **hap
;
191 int type
, class, buflen
, ancount
, qdcount
;
192 int haveanswer
, had_error
;
196 int (*name_ok
) __P((const char *));
200 eom
= answer
->buf
+ anslen
;
210 return (NULL
); /* XXX should be abort(); */
213 * find first satisfactory answer
216 ancount
= ntohs(hp
->ancount
);
217 qdcount
= ntohs(hp
->qdcount
);
219 buflen
= sizeof hostbuf
;
221 BOUNDED_INCR(HFIXEDSZ
);
223 __set_h_errno (NO_RECOVERY
);
226 n
= dn_expand(answer
->buf
, eom
, cp
, bp
, buflen
);
227 if ((n
< 0) || !(*name_ok
)(bp
)) {
228 __set_h_errno (NO_RECOVERY
);
231 BOUNDED_INCR(n
+ QFIXEDSZ
);
232 if (qtype
== T_A
|| qtype
== T_AAAA
) {
233 /* res_send() has already verified that the query name is the
234 * same as the one we sent; this just gets the expanded name
235 * (i.e., with the succeeding search-domain tacked on).
237 n
= strlen(bp
) + 1; /* for the \0 */
238 if (n
>= MAXHOSTNAMELEN
) {
239 __set_h_errno (NO_RECOVERY
);
245 /* The qname can be abbreviated, but h_name is now absolute. */
250 host
.h_aliases
= host_aliases
;
253 host
.h_addr_list
= h_addr_ptrs
;
256 while (ancount
-- > 0 && cp
< eom
&& !had_error
) {
257 n
= dn_expand(answer
->buf
, eom
, cp
, bp
, buflen
);
258 if ((n
< 0) || !(*name_ok
)(bp
)) {
263 BOUNDS_CHECK(cp
, 3 * INT16SZ
+ INT32SZ
);
265 cp
+= INT16SZ
; /* type */
266 class = ns_get16(cp
);
267 cp
+= INT16SZ
+ INT32SZ
; /* class, TTL */
269 cp
+= INT16SZ
; /* len */
273 /* XXX - debug? syslog? */
275 continue; /* XXX - had_error++ ? */
277 if ((qtype
== T_A
|| qtype
== T_AAAA
) && type
== T_CNAME
) {
278 if (ap
>= &host_aliases
[MAXALIASES
-1])
280 n
= dn_expand(answer
->buf
, eom
, cp
, tbuf
, sizeof tbuf
);
281 if ((n
< 0) || !(*name_ok
)(tbuf
)) {
287 __set_h_errno (NO_RECOVERY
);
292 n
= strlen(bp
) + 1; /* for the \0 */
293 if (n
>= MAXHOSTNAMELEN
) {
299 /* Get canonical name. */
300 n
= strlen(tbuf
) + 1; /* for the \0 */
301 if (n
> buflen
|| n
>= MAXHOSTNAMELEN
) {
311 if (qtype
== T_PTR
&& type
== T_CNAME
) {
312 n
= dn_expand(answer
->buf
, eom
, cp
, tbuf
, sizeof tbuf
);
313 if (n
< 0 || !res_dnok(tbuf
)) {
319 __set_h_errno (NO_RECOVERY
);
322 /* Get canonical name. */
323 n
= strlen(tbuf
) + 1; /* for the \0 */
324 if (n
> buflen
|| n
>= MAXHOSTNAMELEN
) {
334 if ((type
== T_SIG
) || (type
== T_KEY
) || (type
== T_NXT
)) {
335 /* We don't support DNSSEC yet. For now, ignore
336 * the record and send a low priority message
339 syslog(LOG_DEBUG
|LOG_AUTH
,
340 "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
341 qname
, p_class(C_IN
), p_type(qtype
),
347 syslog(LOG_NOTICE
|LOG_AUTH
,
348 "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
349 qname
, p_class(C_IN
), p_type(qtype
),
352 continue; /* XXX - had_error++ ? */
356 if (strcasecmp(tname
, bp
) != 0) {
357 syslog(LOG_NOTICE
|LOG_AUTH
,
358 AskedForGot
, qname
, bp
);
360 continue; /* XXX - had_error++ ? */
362 n
= dn_expand(answer
->buf
, eom
, cp
, bp
, buflen
);
363 if ((n
< 0) || !res_hnok(bp
)) {
367 #if MULTI_PTRS_ARE_ALIASES
370 __set_h_errno (NO_RECOVERY
);
375 else if (ap
< &host_aliases
[MAXALIASES
-1])
380 n
= strlen(bp
) + 1; /* for the \0 */
381 if (n
>= MAXHOSTNAMELEN
) {
391 if (_res
.options
& RES_USE_INET6
) {
392 n
= strlen(bp
) + 1; /* for the \0 */
393 if (n
>= MAXHOSTNAMELEN
) {
399 map_v4v6_hostent(&host
, &bp
, &buflen
);
401 __set_h_errno (NETDB_SUCCESS
);
406 if (strcasecmp(host
.h_name
, bp
) != 0) {
407 syslog(LOG_NOTICE
|LOG_AUTH
,
408 AskedForGot
, host
.h_name
, bp
);
410 continue; /* XXX - had_error++ ? */
412 if (n
!= host
.h_length
) {
420 nn
= strlen(bp
) + 1; /* for the \0 */
425 /* XXX: when incrementing bp, we have to decrement
426 * buflen by the same amount --okir */
427 buflen
-= sizeof(align
) - ((u_long
)bp
% sizeof(align
));
429 bp
+= sizeof(align
) - ((u_long
)bp
% sizeof(align
));
431 if (bp
+ n
>= &hostbuf
[sizeof hostbuf
]) {
432 dprintf("size (%d) too big\n", n
);
436 if (hap
>= &h_addr_ptrs
[MAXADDRS
-1]) {
438 dprintf("Too many addresses (%d)\n",
444 memmove(*hap
++ = bp
, cp
, n
);
449 __set_h_errno (NO_RECOVERY
);
462 # if defined(RESOLVSORT)
464 * Note: we sort even if host can take only one address
465 * in its return structures - should give it the "best"
466 * address in that case, not some random one
468 if (_res
.nsort
&& haveanswer
> 1 && qtype
== T_A
)
469 addrsort(h_addr_ptrs
, haveanswer
);
470 # endif /*RESOLVSORT*/
472 n
= strlen(qname
) + 1; /* for the \0 */
473 if (n
> buflen
|| n
>= MAXHOSTNAMELEN
)
480 if (_res
.options
& RES_USE_INET6
)
481 map_v4v6_hostent(&host
, &bp
, &buflen
);
482 __set_h_errno (NETDB_SUCCESS
);
486 __set_h_errno (NO_RECOVERY
);
496 if ((_res
.options
& RES_INIT
) == 0 && __res_ninit(&_res
) == -1) {
497 __set_h_errno (NETDB_INTERNAL
);
500 if (_res
.options
& RES_USE_INET6
) {
501 hp
= gethostbyname2(name
, AF_INET6
);
505 return (gethostbyname2(name
, AF_INET
));
509 gethostbyname2(name
, af
)
519 register const char *cp
;
521 int n
, size
, type
, len
;
523 extern struct hostent
*_gethtbyname2();
525 if ((_res
.options
& RES_INIT
) == 0 && __res_ninit(&_res
) == -1) {
526 __set_h_errno (NETDB_INTERNAL
);
540 __set_h_errno (NETDB_INTERNAL
);
541 __set_errno (EAFNOSUPPORT
);
545 host
.h_addrtype
= af
;
546 host
.h_length
= size
;
549 * if there aren't any dots, it could be a user-level alias.
550 * this is also done in res_query() since we are not the only
551 * function that looks up host names.
553 if (!strchr(name
, '.') && (cp
= __hostalias(name
)))
557 * disallow names consisting only of digits/dots, unless
560 if (isdigit(name
[0]))
561 for (cp
= name
;; ++cp
) {
566 * All-numeric, no dot at the end.
567 * Fake up a hostent as if we'd actually
570 if (inet_pton(af
, name
, host_addr
) <= 0) {
571 __set_h_errno (HOST_NOT_FOUND
);
574 strncpy(hostbuf
, name
, MAXDNAME
);
575 hostbuf
[MAXDNAME
] = '\0';
576 bp
= hostbuf
+ MAXDNAME
;
577 len
= sizeof hostbuf
- MAXDNAME
;
578 host
.h_name
= hostbuf
;
579 host
.h_aliases
= host_aliases
;
580 host_aliases
[0] = NULL
;
581 h_addr_ptrs
[0] = (char *)host_addr
;
582 h_addr_ptrs
[1] = NULL
;
583 host
.h_addr_list
= h_addr_ptrs
;
584 if (_res
.options
& RES_USE_INET6
)
585 map_v4v6_hostent(&host
, &bp
, &len
);
586 __set_h_errno (NETDB_SUCCESS
);
589 if (!isdigit(*cp
) && *cp
!= '.')
592 if ((isxdigit(name
[0]) && strchr(name
, ':') != NULL
) ||
594 for (cp
= name
;; ++cp
) {
599 * All-IPv6-legal, no dot at the end.
600 * Fake up a hostent as if we'd actually
603 if (inet_pton(af
, name
, host_addr
) <= 0) {
604 __set_h_errno (HOST_NOT_FOUND
);
607 strncpy(hostbuf
, name
, MAXDNAME
);
608 hostbuf
[MAXDNAME
] = '\0';
609 bp
= hostbuf
+ MAXDNAME
;
610 len
= sizeof hostbuf
- MAXDNAME
;
611 host
.h_name
= hostbuf
;
612 host
.h_aliases
= host_aliases
;
613 host_aliases
[0] = NULL
;
614 h_addr_ptrs
[0] = (char *)host_addr
;
615 h_addr_ptrs
[1] = NULL
;
616 host
.h_addr_list
= h_addr_ptrs
;
617 __set_h_errno (NETDB_SUCCESS
);
620 if (!isxdigit(*cp
) && *cp
!= ':' && *cp
!= '.')
624 buf
.buf
= origbuf
= (querybuf
*) alloca (1024);
626 if ((n
= __libc_res_nsearch(&_res
, name
, C_IN
, type
, buf
.buf
->buf
, 1024,
628 if (buf
.buf
!= origbuf
)
630 dprintf("res_nsearch failed (%d)\n", n
);
631 if (errno
== ECONNREFUSED
)
632 return (_gethtbyname2(name
, af
));
635 ret
= getanswer(buf
.buf
, n
, name
, type
);
636 if (buf
.buf
!= origbuf
)
642 gethostbyaddr(addr
, len
, af
)
647 const u_char
*uaddr
= (const u_char
*)addr
;
648 static const u_char mapped
[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
649 static const u_char tunnelled
[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };
658 register struct hostent
*hp
;
659 char qbuf
[MAXDNAME
+1], *qp
= NULL
;
661 register struct hostent
*rhp
;
664 char hname2
[MAXDNAME
+1];
665 #endif /*SUNSECURITY*/
666 extern struct hostent
*_gethtbyaddr();
668 if ((_res
.options
& RES_INIT
) == 0 && __res_ninit(&_res
) == -1) {
669 __set_h_errno (NETDB_INTERNAL
);
672 if (af
== AF_INET6
&& len
== IN6ADDRSZ
&&
673 (!bcmp(uaddr
, mapped
, sizeof mapped
) ||
674 !bcmp(uaddr
, tunnelled
, sizeof tunnelled
))) {
676 addr
+= sizeof mapped
;
677 uaddr
+= sizeof mapped
;
689 __set_errno (EAFNOSUPPORT
);
690 __set_h_errno (NETDB_INTERNAL
);
694 __set_errno (EINVAL
);
695 __set_h_errno (NETDB_INTERNAL
);
700 (void) sprintf(qbuf
, "%u.%u.%u.%u.in-addr.arpa",
708 for (n
= IN6ADDRSZ
- 1; n
>= 0; n
--) {
709 qp
+= SPRINTF((qp
, "%x.%x.",
711 (uaddr
[n
] >> 4) & 0xf));
713 strcpy(qp
, "ip6.arpa");
719 buf
.buf
= orig_buf
= (querybuf
*) alloca (1024);
721 n
= __libc_res_nquery(&_res
, qbuf
, C_IN
, T_PTR
, buf
.buf
->buf
, 1024,
723 if (n
< 0 && af
== AF_INET6
) {
724 strcpy(qp
, "ip6.int");
725 n
= __libc_res_nquery(&_res
, qbuf
, C_IN
, T_PTR
, buf
.buf
->buf
,
726 buf
.buf
!= orig_buf
? MAXPACKET
: 1024,
730 if (buf
.buf
!= orig_buf
)
732 dprintf("res_nquery failed (%d)\n", n
);
733 if (errno
== ECONNREFUSED
)
734 return (_gethtbyaddr(addr
, len
, af
));
737 hp
= getanswer(buf
.buf
, n
, qbuf
, T_PTR
);
738 if (buf
.buf
!= orig_buf
)
741 return (NULL
); /* h_errno was set by getanswer() */
745 * turn off search as the name should be absolute,
746 * 'localhost' should be matched by defnames
748 strncpy(hname2
, hp
->h_name
, MAXDNAME
);
749 hname2
[MAXDNAME
] = '\0';
750 old_options
= _res
.options
;
751 _res
.options
&= ~RES_DNSRCH
;
752 _res
.options
|= RES_DEFNAMES
;
753 if (!(rhp
= gethostbyname(hname2
))) {
754 syslog(LOG_NOTICE
|LOG_AUTH
,
755 "gethostbyaddr: No A record for %s (verifying [%s])",
756 hname2
, inet_ntoa(*((struct in_addr
*)addr
)));
757 _res
.options
= old_options
;
758 __set_h_errno (HOST_NOT_FOUND
);
761 _res
.options
= old_options
;
762 for (haddr
= rhp
->h_addr_list
; *haddr
; haddr
++)
763 if (!memcmp(*haddr
, addr
, INADDRSZ
))
766 syslog(LOG_NOTICE
|LOG_AUTH
,
767 "gethostbyaddr: A record of %s != PTR record [%s]",
768 hname2
, inet_ntoa(*((struct in_addr
*)addr
)));
769 __set_h_errno (HOST_NOT_FOUND
);
773 #endif /*SUNSECURITY*/
776 memmove(host_addr
, addr
, len
);
777 h_addr_ptrs
[0] = (char *)host_addr
;
778 h_addr_ptrs
[1] = NULL
;
779 if (af
== AF_INET
&& (_res
.options
& RES_USE_INET6
)) {
780 map_v4v6_address((char*)host_addr
, (char*)host_addr
);
781 hp
->h_addrtype
= AF_INET6
;
782 hp
->h_length
= IN6ADDRSZ
;
784 __set_h_errno (NETDB_SUCCESS
);
793 hostf
= fopen(_PATH_HOSTS
, "r" );
802 if (hostf
&& !stayopen
) {
803 (void) fclose(hostf
);
812 register char *cp
, **q
;
815 if (!hostf
&& !(hostf
= fopen(_PATH_HOSTS
, "r" ))) {
816 __set_h_errno (NETDB_INTERNAL
);
820 if (!(p
= fgets(hostbuf
, sizeof hostbuf
, hostf
))) {
821 __set_h_errno (HOST_NOT_FOUND
);
826 if (!(cp
= strpbrk(p
, "#\n")))
829 if (!(cp
= strpbrk(p
, " \t")))
832 if (inet_pton(AF_INET6
, p
, host_addr
) > 0) {
835 } else if (inet_pton(AF_INET
, p
, host_addr
) > 0) {
836 if (_res
.options
& RES_USE_INET6
) {
837 map_v4v6_address((char*)host_addr
, (char*)host_addr
);
847 h_addr_ptrs
[0] = (char *)host_addr
;
848 h_addr_ptrs
[1] = NULL
;
849 host
.h_addr_list
= h_addr_ptrs
;
851 host
.h_addrtype
= af
;
852 while (*cp
== ' ' || *cp
== '\t')
855 q
= host
.h_aliases
= host_aliases
;
856 if ((cp
= strpbrk(cp
, " \t")))
859 if (*cp
== ' ' || *cp
== '\t') {
863 if (q
< &host_aliases
[MAXALIASES
- 1])
865 if ((cp
= strpbrk(cp
, " \t")))
869 __set_h_errno (NETDB_SUCCESS
);
877 extern struct hostent
*_gethtbyname2();
880 if (_res
.options
& RES_USE_INET6
) {
881 hp
= _gethtbyname2(name
, AF_INET6
);
885 return (_gethtbyname2(name
, AF_INET
));
889 _gethtbyname2(name
, af
)
893 register struct hostent
*p
;
897 while ((p
= _gethtent())) {
898 if (p
->h_addrtype
!= af
)
900 if (strcasecmp(p
->h_name
, name
) == 0)
902 for (cp
= p
->h_aliases
; *cp
!= 0; cp
++)
903 if (strcasecmp(*cp
, name
) == 0)
912 _gethtbyaddr(addr
, len
, af
)
917 register struct hostent
*p
;
920 while ((p
= _gethtent()))
921 if (p
->h_addrtype
== af
&& !bcmp(p
->h_addr
, addr
, len
))
928 map_v4v6_address(src
, dst
)
932 u_char
*p
= (u_char
*)dst
;
936 /* Stash a temporary copy so our caller can update in place. */
937 memcpy(tmp
, src
, INADDRSZ
);
938 /* Mark this ipv6 addr as a mapped ipv4. */
939 for (i
= 0; i
< 10; i
++)
943 /* Retrieve the saved copy and we're done. */
944 memcpy((void*)p
, tmp
, INADDRSZ
);
948 map_v4v6_hostent(hp
, bpp
, lenp
)
955 if (hp
->h_addrtype
!= AF_INET
|| hp
->h_length
!= INADDRSZ
)
957 hp
->h_addrtype
= AF_INET6
;
958 hp
->h_length
= IN6ADDRSZ
;
959 for (ap
= hp
->h_addr_list
; *ap
; ap
++) {
960 int i
= sizeof(align
) - ((u_long
)*bpp
% sizeof(align
));
962 if (*lenp
< (i
+ IN6ADDRSZ
)) {
963 /* Out of memory. Truncate address list here. XXX */
969 map_v4v6_address(*ap
, *bpp
);
984 short aval
[MAXADDRS
];
988 for (i
= 0; i
< num
; i
++, p
++) {
989 for (j
= 0 ; (unsigned)j
< _res
.nsort
; j
++)
990 if (_res
.sort_list
[j
].addr
.s_addr
==
991 (((struct in_addr
*)(*p
))->s_addr
& _res
.sort_list
[j
].mask
))
994 if (needsort
== 0 && i
> 0 && j
< aval
[i
-1])
1000 while (needsort
< num
) {
1001 for (j
= needsort
- 1; j
>= 0; j
--) {
1002 if (aval
[j
] > aval
[j
+1]) {
1006 aval
[j
] = aval
[j
+1];
1021 #if defined(BSD43_BSD43_NFS) || defined(sun)
1022 /* some libc's out there are bound internally to these names (UMIPS) */
1024 ht_sethostent(stayopen
)
1027 _sethtent(stayopen
);
1037 ht_gethostbyname(name
)
1040 return (_gethtbyname(name
));
1044 ht_gethostbyaddr(addr
, len
, af
)
1049 return (_gethtbyaddr(addr
, len
, af
));
1055 return (_gethtent());
1065 dn_skipname(comp_dn
, eom
)
1066 const u_char
*comp_dn
, *eom
;
1068 return (__dn_skipname(comp_dn
, eom
));
1070 #endif /*old-style libc with yp junk in it*/