[03/17] CLNT: check the csr_sequence at CREATE_SESSION
diff mbox

Message ID 4D6DE38D.8050003@cn.fujitsu.com
State RFC, archived
Headers show

Commit Message

Mi Jinlong March 2, 2011, 6:28 a.m. UTC
None

Patch
diff mbox

diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
index b517c27..9786bf3 100644
--- a/nfs4.1/nfs4client.py
+++ b/nfs4.1/nfs4client.py
@@ -404,6 +404,7 @@  class SendChannel(object):
 class SessionRecord(object):
     def __init__(self, csr, client):
         self.sessionid = csr.csr_sessionid
+        self.seqid = csr.csr_sequence
         self.client = client
         self.c = client.c
         self.cred = client.cred
diff --git a/nfs4.1/server41tests/st_create_session.py b/nfs4.1/server41tests/st_create_session.py
index 1d02a50..4185aa8 100644
--- a/nfs4.1/server41tests/st_create_session.py
+++ b/nfs4.1/server41tests/st_create_session.py
@@ -396,3 +396,18 @@  def testNotOnlyOp(t, env):
                                         chan_attrs, chan_attrs,
                                         123, []), op.putrootfh()], None)
     check(res, NFS4ERR_NOT_ONLY_OP)
+
+def testCsr_sequence(t, env):
+    """The corresponding result of csa_sequence is csr_sequence,
+       which MUST be equal to csa_sequence.
+
+    FLAGS: create_session all
+    CODE: CSESS24
+    """
+    c = env.c1.new_client(env.testname(t))
+    # CREATE_SESSION
+    chan_attrs = channel_attrs4(0,8192,8192,8192,128,8,[])
+    csa_sequence = c.seqid
+    sess1 = c.create_session(fore_attrs=chan_attrs)
+    if not nfs4lib.test_equal(sess1.seqid, csa_sequence, "int"):
+        fail("Server returns bad csr_sequence which not equal to csa_sequence")