assert_non_null(sd);
status = se_access_check(sd, &token, 0x10, &access_granted);
assert_ntstatus_equal(status, NT_STATUS_OK, "access check failed\n");
+ TALLOC_FREE(mem_ctx);
}
}; \
struct security_descriptor *sd = NULL;
-
+#define DEINIT() \
+ TALLOC_FREE(mem_ctx);
static void test_composite_different_order(void **state)
{
* Claim arrays are sets, so we assume conditional ACE ones are too.
*/
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_composite_different_order_with_dupes(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\", \"orange\"}");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_composite_different_order_with_dupes_in_composite(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_composite_different_order_with_SID_dupes(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{SID(AA), SID(AA), SID(WD)}");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_composite_different_order_with_SID_dupes_in_composite(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{SID(AA), SID(WD)}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_composite_mixed_types(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{SID(AA), SID(WD)}");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_composite_mixed_types_different_last(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{SID(AA), SID(WD)}");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_composite_mixed_types_deny(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{SID(AA), SID(WD)}");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_different_case(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_different_case_with_case_sensitive_flag(void **state)
/* set the flag bit */
token.device_claims[0].flags = CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE;
DENY_CHECK(0x10);
+ DEINIT()
}
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_claim_name_different_case_case_flag(void **state)
*/
token.device_claims[0].flags = CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE;
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_more_values_not_equal(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_contains(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_contains_incomplete(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_any_of(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_any_of_match_last(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_any_of_1(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_contains_1(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_contains_1_fail(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_any_of_1_fail(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
DENY_CHECK(0x10);
+ DEINIT()
}
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_not_any_of_composite_1(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_not_contains_1_fail(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_not_contains_1(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_not_any_of_1(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_not_Not_Any_of_1(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_not_Not_Contains_1(void **state)
USER_SIDS("WD", "AA");
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
ALLOW_CHECK(0x10);
+ DEINIT()
}
USER_SIDS("WD", "AA");
DEVICE_SIDS("BA", "BG");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_not_not_Not_Member_of_fail(void **state)
USER_SIDS("WD", "AA");
DEVICE_SIDS("BA", "BG");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_not_not_not_not_not_not_not_not_not_not_Not_Member_of(void **state)
USER_SIDS("WD", "AA");
DEVICE_SIDS("BA", "BG");
ALLOW_CHECK(0x10);
+ DEINIT()
}
SD("D:(XA;;0x1f;;;AA;"
"(Device_Member_of{SID(BA)} && Member_of{SID(WD)}))");
ALLOW_CHECK(0x10);
+ DEINIT()
}
SD("D:(XA;;0x1f;;;AA;(@Device.colour Contains @Resource.colour))"
"S:(RA;;;;;WD;(\"colour\",TS,0,\"blue\"))");
ALLOW_CHECK(0x10);
+ DEINIT()
}
SD("D:(XA;;0x1f;;;AA;(@Device.colour Contains @Resource.colour))"
"S:(RA;;;;;WD;(\"colour\",TS,0,\"blue\"))");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_device_claim_eq_resource_claim(void **state)
SD("D:(XA;;0x1f;;;AA;(@Device.colour == @Resource.colour))"
"S:(RA;;;;;WD;(\"colour\",TS,0,\"blue\"))");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_user_claim_eq_device_claim(void **state)
DEVICE_CLAIMS("colour", "\"blue\"");
SD("D:(XA;;0x1f;;;AA;(@User.colour == @Device.colour))");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_device_claim_eq_resource_claim_2(void **state)
DEVICE_CLAIMS("colour", "{\"orange\", \"blue\"}");
SD("D:(XA;;0x1f;;;AA;(@Device.colour == {\"orange\", \"blue\"}))");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_resource_ace_multi(void **state)
SD("D:(XA;;0x1f;;;AA;(@Device.colour Contains @Resource.colour))"
"S:(RA;;;;;WD;(\"colour\",TS,0,\"blue\", \"red\"))");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_resource_ace_multi_any_of(void **state)
SD("D:(XA;;0x1f;;;AA;(@Device.colour Any_of @Resource.colour))"
"S:(RA;;;;;WD;(\"colour\",TS,0,\"grue\", \"blue\", \"red\"))");
ALLOW_CHECK(0x10);
+ DEINIT()
}
static void test_horrible_fuzz_derived_test_3(void **state)
INIT();
USER_SIDS("WD", "AA", "IS");
SD_FAIL("S:PPD:(XA;OI;0x1;;;IS;(q>))");
+ DEINIT()
}
static void test_resource_ace_single(void **state)
SD("D:(XA;;0x1f;;;AA;(@Device.colour Contains @Resource.colour))"
"S:(RA;;;;;WD;(\"colour\",TS,0,\"blue\"))");
ALLOW_CHECK(0x10);
+ DEINIT()
}
DEVICE_CLAIMS("colour", "\"blue\"");
SD("D:(XD;;FX;;;S-1-1-0;(@User.Project Any_of @Resource.Project))");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_user_attr_any_of_missing_resource_attr(void **state)
USER_CLAIMS("Project", "3");
SD("D:(XD;;FX;;;S-1-1-0;(@User.Project Any_of @Resource.Project))");
DENY_CHECK(0x10);
+ DEINIT()
}
static void test_user_attr_any_of_missing_user_attr(void **state)
SD("D:(XD;;FX;;;S-1-1-0;(@User.Project Any_of @Resource.Project))"
"S:(RA;;;;;WD;(\"Project\",TX,0,1234))");
DENY_CHECK(0x10);
+ DEINIT()
}