From patchwork Thu Jan 13 03:20:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mi Jinlong X-Patchwork-Id: 475211 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0D3G528028127 for ; Thu, 13 Jan 2011 03:16:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932830Ab1AMDQA (ORCPT ); Wed, 12 Jan 2011 22:16:00 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:61096 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S932524Ab1AMDP7 convert rfc822-to-8bit (ORCPT ); Wed, 12 Jan 2011 22:15:59 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 852C2170134; Thu, 13 Jan 2011 11:15:56 +0800 (CST) Received: from mailserver.fnst.cn.fujitus.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id p0D3AjGZ028650; Thu, 13 Jan 2011 11:10:45 +0800 Received: from [127.0.0.1] ([10.167.225.24]) by mailserver.fnst.cn.fujitus.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2011011311152999-159224 ; Thu, 13 Jan 2011 11:15:29 +0800 Message-ID: <4D2E6F70.2090501@cn.fujitsu.com> Date: Thu, 13 Jan 2011 11:20:16 +0800 From: Mi Jinlong User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: "J. Bruce Fields" CC: Fred Isaman , "J. Bruce Fields" , linux-nfs@vger.kernel.org Subject: Re: [PATCH 3/3] nfsd4: implement secinfo_no_name References: <1292612511-14203-1-git-send-email-bfields@redhat.com> <1292612511-14203-4-git-send-email-bfields@redhat.com> <4D183265.70608@cn.fujitsu.com> <20101229185609.GA12218@fieldses.org> <4D1C06E7.5060009@cn.fujitsu.com> <20110105010507.GC14744@fieldses.org> <20110105153713.GA13000@fieldses.org> <20110105172916.GD13000@fieldses.org> <4D253CDA.30605@cn.fujitsu.com> <20110111233229.GE28537@fieldses.org> In-Reply-To: <20110111233229.GE28537@fieldses.org> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-01-13 11:15:30, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2011-01-13 11:15:30 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 13 Jan 2011 03:17:41 +0000 (UTC) diff --git a/nfs4.1/server41tests/__init__.py b/nfs4.1/server41tests/__init__.py index 22cd664..3b4411a 100644 --- a/nfs4.1/server41tests/__init__.py +++ b/nfs4.1/server41tests/__init__.py @@ -2,6 +2,8 @@ __all__ = ["st_exchange_id.py", # draft 21 "st_compound.py", "st_create_session.py", "st_destroy_session.py", + "st_secinfo_no_name.py", + "st_secinfo.py", "st_sequence.py", "st_trunking.py", "st_open.py", diff --git a/nfs4.1/server41tests/st_secinfo.py b/nfs4.1/server41tests/st_secinfo.py new file mode 100644 index 0000000..c0e5b71 --- /dev/null +++ b/nfs4.1/server41tests/st_secinfo.py @@ -0,0 +1,57 @@ +from st_create_session import create_session +from nfs4_const import * +from environment import check, fail, use_obj, bad_sessionid, create_file +from nfs4_type import channel_attrs4 +import nfs4_ops as op +import nfs4lib + +def testSupported(t, env): + """Do a simple SECINFO + + FLAGS: all + CODE: SEC1 + """ + name = env.testname(t) + c = env.c1.new_client(env.testname(t)) + sess = c.create_session() + + # Create a tmpfile for testing + owner = "owner_%s" % name + path = sess.c.homedir + [name] + res = create_file(sess, owner, path, access=OPEN4_SHARE_ACCESS_WRITE) + check(res) + + # Get the filehandle of the tmpfile's parent dir + res = sess.compound(use_obj(sess.c.homedir) + [op.getfh()]) + check(res) + fh = res.resarray[-1].object + + # Just do a simple SECINFO + res = sess.compound([op.putfh(fh), op.secinfo(name)]) + check(res) + +def testSupported2(t, env): + """GETFH after do a SECINFO_NO_NAME or SECINFO + result in a NOFILEHANDLE error, See rfc 5661 section 2.6.3.1.1.8 + + FLAGS: all + CODE: SEC2 + """ + name = env.testname(t) + c = env.c1.new_client(env.testname(t)) + sess = c.create_session() + + # Create a tmpfile for testing + owner = "owner_%s" % name + path = sess.c.homedir + [name] + res = create_file(sess, owner, path, access=OPEN4_SHARE_ACCESS_WRITE) + check(res) + + # Get the filehandle of the tmpfile's parent dir + res = sess.compound(use_obj(sess.c.homedir) + [op.getfh()]) + check(res) + fh = res.resarray[-1].object + + # GETFH after do a SECINFO should get error NFS4ERR_NOFILEHANDLE + res = sess.compound([op.putfh(fh), op.secinfo(name), op.getfh()]) + check(res, NFS4ERR_NOFILEHANDLE) diff --git a/nfs4.1/server41tests/st_secinfo_no_name.py b/nfs4.1/server41tests/st_secinfo_no_name.py new file mode 100644 index 0000000..14bc410 --- /dev/null +++ b/nfs4.1/server41tests/st_secinfo_no_name.py @@ -0,0 +1,35 @@ +from st_create_session import create_session +from nfs4_const import * +from environment import check, fail, bad_sessionid, create_file +from nfs4_type import channel_attrs4 +import nfs4_ops as op +import nfs4lib + +def testSupported(t, env): + """Do a simple SECINFO_NO_NAME + send PUTROOTFH+SECINFO_NO_NAME, check is result legal + + FLAGS: all + CODE: SECNN1 + """ + c = env.c1.new_client(env.testname(t)) + sess = c.create_session() + + # Do a simple SECINFO_NO_NAME + res = sess.compound([op.putrootfh(), op.secinfo_no_name(0)]) + check(res) + +def testSupported2(t, env): + """GETFH after do a SECINFO_NO_NAME or SECINFO + result in a NOFILEHANDLE error, See rfc 5661 section 2.6.3.1.1.8 + + FLAGS: all + CODE: SECNN2 + """ + c = env.c1.new_client(env.testname(t)) + sess = c.create_session() + + # GETFH after do a SECINFO_NO_NAME should get error NFS4ERR_NOFILEHANDLE + res = sess.compound([op.putrootfh(), op.secinfo_no_name(0), op.getfh()]) + print res + check(res, NFS4ERR_NOFILEHANDLE)