From patchwork Mon Jan 9 15:15:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mkrtchyan, Tigran" X-Patchwork-Id: 9505201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CF88B606E1 for ; Mon, 9 Jan 2017 15:26:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3E86284F0 for ; Mon, 9 Jan 2017 15:26:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8BAF284F4; Mon, 9 Jan 2017 15:26:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EC0F284F3 for ; Mon, 9 Jan 2017 15:25:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970039AbdAIPZ4 (ORCPT ); Mon, 9 Jan 2017 10:25:56 -0500 Received: from smtp-o-3.desy.de ([131.169.56.156]:32820 "EHLO smtp-o-3.desy.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970035AbdAIPZy (ORCPT ); Mon, 9 Jan 2017 10:25:54 -0500 X-Greylist: delayed 575 seconds by postgrey-1.27 at vger.kernel.org; Mon, 09 Jan 2017 10:25:54 EST X-Clacks-Overhead: GNU Terry Pratchett Received: from smtp-map-3.desy.de (smtp-map-3.desy.de [131.169.56.68]) by smtp-o-3.desy.de (DESY-O-3) with ESMTP id 98D3D280352 for ; Mon, 9 Jan 2017 16:16:17 +0100 (CET) Received: from ZITSWEEP2.win.desy.de (zitsweep2.win.desy.de [131.169.97.96]) by smtp-map-3.desy.de (DESY_MAP_3) with ESMTP id 8A8A911C9 for ; Mon, 9 Jan 2017 16:16:17 +0100 (MET) Received: from smtp-intra-3.desy.de (lb-40-26.desy.de) by ZITSWEEP2.win.desy.de (Clearswift SMTPRS 5.5.0) with ESMTP id ; Mon, 9 Jan 2017 16:16:17 +0100 Received: from ani.desy.de (zitpcx21033.desy.de [131.169.185.213]) by smtp-intra-3.desy.de (DESY-INTRA-3) with ESMTP id 4448211C9; Mon, 9 Jan 2017 16:16:17 +0100 (MET) From: Tigran Mkrtchyan To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, Tigran Mkrtchyan Subject: [PATCH] setattr: test how v4.0 server handles setting of zero length principals Date: Mon, 9 Jan 2017 16:15:56 +0100 Message-Id: <20170109151556.7522-1-tigran.mkrtchyan@desy.de> X-Mailer: git-send-email 2.9.3 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP my interpretation of rfc3530 expects NFS4ERR_INVAL is owner and owner_group are empty strings. Signed-off-by: Tigran Mkrtchyan --- nfs4.0/servertests/st_setattr.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/nfs4.0/servertests/st_setattr.py b/nfs4.0/servertests/st_setattr.py index b6a398b..b192ece 100644 --- a/nfs4.0/servertests/st_setattr.py +++ b/nfs4.0/servertests/st_setattr.py @@ -701,3 +701,34 @@ def testChangeGranularity(t, env): chattr4 = res.resarray[7].obj_attributes if chattr1 == chattr2 or chattr2 == chattr3 or chattr3 == chattr4: t.fail("consecutive SETATTR(mode)'s don't all change change attribute") + +def testEmptyPrincipal(t, env): + """Setting owner with zero length principal must fail + + FLAGS: setattr all + DEPEND: MKFILE + CODE: SATT16 + """ + c = env.c1 + path = c.homedir + [t.code] + res = c.create_obj(path, NF4SOCK) + check(res) + ops = c.use_obj(path) + [c.setattr({FATTR4_OWNER: ''})] + res = c.compound(ops) + check(res, NFS4ERR_INVAL, "Setting empty owner") + + +def testEmptyGroupPrincipal(t, env): + """Setting owner group with zero length principal must fail + + FLAGS: setattr all + DEPEND: MKFILE + CODE: SATT17 + """ + c = env.c1 + path = c.homedir + [t.code] + res = c.create_obj(path, NF4SOCK) + check(res) + ops = c.use_obj(path) + [c.setattr({FATTR4_OWNER_GROUP: ''})] + res = c.compound(ops) + check(res, NFS4ERR_INVAL, "Setting empty owner_group")