Update.
authorUlrich Drepper <drepper@redhat.com>
Wed, 30 Jun 1999 17:41:35 +0000 (17:41 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 30 Jun 1999 17:41:35 +0000 (17:41 +0000)
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.

ChangeLog
inet/rcmd.c
inet/rexec.c
pwd/pwd.h
sunrpc/clnt_gen.c
sunrpc/clnt_simp.c
sunrpc/getrpcport.c
sysdeps/generic/glob.c
sysdeps/unix/sysv/linux/gethostid.c

index 8aaf893..49c5c4b 100644 (file)
--- 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.
index 923f21f..30f20d1 100644 (file)
@@ -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 {
index 6ba7d20..897030e 100644 (file)
@@ -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);
index 50d62a1..a528a51 100644 (file)
--- 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
 
index e8656ee..0f38857 100644 (file)
@@ -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;
index 41d106e..e1e7e2a 100644 (file)
@@ -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
index 188c668..2e12482 100644 (file)
@@ -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
index b48dd7c..9b134c5 100644 (file)
@@ -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;
                }
            }
index f2ebbf2..6f501e3 100644 (file)
@@ -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