dns_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"
#endif
/*
* dns_gr.c --- this file contains the functions for accessing
* group information from Hesiod.
*/
#include "port_before.h"
#ifndef WANT_IRS_GR
static int __bind_irs_gr_unneeded;
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <resolv.h>
#include <isc/memcluster.h>
#include <irs.h>
#include "port_after.h"
#include "irs_p.h"
#include "hesiod.h"
#include "dns_p.h"
/* Types. */
struct pvt {
/*
* This is our private accessor data. It has a shared hesiod context.
*/
/*
* 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;
};
/* Forward. */
static void gr_minimize(struct irs_gr *);
static void gr_res_set(struct irs_gr *,
struct __res_state *,
void (*)(void *));
const char *name,
const char *type);
/* Public. */
struct irs_gr *
return (NULL);
}
return (NULL);
}
return (NULL);
}
return (gr);
}
/* methods */
static void
}
static struct group *
return (NULL);
}
static struct group *
}
static struct group *
char name[32];
}
static void
/* NOOP */
}
static int
{
*ngroups = 0;
/* There's some way to do this in Hesiod. */
return (-1);
}
static void
/* NOOP */
}
/* Private. */
static struct group *
size_t num_members = 0;
u_long t;
if (!hes_list)
return (NULL);
/*
* Copy the returned hesiod string into storage space.
*/
goto cleanup;
*cp++ = '\0';
goto cleanup;
*cp++ = '\0';
errno = 0;
goto cleanup;
goto cleanup;
cp++;
/*
* Parse the members out.
*/
while (*cp) {
goto cleanup;
}
break;
*cp++ = '\0';
}
goto cleanup;
}
}
}
return (NULL);
}
static struct __res_state *
}
static void
void (*free_res)(void *)) {
}
#endif /* WANT_IRS_GR */