Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
	* nscd/nscd_getpw_r.c (nscd_getpw_r): Mark as internal and take
	extra argument with length of key string.
	(__nscd_getpwnam_r): Call nscd_getpw_r with extra argument.
	(__nscd_getpwuid_r): Create key string on stack.
	* nscd/nscd_getgr_r.c: Mark local functions as internal.
	* nscd/nscd_gethst_r.c: Likewise.
  • Loading branch information
Ulrich Drepper committed Feb 2, 1999
1 parent b1418d8 commit 813f4f4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
1999-02-02 Ulrich Drepper <drepper@cygnus.com>

* nscd/nscd_getpw_r.c (nscd_getpw_r): Mark as internal and take
extra argument with length of key string.
(__nscd_getpwnam_r): Call nscd_getpw_r with extra argument.
(__nscd_getpwuid_r): Create key string on stack.
* nscd/nscd_getgr_r.c: Mark local functions as internal.
* nscd/nscd_gethst_r.c: Likewise.

* sysdeps/unix/sysv/linux/reboot.c: Make sure first parameter is
correctly passed to the kernel even on 64bit platforms.
Patch by Bruce Elliott <bde@nwlink.com>.
Expand Down
5 changes: 4 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GNU C Library NEWS -- history of user-visible changes. 1999-01-24
GNU C Library NEWS -- history of user-visible changes. 1999-02-02

Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
See the end for copying conditions.
Expand Down Expand Up @@ -35,6 +35,9 @@ Version 2.1
* the new headers <stdint.h> and <inttypes.h> from ISO C 9X provides
information and interfaces for the available integer types.

* about 130 new math functions were added to implement the ISO C9x math
library.

* the new header <complex.h> contains definitions of the complex math
functions from ISO C 9X.

Expand Down
3 changes: 2 additions & 1 deletion nscd/nscd_getgr_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int __nss_not_use_nscd_group;

static int nscd_getgr_r (const char *key, size_t keylen, request_type type,
struct group *resultbuf, char *buffer,
size_t buflen);
size_t buflen) internal_function;


int
Expand Down Expand Up @@ -89,6 +89,7 @@ open_socket (void)


static int
internal_function
nscd_getgr_r (const char *key, size_t keylen, request_type type,
struct group *resultbuf, char *buffer, size_t buflen)
{
Expand Down
3 changes: 2 additions & 1 deletion nscd/nscd_gethst_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int __nss_not_use_nscd_hosts;

static int nscd_gethst_r (const char *key, size_t keylen, request_type type,
struct hostent *resultbuf, char *buffer,
size_t buflen, int *h_errnop);
size_t buflen, int *h_errnop) internal_function;


int
Expand Down Expand Up @@ -114,6 +114,7 @@ open_socket (void)


static int
internal_function
nscd_gethst_r (const char *key, size_t keylen, request_type type,
struct hostent *resultbuf, char *buffer, size_t buflen,
int *h_errnop)
Expand Down
32 changes: 14 additions & 18 deletions nscd/nscd_getpw_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@

int __nss_not_use_nscd_passwd;

static int nscd_getpw_r (const char *key, request_type type,
static int nscd_getpw_r (const char *key, size_t keylen, request_type type,
struct passwd *resultbuf, char *buffer,
size_t buflen);
size_t buflen) internal_function;

int
__nscd_getpwnam_r (const char *name, struct passwd *resultbuf, char *buffer,
Expand All @@ -44,25 +44,20 @@ __nscd_getpwnam_r (const char *name, struct passwd *resultbuf, char *buffer,
if (name == NULL)
return 1;

return nscd_getpw_r (name, GETPWBYNAME, resultbuf, buffer, buflen);
return nscd_getpw_r (name, strlen (name) + 1, GETPWBYNAME, resultbuf,
buffer, buflen);
}

int
__nscd_getpwuid_r (uid_t uid, struct passwd *resultbuf, char *buffer,
size_t buflen)
{
char *p = buffer;
int plen;
char buf[12];
size_t n;

plen = __snprintf (buffer, buflen, "%d", uid);
if (plen == -1)
{
__set_errno (ERANGE);
return -1;
}
p = buffer + plen + 1;
n = __snprintf (buf, sizeof (buf), "%d", uid) + 1;

return nscd_getpw_r (buffer, GETPWBYUID, resultbuf, p, buflen - plen - 1);
return nscd_getpw_r (buf, n, GETPWBYUID, resultbuf, buffer, buflen);
}

/* Create a socket connected to a name. */
Expand Down Expand Up @@ -93,8 +88,9 @@ open_socket (void)
}

static int
nscd_getpw_r (const char *key, request_type type, struct passwd *resultbuf,
char *buffer, size_t buflen)
internal_function
nscd_getpw_r (const char *key, size_t keylen, request_type type,
struct passwd *resultbuf, char *buffer, size_t buflen)
{
int sock = open_socket ();
request_header req;
Expand All @@ -109,16 +105,16 @@ nscd_getpw_r (const char *key, request_type type, struct passwd *resultbuf,

req.version = NSCD_VERSION;
req.type = type;
req.key_len = strlen (key) + 1;
req.key_len = keylen;
nbytes = __write (sock, &req, sizeof (request_header));
if (nbytes != sizeof (request_header))
{
__close (sock);
return 1;
}

nbytes = __write (sock, key, req.key_len);
if (nbytes != req.key_len)
nbytes = __write (sock, key, keylen);
if (nbytes != keylen)
{
__close (sock);
return 1;
Expand Down

0 comments on commit 813f4f4

Please sign in to comment.