gen_gr.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"
#if !defined(LINT) && !defined(CODECENTER)
#endif
/* Imports */
#include "port_before.h"
#ifndef WANT_IRS_GR
static int __bind_irs_gr_unneeded;
#else
#include <isc/assertions.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <resolv.h>
#include <isc/memcluster.h>
#include <irs.h>
#include "port_after.h"
#include "irs_p.h"
#include "gen_p.h"
/* Definitions */
struct pvt {
/*
* Need space to store the entries read from the group file.
* The members list also needs space per member, and the
* strings making up the user names must be allocated
* somewhere. Rather than doing lots of small allocations,
* we keep one buffer and resize it as needed.
*/
char * membuf;
struct __res_state * res;
void (*free_res)(void *);
};
/* Forward */
static void gr_minimize(struct irs_gr *);
static void gr_res_set(struct irs_gr *,
struct __res_state *,
void (*)(void *));
int preserve);
/* Public */
struct irs_gr *
return (NULL);
}
return (NULL);
}
return (gr);
}
/* Methods. */
static void
}
static struct group *
if (rval)
return (rval);
break;
}
}
return (NULL);
}
static struct group *
int dirty;
dirty = 0;
if (tval) {
break;
} else {
break;
}
}
if (dirty)
return (NULL);
}
static struct group *
int dirty;
dirty = 0;
if (tval) {
break;
} else {
break;
}
}
if (dirty)
return (NULL);
}
static void
}
}
static int
{
int n, t, rval = 0;
*ngroups = 0;
if (!t_groups) {
return (-1);
}
for (n = 0; n < t_ngroups; n++) {
rval = -1;
goto done;
}
}
}
if (t == 0) {
break;
} else {
break;
}
}
done:
return (rval);
}
static void
}
}
static struct __res_state *
struct __res_state *res;
if (!res) {
return (NULL);
}
}
}
static void
void (*free_res)(void *)) {
}
}
}
/* Private. */
static void
if (!preserve) {
m = malloc(sizeof *m);
if (!m) {
/* No harm done, no work done. */
return;
}
}
}
/*
* Make sure destination member array is large enough.
* p points to new portion.
*/
if (!m) {
/* No harm done, no work done. */
return;
}
}
/*
* Enlarge destination membuf; cp points at new portion.
*/
if (!preserve) {
}
if (n == 0) {
/* No work to do. */
return;
}
if (!cp) {
/* No harm done, no work done. */
return;
}
if (used != 0)
/*
* Adjust group.gr_mem.
*/
/*
* Add new elements.
*/
*p++ = cp;
*p = NULL;
#ifdef HAVE_STRLCPY
#else
#endif
}
if (preserve) {
} else {
#ifdef HAVE_STRLCPY
#else
#endif
#ifdef HAVE_STRLCPY
#else
#endif
}
}
static int
int n = 0;
while (*vec++)
n++;
return (n);
}
static int
return (0);
return (1);
}
static int
int n = 0;
return (n);
}
static size_t
size_t n = 0;
return (n);
}
static int
return (0);
return (1);
}
#endif /* WANT_IRS_GR */