Exemple #1
0
    def __init__(self, opts):
        self._lock = Lock()
        self.opts = opts
        self.c1 = nfs4client.NFS4Client(opts.server, opts.port,
                                        opts.minorversion)
        s1 = rpc.security.instance(opts.flavor)
        if opts.flavor == rpc.AUTH_NONE:
            self.cred1 = s1.init_cred()
        elif opts.flavor == rpc.AUTH_SYS:
            self.cred1 = s1.init_cred(uid=opts.uid,
                                      gid=opts.gid,
                                      name=opts.machinename)
        elif opts.flavor == rpc.RPCSEC_GSS:
            call = self.c1.make_call_function(self.c1.c1, 0,
                                              self.c1.default_prog,
                                              self.c1.default_vers)
            krb5_cred = AuthGss().init_cred(call,
                                            target="nfs@%s" % opts.server)
            krb5_cred.service = opts.service
            self.cred1 = krb5_cred
        self.c1.set_cred(self.cred1)
        self.cred2 = AuthSys().init_cred(uid=1111, gid=37, name="shampoo")

        opts.home = opts.path + ['tmp']
        self.c1.homedir = opts.home
        # Put this after client creation, to ensure _last_verf bigger than
        # any natural client verifiers
        self.timestamp = int(time.time())
        self._last_verf = self.timestamp + 1
        self.filedata = "This is the file test data."
        self.linkdata = "/etc/X11"
        self.stateid0 = stateid4(0, '')
        self.stateid1 = stateid4(0xffffffff, '\xff' * 12)

        log.info("Created client to %s, %i" % (opts.server, opts.port))
Exemple #2
0
    def __init__(self, opts):
        self._lock = Lock()
        self.opts = opts
        self.c1 = nfs4client.NFS4Client(opts.server, opts.port, opts.minorversion)
        s1 = rpc.security.instance(opts.flavor)
        if opts.flavor == rpc.AUTH_NONE:
            self.cred1 = s1.init_cred()
        elif opts.flavor == rpc.AUTH_SYS:
            self.cred1 = s1.init_cred(uid=opts.uid, gid=opts.gid, name=opts.machinename)
        elif opts.flavor == rpc.RPCSEC_GSS:
            call = self.c1.make_call_function(self.c1.c1, 0,
                                              self.c1.default_prog,
                                              self.c1.default_vers)
            krb5_cred = AuthGss().init_cred(call, target="nfs@%s" % opts.server)
            krb5_cred.service = opts.service
            self.cred1 = krb5_cred
        self.c1.set_cred(self.cred1)
        self.cred2 = AuthSys().init_cred(uid=1111, gid=37, name="shampoo")

        opts.home = opts.path + ['tmp']
        self.c1.homedir = opts.home
        # Put this after client creation, to ensure _last_verf bigger than
        # any natural client verifiers
        self.timestamp = int(time.time())
        self._last_verf = self.timestamp + 1
        self.filedata = "This is the file test data."
        self.linkdata = "/etc/X11"
        self.stateid0 = stateid4(0, '')
        self.stateid1 = stateid4(0xffffffffL, '\xff'*12)

        log.info("Created client to %s, %i" % (opts.server, opts.port))