summaryrefslogtreecommitdiff
path: root/source4/torture/local/sddl.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-12-02 03:19:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:46:58 -0500
commit3aaa6ff496debf806fdb87d7993061eb5e61af1b (patch)
tree2177b68253f511cdadabe5d403b362b514d3db70 /source4/torture/local/sddl.c
parent51b1deee5def7c66841f10a231b43cfd42a60b5f (diff)
downloadsamba-3aaa6ff496debf806fdb87d7993061eb5e61af1b.tar.gz
samba-3aaa6ff496debf806fdb87d7993061eb5e61af1b.tar.bz2
samba-3aaa6ff496debf806fdb87d7993061eb5e61af1b.zip
r12008: added a simple LOCAL-SDDL test suite. Only one example so far. Will be
filled in with more examples as I expand the sddl parsing code. (This used to be commit 8f80e483a3aa07bb5a16eeccde5af5cd7fb5a975)
Diffstat (limited to 'source4/torture/local/sddl.c')
-rw-r--r--source4/torture/local/sddl.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/source4/torture/local/sddl.c b/source4/torture/local/sddl.c
new file mode 100644
index 0000000000..fa7d15f606
--- /dev/null
+++ b/source4/torture/local/sddl.c
@@ -0,0 +1,60 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ local testing of SDDL parsing
+
+ Copyright (C) Andrew Tridgell 2005
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_security.h"
+
+
+/*
+ test one SDDL example
+*/
+static BOOL test_sddl(TALLOC_CTX *mem_ctx, const char *sddl)
+{
+ struct security_descriptor *sd;
+ sd = sddl_decode(mem_ctx, sddl);
+ if (sd == NULL) {
+ printf("Failed to decode '%s'\n", sddl);
+ return False;
+ }
+ NDR_PRINT_DEBUG(security_descriptor, sd);
+ talloc_free(sd);
+ return True;
+}
+
+static const char *examples[] = {
+"D:(A;;RPWPCRCCDCLCLORCWOWDSDDTSW;;;DA)(A;;RPWPCRCCDCLCLORCWOWDSDDTSW;;;SY)(A;;RPLCLORC;;;AU)"
+};
+
+/* test a set of example SDDL strings */
+BOOL torture_local_sddl(void)
+{
+ int i;
+ BOOL ret = True;
+ TALLOC_CTX *mem_ctx = talloc_new(NULL);
+
+ for (i=0;i<ARRAY_SIZE(examples);i++) {
+ ret &= test_sddl(mem_ctx, examples[i]);
+ }
+
+ talloc_free(mem_ctx);
+ return ret;
+}