From 79eae8ffff0105cd9d16195cfd3c2c025d2c663f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 9 Dec 2005 04:54:30 +0000 Subject: r12137: added sddl_encode(), the reverse of the sddl_decode() function added a couple of days ago. Doesn't yet encode using the shorthand for well known SIDs. (This used to be commit 655a4ebe8e0ee18133103bfba0ca6d14cbf81d56) --- source4/torture/local/sddl.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'source4/torture/local') diff --git a/source4/torture/local/sddl.c b/source4/torture/local/sddl.c index f09af3f83a..8d5874d878 100644 --- a/source4/torture/local/sddl.c +++ b/source4/torture/local/sddl.c @@ -29,14 +29,34 @@ */ static BOOL test_sddl(TALLOC_CTX *mem_ctx, const char *sddl) { - struct security_descriptor *sd; + struct security_descriptor *sd, *sd2; struct dom_sid *domain; + const char *sddl2; + domain = dom_sid_parse_talloc(mem_ctx, "S-1-2-3-4"); sd = sddl_decode(mem_ctx, sddl, domain); if (sd == NULL) { printf("Failed to decode '%s'\n", sddl); return False; } + + sddl2 = sddl_encode(mem_ctx, sd, domain); + if (sddl2 == NULL) { + printf("Failed to re-encode '%s'\n", sddl); + return False; + } + + sd2 = sddl_decode(mem_ctx, sddl2, domain); + if (sd2 == NULL) { + printf("Failed to decode2 '%s'\n", sddl2); + return False; + } + + if (!security_descriptor_equal(sd, sd2)) { + printf("Failed equality test for '%s'\n", sddl); + return False; + } + if (DEBUGLVL(2)) { NDR_PRINT_DEBUG(security_descriptor, sd); } -- cgit