Esempio n. 1
0
static int CheckPosixLinuxDefaultACEs(EvalContext *ctx, Rlist *aces, AclMethod method, AclDefault acl_default,
                                      const char *file_path, Attributes a, const Promise *pp, PromiseResult *result)
{
    int retval;

    switch (acl_default)
    {
    case ACL_DEFAULT_NO_CHANGE:       // no change always succeeds

        retval = true;
        break;

    case ACL_DEFAULT_SPECIFY:        // default ALC is specified in promise

        retval = CheckPosixLinuxACEs(ctx, aces, method, file_path, ACL_TYPE_DEFAULT, a, pp, result);
        break;

    case ACL_DEFAULT_ACCESS:         // default ACL should be the same as access ACL

        retval = CheckDefaultEqualsAccessACL(ctx, file_path, a, pp, result);
        break;

    case ACL_DEFAULT_CLEAR:          // default ALC should be empty

        retval = CheckDefaultClearACL(ctx, file_path, a, pp, result);
        break;

    default:                   // unknown inheritance policy
        Log(LOG_LEVEL_ERR, "Unknown inheritance policy - shouldn't happen");
        retval = false;
        break;
    }

    return retval;
}
Esempio n. 2
0
static int CheckPosixLinuxInheritACEs(Rlist *aces, AclMethod method, AclInheritance directory_inherit,
                                    char *file_path, Attributes a, Promise *pp)
{
    int result;

    switch (directory_inherit)
    {
    case ACL_INHERITANCE_NO_CHANGE:       // no change always succeeds

        result = true;
        break;

    case ACL_INHERITANCE_SPECIFY:        // default ALC is specified in promise

        result = CheckPosixLinuxACEs(aces, method, file_path, ACL_TYPE_DEFAULT, a, pp);
        break;

    case ACL_INHERITANCE_PARENT:         // default ACL should be the same as access ACL

        result = CheckDefaultEqualsAccessACL(file_path, a, pp);
        break;

    case ACL_INHERITANCE_CLEAR:          // default ALC should be empty

        result = CheckDefaultClearACL(file_path, a, pp);
        break;

    default:                   // unknown inheritance policy
        CfOut(OUTPUT_LEVEL_ERROR, "", "!! Unknown inheritance policy - shouldn't happen");
        result = false;
        break;
    }

    return result;
}