summaryrefslogtreecommitdiffstats
path: root/Demo/rpc
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-12-15 20:52:53 (GMT)
committerGuido van Rossum <guido@python.org>1992-12-15 20:52:53 (GMT)
commit749d0bbe6b0cdf377cf8afcf546288ee14c26782 (patch)
tree23d3900d2188a99e27109395dbf24d58db30e6cd /Demo/rpc
parent195a4f70a3156d0fe6045a7f30210cd35b521163 (diff)
downloadcpython-749d0bbe6b0cdf377cf8afcf546288ee14c26782.zip
cpython-749d0bbe6b0cdf377cf8afcf546288ee14c26782.tar.gz
cpython-749d0bbe6b0cdf377cf8afcf546288ee14c26782.tar.bz2
Make auth handling different
Diffstat (limited to 'Demo/rpc')
-rw-r--r--Demo/rpc/rpc.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/Demo/rpc/rpc.py b/Demo/rpc/rpc.py
index ba3bd54..607a25e 100644
--- a/Demo/rpc/rpc.py
+++ b/Demo/rpc/rpc.py
@@ -102,6 +102,21 @@ class Unpacker(xdr.Unpacker):
# Caller must get procedure-specific part of reply
+# Subroutines to create opaque authentication objects
+
+def make_auth_null():
+ return ''
+
+def make_auth_unix(seed, host, uid, gid, groups):
+ p = Packer().init()
+ p.pack_auth_unix(seed, host, uid, gid, groups)
+ return p.get_buf()
+
+def make_auth_unix_default():
+ return make_auth_unix(0, socket.gethostname(), \
+ os.getuid(), os.getgid(), [])
+
+
# Common base class for clients
class Client:
@@ -136,14 +151,13 @@ class Client:
def mkcred(self, proc):
if self.cred == None:
- p = Packer().init()
- p.pack_auth_unix(0, socket.gethostname(), \
- os.getuid(), os.getgid(), [])
- self.cred = p.get_buf()
- return (AUTH_UNIX, self.cred)
+ self.cred = (AUTH_NULL, make_auth_null())
+ return self.cred
def mkverf(self, proc):
- return (AUTH_NULL, '')
+ if self.verf == None:
+ self.verf = (AUTH_NULL, make_auth_null())
+ return self.verf
# Record-Marking standard support