svn commit: samba r12008 - in branches/SAMBA_4_0/source/torture: . local

tridge at samba.org tridge at samba.org
Fri Dec 2 03:19:24 GMT 2005


Author: tridge
Date: 2005-12-02 03:19:23 +0000 (Fri, 02 Dec 2005)
New Revision: 12008

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12008

Log:

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.

Added:
   branches/SAMBA_4_0/source/torture/local/config.mk
   branches/SAMBA_4_0/source/torture/local/sddl.c
Modified:
   branches/SAMBA_4_0/source/torture/config.mk
   branches/SAMBA_4_0/source/torture/torture.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/config.mk
===================================================================
--- branches/SAMBA_4_0/source/torture/config.mk	2005-12-02 03:18:34 UTC (rev 12007)
+++ branches/SAMBA_4_0/source/torture/config.mk	2005-12-02 03:19:23 UTC (rev 12008)
@@ -141,27 +141,7 @@
 # End SUBSYSTEM TORTURE_AUTH
 #################################
 
-#################################
-# Start SUBSYSTEM TORTURE_LOCAL
-[SUBSYSTEM::TORTURE_LOCAL]
-ADD_OBJ_FILES = \
-		local/iconv.o \
-		../lib/talloc/testsuite.o \
-		local/messaging.o \
-		local/binding_string.o \
-		local/idtree.o \
-		local/socket.o \
-		local/irpc.o \
-		local/registry.o \
-		local/resolve.o \
-		local/util_strlist.o \
-		local/util_file.o
-REQUIRED_SUBSYSTEMS = \
-		LIBSMB \
-		MESSAGING \
-		REGISTRY
-# End SUBSYSTEM TORTURE_LOCAL
-#################################
+include local/config.mk
 
 #################################
 # Start SUBSYSTEM TORTURE_NBENCH

Added: branches/SAMBA_4_0/source/torture/local/config.mk
===================================================================
--- branches/SAMBA_4_0/source/torture/local/config.mk	2005-12-02 03:18:34 UTC (rev 12007)
+++ branches/SAMBA_4_0/source/torture/local/config.mk	2005-12-02 03:19:23 UTC (rev 12008)
@@ -0,0 +1,23 @@
+#################################
+# Start SUBSYSTEM TORTURE_LOCAL
+[SUBSYSTEM::TORTURE_LOCAL]
+ADD_OBJ_FILES = \
+		iconv.o \
+		../../lib/talloc/testsuite.o \
+		messaging.o \
+		binding_string.o \
+		idtree.o \
+		socket.o \
+		irpc.o \
+		registry.o \
+		resolve.o \
+		util_strlist.o \
+		util_file.o \
+		sddl.o
+REQUIRED_SUBSYSTEMS = \
+		LIBSMB \
+		MESSAGING \
+		REGISTRY
+# End SUBSYSTEM TORTURE_LOCAL
+#################################
+

Added: branches/SAMBA_4_0/source/torture/local/sddl.c
===================================================================
--- branches/SAMBA_4_0/source/torture/local/sddl.c	2005-12-02 03:18:34 UTC (rev 12007)
+++ branches/SAMBA_4_0/source/torture/local/sddl.c	2005-12-02 03:19:23 UTC (rev 12008)
@@ -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;
+}

Modified: branches/SAMBA_4_0/source/torture/torture.c
===================================================================
--- branches/SAMBA_4_0/source/torture/torture.c	2005-12-02 03:18:34 UTC (rev 12007)
+++ branches/SAMBA_4_0/source/torture/torture.c	2005-12-02 03:19:23 UTC (rev 12008)
@@ -2323,6 +2323,7 @@
 	{"LOCAL-PAC", torture_pac, 0},
 	{"LOCAL-REGISTRY", torture_registry, 0},
 	{"LOCAL-RESOLVE", torture_local_resolve, 0},
+	{"LOCAL-SDDL", torture_local_sddl, 0},
 
 	/* COM (Component Object Model) testers */
 	{"COM-SIMPLE", torture_com_simple, 0 },



More information about the samba-cvs mailing list