1999-06-30  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/gethostid.c: Handle failing call to
	getxxbyYY_r functions correctly for non-existing entry.
	* sunrpc/getrpcport.c: Likewise.
	* sunrpc/clnt_simp.c: Likewise.
	* inet/rexec.c: Likewise.
	* sunrpc/clnt_gen.c: Likewise.
	* inet/rcmd.c: Likewise.
	* sysdeps/generic/glob.c: Likewise.
This commit is contained in:
Ulrich Drepper 1999-06-30 17:41:35 +00:00
parent c11f120913
commit 1d863dc0b4
9 changed files with 40 additions and 15 deletions

View File

@ -1,3 +1,14 @@
1999-06-30 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/gethostid.c: Handle failing call to
getxxbyYY_r functions correctly for non-existing entry.
* sunrpc/getrpcport.c: Likewise.
* sunrpc/clnt_simp.c: Likewise.
* inet/rexec.c: Likewise.
* sunrpc/clnt_gen.c: Likewise.
* inet/rcmd.c: Likewise.
* sysdeps/generic/glob.c: Likewise.
1999-06-29 Andreas Jaeger <aj@arthur.rhein-neckar.de> 1999-06-29 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* pwd/Makefile (tests): Add rules for tst-getpw. * pwd/Makefile (tests): Add rules for tst-getpw.

View File

