Ejemplo n.º 1
0
 def __init__(self,
              host='localhost',
              port=51423,
              program=None,
              version=None,
              sec_list=None,
              timeout=15.0,
              uselowport=False):
     self.debug = 0
     t = threading.currentThread()
     self.lock = threading.Lock()
     self.remotehost = host
     self.remoteport = port
     self.timeout = timeout
     self.uselowport = uselowport
     self._socket = {}
     self.getsocket()  # init socket, is this needed here?
     self.ipaddress = self.socket.getsockname()[0]
     self._rpcpacker = {t: rpc_pack.RPCPacker()}
     self._rpcunpacker = {t: rpc_pack.RPCUnpacker('')}
     self.default_prog = program
     self.default_vers = version
     self.xid = 0L
     self._xidlist = {}
     if sec_list is None:
         sec_list = [SecAuthNone()]
     self.sec_list = sec_list
     self._init_security(self.sec_list)  # Note this can make calls
     self.security = sec_list[0]
Ejemplo n.º 2
0
 def getrpcpacker(self):
     t = threading.currentThread()
     self.lock.acquire()
     if t in self._rpcpacker:
         out = self._rpcpacker[t]
     else:
         out = self._rpcpacker[t] = rpc_pack.RPCPacker()
         self._rpcunpacker[t] = rpc_pack.RPCUnpacker('')
     self.lock.release()
     return out
Ejemplo n.º 3
0
 def __init__(self, prog=10, vers=4, host='', port=51423):
     Server.__init__(self, host, port)
     self.rpcpacker = rpc_pack.RPCPacker()
     self.rpcunpacker = rpc_pack.RPCUnpacker('')
     self.prog = prog
     self.vers = vers  # FRED - this could be more general
     self.security = SecAuthNone()
     self.readbufs = {}
     self.writebufs = {}
     self.packetbufs = {}  # store packets read until have a whole record
     self.recordbufs = {}  # write buffer for outgoing records
     self.sockets = {}
     self.s.listen(5)
Ejemplo n.º 4
0
 def __init__(self, prog=10, vers=4, host='', port=51423, ipv6=False):
     Server.__init__(self, host, port, ipv6)
     self.rpcpacker = rpc_pack.RPCPacker()
     self.rpcunpacker = rpc_pack.RPCUnpacker('')
     self.prog = prog
     self.vers = vers  # FRED - this could be more general
     self.security = {
         AUTH_NONE: SecAuthNone(),
         AUTH_SYS: SecAuthSys(),
     }
     if 'gss' in supported:
         self.security[RPCSEC_GSS] = SecAuthGss()
     self.readbufs = {}
     self.writebufs = {}
     self.packetbufs = {}  # store packets read until have a whole record
     self.recordbufs = {}  # write buffer for outgoing records
     self.sockets = {}
     self.s.listen(5)
Ejemplo n.º 5
0
    def __init__(self, prog=10, vers=4, host='', port=51423):
        Server.__init__(self, host, port)
        self.rpcpacker =  rpc_pack.RPCPacker()
        self.rpcunpacker = rpc_pack.RPCUnpacker('')
        self.prog = prog
        self.vers = vers # FRED - this could be more general
        self.security = {}
        for secname, sectype in {'none': AUTH_NONE,
                                 'sys':  AUTH_SYS,
                                 'gss':  RPCSEC_GSS,
                                }.iteritems():
            if supported.has_key(secname):
                self.security[sectype] = supported[secname]()

        self.readbufs = {}
        self.writebufs = {}
        self.packetbufs = {} # store packets read until have a whole record
        self.recordbufs = {} # write buffer for outgoing records
        self.sockets = {}
        self.s.listen(5)
Ejemplo n.º 6
0
    def __init__(self,
                 host='localhost',
                 port=51423,
                 program=None,
                 version=None,
                 sec_list=None,
                 timeout=15.0,
                 uselowport=False,
                 usenonrandomxid=False,
                 ipv6=False,
                 sym_resend=False):
        self.debug = 0
        t = threading.currentThread()
        self.lock = threading.Lock()
        self.remotehost = host
        self.remoteport = port
        self.timeout = timeout
        self.uselowport = uselowport
        self._socket = {}
        self.ipv6 = ipv6
        self.getsocket()  # init socket, is this needed here?
        self.ipaddress = self.socket.getsockname()[0]
        self._rpcpacker = {t: rpc_pack.RPCPacker()}
        self._rpcunpacker = {t: rpc_pack.RPCUnpacker('')}
        self.default_prog = program
        self.default_vers = version
        self.sym_resend = sym_resend

        if usenonrandomxid:
            self.xid = 0L
        else:
            # Use pseudo random XID, to avoid inadvertant replay-cache
            # problems (when running pynfs multiple times in a row.)
            self.xid = random.randint(0, 0xFFFFFFFF)

        self._xidlist = {}
        if sec_list is None:
            sec_list = [SecAuthNone()]
        self.sec_list = sec_list
        self._init_security(self.sec_list)  # Note this can make calls
        self.security = sec_list[0]