All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] setattr: test how v4.0 server handles setting of zero length principals
@ 2017-01-09 15:15 Tigran Mkrtchyan
  2017-01-13 17:03 ` J. Bruce Fields
  0 siblings, 1 reply; 2+ messages in thread
From: Tigran Mkrtchyan @ 2017-01-09 15:15 UTC (permalink / raw)
  To: bfields; +Cc: linux-nfs, Tigran Mkrtchyan

my interpretation of rfc3530 expects NFS4ERR_INVAL is owner and
owner_group are empty strings.

Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
---
 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")
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] setattr: test how v4.0 server handles setting of zero length principals
  2017-01-09 15:15 [PATCH] setattr: test how v4.0 server handles setting of zero length principals Tigran Mkrtchyan
@ 2017-01-13 17:03 ` J. Bruce Fields
  0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2017-01-13 17:03 UTC (permalink / raw)
  To: Tigran Mkrtchyan; +Cc: linux-nfs

On Mon, Jan 09, 2017 at 04:15:56PM +0100, Tigran Mkrtchyan wrote:
> my interpretation of rfc3530 expects NFS4ERR_INVAL is owner and
> owner_group are empty strings.

Thanks.  This hangs the Linux server.  Possibly an idmapd bug, but I
think nfsd should be checking for this case before it calls idmapd.

Anyway, that's not your problem.

Any reason you're using NF4SOCK instead of NF4REG?

--b.

> 
> Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
> ---
>  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")
> -- 
> 2.9.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-13 17:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 15:15 [PATCH] setattr: test how v4.0 server handles setting of zero length principals Tigran Mkrtchyan
2017-01-13 17:03 ` J. Bruce Fields

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.