nis_ho.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#endif /* LIBC_SCCS and not lint */
/* Imports */
#include "port_before.h"
#ifndef WANT_IRS_NIS
static int __bind_irs_nis_unneeded;
#else
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <netdb.h>
#include <resolv.h>
#include <stdio.h>
#include <string.h>
#include <isc/memcluster.h>
#include <irs.h>
#include "port_after.h"
#include "irs_p.h"
#include "nis_p.h"
/* Definitions */
#define MAXALIASES 35
#define MAXADDRS 35
#if PACKETSZ > 1024
#else
#define MAXPACKET 1024
#endif
struct pvt {
int needrewind;
char * nis_domain;
char * curkey_data;
int curkey_len;
char * curval_data;
int curval_len;
struct __res_state *res;
void (*free_res)(void *);
};
/* Forwards */
int af);
struct __res_state *res,
void (*free_res)(void *));
/* Public */
struct irs_ho *
return (NULL);
}
return (NULL);
}
return (ho);
}
/* Methods */
static void
}
static struct hostent *
return (NULL);
if (hp)
return (hp);
}
}
static struct hostent *
int r;
char *tmp;
return (NULL);
if (r != 0) {
}
if (r != 0) {
}
if (r != 0) {
}
if (r != 0) {
return (NULL);
}
return (makehostent(this));
}
static struct hostent *
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
int r;
return (NULL);
/* Unmap. */
}
return (NULL);
}
if (r != 0)
if (r != 0) {
return (NULL);
}
return (makehostent(this));
}
static struct hostent *
int r;
return (NULL);
do {
if (pvt->needrewind) {
pvt->needrewind = 0;
} else {
char *newkey_data;
int newkey_len;
}
if (r != 0) {
return (NULL);
}
return (rval);
}
static void
}
static void
}
static struct __res_state *
struct __res_state *res;
if (!res) {
return (NULL);
}
}
}
static void
void (*free_res)(void *)) {
}
}
struct nis_res_target {
struct nis_res_target *next;
int family;
};
/* XXX */
static struct addrinfo *
{
struct nis_res_target q, q2, *p;
case AF_UNSPEC: /* INET6 then INET4 */
break;
case AF_INET6:
break;
case AF_INET:
break;
default:
return(NULL);
}
for (p = &q; p; p = p->next) {
/* byname2 should've set an appropriate error */
continue;
}
continue;
}
if (ai) {
}
}
}
/* Private */
/*
ipnodes:
::1 localhost
127.0.0.1 localhost
1.2.3.4 FOO bar
1.2.6.4 FOO bar
1.2.6.5 host
ipnodes.byname:
YP_MULTI_localhost ::1,127.0.0.1 localhost
YP_MULTI_foo 1.2.3.4,1.2.6.4 FOO bar
YP_MULTI_bar 1.2.3.4,1.2.6.4 FOO bar
host 1.2.6.5 host
hosts.byname:
localhost 127.0.0.1 localhost
host 1.2.6.5 host
YP_MULTI_foo 1.2.3.4,1.2.6.4 FOO bar
YP_MULTI_bar 1.2.3.4,1.2.6.4 FOO bar
*/
static struct hostent *
static const char spaces[] = " \t";
int multi = 0;
int addr = 0;
p = pvt->curval_data;
*cp = '\0';
return (NULL);
*cp++ = '\0';
do {
*comma++ = '\0';
multi = 1;
}
break;
} else {
}
} else {
if (!multi)
return (NULL);
continue;
}
}
return (NULL);
*cp++ = '\0';
cp++;
continue;
}
*q++ = cp;
*cp++ = '\0';
}
*q = NULL;
}
static void
}
}
}
static int
return (-1);
return (-1);
return (0);
}
#endif /*WANT_IRS_NIS*/