1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate * 26*7c478bd9Sstevel@tonic-gate * Ye olde non-reentrant interface (MT-unsafe, caveat utor) 27*7c478bd9Sstevel@tonic-gate * 28*7c478bd9Sstevel@tonic-gate * lib/libnsl/nss/gethostent.c 29*7c478bd9Sstevel@tonic-gate */ 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate #include <stdlib.h> 34*7c478bd9Sstevel@tonic-gate #include <ctype.h> 35*7c478bd9Sstevel@tonic-gate #include <string.h> 36*7c478bd9Sstevel@tonic-gate #include <strings.h> 37*7c478bd9Sstevel@tonic-gate #include <netdb.h> 38*7c478bd9Sstevel@tonic-gate #include <stdio.h> 39*7c478bd9Sstevel@tonic-gate #include <arpa/inet.h> 40*7c478bd9Sstevel@tonic-gate #include <nss_dbdefs.h> 41*7c478bd9Sstevel@tonic-gate #include <rpc/trace.h> 42*7c478bd9Sstevel@tonic-gate #include <netinet/in.h> 43*7c478bd9Sstevel@tonic-gate #include <sys/socket.h> 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate /* 46*7c478bd9Sstevel@tonic-gate * Still just a global. If you want per-thread h_errno, 47*7c478bd9Sstevel@tonic-gate * use the reentrant interfaces (gethostbyname_r et al) 48*7c478bd9Sstevel@tonic-gate */ 49*7c478bd9Sstevel@tonic-gate int h_errno; 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate #ifdef NSS_INCLUDE_UNSAFE 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate /* 54*7c478bd9Sstevel@tonic-gate * Don't free this, even on an endhostent(), because bitter experience shows 55*7c478bd9Sstevel@tonic-gate * that there's production code that does getXXXbyYYY(), then endXXXent(), 56*7c478bd9Sstevel@tonic-gate * and then continues to use the pointer it got back. 57*7c478bd9Sstevel@tonic-gate */ 58*7c478bd9Sstevel@tonic-gate static nss_XbyY_buf_t *buffer; 59*7c478bd9Sstevel@tonic-gate #define GETBUF() \ 60*7c478bd9Sstevel@tonic-gate NSS_XbyY_ALLOC(&buffer, sizeof (struct hostent), NSS_BUFLEN_HOSTS) 61*7c478bd9Sstevel@tonic-gate /* === ?? set ENOMEM on failure? */ 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate struct hostent * 64*7c478bd9Sstevel@tonic-gate gethostbyname(const char *nam) 65*7c478bd9Sstevel@tonic-gate { 66*7c478bd9Sstevel@tonic-gate nss_XbyY_buf_t *b; 67*7c478bd9Sstevel@tonic-gate struct hostent *res = 0; 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate trace1(TR_gethostbyname, 0); 70*7c478bd9Sstevel@tonic-gate if ((b = GETBUF()) != 0) { 71*7c478bd9Sstevel@tonic-gate res = gethostbyname_r(nam, 72*7c478bd9Sstevel@tonic-gate b->result, b->buffer, b->buflen, 73*7c478bd9Sstevel@tonic-gate &h_errno); 74*7c478bd9Sstevel@tonic-gate } 75*7c478bd9Sstevel@tonic-gate trace1(TR_gethostbyname, 1); 76*7c478bd9Sstevel@tonic-gate return (res); 77*7c478bd9Sstevel@tonic-gate } 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate struct hostent * 80*7c478bd9Sstevel@tonic-gate gethostbyaddr(const void *addr, socklen_t len, int type) 81*7c478bd9Sstevel@tonic-gate { 82*7c478bd9Sstevel@tonic-gate nss_XbyY_buf_t *b; 83*7c478bd9Sstevel@tonic-gate struct hostent *res = 0; 84*7c478bd9Sstevel@tonic-gate char *c; 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate trace2(TR_gethostbyaddr, 0, len); 87*7c478bd9Sstevel@tonic-gate h_errno = 0; 88*7c478bd9Sstevel@tonic-gate if (type == AF_INET6) 89*7c478bd9Sstevel@tonic-gate return (getipnodebyaddr(addr, len, type, &h_errno)); 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate if ((b = GETBUF()) != 0) { 92*7c478bd9Sstevel@tonic-gate res = gethostbyaddr_r(addr, len, type, 93*7c478bd9Sstevel@tonic-gate b->result, b->buffer, b->buflen, 94*7c478bd9Sstevel@tonic-gate &h_errno); 95*7c478bd9Sstevel@tonic-gate } 96*7c478bd9Sstevel@tonic-gate trace2(TR_gethostbyaddr, 1, len); 97*7c478bd9Sstevel@tonic-gate return (res); 98*7c478bd9Sstevel@tonic-gate } 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate struct hostent * 101*7c478bd9Sstevel@tonic-gate gethostent(void) 102*7c478bd9Sstevel@tonic-gate { 103*7c478bd9Sstevel@tonic-gate nss_XbyY_buf_t *b; 104*7c478bd9Sstevel@tonic-gate struct hostent *res = 0; 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gate trace1(TR_gethostent, 0); 107*7c478bd9Sstevel@tonic-gate if ((b = GETBUF()) != 0) { 108*7c478bd9Sstevel@tonic-gate res = gethostent_r(b->result, b->buffer, b->buflen, &h_errno); 109*7c478bd9Sstevel@tonic-gate } 110*7c478bd9Sstevel@tonic-gate trace1(TR_gethostent, 1); 111*7c478bd9Sstevel@tonic-gate return (res); 112*7c478bd9Sstevel@tonic-gate } 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate /* 115*7c478bd9Sstevel@tonic-gate * Return values: 0 = success, 1 = parse error, 2 = erange ... 116*7c478bd9Sstevel@tonic-gate * The structure pointer passed in is a structure in the caller's space 117*7c478bd9Sstevel@tonic-gate * wherein the field pointers would be set to areas in the buffer if 118*7c478bd9Sstevel@tonic-gate * need be. instring and buffer should be separate areas. 119*7c478bd9Sstevel@tonic-gate */ 120*7c478bd9Sstevel@tonic-gate int 121*7c478bd9Sstevel@tonic-gate __str2hostent(int af, const char *instr, int lenstr, void *ent, char *buffer, 122*7c478bd9Sstevel@tonic-gate int buflen) 123*7c478bd9Sstevel@tonic-gate { 124*7c478bd9Sstevel@tonic-gate struct hostent *host = (struct hostent *)ent; 125*7c478bd9Sstevel@tonic-gate const char *p, *addrstart, *limit; 126*7c478bd9Sstevel@tonic-gate int naddr, i, aliases_erange = 0; 127*7c478bd9Sstevel@tonic-gate int addrlen, res; 128*7c478bd9Sstevel@tonic-gate char addrbuf[100]; /* Why 100? */ 129*7c478bd9Sstevel@tonic-gate struct in_addr *addrp; 130*7c478bd9Sstevel@tonic-gate struct in6_addr *addrp6; 131*7c478bd9Sstevel@tonic-gate char **addrvec; 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate trace3(TR_str2hostent, 0, lenstr, buflen); 134*7c478bd9Sstevel@tonic-gate if ((instr >= buffer && (buffer + buflen) > instr) || 135*7c478bd9Sstevel@tonic-gate (buffer >= instr && (instr + lenstr) > buffer)) { 136*7c478bd9Sstevel@tonic-gate trace3(TR_str2hostent, 1, lenstr, buflen); 137*7c478bd9Sstevel@tonic-gate return (NSS_STR_PARSE_PARSE); 138*7c478bd9Sstevel@tonic-gate } 139*7c478bd9Sstevel@tonic-gate if (af != AF_INET && af != AF_INET6) { 140*7c478bd9Sstevel@tonic-gate trace3(TR_str2hostent, 1, lenstr, buflen); 141*7c478bd9Sstevel@tonic-gate /* 142*7c478bd9Sstevel@tonic-gate * XXX - Returning ERANGE here is completely bogus. 143*7c478bd9Sstevel@tonic-gate * Unfortunately, there's no error code identifying 144*7c478bd9Sstevel@tonic-gate * bogus calls from the backend (and nothing the user 145*7c478bd9Sstevel@tonic-gate * can do about our bugs anyway). 146*7c478bd9Sstevel@tonic-gate */ 147*7c478bd9Sstevel@tonic-gate return (NSS_STR_PARSE_ERANGE); 148*7c478bd9Sstevel@tonic-gate } 149*7c478bd9Sstevel@tonic-gate 150*7c478bd9Sstevel@tonic-gate /* 151*7c478bd9Sstevel@tonic-gate * The DNS-via-YP code returns multiple lines for a key. 152*7c478bd9Sstevel@tonic-gate * Normal YP return values do not contain newlines (nor do 153*7c478bd9Sstevel@tonic-gate * lines from /etc/hosts or other sources) 154*7c478bd9Sstevel@tonic-gate * We count the number of newlines; this should give us 155*7c478bd9Sstevel@tonic-gate * the number of IP addresses specified. 156*7c478bd9Sstevel@tonic-gate * We'll also call the aliases code and instruct it to 157*7c478bd9Sstevel@tonic-gate * stop at the first newline as the remaining lines will 158*7c478bd9Sstevel@tonic-gate * all contain the same hostname/aliases (no aliases, unfortunately). 159*7c478bd9Sstevel@tonic-gate * 160*7c478bd9Sstevel@tonic-gate * When confronted with a string with embedded newlines, 161*7c478bd9Sstevel@tonic-gate * this code will take the hostname/aliases on the first line 162*7c478bd9Sstevel@tonic-gate * and each of the IP addresses at the start of all lines. 163*7c478bd9Sstevel@tonic-gate * Because the NIS protocol limits return values to 1024 bytes, 164*7c478bd9Sstevel@tonic-gate * we still do not get all addresses. If you want to fix 165*7c478bd9Sstevel@tonic-gate * that problem, do not look here. 166*7c478bd9Sstevel@tonic-gate */ 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate p = instr; 169*7c478bd9Sstevel@tonic-gate 170*7c478bd9Sstevel@tonic-gate /* Strip trailing newlines */ 171*7c478bd9Sstevel@tonic-gate while (lenstr > 0 && p[lenstr - 1] == '\n') 172*7c478bd9Sstevel@tonic-gate lenstr--; 173*7c478bd9Sstevel@tonic-gate 174*7c478bd9Sstevel@tonic-gate naddr = 1; 175*7c478bd9Sstevel@tonic-gate limit = p + lenstr; 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate for (; p < limit && (p = memchr(p, '\n', limit - p)); p++) 178*7c478bd9Sstevel@tonic-gate naddr++; 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate /* Allocate space for naddr addresses and h_addr_list */ 181*7c478bd9Sstevel@tonic-gate 182*7c478bd9Sstevel@tonic-gate if (af == AF_INET6) { 183*7c478bd9Sstevel@tonic-gate addrp6 = (struct in6_addr *)ROUND_DOWN(buffer + buflen, 184*7c478bd9Sstevel@tonic-gate sizeof (*addrp6)); 185*7c478bd9Sstevel@tonic-gate addrp6 -= naddr; 186*7c478bd9Sstevel@tonic-gate addrvec = (char **)ROUND_DOWN(addrp6, sizeof (*addrvec)); 187*7c478bd9Sstevel@tonic-gate addrvec -= naddr + 1; 188*7c478bd9Sstevel@tonic-gate } else { 189*7c478bd9Sstevel@tonic-gate addrp = (struct in_addr *)ROUND_DOWN(buffer + buflen, 190*7c478bd9Sstevel@tonic-gate sizeof (*addrp)); 191*7c478bd9Sstevel@tonic-gate addrp -= naddr; 192*7c478bd9Sstevel@tonic-gate addrvec = (char **)ROUND_DOWN(addrp, sizeof (*addrvec)); 193*7c478bd9Sstevel@tonic-gate addrvec -= naddr + 1; 194*7c478bd9Sstevel@tonic-gate } 195*7c478bd9Sstevel@tonic-gate 196*7c478bd9Sstevel@tonic-gate if ((char *)addrvec < buffer) { 197*7c478bd9Sstevel@tonic-gate trace3(TR_str2hostent, 1, lenstr, buflen); 198*7c478bd9Sstevel@tonic-gate return (NSS_STR_PARSE_ERANGE); 199*7c478bd9Sstevel@tonic-gate } 200*7c478bd9Sstevel@tonic-gate 201*7c478bd9Sstevel@tonic-gate /* For each addr, parse and get it */ 202*7c478bd9Sstevel@tonic-gate 203*7c478bd9Sstevel@tonic-gate p = instr; 204*7c478bd9Sstevel@tonic-gate 205*7c478bd9Sstevel@tonic-gate for (i = 0; i < naddr; i ++) { 206*7c478bd9Sstevel@tonic-gate 207*7c478bd9Sstevel@tonic-gate limit = memchr(p, '\n', lenstr - (p - instr)); 208*7c478bd9Sstevel@tonic-gate if (limit == NULL) 209*7c478bd9Sstevel@tonic-gate limit = instr + lenstr; 210*7c478bd9Sstevel@tonic-gate 211*7c478bd9Sstevel@tonic-gate while (p < limit && isspace(*p)) { 212*7c478bd9Sstevel@tonic-gate p++; 213*7c478bd9Sstevel@tonic-gate } 214*7c478bd9Sstevel@tonic-gate addrstart = p; 215*7c478bd9Sstevel@tonic-gate while (p < limit && !isspace(*p)) { 216*7c478bd9Sstevel@tonic-gate p++; 217*7c478bd9Sstevel@tonic-gate } 218*7c478bd9Sstevel@tonic-gate if (p >= limit) { 219*7c478bd9Sstevel@tonic-gate /* Syntax error - no hostname present or truncated line */ 220*7c478bd9Sstevel@tonic-gate trace3(TR_str2hostent, 1, lenstr, buflen); 221*7c478bd9Sstevel@tonic-gate return (NSS_STR_PARSE_PARSE); 222*7c478bd9Sstevel@tonic-gate } 223*7c478bd9Sstevel@tonic-gate addrlen = p - addrstart; 224*7c478bd9Sstevel@tonic-gate if (addrlen >= sizeof (addrbuf)) { 225*7c478bd9Sstevel@tonic-gate /* Syntax error -- supposed IP address is too long */ 226*7c478bd9Sstevel@tonic-gate trace3(TR_str2hostent, 1, lenstr, buflen); 227*7c478bd9Sstevel@tonic-gate return (NSS_STR_PARSE_PARSE); 228*7c478bd9Sstevel@tonic-gate } 229*7c478bd9Sstevel@tonic-gate memcpy(addrbuf, addrstart, addrlen); 230*7c478bd9Sstevel@tonic-gate addrbuf[addrlen] = '\0'; 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate if (addrlen > ((af == AF_INET6) ? INET6_ADDRSTRLEN 233*7c478bd9Sstevel@tonic-gate : INET_ADDRSTRLEN)) { 234*7c478bd9Sstevel@tonic-gate /* Syntax error -- supposed IP address is too long */ 235*7c478bd9Sstevel@tonic-gate trace3(TR_str2hostent, 4, lenstr, buflen); 236*7c478bd9Sstevel@tonic-gate return (NSS_STR_PARSE_PARSE); 237*7c478bd9Sstevel@tonic-gate } 238*7c478bd9Sstevel@tonic-gate if (af == AF_INET) { 239*7c478bd9Sstevel@tonic-gate /* 240*7c478bd9Sstevel@tonic-gate * inet_pton() doesn't handle d.d.d, d.d, or d formats, 241*7c478bd9Sstevel@tonic-gate * so we must use inet_addr() for IPv4 addresses. 242*7c478bd9Sstevel@tonic-gate */ 243*7c478bd9Sstevel@tonic-gate addrvec[i] = (char *)&addrp[i]; 244*7c478bd9Sstevel@tonic-gate if ((addrp[i].s_addr = inet_addr(addrbuf)) == -1) { 245*7c478bd9Sstevel@tonic-gate /* Syntax error -- bogus IPv4 address */ 246*7c478bd9Sstevel@tonic-gate trace3(TR_str2hostent, 4, lenstr, buflen); 247*7c478bd9Sstevel@tonic-gate return (NSS_STR_PARSE_PARSE); 248*7c478bd9Sstevel@tonic-gate } 249*7c478bd9Sstevel@tonic-gate } else { 250*7c478bd9Sstevel@tonic-gate /* 251*7c478bd9Sstevel@tonic-gate * In the case of AF_INET6, we can have both v4 and v6 252*7c478bd9Sstevel@tonic-gate * addresses, so we convert v4's to v4 mapped addresses 253*7c478bd9Sstevel@tonic-gate * and return them as such. 254*7c478bd9Sstevel@tonic-gate */ 255*7c478bd9Sstevel@tonic-gate addrvec[i] = (char *)&addrp6[i]; 256*7c478bd9Sstevel@tonic-gate if (strchr(addrbuf, ':') != 0) { 257*7c478bd9Sstevel@tonic-gate if (inet_pton(af, addrbuf, &addrp6[i]) != 1) { 258*7c478bd9Sstevel@tonic-gate trace3(TR_str2hostent, 4, lenstr, 259*7c478bd9Sstevel@tonic-gate buflen); 260*7c478bd9Sstevel@tonic-gate return (NSS_STR_PARSE_PARSE); 261*7c478bd9Sstevel@tonic-gate } 262*7c478bd9Sstevel@tonic-gate } else { 263*7c478bd9Sstevel@tonic-gate struct in_addr in4; 264*7c478bd9Sstevel@tonic-gate if ((in4.s_addr = inet_addr(addrbuf)) == -1) { 265*7c478bd9Sstevel@tonic-gate trace3(TR_str2hostent, 4, lenstr, 266*7c478bd9Sstevel@tonic-gate buflen); 267*7c478bd9Sstevel@tonic-gate return (NSS_STR_PARSE_PARSE); 268*7c478bd9Sstevel@tonic-gate } 269*7c478bd9Sstevel@tonic-gate IN6_INADDR_TO_V4MAPPED(&in4, &addrp6[i]); 270*7c478bd9Sstevel@tonic-gate } 271*7c478bd9Sstevel@tonic-gate } 272*7c478bd9Sstevel@tonic-gate 273*7c478bd9Sstevel@tonic-gate /* First address, this is where we get the hostname + aliases */ 274*7c478bd9Sstevel@tonic-gate if (i == 0) { 275*7c478bd9Sstevel@tonic-gate while (p < limit && isspace(*p)) { 276*7c478bd9Sstevel@tonic-gate p++; 277*7c478bd9Sstevel@tonic-gate } 278*7c478bd9Sstevel@tonic-gate host->h_aliases = _nss_netdb_aliases(p, limit - p, 279*7c478bd9Sstevel@tonic-gate buffer, ((char *)addrvec) - buffer); 280*7c478bd9Sstevel@tonic-gate if (host->h_aliases == NULL) 281*7c478bd9Sstevel@tonic-gate aliases_erange = 1; /* too big for buffer */ 282*7c478bd9Sstevel@tonic-gate } 283*7c478bd9Sstevel@tonic-gate if (limit >= instr + lenstr) 284*7c478bd9Sstevel@tonic-gate break; 285*7c478bd9Sstevel@tonic-gate else 286*7c478bd9Sstevel@tonic-gate p = limit + 1; /* skip NL */ 287*7c478bd9Sstevel@tonic-gate } 288*7c478bd9Sstevel@tonic-gate 289*7c478bd9Sstevel@tonic-gate if (host->h_aliases == 0) { 290*7c478bd9Sstevel@tonic-gate if (aliases_erange) 291*7c478bd9Sstevel@tonic-gate res = NSS_STR_PARSE_ERANGE; 292*7c478bd9Sstevel@tonic-gate else 293*7c478bd9Sstevel@tonic-gate res = NSS_STR_PARSE_PARSE; 294*7c478bd9Sstevel@tonic-gate } else { 295*7c478bd9Sstevel@tonic-gate /* Success */ 296*7c478bd9Sstevel@tonic-gate host->h_name = host->h_aliases[0]; 297*7c478bd9Sstevel@tonic-gate host->h_aliases++; 298*7c478bd9Sstevel@tonic-gate res = NSS_STR_PARSE_SUCCESS; 299*7c478bd9Sstevel@tonic-gate } 300*7c478bd9Sstevel@tonic-gate /* 301*7c478bd9Sstevel@tonic-gate * If i < naddr, we quit the loop early and addrvec[i+1] needs NULL 302*7c478bd9Sstevel@tonic-gate * otherwise, we ran naddr iterations and addrvec[naddr] needs NULL 303*7c478bd9Sstevel@tonic-gate */ 304*7c478bd9Sstevel@tonic-gate addrvec[i >= naddr ? naddr : i + 1] = 0; 305*7c478bd9Sstevel@tonic-gate if (af == AF_INET6) { 306*7c478bd9Sstevel@tonic-gate host->h_length = sizeof (struct in6_addr); 307*7c478bd9Sstevel@tonic-gate } else { 308*7c478bd9Sstevel@tonic-gate host->h_length = sizeof (struct in_addr); 309*7c478bd9Sstevel@tonic-gate } 310*7c478bd9Sstevel@tonic-gate host->h_addrtype = af; 311*7c478bd9Sstevel@tonic-gate host->h_addr_list = addrvec; 312*7c478bd9Sstevel@tonic-gate 313*7c478bd9Sstevel@tonic-gate trace3(TR_str2hostent, 1, lenstr, buflen); 314*7c478bd9Sstevel@tonic-gate return (res); 315*7c478bd9Sstevel@tonic-gate } 316*7c478bd9Sstevel@tonic-gate 317*7c478bd9Sstevel@tonic-gate #endif /* NSS_INCLUDE_UNSAFE */ 318