]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add explicit auth call
authorGuido van Rossum <guido@python.org>
Tue, 15 Dec 1992 20:53:17 +0000 (20:53 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 15 Dec 1992 20:53:17 +0000 (20:53 +0000)
Demo/rpc/mountclient.py

index 021de8c760a35c8fab61cb3571fa9423224d763d..a0de94b93d07501a1de6d7855c35f02b61418444 100644 (file)
@@ -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>)