about summary refs log tree commit diff
path: root/sunrpc/auth_none.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-03-20 18:35:13 +0000
committerUlrich Drepper <drepper@redhat.com>2001-03-20 18:35:13 +0000
commitf1e4a4a403f740c153acfc0cd96ecc5aa542e341 (patch)
tree55d564a6eba26109ea12055a24b7846c1a100fa4 /sunrpc/auth_none.c
parent373e6a512c30b2e34ac4a6f5b154edf45f400b35 (diff)
downloadglibc-f1e4a4a403f740c153acfc0cd96ecc5aa542e341.tar.gz
glibc-f1e4a4a403f740c153acfc0cd96ecc5aa542e341.tar.xz
glibc-f1e4a4a403f740c153acfc0cd96ecc5aa542e341.zip
Update.
	* sunrpc/Makefile (routines): Add rpc_thread.
	(CPPFLAGS): Add -D_RPC_THREAD_SAFE.
	* sunrpc/rpc_thread.c: New file.
	* sunrpc/Versions [libc] (GLIBC_2.2.3): Export __rpc_thread_destroy.
	* sunrpc/auth_none.c: Don't use global variables.  Access state in
	thread-local storage.
	* sunrpc/clnt_perr.c: Likewise.
	* sunrpc/clnt_raw.c: Likewise.
	* sunrpc/clnt_simp.c: Likewise.
	* sunrpc/key_call.c: Likewise.
	* sunrpc/rpc_common.c: Likewise.
	* sunrpc/svc.c: Likewise.
	* sunrpc/svc_raw.c: Likewise.
	* sunrpc/svc_simple.c: Likewise.
	* sunrpc/svcauth_des.c: Likewise.
	* hurd/hurd/threadvar.h (enum __hurd_threadvar_index): Add
	_HURD_THREADVAR_RPC_VARS.
	* sysdeps/generic/bits/libc-tsd.h: Mention _LIBC_TSD_KEY_RPC_VARS.
	* include/rpc/rpc.h: Define data structures for internal thread-local
	"global" variables.
	Based on patches by Eric Norum <eric.norum@usask.ca>.
Diffstat (limited to 'sunrpc/auth_none.c')
-rw-r--r--sunrpc/auth_none.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/sunrpc/auth_none.c b/sunrpc/auth_none.c
index b2f9273530..10e9b2f65a 100644
--- a/sunrpc/auth_none.c
+++ b/sunrpc/auth_none.c
@@ -35,8 +35,7 @@
  * credentials and verifiers to remote systems.
  */
 
-#include <rpc/types.h>
-#include <rpc/auth.h>
+#include <rpc/rpc.h>
 
 #define MAX_MARSHEL_SIZE 20
 
@@ -57,24 +56,29 @@ static struct auth_ops ops = {
   authnone_destroy
 };
 
-static struct authnone_private
-{
+struct authnone_private_s {
   AUTH no_client;
   char marshalled_client[MAX_MARSHEL_SIZE];
   u_int mcnt;
-} *authnone_private;
+};
+#ifdef _RPC_THREAD_SAFE_
+#define authnone_private ((struct authnone_private_ *)RPC_THREAD_VARIABLE(authnone_private_s))
+#else
+static struct authnone_private_s *authnone_private;
+#endif
 
 AUTH *
 authnone_create (void)
 {
-  struct authnone_private *ap = authnone_private;
+  struct authnone_private_s *ap;
   XDR xdr_stream;
   XDR *xdrs;
 
-  if (ap == 0)
+  ap = (struct authnone_private_s *) authnone_private;
+  if (ap == NULL)
     {
-      ap = (struct authnone_private *) calloc (1, sizeof (*ap));
-      if (ap == 0)
+      ap = (struct authnone_private_s *) calloc (1, sizeof (*ap));
+      if (ap == NULL)
 	return NULL;
       authnone_private = ap;
     }
@@ -97,10 +101,11 @@ authnone_create (void)
 static bool_t
 authnone_marshal (AUTH *client, XDR *xdrs)
 {
-  struct authnone_private *ap = authnone_private;
+  struct authnone_private_s *ap;
 
-  if (ap == 0)
-    return 0;
+  ap = (struct authnone_private_s *) authnone_private;
+  if (ap == NULL)
+    return FALSE;
   return (*xdrs->x_ops->x_putbytes) (xdrs, ap->marshalled_client, ap->mcnt);
 }