Update.
* nss/nsswitch.h (service_user): Change name field from const char * to char[0]. (name_database_entry): Likewise. * nss/nsswitch.c (nss_parse_service_list): Adjust memory allocation for change of `service_user'. (nss_getline): Adjust memory allocation for change of `name_database_entry'.
This commit is contained in:
parent
ed3b44d39c
commit
1a989e004c
|
@ -1,5 +1,13 @@
|
||||||
1999-02-18 Ulrich Drepper <drepper@cygnus.com>
|
1999-02-18 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* nss/nsswitch.h (service_user): Change name field from const char *
|
||||||
|
to char[0].
|
||||||
|
(name_database_entry): Likewise.
|
||||||
|
* nss/nsswitch.c (nss_parse_service_list): Adjust memory allocation
|
||||||
|
for change of `service_user'.
|
||||||
|
(nss_getline): Adjust memory allocation for change of
|
||||||
|
`name_database_entry'.
|
||||||
|
|
||||||
* catgets/catgets.c: Correctly handle NLSPATH from environment
|
* catgets/catgets.c: Correctly handle NLSPATH from environment
|
||||||
[PR libc/980].
|
[PR libc/980].
|
||||||
|
|
||||||
|
@ -11,6 +19,7 @@
|
||||||
|
|
||||||
* string/bits/string2.h: Only use strncmp optimization if count
|
* string/bits/string2.h: Only use strncmp optimization if count
|
||||||
argument is constant.
|
argument is constant.
|
||||||
|
|
||||||
1999-02-16 Roland McGrath <roland@baalperazim.frob.com>
|
1999-02-16 Roland McGrath <roland@baalperazim.frob.com>
|
||||||
|
|
||||||
* sysdeps/mach/hurd/revoke.c: New file.
|
* sysdeps/mach/hurd/revoke.c: New file.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
|
@ -575,21 +575,12 @@ nss_parse_service_list (const char *line)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|
||||||
new_service = (service_user *) malloc (sizeof (service_user));
|
new_service = (service_user *) malloc (sizeof (service_user)
|
||||||
|
+ (line - name + 1));
|
||||||
if (new_service == NULL)
|
if (new_service == NULL)
|
||||||
return result;
|
return result;
|
||||||
else
|
|
||||||
{
|
|
||||||
char *source = (char *) malloc (line - name + 1);
|
|
||||||
if (source == NULL)
|
|
||||||
{
|
|
||||||
free (new_service);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
*((char *) __mempcpy (source, name, line - name)) = '\0';
|
|
||||||
|
|
||||||
new_service->name = source;
|
*((char *) __mempcpy (new_service->name, name, line - name)) = '\0';
|
||||||
}
|
|
||||||
|
|
||||||
/* Set default actions. */
|
/* Set default actions. */
|
||||||
new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
|
new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
|
||||||
|
@ -706,6 +697,7 @@ nss_getline (char *line)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
name_database_entry *result;
|
name_database_entry *result;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
/* Ignore leading white spaces. ATTENTION: this is different from
|
/* Ignore leading white spaces. ATTENTION: this is different from
|
||||||
what is implemented in Solaris. The Solaris man page says a line
|
what is implemented in Solaris. The Solaris man page says a line
|
||||||
|
@ -723,21 +715,14 @@ nss_getline (char *line)
|
||||||
return NULL;
|
return NULL;
|
||||||
*line++ = '\0';
|
*line++ = '\0';
|
||||||
|
|
||||||
result = (name_database_entry *) malloc (sizeof (name_database_entry));
|
len = strlen (name) + 1;
|
||||||
|
|
||||||
|
result = (name_database_entry *) malloc (sizeof (name_database_entry) + len);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Save the database name. */
|
/* Save the database name. */
|
||||||
{
|
memcpy (result->name, name, len);
|
||||||
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. */
|
/* Parse the list of services. */
|
||||||
result->service = nss_parse_service_list (line);
|
result->service = nss_parse_service_list (line);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997, 1998, 1999 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
|
||||||
|
@ -60,16 +60,16 @@ typedef struct
|
||||||
|
|
||||||
typedef struct service_user
|
typedef struct service_user
|
||||||
{
|
{
|
||||||
/* Name of the service (`files', `dns', `nis', ...). */
|
/* And the link to the next entry. */
|
||||||
const char *name;
|
struct service_user *next;
|
||||||
/* Action according to result. */
|
/* Action according to result. */
|
||||||
lookup_actions actions[5];
|
lookup_actions actions[5];
|
||||||
/* Link to the underlying library object. */
|
/* Link to the underlying library object. */
|
||||||
service_library *library;
|
service_library *library;
|
||||||
/* Collection of known functions. */
|
/* Collection of known functions. */
|
||||||
struct entry *known;
|
struct entry *known;
|
||||||
/* And the link to the next entry. */
|
/* Name of the service (`files', `dns', `nis', ...). */
|
||||||
struct service_user *next;
|
char name[0];
|
||||||
} service_user;
|
} service_user;
|
||||||
|
|
||||||
/* To access the action based on the status value use this macro. */
|
/* To access the action based on the status value use this macro. */
|
||||||
|
@ -78,12 +78,12 @@ typedef struct service_user
|
||||||
|
|
||||||
typedef struct name_database_entry
|
typedef struct name_database_entry
|
||||||
{
|
{
|
||||||
/* Name of the database. */
|
|
||||||
const char *name;
|
|
||||||
/* List of service to be used. */
|
|
||||||
service_user *service;
|
|
||||||
/* And the link to the next entry. */
|
/* And the link to the next entry. */
|
||||||
struct name_database_entry *next;
|
struct name_database_entry *next;
|
||||||
|
/* List of service to be used. */
|
||||||
|
service_user *service;
|
||||||
|
/* Name of the database. */
|
||||||
|
char name[0];
|
||||||
} name_database_entry;
|
} name_database_entry;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue