mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Make auth handling different
This commit is contained in:
parent
195a4f70a3
commit
749d0bbe6b
1 changed files with 20 additions and 6 deletions
|
|
@ -102,6 +102,21 @@ class Unpacker(xdr.Unpacker):
|
||||||
# Caller must get procedure-specific part of reply
|
# 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
|
# Common base class for clients
|
||||||
|
|
||||||
class Client:
|
class Client:
|
||||||
|
|
@ -136,14 +151,13 @@ class Client:
|
||||||
|
|
||||||
def mkcred(self, proc):
|
def mkcred(self, proc):
|
||||||
if self.cred == None:
|
if self.cred == None:
|
||||||
p = Packer().init()
|
self.cred = (AUTH_NULL, make_auth_null())
|
||||||
p.pack_auth_unix(0, socket.gethostname(), \
|
return self.cred
|
||||||
os.getuid(), os.getgid(), [])
|
|
||||||
self.cred = p.get_buf()
|
|
||||||
return (AUTH_UNIX, self.cred)
|
|
||||||
|
|
||||||
def mkverf(self, proc):
|
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
|
# Record-Marking standard support
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue