Wed Jun 26 01:58:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>

* nss/nss_files/files-parse.c (parse_list): Count null in EOL calc.

	Move DB code into separate -ldb library.
	* db/Makefile (extra-libs): New variable, list libdb.
	(routines): Renamed to libdb-routines.
	* shlib-versions: Add libdb=2.

	* nss/network-lookup.c (DEFAULT_CONFIG): New macro.
	* nss/host-lookup.c (DEFAULT_CONFIG): New macro.

	* nss/nsswitch.c (nss_parse_service_list): Use __strncasecmp instead
	of strncasecmp.  Extend syntax to grok [!foo=bar].

	* sysdeps/generic/strncase.c: Define __strncasecmp with strncasecmp as
	weak alias.
	* string/string.h: Declare __strncasecmp.

	* nss/nsswitch.c (nss_parse_file): Call __getline, not getline.
	(service_alias): Variable removed.
	(nss_parse_service_list): New function, broken out of nss_getline.
	Remove alias conversion; we will just use symlinks.
	(__nss_database_lookup): Take new string arg DEFCONFIG.
	If no entry exists, make one with service list parsed from that.
	* nss/nsswitch.h: Update protocol for __nss_database_lookup.
	* nss/XXX-lookup.c (DEFAULT_CONFIG): New macro, set to 0 if undefined.
	(DB_LOOKUP_FCT): Pass it to _nss_database_lookup.

	* grp/initgroups.c: Rewritten using getgrent.  Handle unlimited group
	list size.

	* sunrpc/xdr.c (xdr_int): #if 0 out unresolved references in dead code.

Wed Jun 26 01:56:50 1996  Ulrich Drepper  <drepper@cygnus.com>

	* locale/programs/locale.c (long_options): Short form of
	--version option is `-V'.
	(main): Recognize `-V' as option, not `-v'.
	Call `usage' instead of printing error message for illegal
	option.
	(usage): Document `-V'.
This commit is contained in:
Roland McGrath 1996-06-26 15:46:01 +00:00
parent be64fe6d86
commit bba7bb78f3
14 changed files with 234 additions and 174 deletions

View File

@ -1,3 +1,46 @@
Wed Jun 26 01:58:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* nss/nss_files/files-parse.c (parse_list): Count null in EOL calc.
Move DB code into separate -ldb library.
* db/Makefile (extra-libs): New variable, list libdb.
(routines): Renamed to libdb-routines.
* shlib-versions: Add libdb=2.
* nss/network-lookup.c (DEFAULT_CONFIG): New macro.
* nss/host-lookup.c (DEFAULT_CONFIG): New macro.
* nss/nsswitch.c (nss_parse_service_list): Use __strncasecmp instead
of strncasecmp. Extend syntax to grok [!foo=bar].
* sysdeps/generic/strncase.c: Define __strncasecmp with strncasecmp as
weak alias.
* string/string.h: Declare __strncasecmp.
* nss/nsswitch.c (nss_parse_file): Call __getline, not getline.
(service_alias): Variable removed.
(nss_parse_service_list): New function, broken out of nss_getline.
Remove alias conversion; we will just use symlinks.
(__nss_database_lookup): Take new string arg DEFCONFIG.
If no entry exists, make one with service list parsed from that.
* nss/nsswitch.h: Update protocol for __nss_database_lookup.
* nss/XXX-lookup.c (DEFAULT_CONFIG): New macro, set to 0 if undefined.
(DB_LOOKUP_FCT): Pass it to _nss_database_lookup.
* grp/initgroups.c: Rewritten using getgrent. Handle unlimited group
list size.
* sunrpc/xdr.c (xdr_int): #if 0 out unresolved references in dead code.
Wed Jun 26 01:56:50 1996 Ulrich Drepper <drepper@cygnus.com>
* locale/programs/locale.c (long_options): Short form of
--version option is `-V'.
(main): Recognize `-V' as option, not `-v'.
Call `usage' instead of printing error message for illegal
option.
(usage): Document `-V'.
Tue Jun 25 17:22:55 1996 Miles Bader <miles@gnu.ai.mit.edu> Tue Jun 25 17:22:55 1996 Miles Bader <miles@gnu.ai.mit.edu>
* sysdeps/mach/hurd/getcwd.c * sysdeps/mach/hurd/getcwd.c

View File

