summaryrefslogtreecommitdiff
path: root/Demo/rpc/mountclient.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-12-15 20:53:17 +0000
committerGuido van Rossum <guido@python.org>1992-12-15 20:53:17 +0000
commit68a2716c7cede435e9480645fda656042ebd9256 (patch)
treee164b69ec92a08897fa7afcd56f6819e3cea0336 /Demo/rpc/mountclient.py
parent31197bd30f520f12254fd2bc10b773783a0cda7b (diff)
downloadcpython-68a2716c7cede435e9480645fda656042ebd9256.tar.gz
Add explicit auth call
Diffstat (limited to 'Demo/rpc/mountclient.py')
-rw-r--r--Demo/rpc/mountclient.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Demo/rpc/mountclient.py b/Demo/rpc/mountclient.py
index 021de8c760..a0de94b93d 100644
--- a/Demo/rpc/mountclient.py
+++ b/Demo/rpc/mountclient.py
@@ -8,6 +8,7 @@
# version of a protocol, use multiple inheritance as shown below.
+import rpc
from rpc import Packer, Unpacker, TCPClient, UDPClient
MOUNTPROG = 100005
@@ -76,6 +77,18 @@ class PartialMountClient:
self.packer = MountPacker().init()
self.unpacker = MountUnpacker().init('')
+ # This function is called to gobble up a suitable
+ # authentication object for a call to procedure 'proc'.
+ # (Experiments suggest that for Mnt/Unmnt, Unix authentication
+ # is necessary, while the other calls require no
+ # authentication.)
+ def mkcred(self, proc):
+ if proc not in (1, 3, 4): # not Mnt/Unmnt/Unmntall
+ return rpc.AUTH_NULL, ''
+ if self.cred == None:
+ self.cred = rpc.AUTH_UNIX, rpc.make_auth_unix_default()
+ return self.cred
+
# The methods Mnt, Dump etc. each implement one Remote
# Procedure Call. Their general structure is
# self.start_call(<procedure-number>)