Add explicit auth call

This commit is contained in:
Guido van Rossum 1992-12-15 20:53:17 +00:00
parent 749d0bbe6b
commit 20f9960427
1 changed files with 13 additions and 0 deletions

View File

@ -8,6 +8,7 @@
# version of a protocol, use multiple inheritance as shown below. # version of a protocol, use multiple inheritance as shown below.
import rpc
from rpc import Packer, Unpacker, TCPClient, UDPClient from rpc import Packer, Unpacker, TCPClient, UDPClient
MOUNTPROG = 100005 MOUNTPROG = 100005
@ -76,6 +77,18 @@ def addpackers(self):
self.packer = MountPacker().init() self.packer = MountPacker().init()
self.unpacker = MountUnpacker().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 # The methods Mnt, Dump etc. each implement one Remote
# Procedure Call. Their general structure is # Procedure Call. Their general structure is
# self.start_call(<procedure-number>) # self.start_call(<procedure-number>)