Skip to contentSkip to conversation

NFS4.0: Case for linking to bad source patch with zero-length

PATCH Superseded Kinglong Mee 2 participants 3 messages Apr 24, 2014 – May 7, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 NFS4.0: Case for linking to bad source patch with zero-length

---
 nfs4.0/servertests/st_create.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)
nfs4.0/servertests/st_create.py +13 -0
index d2d6701..09c80cc 100644
@@ -161,6 +161,19 @@ def testZeroLength(t, env):
     res = c.create_obj(c.homedir + [''])
     check(res, NFS4ERR_INVAL, "CREATE with zero-length name")
 
+def testZeroLengthForLNK(t, env):
+    """CREATE with zero length name should return NFS4ERR_INVAL
+
+    FLAGS: create symlink all
+    CODE: CR9a
+    """
+    c = env.c1
+    ops = c.go_home()
+    objtype = createtype4(NF4LNK, **{'linkdata':''})
+    ops += [c.create_op(objtype, t.code, getDefaultAttr(c))]
+    res = c.compound(ops)
+    check(res, NFS4ERR_INVAL, "CREATE with zero-length name for SYMLINK")
+
 def testRegularFile(t, env):
     """CREATE should fail with NFS4ERR_BADTYPE for regular files
 
Signature · 1 line
1.9.0
#1 lore raw
Quoted 10 lines · Kinglong Mee
---
 nfs4.0/servertests/st_create.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)
nfs4.0/servertests/st_create.py +0 -0
index d2d6701..09c80cc 100644

nfs4.0/servertests/st_create.py def testZeroLength(t, env): · line 165

Quoted 5 lines
nfs4.0/servertests/st_create.py +2 -0
@@ -161,6 +161,19 @@ def testZeroLength(t, env):
     res = c.create_obj(c.homedir + [''])
     check(res, NFS4ERR_INVAL, "CREATE with zero-length name")
 
+def testZeroLengthForLNK(t, env):
+    """CREATE with zero length name should return NFS4ERR_INVAL

Is it actually true that attempts to create symlinks with zero-length content should fail with NFS4ERR_INVAL, and if so according to who? (Is there language in the RFC's?)

--b.

Quoted 17 lines
nfs4.0/servertests/st_create.py +11 -0
+
+    FLAGS: create symlink all
+    CODE: CR9a
+    """
+    c = env.c1
+    ops = c.go_home()
+    objtype = createtype4(NF4LNK, **{'linkdata':''})
+    ops += [c.create_op(objtype, t.code, getDefaultAttr(c))]
+    res = c.compound(ops)
+    check(res, NFS4ERR_INVAL, "CREATE with zero-length name for SYMLINK")
+
 def testRegularFile(t, env):
     """CREATE should fail with NFS4ERR_BADTYPE for regular files
 
Signature · 1 line
1.9.0
#2 lore raw
Quoted 14 lines · J. Bruce Fields
Quoted 13 lines · Kinglong Mee
---
 nfs4.0/servertests/st_create.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)
nfs4.0/servertests/st_create.py +0 -0
index d2d6701..09c80cc 100644
@@ -161,6 +161,19 @@ def testZeroLength(t, env):
     res = c.create_obj(c.homedir + [''])
     check(res, NFS4ERR_INVAL, "CREATE with zero-length name")
 
Quoted 6 lines

nfs4.0/servertests/st_create.py def testZeroLength(t, env): · line 165

Quoted 2 lines
nfs4.0/servertests/st_create.py +2 -0
+def testZeroLengthForLNK(t, env):
+    """CREATE with zero length name should return NFS4ERR_INVAL

Is it actually true that attempts to create symlinks with zero-length content should fail with NFS4ERR_INVAL, and if so according to who? (Is there language in the RFC's?)

This test is for Bernd Schubert's fix.
http://www.spinics.net/lists/linux-nfs/msg42800.html

According to rfc3530, 14.2.9, DESCRIPTION

If the newname has a length of 0 (zero), or if newname does not obey the UTF-8 definition, the error NFS4ERR_INVAL will be returned.

thanks,
Kinglong Mee

Quoted 18 lines
Quoted 17 lines
nfs4.0/servertests/st_create.py +11 -0
+
+    FLAGS: create symlink all
+    CODE: CR9a
+    """
+    c = env.c1
+    ops = c.go_home()
+    objtype = createtype4(NF4LNK, **{'linkdata':''})
+    ops += [c.create_op(objtype, t.code, getDefaultAttr(c))]
+    res = c.compound(ops)
+    check(res, NFS4ERR_INVAL, "CREATE with zero-length name for SYMLINK")
+
 def testRegularFile(t, env):
     """CREATE should fail with NFS4ERR_BADTYPE for regular files
 
Signature · 1 line
1.9.0