summary refs log tree commit diff
path: root/nis/nis_call.c
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nis_call.c')
-rw-r--r--nis/nis_call.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/nis/nis_call.c b/nis/nis_call.c
index 14041a160c..5b432b7981 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2001, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2001, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -40,25 +40,16 @@ extern u_short __pmap_getnisport (struct sockaddr_in *address, u_long program,
 unsigned long
 inetstr2int (const char *str)
 {
-  char buffer[strlen (str) + 3];
-  size_t buflen;
-  size_t i, j;
-
-  buflen = stpcpy (buffer, str) - buffer;
-
-  j = 0;
-  for (i = 0; i < buflen; ++i)
-    if (buffer[i] == '.')
+  size_t j = 0;
+  for (size_t i = 0; str[i] != '\0'; ++i)
+    if (str[i] == '.' && ++j == 4)
       {
-	++j;
-	if (j == 4)
-	  {
-	    buffer[i] = '\0';
-	    break;
-	  }
+	char buffer[i + 1];
+	buffer[i] = '\0';
+	return inet_addr (memcpy (buffer, str, i));
       }
 
-  return inet_addr (buffer);
+  return inet_addr (str);
 }
 
 void
@@ -179,7 +170,6 @@ __nisbind_connect (dir_binding *dbp)
 	}
       else
 	dbp->clnt->cl_auth = authunix_create_default ();
-      dbp->use_auth = TRUE;
     }
 
   return NIS_SUCCESS;
@@ -215,10 +205,7 @@ __nisbind_create (dir_binding *dbp, const nis_server *serv_val,
 
   dbp->class = -1;
   if (__nis_findfastest (dbp) < 1)
-    {
-      __nisbind_destroy (dbp);
-      return NIS_NAMEUNREACHABLE;
-    }
+    return NIS_NAMEUNREACHABLE;
 
   return NIS_SUCCESS;
 }
@@ -585,7 +572,6 @@ __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs,
 	  if (__nisbind_next (&bptr) != NIS_SUCCESS)
 	    {
 	      nis_free_directory (dir);
-	      __nisbind_destroy (&bptr);
 	      return NIS_NAMEUNREACHABLE;
 	    }
 	}