def testBadTags(t, env): """COMPOUND with invalid utf8 tags FLAGS: compound utf8 ganesha CODE: COMP3 """ c = env.c1 for tag in get_invalid_utf8strings(): res = c.compound([], tag=tag) check(res, NFS4ERR_INVAL, "Compound with invalid utf8 tag %s" % repr(tag))
def testInvalidUtf8(t, env): """LOOKUP with bad UTF-8 name strings should return NFS4ERR_INVAL FLAGS: lookup utf8 DEPEND: CODE: LOOK7 """ c = env.c1 for name in get_invalid_utf8strings(): res = c.compound(c.use_obj(c.homedir + [name])) check(res, NFS4ERR_INVAL, "LOOKUP object with invalid utf-8 name %s" % repr(name)[1:-1])
def testInvalidUtf8(t, env): """LOOKUP with bad UTF-8 name strings should return NFS4ERR_INVAL FLAGS: lookup utf8 ganesha DEPEND: CODE: LOOK7 """ c = env.c1 for name in get_invalid_utf8strings(): res = c.compound(c.use_obj(c.homedir + [name])) check(res, NFS4ERR_INVAL, "LOOKUP object with invalid utf-8 name %s" % repr(name)[1:-1])
def testBadutf8Newname(t, env): """RENAME with non-UTF8 newname should return NFS4ERR_INVAL FLAGS: rename utf8 ganesha DEPEND: MKDIR CODE: RNM9 """ c = env.c1 basedir = c.homedir + [t.code] c.maketree([t.code, [t.code]]) for name in get_invalid_utf8strings(): res = c.rename_obj(basedir + [t.code], basedir + [name]) check(res, NFS4ERR_INVAL, "RENAME with non-UTF8 newname %s/%s" % (t.code, repr(name)[1:-1]))
def testBadutf8Newname(t, env): """RENAME with non-UTF8 newname should return NFS4ERR_INVAL FLAGS: rename utf8 all DEPEND: MKDIR CODE: RNM9 """ c = env.c1 basedir = c.homedir + [t.code] c.maketree([t.code, [t.code]]) for name in get_invalid_utf8strings(): res = c.rename_obj(basedir + [t.code], basedir + [name]) check(res, NFS4ERR_INVAL, "RENAME with non-UTF8 newname %s/%s" % (t.code, repr(name)[1:-1]))
def testBadTags(t, env): """COMPOUND with invalid utf8 tags FLAGS: compound utf8 all CODE: COMP3 """ c = env.c1 for tag in get_invalid_utf8strings(): res = c.compound([c.putrootfh_op()], tag) check(res, NFS4ERR_INVAL, "Compound with invalid utf8 tag %s" % repr(tag)) if res.tag != tag: t.fail("Returned tag %s does not equal sent tag %s" % (repr(res.tag), repr(tag)))
def testInvalidUtf8(t, env): """LINK with bad UTF-8 name strings should return NFS4ERR_INVAL FLAGS: link utf8 DEPEND: LINKS LOOKFILE MKDIR CODE: LINK8 """ c = env.c1 res = c.create_obj(c.homedir + [t.code]) check(res) for name in get_invalid_utf8strings(): res = c.link(env.opts.usefile, c.homedir + [t.code, name]) check(res, NFS4ERR_INVAL, "LINK with invalid utf8 name %s/%s" % (t.code, repr(name)[1:-1]))
def testBadutf8Newname(t, env): """RENAME with non-UTF8 newname should return NFS4ERR_INVAL FLAGS: rename utf8 CODE: RNM9 """ name = env.testname(t) sess = env.c1.new_client_session(name) basedir = env.c1.homedir + [name] maketree(sess, [name, [name]]) for bad_utf8 in get_invalid_utf8strings(): res = rename_obj(sess, basedir + [name], basedir + [bad_utf8]) check(res, NFS4ERR_INVAL, "RENAME with non-UTF8 newname %s/%s" % (name, repr(bad_utf8)[1:-1]))
def testBadTags(t, env): """COMPOUND with invalid utf8 tags FLAGS: compound utf8 ganesha CODE: COMP3 """ c = env.c1 for tag in get_invalid_utf8strings(): res = c.compound([c.putrootfh_op()], tag) check(res, NFS4ERR_INVAL, "Compound with invalid utf8 tag %s" % repr(tag)) if res.tag != tag: t.fail("Returned tag %s does not equal sent tag %s" % (repr(res.tag), repr(tag)))
def testInvalidUtf8(t, env): """LINK with bad UTF-8 name strings should return NFS4ERR_INVAL FLAGS: link utf8 ganesha DEPEND: LINKS LOOKFILE MKDIR CODE: LINK8 """ c = env.c1 res = c.create_obj(c.homedir + [t.code]) check(res) for name in get_invalid_utf8strings(): res = c.link(env.opts.usefile, c.homedir + [t.code, name]) check(res, NFS4ERR_INVAL, "LINK with invalid utf8 name %s/%s" % (t.code, repr(name)[1:-1]))
def testBadutf8Oldname(t, env): """RENAME with non-UTF8 oldname should return NFS4ERR_INVAL FLAGS: rename utf8 all DEPEND: MKDIR CODE: RNM8 """ c = env.c1 basedir = c.homedir + [t.code] res = c.create_obj(basedir) check(res) for name in get_invalid_utf8strings(): res = c.rename_obj(basedir + [name], basedir + [t.code]) check(res, NFS4ERR_INVAL, "RENAME with non-UTF8 oldname %s/%s" % (t.code, repr(name)[1:-1]))
def testInvalidUtf8(t, env): """OPEN with bad UTF-8 name strings should return NFS4ERR_INVAL FLAGS: open utf8 DEPEND: MKDIR CODE: OPEN13 """ c = env.c1 c.init_connection() res = c.create_obj(c.homedir + [t.code]) check(res) for name in get_invalid_utf8strings(): res = c.create_file(t.code, c.homedir + [t.code, name]) check(res, NFS4ERR_INVAL, "Trying to open file with invalid utf8 " "name %s/%s" % (t.code, repr(name)[1:-1]))
def testBadutf8Oldname(t, env): """RENAME with non-UTF8 oldname should return NFS4ERR_INVAL FLAGS: rename utf8 ganesha CODE: RNM8 """ name = env.testname(t) sess = env.c1.new_client_session(name) basedir = env.c1.homedir + [name] res = create_obj(sess, basedir) check(res) for bad_utf8 in get_invalid_utf8strings(): res = rename_obj(sess, basedir + [bad_utf8], basedir + [name]) check(res, NFS4ERR_INVAL, "RENAME with non-UTF8 oldname %s/%s" % (name, repr(bad_utf8)[1:-1]))
def testNonUTF8(t, env): """REMOVE with non-UTF8 components should return NFS4ERR_INVAL FLAGS: remove utf8 all DEPEND: MKDIR CODE: RM5 """ c = env.c1 basedir = c.homedir + [t.code] res = c.create_obj(basedir) check(res) for name in get_invalid_utf8strings(): res = c.remove_obj(basedir, name) check(res, NFS4ERR_INVAL, "Trying to remove file with invalid utf8 " "name %s/%s" % (t.code, repr(name)[1:-1]))
def testInvalidUtf8(t, env): """SECINFO with bad UTF-8 name strings should return NFS4ERR_INVAL FLAGS: secinfo utf8 all DEPEND: SEC1 CODE: SEC6 """ c = env.c1 newdir = c.homedir + [t.code] res = c.create_obj(newdir) check(res) baseops = c.use_obj(newdir) for name in get_invalid_utf8strings(): res = c.compound(baseops + [c.secinfo_op(name)]) check(res, NFS4ERR_INVAL, "SECINFO of non-existant file with invalid " "utf8 name %s" % repr(name))
def testNonUTF8(t, env): """REMOVE with non-UTF8 components should return NFS4ERR_INVAL FLAGS: remove utf8 all DEPEND: MKDIR CODE: RM5 """ c = env.c1 basedir = c.homedir + [t.code] res = c.create_obj(basedir) check(res) for name in get_invalid_utf8strings(): res = c.remove_obj(basedir, name) check( res, NFS4ERR_INVAL, "Trying to remove file with invalid utf8 " "name %s/%s" % (t.code, repr(name)[1:-1]))
def testBadutf8Oldname(t, env): """RENAME with non-UTF8 oldname should return NFS4ERR_INVAL FLAGS: rename utf8 ganesha DEPEND: MKDIR CODE: RNM8 """ c = env.c1 basedir = c.homedir + [t.code] res = c.create_obj(basedir) check(res) for name in get_invalid_utf8strings(): res = c.rename_obj(basedir + [name], basedir + [t.code]) check( res, NFS4ERR_INVAL, "RENAME with non-UTF8 oldname %s/%s" % (t.code, repr(name)[1:-1]))
def testInvalidUtf8(t, env): """SECINFO with bad UTF-8 name strings should return NFS4ERR_INVAL FLAGS: secinfo utf8 DEPEND: SEC1 CODE: SEC6 """ c = env.c1 newdir = c.homedir + [t.code] res = c.create_obj(newdir) check(res) baseops = c.use_obj(newdir) for name in get_invalid_utf8strings(): res = c.compound(baseops + [c.secinfo_op(name)]) check( res, NFS4ERR_INVAL, "SECINFO of non-existant file with invalid " "utf8 name %s" % repr(name))
def testNonUTF8(t, env): """SETATTR(_MIMETYPE) with non-utf8 string should return NFS4ERR_INVAL The only attributes that use utf8 are MIMETYPE, OWNER, GROUP, and ACL. OWNER and GROUP are subject to too many restrictions to use. Similarly for ACL. FLAGS: setattr utf8 ganesha DEPEND: MKFILE CODE: SATT9 """ c = env.c1 c.create_confirm(t.code) supported = c.supportedAttrs() if not (supported & 2**FATTR4_MIMETYPE): t.fail_support("FATTR4_MIMETYPE not supported") baseops = c.use_obj(c.homedir + [t.code]) for name in get_invalid_utf8strings(): ops = baseops + [c.setattr({FATTR4_MIMETYPE: name})] res = c.compound(ops) check(res, NFS4ERR_INVAL, "SETATTR(_MIMETYPE) with non-utf8 string %s" % repr(name))
def testNonUTF8(t, env): """SETATTR(_MIMETYPE) with non-utf8 string should return NFS4ERR_INVAL The only attributes that use utf8 are MIMETYPE, OWNER, GROUP, and ACL. OWNER and GROUP are subject to too many restrictions to use. Similarly for ACL. FLAGS: setattr utf8 all DEPEND: MKFILE CODE: SATT9 """ c = env.c1 c.create_confirm(t.code) supported = c.supportedAttrs() if not (supported & 2**FATTR4_MIMETYPE): t.fail_support("FATTR4_MIMETYPE not supported") baseops = c.use_obj(c.homedir + [t.code]) for name in get_invalid_utf8strings(): ops = baseops + [c.setattr({FATTR4_MIMETYPE: name})] res = c.compound(ops) check(res, NFS4ERR_INVAL, "SETATTR(_MIMETYPE) with non-utf8 string %s" % repr(name))