summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-12-09 04:54:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:13 -0500
commit79eae8ffff0105cd9d16195cfd3c2c025d2c663f (patch)
treea2c2e11159496bbaff23bf9fd8652e3cb97a5c8b /source4/torture
parent499e51b5a917388153f09d3203f14ff8c733bf52 (diff)
downloadsamba-79eae8ffff0105cd9d16195cfd3c2c025d2c663f.tar.gz
samba-79eae8ffff0105cd9d16195cfd3c2c025d2c663f.tar.bz2
samba-79eae8ffff0105cd9d16195cfd3c2c025d2c663f.zip
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)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/local/sddl.c22
1 files changed, 21 insertions, 1 deletions
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);
}