@ -8,8 +8,10 @@ subdir = db
subdir-dirs = btree db hash mpool recno subdir-dirs = btree db hash mpool recno
vpath %.c $(subdir-dirs) vpath %.c $(subdir-dirs)
routines := bt_close bt_conv bt_debug bt_delete bt_get bt_open bt_overflow \ extra-libs := libdb
bt_page bt_put bt_search bt_seq bt_split bt_utils \ libdb-routines := bt_close bt_conv bt_debug bt_delete bt_get \
bt_open bt_overflow bt_page bt_put bt_search \
bt_seq bt_split bt_utils \
db \ db \
hash hash_bigkey hash_buf hash_func hash_log2 hash_page \ hash hash_bigkey hash_buf hash_func hash_log2 hash_page \
ndbm \ ndbm \

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1989, 1991, 1993 Free Software Foundation, Inc. /* Copyright (C) 1989, 1991, 1993, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -31,43 +31,66 @@ int
DEFUN(initgroups, (user, group), DEFUN(initgroups, (user, group),
CONST char *user AND gid_t group) CONST char *user AND gid_t group)
{ {
#ifdef NGROUPS_MAX #if defined (NGROUPS_MAX) && NGROUPS_MAX == 0
#if NGROUPS_MAX == 0
/* No extra groups allowed. */
return 0; return 0;
#else #else
static PTR info = NULL;
register FILE *stream; struct group *g;
register struct group *g;
gid_t groups[NGROUPS_MAX];
register size_t n; register size_t n;
#ifdef NGROUPS_MAX
gid_t groups[NGROUPS_MAX];
#else
long int limit = sysconf (_SC_NGROUPS_MAX);
gid_t *groups;
size_t ngroups;
if (info == NULL) if (limit > 0)
{ ngroups = limit;
info = __grpalloc(); else
if (info == NULL) /* No fixed limit on groups. Pick a starting buffer size. */
return -1; ngroups = 16;
}
stream = __grpopen(); groups = __alloca (ngroups * sizeof *groups);
if (stream == NULL) #endif
return -1;
setgrent ();
n = 0; n = 0;
groups[n++] = group; groups[n++] = group;
while (n < NGROUPS_MAX && (g = __grpread(stream, info)) != NULL) while ((g = getgrent ()) != NULL)
if (g->gr_gid != group) if (g->gr_gid != group)
{ {
register char **m; register char **m;
for (m = g->gr_mem; *m != NULL; ++m) for (m = g->gr_mem; *m != NULL; ++m)
if (!strcmp (*m, user)) if (!strcmp (*m, user))
groups[n++] = g->gr_gid; break;
if (*m == NULL)
{
/* Matched the user. Insert this group. */
if (n == ngroups && limit <= 0)
{
/* Need a bigger buffer. */
groups = memcpy (__alloca (ngroups * 2 * sizeof *groups),
groups, ngroups * sizeof *groups);
ngroups *= 2;
} }
groups[n++] = g->gr_gid;
if (n == limit)
/* Can't take any more groups; stop searching. */
break;
}
}
endgrent ();
return setgroups (n, groups); return setgroups (n, groups);
#endif #endif
#else
return 0;
#endif
} }

View File

@ -49,7 +49,7 @@ static const struct option long_options[] =
{ "charmaps", no_argument, NULL, 'm' }, { "charmaps", no_argument, NULL, 'm' },
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "keyword-name", no_argument, &show_keyword_name, 1 }, { "keyword-name", no_argument, &show_keyword_name, 1 },
{ "version", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
@ -130,7 +130,7 @@ main (int argc, char *argv[])
int do_version = 0; int do_version = 0;
int do_charmaps = 0; int do_charmaps = 0;
/* Set initial values for global varaibles. */ /* Set initial values for global variables. */
show_category_name = 0; show_category_name = 0;
show_keyword_name = 0; show_keyword_name = 0;
@ -142,7 +142,7 @@ main (int argc, char *argv[])
/* Initialize the message catalog. */ /* Initialize the message catalog. */
textdomain (PACKAGE); textdomain (PACKAGE);
while ((optchar = getopt_long (argc, argv, "achkmv", long_options, NULL)) while ((optchar = getopt_long (argc, argv, "achkmV", long_options, NULL))
!= EOF) != EOF)
switch (optchar) switch (optchar)
{ {
@ -163,12 +163,11 @@ main (int argc, char *argv[])
case 'm': case 'm':
do_charmaps = 1; do_charmaps = 1;
break; break;
case 'v': case 'V':
do_version = 1; do_version = 1;
break; break;
default: default:
error (1, 0, gettext ("illegal option \"%s\""), optarg); usage (EXIT_FAILURE);
break;
} }
/* Version information is requested. */ /* Version information is requested. */
@ -229,15 +228,14 @@ usage(int status)
Usage: %s [OPTION]... name\n\ Usage: %s [OPTION]... name\n\
Mandatory arguments to long options are mandatory for short options too.\n\ Mandatory arguments to long options are mandatory for short options too.\n\
-h, --help display this help and exit\n\ -h, --help display this help and exit\n\
-v, --version output version information and exit\n\ -V, --version output version information and exit\n\
\n\ \n\
-a, --all-locales write names of available locales\n\ -a, --all-locales write names of available locales\n\
-m, --charmaps write names of available charmaps\n\ -m, --charmaps write names of available charmaps\n\
\n\ \n\
-c, --category-name write names of selected categories\n\ -c, --category-name write names of selected categories\n\
-k, --keyword-name write names of selected keywords\n\ -k, --keyword-name write names of selected keywords\n"),
\n\ program_invocation_name);
"), program_invocation_name);
exit (status); exit (status);
} }

