summary refs log tree commit diff
path: root/nss
diff options
context:
space:
mode:
Diffstat (limited to 'nss')
-rw-r--r--nss/digits_dots.c41
-rw-r--r--nss/getXXbyYY_r.c2
-rw-r--r--nss/nsswitch.c17
3 files changed, 32 insertions, 28 deletions
diff --git a/nss/digits_dots.c b/nss/digits_dots.c
index e1baafa843..dab64bfe1f 100644
--- a/nss/digits_dots.c
+++ b/nss/digits_dots.c
@@ -25,7 +25,6 @@
     {
       const char *cp;
       char *hostname;
-      struct hostent *host;
       typedef unsigned char host_addr_t [16];
       host_addr_t *host_addr;
       typedef char *host_addr_list_t [2];
@@ -53,7 +52,7 @@
 	  break;
 	}
 
-      size_needed = (sizeof (*host) + sizeof (*host_addr)
+      size_needed = (sizeof (*host_addr)
 		     + sizeof (*host_aliases) + sizeof (*h_addr_ptrs)
 		     + strlen (name) + 1);
 
@@ -86,8 +85,7 @@
 
       memset (buffer, 0, size_needed);
 
-      host = (struct hostent *) buffer;
-      host_addr = (host_addr_t *) ((char *) host + sizeof (*host));
+      host_addr = (host_addr_t *) buffer;
       host_aliases = (host_addr_list_t *)
 	((char *) host_addr + sizeof (*host_addr));
       h_addr_ptrs = (host_addr_list_t *)
@@ -115,13 +113,12 @@
 		      goto done;
 		    }
 
-		  strcpy (hostname, name);
-		  host->h_name = hostname;
-		  host->h_aliases = *host_aliases;
+		  resbuf.h_name = strcpy (hostname, name);
+		  resbuf.h_aliases = *host_aliases;
 		  (*host_aliases)[0] = NULL;
 		  (*h_addr_ptrs)[0] = (char *)host_addr;
 		  (*h_addr_ptrs)[1] = (char *)0;
-		  host->h_addr_list = *h_addr_ptrs;
+		  resbuf.h_addr_list = *h_addr_ptrs;
 		  if (_res.options & RES_USE_INET6 && af == AF_INET)
 		    {
 		      /* We need to change the IP v4 address into the
@@ -138,19 +135,19 @@
 		      *p++ = 0xff;
 		      /* Copy the IP v4 address. */
 		      memcpy (p, tmp, INADDRSZ);
-		      host->h_addrtype = AF_INET6;
-		      host->h_length = IN6ADDRSZ;
+		      resbuf.h_addrtype = AF_INET6;
+		      resbuf.h_length = IN6ADDRSZ;
 		    }
 		  else
 		    {
-		      host->h_addrtype = af;
-		      host->h_length = addr_size;
+		      resbuf.h_addrtype = af;
+		      resbuf.h_length = addr_size;
 		    }
 		  __set_h_errno (NETDB_SUCCESS);
 #ifdef HAVE_LOOKUP_BUFFER
 		  status = NSS_STATUS_SUCCESS;
 #else
-		  result = host;
+		  result = &resbuf;
 #endif
 		  goto done;
 		}
@@ -164,7 +161,6 @@
 	{
 	  const char *cp;
 	  char *hostname;
-	  struct hostent *host;
 	  typedef unsigned char host_addr_t [16];
 	  host_addr_t *host_addr;
 	  typedef char *host_addr_list_t [2];
@@ -192,7 +188,7 @@
 	      break;
 	    }
 
-	  size_needed = (sizeof (*host) + sizeof (*host_addr)
+	  size_needed = (sizeof (*host_addr)
 			 + sizeof (*host_aliases) + sizeof (*h_addr_ptrs)
 			 + strlen (name) + 1);
 
@@ -225,8 +221,7 @@
 
 	  memset (buffer, 0, size_needed);
 
-	  host = (struct hostent *) buffer;
-	  host_addr = (host_addr_t *) ((char *) host + sizeof (*host));
+	  host_addr = (host_addr_t *) buffer;
 	  host_aliases = (host_addr_list_t *)
 	    ((char *) host_addr + sizeof (*host_addr));
 	  h_addr_ptrs = (host_addr_list_t *)
@@ -252,19 +247,19 @@
 		    }
 
 		  strcpy (hostname, name);
-		  host->h_name = hostname;
-		  host->h_aliases = *host_aliases;
+		  resbuf.h_name = hostname;
+		  resbuf.h_aliases = *host_aliases;
 		  (*host_aliases)[0] = NULL;
 		  (*h_addr_ptrs)[0] = (char *) host_addr;
 		  (*h_addr_ptrs)[1] = (char *) 0;
-		  host->h_addr_list = *h_addr_ptrs;
-		  host->h_addrtype = af;
-		  host->h_length = addr_size;
+		  resbuf.h_addr_list = *h_addr_ptrs;
+		  resbuf.h_addrtype = af;
+		  resbuf.h_length = addr_size;
 		  __set_h_errno (NETDB_SUCCESS);
 #ifdef HAVE_LOOKUP_BUFFER
 		  status = NSS_STATUS_SUCCESS;
 #else
-		  result = host;
+		  result = &resbuf;
 #endif
 		  goto done;
 		}
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 988f46c88e..18f0bae03a 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -94,7 +94,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
   enum nss_status status = NSS_STATUS_UNAVAIL;
 
 #ifdef HANDLE_DIGITS_DOTS
+# define resbuf (*resbuf)
 # include "digits_dots.c"
+# undef resbuf
 #endif
 
   if (startp == NULL)
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 7dd3e0526f..18129bb5c0 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -35,12 +35,14 @@
 #include "nsswitch.h"
 
 /* Prototypes for the local functions.  */
-static void *nss_lookup_function (service_user *ni, const char *fct_name);
-static name_database *nss_parse_file (const char *fname);
-static name_database_entry *nss_getline (char *line);
-static service_user *nss_parse_service_list (const char *line);
+static void *nss_lookup_function (service_user *ni, const char *fct_name)
+     internal_function;
+static name_database *nss_parse_file (const char *fname) internal_function;
+static name_database_entry *nss_getline (char *line) internal_function;
+static service_user *nss_parse_service_list (const char *line)
+     internal_function;
 static service_library *nss_new_service (name_database *database,
-					 const char *name);
+					 const char *name) internal_function;
 
 
 /* Declare external database variables.  */
@@ -310,6 +312,7 @@ known_compare (const void *p1, const void *p2)
 
 
 static void *
+internal_function
 nss_lookup_function (service_user *ni, const char *fct_name)
 {
   void **found, *result;
@@ -476,6 +479,7 @@ nss_lookup_function (service_user *ni, const char *fct_name)
 
 
 static name_database *
+internal_function
 nss_parse_file (const char *fname)
 {
   FILE *fp;
@@ -548,6 +552,7 @@ nss_parse_file (const char *fname)
 	`( <source> ( "[" "!"? (<status> "=" <action> )+ "]" )? )*'
    */
 static service_user *
+internal_function
 nss_parse_service_list (const char *line)
 {
   service_user *result = NULL, **nextp = &result;
@@ -697,6 +702,7 @@ nss_parse_service_list (const char *line)
 }
 
 static name_database_entry *
+internal_function
 nss_getline (char *line)
 {
   const char *name;
@@ -743,6 +749,7 @@ nss_getline (char *line)
 
 
 static service_library *
+internal_function
 nss_new_service (name_database *database, const char *name)
 {
   service_library **currentp = &database->library;