Ejemplo n.º 1
0
def testInvalidAttr1(t, env):
    """SETATTR with invalid attribute data should return NFS4ERR_BADXDR

    This testcase try to set FATTR4_MODE but does not send any mode data.

    FLAGS: setattr all
    DEPEND: MODE MKDIR
    CODE: SATT7
    """
    c = env.c1
    path = c.homedir + [t.code]
    res = c.create_obj(path)
    check(res)
    badattr = dict2fattr({FATTR4_MODE: 0644})
    badattr.attr_vals = ''
    res = c.compound(c.use_obj(path) + [c.setattr_op(env.stateid0, badattr)])
    check(res, NFS4ERR_BADXDR, "SETATTR(FATTR4_MODE) with no data")
Ejemplo n.º 2
0
def testInvalidAttr2(t, env):
    """SETATTR with extraneous attribute data should return NFS4ERR_BADXDR

    This testcase try to set FATTR4_MODE with extraneous attribute data
    appended

    FLAGS: setattr all
    DEPEND: MODE MKDIR
    CODE: SATT8
    """
    c = env.c1
    path = c.homedir + [t.code]
    res = c.create_obj(path)
    check(res)
    badattr = dict2fattr({FATTR4_MODE: 0644})
    badattr.attr_vals += 'Garbage data'
    res = c.compound(c.use_obj(path) + [c.setattr_op(env.stateid0, badattr)])
    check(res, NFS4ERR_BADXDR,
          "SETATTR(FATTR4_MODE) with extraneous attribute data appended")
Ejemplo n.º 3
0
def getDefaultAttr(c):
    attr = {}
    # attr[FATTR4_OWNER] = c.security.get_owner()
    # attr[FATTR4_OWNER_GROUP] = c.security.get_group()
    attr[FATTR4_MODE] = 0755
    return dict2fattr(attr)
Ejemplo n.º 4
0
def getDefaultAttr(c):
    attr = {}
    #attr[FATTR4_OWNER] = c.security.get_owner()
    #attr[FATTR4_OWNER_GROUP] = c.security.get_group()
    attr[FATTR4_MODE] = 0755
    return dict2fattr(attr)