1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved. 3*0Sstevel@tonic-gate * Use is subject to license terms. 4*0Sstevel@tonic-gate */ 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gate /* 7*0Sstevel@tonic-gate * Portions Copyright (c) 1996,1998 by Internet Software Consortium. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * Permission to use, copy, modify, and distribute this software for any 10*0Sstevel@tonic-gate * purpose with or without fee is hereby granted, provided that the above 11*0Sstevel@tonic-gate * copyright notice and this permission notice appear in all copies. 12*0Sstevel@tonic-gate * 13*0Sstevel@tonic-gate * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS 14*0Sstevel@tonic-gate * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES 15*0Sstevel@tonic-gate * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE 16*0Sstevel@tonic-gate * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 17*0Sstevel@tonic-gate * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 18*0Sstevel@tonic-gate * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 19*0Sstevel@tonic-gate * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 20*0Sstevel@tonic-gate * SOFTWARE. 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate 23*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 24*0Sstevel@tonic-gate 25*0Sstevel@tonic-gate #if defined(LIBC_SCCS) && !defined(lint) 26*0Sstevel@tonic-gate static const char rcsid[] = "$Id: irp_ho.c,v 8.3 2001/05/29 05:48:59 marka Exp $"; 27*0Sstevel@tonic-gate #endif /* LIBC_SCCS and not lint */ 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate /* Imports. */ 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate #include "port_before.h" 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate #include <syslog.h> 34*0Sstevel@tonic-gate #include <sys/types.h> 35*0Sstevel@tonic-gate #include <sys/param.h> 36*0Sstevel@tonic-gate #include <sys/socket.h> 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate #include <netinet/in.h> 39*0Sstevel@tonic-gate #include <arpa/inet.h> 40*0Sstevel@tonic-gate #include <arpa/nameser.h> 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate #include <ctype.h> 43*0Sstevel@tonic-gate #include <errno.h> 44*0Sstevel@tonic-gate #include <fcntl.h> 45*0Sstevel@tonic-gate #include <netdb.h> 46*0Sstevel@tonic-gate #include <resolv.h> 47*0Sstevel@tonic-gate #include <stdio.h> 48*0Sstevel@tonic-gate #include <stdlib.h> 49*0Sstevel@tonic-gate #include <string.h> 50*0Sstevel@tonic-gate #include <syslog.h> 51*0Sstevel@tonic-gate 52*0Sstevel@tonic-gate #include <irs.h> 53*0Sstevel@tonic-gate #include <irp.h> 54*0Sstevel@tonic-gate #include <isc/irpmarshall.h> 55*0Sstevel@tonic-gate #include <isc/memcluster.h> 56*0Sstevel@tonic-gate 57*0Sstevel@tonic-gate #include "irs_p.h" 58*0Sstevel@tonic-gate #include "dns_p.h" 59*0Sstevel@tonic-gate #include "irp_p.h" 60*0Sstevel@tonic-gate 61*0Sstevel@tonic-gate #include "port_after.h" 62*0Sstevel@tonic-gate 63*0Sstevel@tonic-gate /* Definitions. */ 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate #define MAXALIASES 35 66*0Sstevel@tonic-gate #define MAXADDRS 35 67*0Sstevel@tonic-gate #define Max(a,b) ((a) > (b) ? (a) : (b)) 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gate 70*0Sstevel@tonic-gate struct pvt { 71*0Sstevel@tonic-gate struct irp_p *girpdata; 72*0Sstevel@tonic-gate int warned; 73*0Sstevel@tonic-gate struct hostent host; 74*0Sstevel@tonic-gate }; 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate /* Forward. */ 77*0Sstevel@tonic-gate 78*0Sstevel@tonic-gate static void ho_close(struct irs_ho *this); 79*0Sstevel@tonic-gate static struct hostent * ho_byname(struct irs_ho *this, const char *name); 80*0Sstevel@tonic-gate static struct hostent * ho_byname2(struct irs_ho *this, const char *name, 81*0Sstevel@tonic-gate int af); 82*0Sstevel@tonic-gate static struct hostent * ho_byaddr(struct irs_ho *this, const void *addr, 83*0Sstevel@tonic-gate int len, int af); 84*0Sstevel@tonic-gate static struct hostent * ho_next(struct irs_ho *this); 85*0Sstevel@tonic-gate static void ho_rewind(struct irs_ho *this); 86*0Sstevel@tonic-gate static void ho_minimize(struct irs_ho *this); 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate static void free_host(struct hostent *ho); 89*0Sstevel@tonic-gate static struct addrinfo * ho_addrinfo(struct irs_ho *this, const char *name, 90*0Sstevel@tonic-gate const struct addrinfo *pai); 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate /* Public. */ 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate 96*0Sstevel@tonic-gate /* 97*0Sstevel@tonic-gate * struct irs_ho * irs_irp_ho(struct irs_acc *this) 98*0Sstevel@tonic-gate * 99*0Sstevel@tonic-gate * Notes: 100*0Sstevel@tonic-gate * 101*0Sstevel@tonic-gate * Initializes the irp_ho module. 102*0Sstevel@tonic-gate * 103*0Sstevel@tonic-gate */ 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate struct irs_ho * 106*0Sstevel@tonic-gate irs_irp_ho(struct irs_acc *this) { 107*0Sstevel@tonic-gate struct irs_ho *ho; 108*0Sstevel@tonic-gate struct pvt *pvt; 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gate if (!(ho = memget(sizeof *ho))) { 111*0Sstevel@tonic-gate errno = ENOMEM; 112*0Sstevel@tonic-gate return (NULL); 113*0Sstevel@tonic-gate } 114*0Sstevel@tonic-gate memset(ho, 0x0, sizeof *ho); 115*0Sstevel@tonic-gate 116*0Sstevel@tonic-gate if (!(pvt = memget(sizeof *pvt))) { 117*0Sstevel@tonic-gate memput(ho, sizeof *ho); 118*0Sstevel@tonic-gate errno = ENOMEM; 119*0Sstevel@tonic-gate return (NULL); 120*0Sstevel@tonic-gate } 121*0Sstevel@tonic-gate memset(pvt, 0, sizeof *pvt); 122*0Sstevel@tonic-gate pvt->girpdata = this->private; 123*0Sstevel@tonic-gate 124*0Sstevel@tonic-gate ho->private = pvt; 125*0Sstevel@tonic-gate ho->close = ho_close; 126*0Sstevel@tonic-gate ho->byname = ho_byname; 127*0Sstevel@tonic-gate ho->byname2 = ho_byname2; 128*0Sstevel@tonic-gate ho->byaddr = ho_byaddr; 129*0Sstevel@tonic-gate ho->next = ho_next; 130*0Sstevel@tonic-gate ho->rewind = ho_rewind; 131*0Sstevel@tonic-gate ho->minimize = ho_minimize; 132*0Sstevel@tonic-gate ho->addrinfo = ho_addrinfo; 133*0Sstevel@tonic-gate 134*0Sstevel@tonic-gate return (ho); 135*0Sstevel@tonic-gate } 136*0Sstevel@tonic-gate 137*0Sstevel@tonic-gate /* Methods. */ 138*0Sstevel@tonic-gate 139*0Sstevel@tonic-gate 140*0Sstevel@tonic-gate 141*0Sstevel@tonic-gate /* 142*0Sstevel@tonic-gate * void ho_close(struct irs_ho *this) 143*0Sstevel@tonic-gate * 144*0Sstevel@tonic-gate * Notes: 145*0Sstevel@tonic-gate * 146*0Sstevel@tonic-gate * Closes down the module. 147*0Sstevel@tonic-gate * 148*0Sstevel@tonic-gate */ 149*0Sstevel@tonic-gate 150*0Sstevel@tonic-gate static void 151*0Sstevel@tonic-gate ho_close(struct irs_ho *this) { 152*0Sstevel@tonic-gate struct pvt *pvt = (struct pvt *)this->private; 153*0Sstevel@tonic-gate 154*0Sstevel@tonic-gate ho_minimize(this); 155*0Sstevel@tonic-gate 156*0Sstevel@tonic-gate free_host(&pvt->host); 157*0Sstevel@tonic-gate 158*0Sstevel@tonic-gate memput(pvt, sizeof *pvt); 159*0Sstevel@tonic-gate memput(this, sizeof *this); 160*0Sstevel@tonic-gate } 161*0Sstevel@tonic-gate 162*0Sstevel@tonic-gate 163*0Sstevel@tonic-gate 164*0Sstevel@tonic-gate /* 165*0Sstevel@tonic-gate * struct hostent * ho_byname(struct irs_ho *this, const char *name) 166*0Sstevel@tonic-gate * 167*0Sstevel@tonic-gate */ 168*0Sstevel@tonic-gate 169*0Sstevel@tonic-gate static struct hostent * 170*0Sstevel@tonic-gate ho_byname(struct irs_ho *this, const char *name) { 171*0Sstevel@tonic-gate return (ho_byname2(this, name, AF_INET)); 172*0Sstevel@tonic-gate } 173*0Sstevel@tonic-gate 174*0Sstevel@tonic-gate 175*0Sstevel@tonic-gate 176*0Sstevel@tonic-gate 177*0Sstevel@tonic-gate 178*0Sstevel@tonic-gate /* 179*0Sstevel@tonic-gate * struct hostent * ho_byname2(struct irs_ho *this, const char *name, int af) 180*0Sstevel@tonic-gate * 181*0Sstevel@tonic-gate */ 182*0Sstevel@tonic-gate 183*0Sstevel@tonic-gate static struct hostent * 184*0Sstevel@tonic-gate ho_byname2(struct irs_ho *this, const char *name, int af) { 185*0Sstevel@tonic-gate struct pvt *pvt = (struct pvt *)this->private; 186*0Sstevel@tonic-gate struct hostent *ho = &pvt->host; 187*0Sstevel@tonic-gate char *body = NULL; 188*0Sstevel@tonic-gate size_t bodylen; 189*0Sstevel@tonic-gate int code; 190*0Sstevel@tonic-gate char text[256]; 191*0Sstevel@tonic-gate 192*0Sstevel@tonic-gate if (ho->h_name != NULL && 193*0Sstevel@tonic-gate strcmp(name, ho->h_name) == 0 && 194*0Sstevel@tonic-gate af == ho->h_addrtype) { 195*0Sstevel@tonic-gate return (ho); 196*0Sstevel@tonic-gate } 197*0Sstevel@tonic-gate 198*0Sstevel@tonic-gate if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) { 199*0Sstevel@tonic-gate return (NULL); 200*0Sstevel@tonic-gate } 201*0Sstevel@tonic-gate 202*0Sstevel@tonic-gate if (irs_irp_send_command(pvt->girpdata, "gethostbyname2 %s %s", 203*0Sstevel@tonic-gate name, ADDR_T_STR(af)) != 0) 204*0Sstevel@tonic-gate return (NULL); 205*0Sstevel@tonic-gate 206*0Sstevel@tonic-gate if (irs_irp_get_full_response(pvt->girpdata, &code, 207*0Sstevel@tonic-gate text, sizeof text, 208*0Sstevel@tonic-gate &body, &bodylen) != 0) { 209*0Sstevel@tonic-gate return (NULL); 210*0Sstevel@tonic-gate } 211*0Sstevel@tonic-gate 212*0Sstevel@tonic-gate if (code == IRPD_GETHOST_OK) { 213*0Sstevel@tonic-gate free_host(ho); 214*0Sstevel@tonic-gate if (irp_unmarshall_ho(ho, body) != 0) { 215*0Sstevel@tonic-gate ho = NULL; 216*0Sstevel@tonic-gate } 217*0Sstevel@tonic-gate } else { 218*0Sstevel@tonic-gate ho = NULL; 219*0Sstevel@tonic-gate } 220*0Sstevel@tonic-gate 221*0Sstevel@tonic-gate if (body != NULL) { 222*0Sstevel@tonic-gate memput(body, bodylen); 223*0Sstevel@tonic-gate } 224*0Sstevel@tonic-gate 225*0Sstevel@tonic-gate return (ho); 226*0Sstevel@tonic-gate } 227*0Sstevel@tonic-gate 228*0Sstevel@tonic-gate 229*0Sstevel@tonic-gate 230*0Sstevel@tonic-gate /* 231*0Sstevel@tonic-gate * struct hostent * ho_byaddr(struct irs_ho *this, const void *addr, 232*0Sstevel@tonic-gate * int len, int af) 233*0Sstevel@tonic-gate * 234*0Sstevel@tonic-gate */ 235*0Sstevel@tonic-gate 236*0Sstevel@tonic-gate static struct hostent * 237*0Sstevel@tonic-gate ho_byaddr(struct irs_ho *this, const void *addr, int len, int af) { 238*0Sstevel@tonic-gate struct pvt *pvt = (struct pvt *)this->private; 239*0Sstevel@tonic-gate struct hostent *ho = &pvt->host; 240*0Sstevel@tonic-gate char *body = NULL; 241*0Sstevel@tonic-gate size_t bodylen; 242*0Sstevel@tonic-gate int code; 243*0Sstevel@tonic-gate char **p; 244*0Sstevel@tonic-gate char paddr[MAXPADDRSIZE]; 245*0Sstevel@tonic-gate char text[256]; 246*0Sstevel@tonic-gate 247*0Sstevel@tonic-gate if (ho->h_name != NULL && 248*0Sstevel@tonic-gate af == ho->h_addrtype && 249*0Sstevel@tonic-gate len == ho->h_length) { 250*0Sstevel@tonic-gate for (p = ho->h_addr_list ; *p != NULL ; p++) { 251*0Sstevel@tonic-gate if (memcmp(*p, addr, len) == 0) 252*0Sstevel@tonic-gate return (ho); 253*0Sstevel@tonic-gate } 254*0Sstevel@tonic-gate } 255*0Sstevel@tonic-gate 256*0Sstevel@tonic-gate if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) { 257*0Sstevel@tonic-gate return (NULL); 258*0Sstevel@tonic-gate } 259*0Sstevel@tonic-gate 260*0Sstevel@tonic-gate if (inet_ntop(af, addr, paddr, sizeof paddr) == NULL) { 261*0Sstevel@tonic-gate return (NULL); 262*0Sstevel@tonic-gate } 263*0Sstevel@tonic-gate 264*0Sstevel@tonic-gate if (irs_irp_send_command(pvt->girpdata, "gethostbyaddr %s %s", 265*0Sstevel@tonic-gate paddr, ADDR_T_STR(af)) != 0) { 266*0Sstevel@tonic-gate return (NULL); 267*0Sstevel@tonic-gate } 268*0Sstevel@tonic-gate 269*0Sstevel@tonic-gate if (irs_irp_get_full_response(pvt->girpdata, &code, 270*0Sstevel@tonic-gate text, sizeof text, 271*0Sstevel@tonic-gate &body, &bodylen) != 0) { 272*0Sstevel@tonic-gate return (NULL); 273*0Sstevel@tonic-gate } 274*0Sstevel@tonic-gate 275*0Sstevel@tonic-gate if (code == IRPD_GETHOST_OK) { 276*0Sstevel@tonic-gate free_host(ho); 277*0Sstevel@tonic-gate if (irp_unmarshall_ho(ho, body) != 0) { 278*0Sstevel@tonic-gate ho = NULL; 279*0Sstevel@tonic-gate } 280*0Sstevel@tonic-gate } else { 281*0Sstevel@tonic-gate ho = NULL; 282*0Sstevel@tonic-gate } 283*0Sstevel@tonic-gate 284*0Sstevel@tonic-gate if (body != NULL) { 285*0Sstevel@tonic-gate memput(body, bodylen); 286*0Sstevel@tonic-gate } 287*0Sstevel@tonic-gate 288*0Sstevel@tonic-gate return (ho); 289*0Sstevel@tonic-gate } 290*0Sstevel@tonic-gate 291*0Sstevel@tonic-gate 292*0Sstevel@tonic-gate 293*0Sstevel@tonic-gate 294*0Sstevel@tonic-gate 295*0Sstevel@tonic-gate /* 296*0Sstevel@tonic-gate * struct hostent * ho_next(struct irs_ho *this) 297*0Sstevel@tonic-gate * 298*0Sstevel@tonic-gate * Notes: 299*0Sstevel@tonic-gate * 300*0Sstevel@tonic-gate * The implementation for gethostent(3). The first time it's 301*0Sstevel@tonic-gate * called all the data is pulled from the remote(i.e. what 302*0Sstevel@tonic-gate * the maximum number of gethostent(3) calls would return) 303*0Sstevel@tonic-gate * and that data is cached. 304*0Sstevel@tonic-gate * 305*0Sstevel@tonic-gate */ 306*0Sstevel@tonic-gate 307*0Sstevel@tonic-gate static struct hostent * 308*0Sstevel@tonic-gate ho_next(struct irs_ho *this) { 309*0Sstevel@tonic-gate struct pvt *pvt = (struct pvt *)this->private; 310*0Sstevel@tonic-gate struct hostent *ho = &pvt->host; 311*0Sstevel@tonic-gate char *body; 312*0Sstevel@tonic-gate size_t bodylen; 313*0Sstevel@tonic-gate int code; 314*0Sstevel@tonic-gate char text[256]; 315*0Sstevel@tonic-gate 316*0Sstevel@tonic-gate if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) { 317*0Sstevel@tonic-gate return (NULL); 318*0Sstevel@tonic-gate } 319*0Sstevel@tonic-gate 320*0Sstevel@tonic-gate if (irs_irp_send_command(pvt->girpdata, "gethostent") != 0) { 321*0Sstevel@tonic-gate return (NULL); 322*0Sstevel@tonic-gate } 323*0Sstevel@tonic-gate 324*0Sstevel@tonic-gate if (irs_irp_get_full_response(pvt->girpdata, &code, 325*0Sstevel@tonic-gate text, sizeof text, 326*0Sstevel@tonic-gate &body, &bodylen) != 0) { 327*0Sstevel@tonic-gate return (NULL); 328*0Sstevel@tonic-gate } 329*0Sstevel@tonic-gate 330*0Sstevel@tonic-gate if (code == IRPD_GETHOST_OK) { 331*0Sstevel@tonic-gate free_host(ho); 332*0Sstevel@tonic-gate if (irp_unmarshall_ho(ho, body) != 0) { 333*0Sstevel@tonic-gate ho = NULL; 334*0Sstevel@tonic-gate } 335*0Sstevel@tonic-gate } else { 336*0Sstevel@tonic-gate ho = NULL; 337*0Sstevel@tonic-gate } 338*0Sstevel@tonic-gate 339*0Sstevel@tonic-gate if (body != NULL) { 340*0Sstevel@tonic-gate memput(body, bodylen); 341*0Sstevel@tonic-gate } 342*0Sstevel@tonic-gate 343*0Sstevel@tonic-gate return (ho); 344*0Sstevel@tonic-gate } 345*0Sstevel@tonic-gate 346*0Sstevel@tonic-gate 347*0Sstevel@tonic-gate 348*0Sstevel@tonic-gate 349*0Sstevel@tonic-gate 350*0Sstevel@tonic-gate /* 351*0Sstevel@tonic-gate * void ho_rewind(struct irs_ho *this) 352*0Sstevel@tonic-gate * 353*0Sstevel@tonic-gate */ 354*0Sstevel@tonic-gate 355*0Sstevel@tonic-gate static void 356*0Sstevel@tonic-gate ho_rewind(struct irs_ho *this) { 357*0Sstevel@tonic-gate struct pvt *pvt = (struct pvt *)this->private; 358*0Sstevel@tonic-gate char text[256]; 359*0Sstevel@tonic-gate int code; 360*0Sstevel@tonic-gate 361*0Sstevel@tonic-gate if (irs_irp_connection_setup(pvt->girpdata, &pvt->warned) != 0) { 362*0Sstevel@tonic-gate return; 363*0Sstevel@tonic-gate } 364*0Sstevel@tonic-gate 365*0Sstevel@tonic-gate if (irs_irp_send_command(pvt->girpdata, "sethostent") != 0) { 366*0Sstevel@tonic-gate return; 367*0Sstevel@tonic-gate } 368*0Sstevel@tonic-gate 369*0Sstevel@tonic-gate code = irs_irp_read_response(pvt->girpdata, text, sizeof text); 370*0Sstevel@tonic-gate if (code != IRPD_GETHOST_SETOK) { 371*0Sstevel@tonic-gate if (irp_log_errors) { 372*0Sstevel@tonic-gate syslog(LOG_WARNING, "sethostent failed: %s", text); 373*0Sstevel@tonic-gate } 374*0Sstevel@tonic-gate } 375*0Sstevel@tonic-gate 376*0Sstevel@tonic-gate return; 377*0Sstevel@tonic-gate } 378*0Sstevel@tonic-gate 379*0Sstevel@tonic-gate 380*0Sstevel@tonic-gate 381*0Sstevel@tonic-gate 382*0Sstevel@tonic-gate /* 383*0Sstevel@tonic-gate * void ho_minimize(struct irs_ho *this) 384*0Sstevel@tonic-gate * 385*0Sstevel@tonic-gate */ 386*0Sstevel@tonic-gate 387*0Sstevel@tonic-gate static void 388*0Sstevel@tonic-gate ho_minimize(struct irs_ho *this) { 389*0Sstevel@tonic-gate struct pvt *pvt = (struct pvt *)this->private; 390*0Sstevel@tonic-gate 391*0Sstevel@tonic-gate free_host(&pvt->host); 392*0Sstevel@tonic-gate 393*0Sstevel@tonic-gate irs_irp_disconnect(pvt->girpdata); 394*0Sstevel@tonic-gate } 395*0Sstevel@tonic-gate 396*0Sstevel@tonic-gate 397*0Sstevel@tonic-gate 398*0Sstevel@tonic-gate 399*0Sstevel@tonic-gate /* 400*0Sstevel@tonic-gate * void free_host(struct hostent *ho) 401*0Sstevel@tonic-gate * 402*0Sstevel@tonic-gate */ 403*0Sstevel@tonic-gate 404*0Sstevel@tonic-gate static void 405*0Sstevel@tonic-gate free_host(struct hostent *ho) { 406*0Sstevel@tonic-gate char **p; 407*0Sstevel@tonic-gate 408*0Sstevel@tonic-gate if (ho == NULL) { 409*0Sstevel@tonic-gate return; 410*0Sstevel@tonic-gate } 411*0Sstevel@tonic-gate 412*0Sstevel@tonic-gate if (ho->h_name != NULL) 413*0Sstevel@tonic-gate free(ho->h_name); 414*0Sstevel@tonic-gate 415*0Sstevel@tonic-gate if (ho->h_aliases != NULL) { 416*0Sstevel@tonic-gate for (p = ho->h_aliases ; *p != NULL ; p++) 417*0Sstevel@tonic-gate free(*p); 418*0Sstevel@tonic-gate free(ho->h_aliases); 419*0Sstevel@tonic-gate } 420*0Sstevel@tonic-gate 421*0Sstevel@tonic-gate if (ho->h_addr_list != NULL) { 422*0Sstevel@tonic-gate for (p = ho->h_addr_list ; *p != NULL ; p++) 423*0Sstevel@tonic-gate free(*p); 424*0Sstevel@tonic-gate free(ho->h_addr_list); 425*0Sstevel@tonic-gate } 426*0Sstevel@tonic-gate } 427*0Sstevel@tonic-gate 428*0Sstevel@tonic-gate /* dummy */ 429*0Sstevel@tonic-gate static struct addrinfo * 430*0Sstevel@tonic-gate ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai) 431*0Sstevel@tonic-gate { 432*0Sstevel@tonic-gate UNUSED(this); 433*0Sstevel@tonic-gate UNUSED(name); 434*0Sstevel@tonic-gate UNUSED(pai); 435*0Sstevel@tonic-gate return(NULL); 436*0Sstevel@tonic-gate } 437