@ -80,7 +80,8 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
hstbuflen = 1024; hstbuflen = 1024;
tmphstbuf = __alloca (hstbuflen); tmphstbuf = __alloca (hstbuflen);
while (__gethostbyname_r (*ahost, &hostbuf, tmphstbuf, hstbuflen, while (__gethostbyname_r (*ahost, &hostbuf, tmphstbuf, hstbuflen,
&hp, &herr) != 0) &hp, &herr) != 0
|| hp == NULL)
if (herr != NETDB_INTERNAL || errno != ERANGE) if (herr != NETDB_INTERNAL || errno != ERANGE)
{ {
__set_h_errno (herr); __set_h_errno (herr);
@ -270,7 +271,8 @@ ruserok(rhost, superuser, ruser, luser)
buffer = __alloca (buflen); buffer = __alloca (buflen);
while (__gethostbyname_r (rhost, &hostbuf, buffer, buflen, &hp, &herr) while (__gethostbyname_r (rhost, &hostbuf, buffer, buflen, &hp, &herr)
!= 0) != 0
|| hp == NULL)
if (herr != NETDB_INTERNAL || errno != ERANGE) if (herr != NETDB_INTERNAL || errno != ERANGE)
return -1; return -1;
else else
@ -370,7 +372,8 @@ iruserok2 (raddr, superuser, ruser, luser, rhost)
char *buffer = __alloca (buflen); char *buffer = __alloca (buflen);
uid_t uid; uid_t uid;
if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd)) if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) != 0
|| pwd == NULL)
return -1; return -1;
dirlen = strlen (pwd->pw_dir); dirlen = strlen (pwd->pw_dir);
@ -469,7 +472,8 @@ __icheckhost (raddr, lhost, rhost)
buffer = __alloca (buflen); buffer = __alloca (buflen);
save_errno = errno; save_errno = errno;
while (__gethostbyname_r (lhost, &hostbuf, buffer, buflen, &hp, &herr) while (__gethostbyname_r (lhost, &hostbuf, buffer, buflen, &hp, &herr)
!= 0) != 0
|| hp = NULL)
if (herr != NETDB_INTERNAL || errno != ERANGE) if (herr != NETDB_INTERNAL || errno != ERANGE)
return (0); return (0);
else { else {

View File

@ -64,7 +64,8 @@ rexec(ahost, rport, name, pass, cmd, fd2p)
hstbuflen = 1024; hstbuflen = 1024;
hsttmpbuf = __alloca (hstbuflen); hsttmpbuf = __alloca (hstbuflen);
while (__gethostbyname_r (*ahost, &hostbuf, hsttmpbuf, hstbuflen, while (__gethostbyname_r (*ahost, &hostbuf, hsttmpbuf, hstbuflen,
&hp, &herr) != 0) &hp, &herr) != 0
|| hp == NULL)
if (herr != NETDB_INTERNAL || errno != ERANGE) if (herr != NETDB_INTERNAL || errno != ERANGE)
{ {
__set_h_errno (herr); __set_h_errno (herr);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 92, 95, 96, 97, 98 Free Software Foundation, Inc. /* Copyright (C) 1991, 92, 95, 96, 97, 98, 99 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
@ -135,6 +135,12 @@ extern int fgetpwent_r __P ((FILE *__restrict __stream,
#endif /* POSIX or reentrant */ #endif /* POSIX or reentrant */
#ifdef __USE_GNU
/* Re-construct the password-file line for the given uid
in the given buffer. This knows the format that the caller
will expect, but this need not be the format of the password file. */
extern int getpw __P ((__uid_t __uid, char *__buffer));
#endif
__END_DECLS __END_DECLS

View File

@ -78,7 +78,8 @@ clnt_create (const char *hostname, u_long prog, u_long vers,
hstbuflen = 1024; hstbuflen = 1024;
hsttmpbuf = __alloca (hstbuflen); hsttmpbuf = __alloca (hstbuflen);
while (__gethostbyname_r (hostname, &hostbuf, hsttmpbuf, hstbuflen, while (__gethostbyname_r (hostname, &hostbuf, hsttmpbuf, hstbuflen,
&h, &herr) != 0) &h, &herr) != 0
|| h == NULL)
if (herr != NETDB_INTERNAL || errno != ERANGE) if (herr != NETDB_INTERNAL || errno != ERANGE)
{ {
rpc_createerr.cf_stat = RPC_UNKNOWNHOST; rpc_createerr.cf_stat = RPC_UNKNOWNHOST;
@ -107,7 +108,8 @@ clnt_create (const char *hostname, u_long prog, u_long vers,
prtbuflen = 1024; prtbuflen = 1024;
prttmpbuf = __alloca (prtbuflen); prttmpbuf = __alloca (prtbuflen);
while (__getprotobyname_r (proto, &protobuf, prttmpbuf, prtbuflen, &p) != 0) while (__getprotobyname_r (proto, &protobuf, prttmpbuf, prtbuflen, &p) != 0
|| p == NULL)
if (errno != ERANGE) if (errno != ERANGE)
{ {
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;

View File

@ -105,7 +105,8 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum,
buflen = 1024; buflen = 1024;
buffer = __alloca (buflen); buffer = __alloca (buflen);
while (__gethostbyname_r (host, &hostbuf, buffer, buflen, while (__gethostbyname_r (host, &hostbuf, buffer, buflen,
&hp, &herr) != 0) &hp, &herr) != 0
|| hp == NULL)
if (herr != NETDB_INTERNAL || errno != ERANGE) if (herr != NETDB_INTERNAL || errno != ERANGE)
return (int) RPC_UNKNOWNHOST; return (int) RPC_UNKNOWNHOST;
else else

View File

@ -56,7 +56,8 @@ getrpcport (const char *host, u_long prognum, u_long versnum, u_int proto)
buflen = 1024; buflen = 1024;
buffer = __alloca (buflen); buffer = __alloca (buflen);
while (__gethostbyname_r (host, &hostbuf, buffer, buflen, &hp, &herr) != 0) while (__gethostbyname_r (host, &hostbuf, buffer, buflen, &hp, &herr) != 0
|| hp == NULL)
if (herr != NETDB_INTERNAL || errno != ERANGE) if (herr != NETDB_INTERNAL || errno != ERANGE)
return 0; return 0;
else else

View File

@ -650,13 +650,12 @@ glob (pattern, flags, errfunc, pglob)
pwbuflen = 1024; pwbuflen = 1024;
pwtmpbuf = (char *) __alloca (pwbuflen); pwtmpbuf = (char *) __alloca (pwbuflen);
success = 1;
while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p) while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p)
!= 0) != 0)
{ {
if (errno != ERANGE) if (errno != ERANGE)
{ {
success = 0; p = NULL;
break; break;
} }
pwbuflen *= 2; pwbuflen *= 2;
@ -665,9 +664,8 @@ glob (pattern, flags, errfunc, pglob)
} }
# else # else
p = getpwnam (name); p = getpwnam (name);
success = p != NULL;
# endif # endif
if (success) if (p != NULL)
home_dir = p->pw_dir; home_dir = p->pw_dir;
} }
} }

View File

@ -91,7 +91,8 @@ gethostid ()
/* To get the IP address we need to know the host name. */ /* To get the IP address we need to know the host name. */
while (__gethostbyname_r (hostname, &hostbuf, buffer, buflen, &hp, &herr) while (__gethostbyname_r (hostname, &hostbuf, buffer, buflen, &hp, &herr)
!= 0) != 0
|| hp == NULL)
if (herr != NETDB_INTERNAL || errno != ERANGE) if (herr != NETDB_INTERNAL || errno != ERANGE)
return 0; return 0;
else else