View File

@ -25,6 +25,10 @@ Boston, MA 02111-1307, USA. */
|* DATABASE_NAME - name of the database the function accesses *| |* DATABASE_NAME - name of the database the function accesses *|
|* (e.g., hosts, servicess, ...) *| |* (e.g., hosts, servicess, ...) *|
|* *| |* *|
|* One additional symbol may optionally be defined: *|
|* *|
|* DEFAULT_CONFIG - string for default conf (e.g. "dns files") *|
|* *|
\*******************************************************************/ \*******************************************************************/
#define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup) #define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup)
@ -35,6 +39,9 @@ Boston, MA 02111-1307, USA. */
#define STRINGIFY1(Name) STRINGIFY2 (Name) #define STRINGIFY1(Name) STRINGIFY2 (Name)
#define STRINGIFY2(Name) #Name #define STRINGIFY2(Name) #Name
#ifndef DEFAULT_CONFIG
#define DEFAULT_CONFIG 0
#endif
static service_user *database = NULL; static service_user *database = NULL;
@ -42,7 +49,8 @@ int
DB_LOOKUP_FCT (service_user **ni, const char *fct_name, void **fctp) DB_LOOKUP_FCT (service_user **ni, const char *fct_name, void **fctp)
{ {
if (database == NULL if (database == NULL
&& __nss_database_lookup (DATABASE_NAME_STRING, &database) < 0) && __nss_database_lookup (DATABASE_NAME_STRING, DEFAULT_CONFIG,
&database) < 0)
return -1; return -1;
*ni = database; *ni = database;

View File

@ -1,22 +0,0 @@
/* Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#define DATABASE_NAME hosts
#include "XXX-lookup.c"

View File

@ -18,5 +18,6 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#define DATABASE_NAME hosts #define DATABASE_NAME hosts
#define DEFAULT_CONFIG "dns [!UNAVAIL=return] files"
#include "XXX-lookup.c" #include "XXX-lookup.c"

View File

@ -18,5 +18,6 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#define DATABASE_NAME networks #define DATABASE_NAME networks
#define DEFAULT_CONFIG "dns files"
#include "XXX-lookup.c" #include "XXX-lookup.c"

View File

@ -107,7 +107,7 @@ parse_list (char *line, struct parser_data *data, int datalen)
char *eol, **list, **p; char *eol, **list, **p;
/* Find the end of the line buffer. */ /* Find the end of the line buffer. */
eol = strchr (line, '\0'); eol = strchr (line, '\0') + 1;
/* Adjust the pointer so it is aligned for storing pointers. */ /* Adjust the pointer so it is aligned for storing pointers. */
eol += (eol - (char *) 0) % __alignof__ (char *); eol += (eol - (char *) 0) % __alignof__ (char *);
/* We will start the storage here for the vector of pointers. */ /* We will start the storage here for the vector of pointers. */

View File

@ -38,6 +38,7 @@ static void nss_insert_entry (struct entry **knownp, const char *key,
void *val); void *val);
static name_database *nss_parse_file (const char *fname); static name_database *nss_parse_file (const char *fname);
static name_database_entry *nss_getline (char *line); static name_database_entry *nss_getline (char *line);
static service_user *nss_parse_service_list (const char *line);
static service_library *nss_new_service (name_database *database, static service_library *nss_new_service (name_database *database,
const char *name); const char *name);
@ -49,17 +50,6 @@ __libc_lock_define_initialized (static, lock);
struct __res_state _res; struct __res_state _res;
/* Known aliases for service names. */
static struct {
const char *alias;
const char *value;
} service_alias[] =
{
{ "nis+", "nisplus" },
{ "yp", "nis" }
};
/* Nonzero if the sevices are already initialized. */ /* Nonzero if the sevices are already initialized. */
static int nss_initialized; static int nss_initialized;
@ -84,8 +74,11 @@ nss_init (void)
/* -1 == database not found /* -1 == database not found
0 == database entry pointer stored */ 0 == database entry pointer stored */
int int
__nss_database_lookup (const char *database, service_user **ni) __nss_database_lookup (const char *database, const char *defconfig,
service_user **ni)
{ {
name_database_entry *entry;
if (nss_initialized == 0) if (nss_initialized == 0)
nss_init (); nss_init ();
@ -94,7 +87,6 @@ __nss_database_lookup (const char *database, service_user **ni)
{ {
/* Return first `service_user' entry for DATABASE. /* Return first `service_user' entry for DATABASE.
XXX Will use perfect hashing function for known databases. */ XXX Will use perfect hashing function for known databases. */
name_database_entry *entry;
/* XXX Could use some faster mechanism here. But each database is /* XXX Could use some faster mechanism here. But each database is
only requested once and so this might not be critical. */ only requested once and so this might not be critical. */
@ -107,29 +99,17 @@ __nss_database_lookup (const char *database, service_user **ni)
} }
/* No configuration data is available, either because nsswitch.conf /* No configuration data is available, either because nsswitch.conf
doesn't exist or because it doesn't have a line for this database. doesn't exist or because it doesn't have a line for this database. */
Use a default equivalent to: entry = malloc (sizeof *entry);
database: compat [NOTFOUND=return] dns [NOTFOUND=return] files if (entry == NULL)
*/ return -1;
{ entry->name = database;
#define DEFAULT_SERVICE(name, next) \ /* DEFCONFIG specifies the default service list for this database,
static service_user default_##name = \ or null to use the most common default. */
{ \ entry->service = nss_parse_service_list (defconfig ?:
#name, \ "compat [NOTFOUND=return] files");
{ \
NSS_ACTION_CONTINUE, \ *ni = entry->service;
NSS_ACTION_CONTINUE, \
NSS_ACTION_RETURN, \
NSS_ACTION_RETURN, \
}, \
NULL, NULL, \
next \
}
DEFAULT_SERVICE (files, NULL);
DEFAULT_SERVICE (dns, &default_files);
DEFAULT_SERVICE (compat, &default_dns);
*ni = &default_compat;
}
return 0; return 0;
} }
@ -246,9 +226,7 @@ nss_lookup_function (service_user *ni, const char *fct_name)
void do_open (void) void do_open (void)
{ {
/* The used function is found in GNU ld.so. XXX The first /* Open and relocate the shared object. */
argument to _dl_open used to be `_dl_loaded'. But this
does (currently) not work. */
ni->library->lib_handle = _dl_open (shlib_name, RTLD_LAZY); ni->library->lib_handle = _dl_open (shlib_name, RTLD_LAZY);
} }
@ -370,7 +348,7 @@ nss_parse_file (const char *fname)
ssize_t n; ssize_t n;
char *cp; char *cp;
n = getline (&line, &len, fp); n = __getline (&line, &len, fp);
if (n < 0) if (n < 0)
break; break;
if (line[n - 1] == '\n') if (line[n - 1] == '\n')
@ -410,48 +388,16 @@ nss_parse_file (const char *fname)
} }
static name_database_entry *
nss_getline (char *line)
{
const char *name;
name_database_entry *result;
service_user *last;
/* Ignore leading white spaces. ATTENTION: this is different from
what is implemented in Solaris. The Solaris man page says a line
beginning with a white space character is ignored. We regard
this as just another misfeature in Solaris. */
while (isspace (line[0]))
++line;
/* Recognize `<database> ":"'. */
name = line;
while (line[0] != '\0' && !isspace (line[0]) && line[0] != ':')
++line;
if (line[0] == '\0' || name == line)
/* Syntax error. */
return NULL;
*line++ = '\0';
result = (name_database_entry *) malloc (sizeof (name_database_entry));
if (result == NULL)
return NULL;
result->name = strdup (name);
if (result->name == NULL)
{
free (result);
return NULL;
}
result->service = NULL;
result->next = NULL;
last = NULL;
/* Read the source names: `<source> ( "[" <status> "=" <action> "]" )*'. */ /* Read the source names: `<source> ( "[" <status> "=" <action> "]" )*'. */
static service_user *
nss_parse_service_list (const char *line)
{
service_user *result = NULL, **nextp = &result;
while (1) while (1)
{ {
service_user *new_service; service_user *new_service;
size_t n; char *name;
while (isspace (line[0])) while (isspace (line[0]))
++line; ++line;
@ -470,15 +416,6 @@ nss_getline (char *line)
new_service = (service_user *) malloc (sizeof (service_user)); new_service = (service_user *) malloc (sizeof (service_user));
if (new_service == NULL) if (new_service == NULL)
return result; return result;
/* Test whether the source name is one of the aliases. */
for (n = 0; n < sizeof (service_alias) / sizeof (service_alias[0]); ++n)
if (strncmp (service_alias[n].alias, name, line - name) == 0
&& service_alias[n].alias[line - name] == '\0')
break;
if (n < sizeof (service_alias) / sizeof (service_alias[0]))
new_service->name = service_alias[n].value;
else else
{ {
char *source = (char *) malloc (line - name + 1); char *source = (char *) malloc (line - name + 1);
@ -507,8 +444,6 @@ nss_getline (char *line)
if (line[0] == '[') if (line[0] == '[')
{ {
int status;
/* Read criterions. */ /* Read criterions. */
do do
++line; ++line;
@ -516,6 +451,14 @@ nss_getline (char *line)
do do
{ {
int not;
enum nss_status status;
lookup_actions action;
/* Grok ! before name to mean all statii but that one. */
if (not = line[0] == '!')
++line;
/* Read status name. */ /* Read status name. */
name = line; name = line;
while (line[0] != '\0' && !isspace (line[0]) && line[0] != '=' while (line[0] != '\0' && !isspace (line[0]) && line[0] != '='
@ -525,18 +468,18 @@ nss_getline (char *line)
/* Compare with known statii. */ /* Compare with known statii. */
if (line - name == 7) if (line - name == 7)
{ {
if (strncasecmp (name, "SUCCESS", 7) == 0) if (__strncasecmp (name, "SUCCESS", 7) == 0)
status = NSS_STATUS_SUCCESS; status = NSS_STATUS_SUCCESS;
else if (strncasecmp (name, "UNAVAIL", 7) == 0) else if (__strncasecmp (name, "UNAVAIL", 7) == 0)
status = NSS_STATUS_UNAVAIL; status = NSS_STATUS_UNAVAIL;
else else
return result; return result;
} }
else if (line - name == 8) else if (line - name == 8)
{ {
if (strncasecmp (name, "NOTFOUND", 8) == 0) if (__strncasecmp (name, "NOTFOUND", 8) == 0)
status = NSS_STATUS_NOTFOUND; status = NSS_STATUS_NOTFOUND;
else if (strncasecmp (name, "TRYAGAIN", 8) == 0) else if (__strncasecmp (name, "TRYAGAIN", 8) == 0)
status = NSS_STATUS_TRYAGAIN; status = NSS_STATUS_TRYAGAIN;
else else
return result; return result;
@ -557,15 +500,29 @@ nss_getline (char *line)
&& line[0] != ']') && line[0] != ']')
++line; ++line;
if (line - name == 6 && strncasecmp (name, "RETURN", 6) == 0) if (line - name == 6 && __strncasecmp (name, "RETURN", 6) == 0)
new_service->actions[2 + status] = NSS_ACTION_RETURN; action = NSS_ACTION_RETURN;
else if (line - name == 8 else if (line - name == 8
&& strncasecmp (name, "CONTINUE", 8) == 0) && __strncasecmp (name, "CONTINUE", 8) == 0)
new_service->actions[2 + status] = NSS_ACTION_CONTINUE; action = NSS_ACTION_CONTINUE;
else else
return result; return result;
/* Match white spaces. */ if (not)
{
/* Save the current action setting for this status,
set them all to the given action, and reset this one. */
const lookup_actions save = new_service->actions[2 + status];
new_service->actions[2 + NSS_STATUS_TRYAGAIN] = action;
new_service->actions[2 + NSS_STATUS_UNAVAIL] = action;
new_service->actions[2 + NSS_STATUS_NOTFOUND] = action;
new_service->actions[2 + NSS_STATUS_SUCCESS] = action;
new_service->actions[2 + status] = save;
}
else
new_service->actions[2 + status] = action;
/* Skip white spaces. */
while (isspace (line[0])) while (isspace (line[0]))
++line; ++line;
} }
@ -575,14 +532,54 @@ nss_getline (char *line)
++line; ++line;
} }
if (last == NULL) *nextp = new_service;
result->service = new_service; nextp = &new_service->next;
else
last->next = new_service;
last = new_service;
} }
/* NOTREACHED */ }
static name_database_entry *
nss_getline (char *line)
{
const char *name;
name_database_entry *result;
/* Ignore leading white spaces. ATTENTION: this is different from
what is implemented in Solaris. The Solaris man page says a line
beginning with a white space character is ignored. We regard
this as just another misfeature in Solaris. */
while (isspace (line[0]))
++line;
/* Recognize `<database> ":"'. */
name = line;
while (line[0] != '\0' && !isspace (line[0]) && line[0] != ':')
++line;
if (line[0] == '\0' || name == line)
/* Syntax error. */
return NULL; return NULL;
*line++ = '\0';
result = (name_database_entry *) malloc (sizeof (name_database_entry));
if (result == NULL)
return NULL;
/* Save the database name. */
{
const size_t len = strlen (name) + 1;
char *new = malloc (len);
if (new == NULL)
{
free (result);
return NULL;
}
result->name = memcpy (new, name, len);
}
/* Parse the list of services. */
result->service = nss_parse_service_list (line);
result->next = NULL;
return result;
} }

View File

@ -108,9 +108,12 @@ typedef struct name_database
/* Interface functions for NSS. */ /* Interface functions for NSS. */
/* Get the data structure representing the specified database. More /* Get the data structure representing the specified database.
If there is no configuration for this database in the file,
parse a service list from DEFCONFIG and use that. More
than one function can use the database. */ than one function can use the database. */
int __nss_database_lookup (const char *database, service_user **ni); int __nss_database_lookup (const char *database, const char *defconfig,
service_user **ni);
/* Put first function with name FCT_NAME for SERVICE in FCTP. The /* Put first function with name FCT_NAME for SERVICE in FCTP. The

View File

@ -40,3 +40,6 @@ alpha-*-linux* libc=6
# names given in /etc/nsswitch.conf. # names given in /etc/nsswitch.conf.
*-*-* libnss_files=1 *-*-* libnss_files=1
*-*-* libnss_dns=1 *-*-* libnss_dns=1
# We use libdb.so.2 for the interface in version 1.85 of the Berkeley DB code.
*-*-* libdb=2

View File

@ -185,6 +185,8 @@ extern int __strcasecmp __P ((__const char *__s1, __const char *__s2));
extern int strcasecmp __P ((__const char *__s1, __const char *__s2)); extern int strcasecmp __P ((__const char *__s1, __const char *__s2));
/* Compare no more than N chars of S1 and S2, ignoring case. */ /* Compare no more than N chars of S1 and S2, ignoring case. */
extern int __strncasecmp __P ((__const char *__s1, __const char *__s2,
size_t __n));
extern int strncasecmp __P ((__const char *__s1, __const char *__s2, extern int strncasecmp __P ((__const char *__s1, __const char *__s2,
size_t __n)); size_t __n));

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992 Free Software Foundation, Inc. /* Copyright (C) 1992, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -25,7 +25,7 @@ Cambridge, MA 02139, USA. */
greater than zero if S1 is lexicographically less greater than zero if S1 is lexicographically less
than, equal to or greater than S2. */ than, equal to or greater than S2. */
int int
DEFUN(strncasecmp, (s1, s2, n), DEFUN(__strncasecmp, (s1, s2, n),
CONST char *s1 AND CONST char *s2 AND size_t n) CONST char *s1 AND CONST char *s2 AND size_t n)
{ {
register CONST unsigned char *p1 = (CONST unsigned char *) s1; register CONST unsigned char *p1 = (CONST unsigned char *) s1;
@ -45,3 +45,4 @@ DEFUN(strncasecmp, (s1, s2, n),
return c1 - c2; return c1 - c2;
} }
weak_alias (__strncasecmp, strncasecmp)