nis_nw.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 1997-2002 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 <errno.h>
#include <resolv.h>
#include <stdio.h>
#include <stdlib.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 MAXADDRSIZE 4
struct pvt {
int needrewind;
char * nis_domain;
char * curkey_data;
int curkey_len;
char * curval_data;
int curval_len;
char * nwbuf;
struct __res_state * res;
void (*free_res)(void *);
};
/* Forward */
static void nw_minimize(struct irs_nw *);
struct __res_state *res,
void (*free_res)(void *));
/* Public */
struct irs_nw *
return (NULL);
}
return (NULL);
}
return (nw);
}
/* Methods */
static void
}
static struct nwent *
char tmp[sizeof "255.255.255.255/32"], *t;
int r;
return (NULL);
return (NULL);
}
/* Try it with /CIDR first. */
return (NULL);
}
if (r != 0) {
/* Give it a shot without the /CIDR. */
*t = '\0';
}
if (r != 0) {
return (NULL);
}
}
}
static struct nwent *
int r;
char *tmp;
return (NULL);
return (NULL);
}
if (r != 0) {
return (NULL);
}
}
static void
}
static struct nwent *
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 struct __res_state *
struct __res_state *res;
if (!res) {
return (NULL);
}
}
}
static void
void (*free_res)(void *)) {
}
}
/* Private */
static struct nwent *
static const char spaces[] = " \t";
*cp = '\0';
/* Name */
if (!*cp)
goto cleanup;
*cp++ = '\0';
/* Network */
if (*t)
*t++ = '\0';
goto cleanup;
cp = t;
/* Aliases */
while (*cp) {
break;
if (!*cp)
break;
*cp++ = '\0';
}
}
return (NULL);
}
static void
}
}
}
static int
return (-1);
return (-1);
return (0);
}
#endif /*WANT_IRS_NIS*/