Exemplo n.º 1
0
def testBadSession(t, env):
    """SEQUENCE sent on unknown session

    FLAGS: sequence all
    CODE: SEQ5
    """
    c = env.c1
    # SEQUENCE
    res = c.compound([op.sequence(bad_sessionid, 1, 0, 0, True)])
    check(res, NFS4ERR_BADSESSION)
Exemplo n.º 2
0
def testBadSession(t, env):
    """SEQUENCE sent on unknown session

    FLAGS: sequence all
    CODE: SEQ5
    """
    c = env.c1
    # SEQUENCE
    res = c.compound([op.sequence(bad_sessionid, 1, 0, 0, True)])
    check(res, NFS4ERR_BADSESSION)
Exemplo n.º 3
0
 def seq_op(self, slot=None, seq_delta=1, cache_this=False):
     if slot is None:
         slot = self.fore_channel.choose_slot()
     else:
         # XXX Does anyone use this? it will likely break things
         raise RuntimeError
         slot = self.fore_channel.slots[slot]
     # STUB, need to properly set highest
     return op.sequence(self.sessionid, slot.get_seqid(seq_delta),
                        slot.id, slot.id, cache_this)
Exemplo n.º 4
0
 def seq_op(self, slot=None, seq_delta=1, cache_this=False):
     if slot is None:
         slot = self.fore_channel.choose_slot()
     else:
         # XXX Does anyone use this? it will likely break things
         raise RuntimeError
         slot = self.fore_channel.slots[slot]
     # STUB, need to properly set highest
     return op.sequence(self.sessionid, slot.get_seqid(seq_delta),
                        slot.id, slot.id, cache_this)
Exemplo n.º 5
0
def testBadSlot(t, env):
    """Send a request with a bad slot

    FLAGS: sequence all
    CODE: SEQ8
    """
    c1 = env.c1.new_client(env.testname(t))
    # Session has 8 slots (numbered 0 through 7)
    attrs = channel_attrs4(0, 8192, 8192, 8192, 128, 8, [])
    sess1 = c1.create_session(fore_attrs = attrs)
    # Send sequence on (non-existant) slot number 8
    res = env.c1.compound([op.sequence(sess1.sessionid, 1, 8, 8, True)])
    check(res, NFS4ERR_BADSLOT)
Exemplo n.º 6
0
def testBadSequenceidAtSlot(t, env):
    """ If the difference between sa_sequenceid and the server's cached
        sequence ID at the slot ID is two (2) or more, or if sa_sequenceid
        is less than the cached sequence ID , server MUST return
        NFS4ERR_SEQ_MISORDERED. rfc5661 18.46.3

    FLAGS: sequence all
    CODE: SEQ13
    """
    c = env.c1.new_client(env.testname(t))
    # CREATE_SESSION
    sess1 = c.create_session()

    sid = sess1.sessionid
    res = c.c.compound([op.sequence(sid, 1, 2, 3, True)])
    check(res)

    seqid = res.resarray[0].sr_sequenceid
    # SEQUENCE with bad sr_sequenceid
    res = c.c.compound([op.sequence(sid, seqid + 2, 2, 3, True)])
    check(res, NFS4ERR_SEQ_MISORDERED)

    res = c.c.compound([op.sequence(sid, nfs4lib.dec_u32(seqid), 2, 3, True)])
    check(res, NFS4ERR_SEQ_MISORDERED)
Exemplo n.º 7
0
def testDestoryNotFinalOps(t, env):
    """ If the COMPOUND request starts with SEQUENCE, DESTROY_SESSION
        MUST be the final operation in the COMPOUND request.
        rfc5661 18.37.3

    FLAGS: destroy_session
    CODE: DSESS9004
    """
    c = env.c1.new_client(env.testname(t))
    sess1 = c.create_session()

    sid = sess1.sessionid
    res = c.c.compound([op.sequence(sid, 1, 2, 3, False),
                        op.destroy_session(sess1.sessionid),
                        op.putrootfh()])
    check(res, NFS4ERR_NOT_ONLY_OP)
Exemplo n.º 8
0
def testDestoryNotFinalOps(t, env):
    """ If the COMPOUND request starts with SEQUENCE, DESTROY_SESSION
        MUST be the final operation in the COMPOUND request.
        rfc5661 18.37.3

    FLAGS: destroy_session
    CODE: DSESS9004
    """
    c = env.c1.new_client(env.testname(t))
    sess1 = c.create_session()

    sid = sess1.sessionid
    res = c.c.compound([
        op.sequence(sid, 1, 2, 3, False),
        op.destroy_session(sess1.sessionid),
        op.putrootfh()
    ])
    check(res, NFS4ERR_NOT_ONLY_OP)
Exemplo n.º 9
0
def testRepTooBigToCache(t, env):
    """If requester sends a request for which the size of the reply
       would exceed ca_maxresponsesize_cached, the replier will return
       NFS4ERR_REP_TOO_BIG_TO_CACHE

    FLAGS: create_session all
    CODE: CSESS27
    """
    c = env.c1.new_client(env.testname(t))
    # CREATE_SESSION with a small ca_maxresponsesize_cached
    chan_attrs = channel_attrs4(0,8192,8192,10,128,8,[])
    res = c.c.compound([op.create_session(c.clientid, c.seqid, 0,
                                        chan_attrs, chan_attrs,
                                        123, [])], None)
    check(res)

    # SEQUENCE with cache this
    sid = res.resarray[0].csr_sessionid
    res = c.c.compound([op.sequence(sid, 1, 0, 0, True)])
    check(res, NFS4ERR_REP_TOO_BIG_TO_CACHE)
Exemplo n.º 10
0
def testSessionidSequenceidSlotid(t, env):
    """ The sr_sessionid result MUST equal sa_sessionid.
        The sr_slotid result MUST equal sa_slotid.
        The sr_sequenceid result MUST equal sa_sequenceid.
        rfc5661 18.46.3

    FLAGS: sequence all
    CODE: SEQ12
    """
    c = env.c1.new_client(env.testname(t))
    sess1 = c.create_session()

    # SEQUENCE
    sid = sess1.sessionid
    res = c.c.compound([op.sequence(sid, 1, 2, 3, True)])
    if not nfs4lib.test_equal(res.resarray[0].sr_sessionid, sid, "opaque"):
        fail("server return bad sessionid")

    if not nfs4lib.test_equal(res.resarray[0].sr_sequenceid, 1, "int"):
        fail("server return bad sequenceid")

    if not nfs4lib.test_equal(res.resarray[0].sr_slotid, 2, "int"):
        fail("server return bad slotid")