1999-07-09  Ulrich Drepper  <drepper@cygnus.com>

	* hesiod/Versions [GLIBC_2.2]: Add _nss_hesiod_initgroups.
	* hesiod/hesiod-grp.c: Add initgroups support.
	Patch by Nalin Dahyabhai <nsdahya1@pobox.com>.
This commit is contained in:
Ulrich Drepper 1999-07-09 09:58:27 +00:00
parent 110215a9a7
commit bee1e289fa
4 changed files with 137 additions and 5 deletions

View File

@ -1,3 +1,9 @@
1999-07-09 Ulrich Drepper <drepper@cygnus.com>
* hesiod/Versions [GLIBC_2.2]: Add _nss_hesiod_initgroups.
* hesiod/hesiod-grp.c: Add initgroups support.
Patch by Nalin Dahyabhai <nsdahya1@pobox.com>.
1999-07-08 Andreas Schwab <schwab@suse.de>
* libio/iofopncook.c (fopencookie): Set _fileno to -2.

17
FAQ.in
View File

@ -342,6 +342,23 @@ against the previous version of the GNU libc (version 2.0) but also against
all future versions.
?? How can I compile on my fast ix86 machine a working libc for my slow
i386? After installing libc, programs abort with "Illegal
Instruction".
{AJ} glibc and gcc might generate some instructions on your machine that
aren't available on i386. You've got to tell glibc that you're configuring
for i386 with adding i386 as your machine, for example:
../configure --prefix=/usr i386-pc-linux-gnu
And you need to tell gcc to only generate i386 code, just add `-mcpu=i386'
(just -m386 doesn't work) to your CFLAGS.
{UD} This applies not only to the i386. Compiling on a i686 for any older
model will also fail if the above methods are not used.
? Installation and configuration issues
?? Can I replace the libc on my Linux system with GNU libc?

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997 Free Software Foundation, Inc.
/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
@ -17,14 +17,15 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <bits/libc-lock.h>
#include <ctype.h>
#include <errno.h>
#include <hesiod.h>
#include <nss.h>
#include <grp.h>
#include <hesiod.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <nss.h>
#include <bits/libc-lock.h>
/* Get the declaration of the parser function. */
#define ENTNAME grent
@ -150,3 +151,111 @@ _nss_hesiod_getgrgid_r (gid_t gid, struct group *grp,
return status;
}
static int
internal_gid_in_list (const gid_t *list, const gid_t g, long int len)
{
while (len > 0)
{
if (*list == g)
return 1;
--len;
++list;
}
return 0;
}
static enum nss_status
internal_gid_from_group (void *context, const char *groupname, gid_t *group)
{
char **grp_res;
enum nss_status status = NSS_STATUS_NOTFOUND;
grp_res = hesiod_resolve (context, groupname, "group");
if (grp_res != NULL && *grp_res != NULL)
{
char *p = *grp_res;
while (*p != '\0' && *p != ':')
++p;
while (*p != '\0' && *p == ':')
++p;
while (*p != '\0' && *p != ':')
++p;
while (*p != '\0' && *p == ':')
++p;
if (*p == ':')
{
char *endp;
char *q = ++p;
q = p;
while (*q != '\0' && *q != ':')
++q;
*group = strtol (p, &endp, 10);
if (endp == q && endp != p)
status = NSS_STATUS_SUCCESS;
}
hesiod_free_list (context, grp_res);
}
return status;
}
enum nss_status
_nss_hesiod_initgroups (const char *user, gid_t group, long int *start,
long int *size, gid_t *groups, long int limit,
int *errnop)
{
enum nss_status status = NSS_STATUS_SUCCESS;
char **list = NULL;
char *p;
void *context;
if (hesiod_init (&context) == -1)
return NSS_STATUS_UNAVAIL;
list = hesiod_resolve (context, user, "grplist");
if (list == NULL)
{
hesiod_end(context);
return errno == ENOENT ? NSS_STATUS_NOTFOUND : NSS_STATUS_UNAVAIL;
}
if (!internal_gid_in_list (groups, group, *start) && *start < limit)
groups[(*start)++] = group;
p = *list;
while (*p != '\0' && *start < limit)
{
char *endp;
char *q;
status = NSS_STATUS_NOTFOUND;
q = p;
while (*q != '\0' && *q != ':')
++q;
if (*q != '\0')
*q++ = '\0';
group = strtol (p, &endp, 10);
if (*endp == '\0' && endp != p)
status = NSS_STATUS_SUCCESS;
else
status = internal_gid_from_group (context, p, &group);
if (status == NSS_STATUS_SUCCESS
&& !internal_gid_in_list (groups, group, *start))
groups[(*start)++] = group;
p = q;
}
hesiod_free_list (context, list);
hesiod_end(context);
return NSS_STATUS_SUCCESS;
}

View File

@ -13,7 +13,7 @@ if test -n "$sysheaders"; then
fi
echo $ac_n "checking installed Linux kernel header files""... $ac_c" 1>&6
echo "configure:16: checking installed Linux kernel header files" >&5
if eval "test \"\${libc_cv_linux2010+set}\" = set"; then
if eval "test \"`echo '$''{'libc_cv_linux2010'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF