summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-06-30 17:41:35 +0000
committerUlrich Drepper <drepper@redhat.com>1999-06-30 17:41:35 +0000
commit1d863dc0b41da22b5a06110d67b47a0f102cb639 (patch)
tree3570b4ace8356ad2e0dd2ce8ab2edb900257203d
parentc11f120913b8c6a6be67ddf3dc36a3d239f2f322 (diff)
downloadglibc-1d863dc0b41da22b5a06110d67b47a0f102cb639.tar.gz
glibc-1d863dc0b41da22b5a06110d67b47a0f102cb639.tar.xz
glibc-1d863dc0b41da22b5a06110d67b47a0f102cb639.zip
Update.
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.
-rw-r--r--ChangeLog11
-rw-r--r--inet/rcmd.c12
-rw-r--r--inet/rexec.c3
-rw-r--r--pwd/pwd.h8
-rw-r--r--sunrpc/clnt_gen.c6
-rw-r--r--sunrpc/clnt_simp.c3
-rw-r--r--sunrpc/getrpcport.c3
-rw-r--r--sysdeps/generic/glob.c6
-rw-r--r--sysdeps/unix/sysv/linux/gethostid.c3
9 files changed, 40 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 8aaf8932a8..49c5c4b264 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
 	* pwd/Makefile (tests): Add rules for tst-getpw.
diff --git a/inet/rcmd.c b/inet/rcmd.c
index 923f21fe40..30f20d1922 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -80,7 +80,8 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
 	hstbuflen = 1024;
 	tmphstbuf = __alloca (hstbuflen);
 	while (__gethostbyname_r (*ahost, &hostbuf, tmphstbuf, hstbuflen,
-				  &hp, &herr) != 0)
+				  &hp, &herr) != 0
+	       || hp == NULL)
 	  if (herr != NETDB_INTERNAL || errno != ERANGE)
 	    {
 	      __set_h_errno (herr);
@@ -270,7 +271,8 @@ ruserok(rhost, superuser, ruser, luser)
 	buffer = __alloca (buflen);
 
 	while (__gethostbyname_r (rhost, &hostbuf, buffer, buflen, &hp, &herr)
-	       != 0)
+	       != 0
+	       || hp == NULL)
 	  if (herr != NETDB_INTERNAL || errno != ERANGE)
 	    return -1;
 	  else
@@ -370,7 +372,8 @@ iruserok2 (raddr, superuser, ruser, luser, rhost)
       char *buffer = __alloca (buflen);
       uid_t uid;
 
-      if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd))
+      if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) != 0
+	  || pwd == NULL)
 	return -1;
 
       dirlen = strlen (pwd->pw_dir);
@@ -469,7 +472,8 @@ __icheckhost (raddr, lhost, rhost)
 	buffer = __alloca (buflen);
 	save_errno = errno;
 	while (__gethostbyname_r (lhost, &hostbuf, buffer, buflen, &hp, &herr)
-	       != 0)
+	       != 0
+	       || hp = NULL)
 		if (herr != NETDB_INTERNAL || errno != ERANGE)
 			return (0);
 		else {
diff --git a/inet/rexec.c b/inet/rexec.c
index 6ba7d20f71..897030e6b9 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -64,7 +64,8 @@ rexec(ahost, rport, name, pass, cmd, fd2p)
 	hstbuflen = 1024;
 	hsttmpbuf = __alloca (hstbuflen);
 	while (__gethostbyname_r (*ahost, &hostbuf, hsttmpbuf, hstbuflen,
-				  &hp, &herr) != 0)
+				  &hp, &herr) != 0
+	       || hp == NULL)
 	  if (herr != NETDB_INTERNAL || errno != ERANGE)
 	    {
 	      __set_h_errno (herr);
diff --git a/pwd/pwd.h b/pwd/pwd.h
index 50d62a1708..a528a51948 100644
--- a/pwd/pwd.h
+++ b/pwd/pwd.h
@@ -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.
 
    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 */
 
+#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
 
diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c
index e8656eefc7..0f388572d4 100644
--- a/sunrpc/clnt_gen.c
+++ b/sunrpc/clnt_gen.c
@@ -78,7 +78,8 @@ clnt_create (const char *hostname, u_long prog, u_long vers,
   hstbuflen = 1024;
   hsttmpbuf = __alloca (hstbuflen);
   while (__gethostbyname_r (hostname, &hostbuf, hsttmpbuf, hstbuflen,
-			    &h, &herr) != 0)
+			    &h, &herr) != 0
+	 || h == NULL)
     if (herr != NETDB_INTERNAL || errno != ERANGE)
       {
 	rpc_createerr.cf_stat = RPC_UNKNOWNHOST;
@@ -107,7 +108,8 @@ clnt_create (const char *hostname, u_long prog, u_long vers,
 
   prtbuflen = 1024;
   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)
       {
 	rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
diff --git a/sunrpc/clnt_simp.c b/sunrpc/clnt_simp.c
index 41d106e570..e1e7e2ab73 100644
--- a/sunrpc/clnt_simp.c
+++ b/sunrpc/clnt_simp.c
@@ -105,7 +105,8 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum,
       buflen = 1024;
       buffer = __alloca (buflen);
       while (__gethostbyname_r (host, &hostbuf, buffer, buflen,
-				&hp, &herr) != 0)
+				&hp, &herr) != 0
+	     || hp == NULL)
 	if (herr != NETDB_INTERNAL || errno != ERANGE)
 	  return (int) RPC_UNKNOWNHOST;
 	else
diff --git a/sunrpc/getrpcport.c b/sunrpc/getrpcport.c
index 188c668c1d..2e12482abc 100644
--- a/sunrpc/getrpcport.c
+++ b/sunrpc/getrpcport.c
@@ -56,7 +56,8 @@ getrpcport (const char *host, u_long prognum, u_long versnum, u_int proto)
 
   buflen = 1024;
   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)
       return 0;
     else
diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c
index b48dd7c84a..9b134c5a0d 100644
--- a/sysdeps/generic/glob.c
+++ b/sysdeps/generic/glob.c
@@ -650,13 +650,12 @@ glob (pattern, flags, errfunc, pglob)
 		    pwbuflen = 1024;
 		  pwtmpbuf = (char *) __alloca (pwbuflen);
 
-		  success = 1;
 		  while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p)
 			 != 0)
 		    {
 		      if (errno != ERANGE)
 			{
-			  success = 0;
+			  p = NULL;
 			  break;
 			}
 		      pwbuflen *= 2;
@@ -665,9 +664,8 @@ glob (pattern, flags, errfunc, pglob)
 		    }
 #   else
 		  p = getpwnam (name);
-		  success = p != NULL;
 #   endif
-		  if (success)
+		  if (p != NULL)
 		    home_dir = p->pw_dir;
 		}
 	    }
diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c
index f2ebbf2b6a..6f501e391d 100644
--- a/sysdeps/unix/sysv/linux/gethostid.c
+++ b/sysdeps/unix/sysv/linux/gethostid.c
@@ -91,7 +91,8 @@ gethostid ()
 
   /* To get the IP address we need to know the host name.  */
   while (__gethostbyname_r (hostname, &hostbuf, buffer, buflen, &hp, &herr)
-	 != 0)
+	 != 0
+	 || hp == NULL)
     if (herr != NETDB_INTERNAL || errno != ERANGE)
       return 0;
     else