[SCM] Samba Shared Repository - branch master updated - 2227860a793dbde0b41e6ba1a720ac0d161ad784

Jelmer Vernooij jelmer at samba.org
Sun Dec 21 22:06:14 GMT 2008


The branch, master has been updated
       via  2227860a793dbde0b41e6ba1a720ac0d161ad784 (commit)
       via  d75c51eef34836f9eb5fa3449cef31f6463ce470 (commit)
       via  7e651c7ef3afb4effa045fa84ee3a87ab8226995 (commit)
       via  38a4749d2cf9266164527e2b3c14bc7e47b72326 (commit)
       via  f2b4aa82e0febd6528eb8231ac14d845b8aa80d0 (commit)
       via  a925e22d7aefad3b9cb0d9c258c33c41978a0015 (commit)
       via  4d811a8ef2b3cadd3ee317c2b7d6ba33463196a6 (commit)
      from  a32194033a6dcfe368b7ff64789fa152f090e7e6 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2227860a793dbde0b41e6ba1a720ac0d161ad784
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Dec 21 23:05:35 2008 +0100

    Fix more tests, improve repr() functions for various Python types.

commit d75c51eef34836f9eb5fa3449cef31f6463ce470
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Dec 21 21:16:40 2008 +0100

    Remove infrastructure for (no longer used) SWIG.

commit 7e651c7ef3afb4effa045fa84ee3a87ab8226995
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Dec 21 21:10:40 2008 +0100

    Simplify customization of pidl-generated Python modules.

commit 38a4749d2cf9266164527e2b3c14bc7e47b72326
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Dec 21 18:46:59 2008 +0100

    Allow providing extra module-level Python functions.

commit f2b4aa82e0febd6528eb8231ac14d845b8aa80d0
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Dec 21 18:25:59 2008 +0100

    Merge the rest of security.i into samba.dcerpc.security.

commit a925e22d7aefad3b9cb0d9c258c33c41978a0015
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Dec 21 18:03:27 2008 +0100

    Remove duplicate Python bindings for dom_sid, security_descriptor and
    security_token.

commit 4d811a8ef2b3cadd3ee317c2b7d6ba33463196a6
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Dec 21 17:01:50 2008 +0100

    Remove libcli_smb SWIG bindings - only one (useless on its own) function was wrapped anyway.

-----------------------------------------------------------------------

Summary of changes:
 pidl/lib/Parse/Pidl/Samba4/Python.pm              |   45 +-
 source4/build/m4/ac_pkg_swig.m4                   |  125 -
 source4/build/m4/env.m4                           |    4 -
 source4/build/make/python.mk                      |   12 -
 source4/dsdb/samdb/ldb_modules/tests/samba3sam.py |   11 +-
 source4/libcli/config.mk                          |   11 -
 source4/libcli/security/config.mk                 |   10 -
 source4/libcli/security/dom_sid.c                 |   42 +-
 source4/libcli/security/security.i                |  182 -
 source4/libcli/security/security.py               |  175 -
 source4/libcli/security/security_wrap.c           | 4316 ---------------------
 source4/libcli/security/tests/bindings.py         |   14 +-
 source4/libcli/swig/libcli_smb.i                  |   18 -
 source4/libcli/swig/libcli_smb.py                 |   64 -
 source4/libcli/swig/libcli_smb_wrap.c             | 3272 ----------------
 source4/librpc/ndr/py_security.c                  |  312 ++-
 source4/param/pyparam.c                           |    5 +-
 source4/scripting/python/samba/provision.py       |    8 +-
 source4/scripting/python/samba/samba3.py          |   15 +-
 source4/setup/provision-backend                   |    2 +-
 source4/setup/upgrade                             |    2 +-
 21 files changed, 382 insertions(+), 8263 deletions(-)
 delete mode 100644 source4/build/m4/ac_pkg_swig.m4
 delete mode 100644 source4/libcli/security/security.i
 delete mode 100644 source4/libcli/security/security.py
 delete mode 100644 source4/libcli/security/security_wrap.c
 delete mode 100644 source4/libcli/swig/libcli_smb.i
 delete mode 100644 source4/libcli/swig/libcli_smb.py
 delete mode 100644 source4/libcli/swig/libcli_smb_wrap.c


Changeset truncated at 500 lines:

diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 120a35a..73ae835 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -24,7 +24,7 @@ sub new($) {
 	my ($class) = @_;
 	my $self = { res => "", res_hdr => "", tabs => "", constants => {},
 	             module_methods => [], module_objects => [], ready_types => [],
-			 	 readycode => [] };
+				 patch_type_calls => [], readycode => [] };
 	bless($self, $class);
 }
 
@@ -38,7 +38,9 @@ sub pidl($$)
 {
 	my ($self, $d) = @_;
 	if ($d) {
-		$self->{res} .= $self->{tabs};
+		if ((!($d =~ /^#/))) {
+			$self->{res} .= $self->{tabs};
+		}
 		$self->{res} .= $d;
 	}
 	$self->{res} .= "\n";
@@ -279,11 +281,6 @@ sub PythonStruct($$$$$$)
 		$self->indent;
 		$self->pidl("{ \"__ndr_pack__\", (PyCFunction)py_$name\_ndr_pack, METH_NOARGS, \"S.pack() -> blob\\nNDR pack\" },");
 		$self->pidl("{ \"__ndr_unpack__\", (PyCFunction)py_$name\_ndr_unpack, METH_VARARGS, \"S.unpack(blob) -> None\\nNDR unpack\" },");
-		$self->deindent;
-		$self->pidl("#ifdef ".uc("py_$name\_extra_methods"));
-		$self->pidl("\t" .uc("py_$name\_extra_methods"));
-		$self->pidl("#endif");
-		$self->indent;
 		$self->pidl("{ NULL, NULL, 0, NULL }");
 		$self->deindent;
 		$self->pidl("};");
@@ -294,11 +291,8 @@ sub PythonStruct($$$$$$)
 	$self->pidl_hdr("#define $name\_Check(op) PyObject_TypeCheck(op, &$name\_Type)\n");
 	$self->pidl_hdr("#define $name\_CheckExact(op) ((op)->ob_type == &$name\_Type)\n");
 	$self->pidl_hdr("\n");
-	$self->pidl("#ifndef ".uc("py_$name\_repr"));
-	$self->pidl("#define ".uc("py_$name\_repr") . " py_talloc_default_repr");
-	$self->pidl("#endif");
 	$self->pidl("");
-	my $docstring = ($self->DocString($d, $name) or "NULL");
+	my $docstring = $self->DocString($d, $name);
 	my $typeobject = "$name\_Type";
 	$self->pidl("PyTypeObject $typeobject = {");
 	$self->indent;
@@ -307,8 +301,10 @@ sub PythonStruct($$$$$$)
 	$self->pidl(".tp_basicsize = sizeof(py_talloc_Object),");
 	$self->pidl(".tp_dealloc = py_talloc_dealloc,");
 	$self->pidl(".tp_getset = $getsetters,");
-	$self->pidl(".tp_repr = ".uc("py_$name\_repr").",");
-	$self->pidl(".tp_doc = $docstring,");
+	$self->pidl(".tp_repr = py_talloc_default_repr,");
+	if ($docstring) {
+		$self->pidl(".tp_doc = $docstring,");
+	}
 	$self->pidl(".tp_methods = $py_methods,");
 	$self->pidl(".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,");
 	$self->pidl(".tp_new = py_$name\_new,");
@@ -815,6 +811,8 @@ sub register_module_typeobject($$$)
 	$self->register_module_object($name, "(PyObject *)$py_name");
 
 	$self->check_ready_type($py_name);
+
+	$self->register_patch_type_call($name, $py_name);
 }
 
 sub check_ready_type($$)
@@ -823,6 +821,14 @@ sub check_ready_type($$)
 	push (@{$self->{ready_types}}, $py_name) unless (grep(/^$py_name$/,@{$self->{ready_types}}));
 }
 
+sub register_patch_type_call($$$)
+{
+	my ($self, $typename, $cvar) = @_;
+
+	push(@{$self->{patch_type_calls}}, [$typename, $cvar]);
+
+}
+
 sub register_module_readycode($$)
 {
 	my ($self, $code) = @_;
@@ -1183,7 +1189,7 @@ sub Parse($$$$$)
 		my ($fn_name, $pyfn_name, $flags, $doc) = @$_;
 		$self->pidl("{ \"$fn_name\", (PyCFunction)$pyfn_name, $flags, $doc },");
 	}
-	
+
 	$self->pidl("{ NULL, NULL, 0, NULL }");
 	$self->deindent;
 	$self->pidl("};");
@@ -1203,6 +1209,13 @@ sub Parse($$$$$)
 
 	$self->pidl($_) foreach (@{$self->{readycode}});
 
+	foreach (@{$self->{patch_type_calls}}) {
+		my ($typename, $cvar) = @$_;
+		$self->pidl("#ifdef PY_".uc($typename)."_PATCH");
+		$self->pidl("PY_".uc($typename)."_PATCH($cvar);");
+		$self->pidl("#endif");
+	}
+
 	$self->pidl("");
 
 	$self->pidl("m = Py_InitModule3(\"$basename\", $basename\_methods, \"$basename DCE/RPC\");");
@@ -1229,6 +1242,10 @@ sub Parse($$$$$)
 		$self->pidl("PyModule_AddObject(m, \"$object_name\", $c_name);");
 	}
 
+	$self->pidl("#ifdef PY_MOD_".uc($basename)."_PATCH");
+	$self->pidl("PY_MOD_".uc($basename)."_PATCH(m);");
+	$self->pidl("#endif");
+
 	$self->pidl("");
 	$self->deindent;
 	$self->pidl("}");
diff --git a/source4/build/m4/ac_pkg_swig.m4 b/source4/build/m4/ac_pkg_swig.m4
deleted file mode 100644
index 8d3561a..0000000
--- a/source4/build/m4/ac_pkg_swig.m4
+++ /dev/null
@@ -1,125 +0,0 @@
-##### http://autoconf-archive.cryp.to/ac_pkg_swig.html
-#
-# SYNOPSIS
-#
-#   AC_PROG_SWIG([major.minor.micro])
-#
-# DESCRIPTION
-#
-#   This macro searches for a SWIG installation on your system. If
-#   found you should call SWIG via $(SWIG). You can use the optional
-#   first argument to check if the version of the available SWIG is
-#   greater than or equal to the value of the argument. It should have
-#   the format: N[.N[.N]] (N is a number between 0 and 999. Only the
-#   first N is mandatory.)
-#
-#   If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks
-#   that the swig package is this version number or higher.
-#
-#   In configure.in, use as:
-#
-#     AC_PROG_SWIG(1.3.17)
-#     SWIG_ENABLE_CXX
-#     SWIG_MULTI_MODULE_SUPPORT
-#     SWIG_PYTHON
-#
-# LAST MODIFICATION
-#
-#   2006-10-22
-#
-# COPYLEFT
-#
-#   Copyright (c) 2006 Sebastian Huber <sebastian-huber at web.de>
-#   Copyright (c) 2006 Alan W. Irwin <irwin at beluga.phys.uvic.ca>
-#   Copyright (c) 2006 Rafael Laboissiere <rafael at laboissiere.net>
-#   Copyright (c) 2006 Andrew Collier <colliera at ukzn.ac.za>
-#
-#   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., 59 Temple Place - Suite 330, Boston, MA
-#   02111-1307, USA.
-#
-#   As a special exception, the respective Autoconf Macro's copyright
-#   owner gives unlimited permission to copy, distribute and modify the
-#   configure scripts that are the output of Autoconf when processing
-#   the Macro. You need not follow the terms of the GNU General Public
-#   License when using or distributing such scripts, even though
-#   portions of the text of the Macro appear in them. The GNU General
-#   Public License (GPL) does govern all other use of the material that
-#   constitutes the Autoconf Macro.
-#
-#   This special exception to the GPL applies to versions of the
-#   Autoconf Macro released by the Autoconf Macro Archive. When you
-#   make and distribute a modified version of the Autoconf Macro, you
-#   may extend this special exception to the GPL to apply to your
-#   modified version as well.
-
-AC_DEFUN([AC_PROG_SWIG],[
-        AC_PATH_PROG([SWIG],[swig])
-        if test -z "$SWIG" ; then
-                AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
-                SWIG='no'
-        elif test -n "$1" ; then
-                AC_MSG_CHECKING([for SWIG version])
-                [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
-                AC_MSG_RESULT([$swig_version])
-                if test -n "$swig_version" ; then
-                        # Calculate the required version number components
-                        [required=$1]
-                        [required_major=`echo $required | sed 's/[^0-9].*//'`]
-                        if test -z "$required_major" ; then
-                                [required_major=0]
-                        fi
-                        [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
-                        [required_minor=`echo $required | sed 's/[^0-9].*//'`]
-                        if test -z "$required_minor" ; then
-                                [required_minor=0]
-                        fi
-                        [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
-                        [required_patch=`echo $required | sed 's/[^0-9].*//'`]
-                        if test -z "$required_patch" ; then
-                                [required_patch=0]
-                        fi
-                        # Calculate the available version number components
-                        [available=$swig_version]
-                        [available_major=`echo $available | sed 's/[^0-9].*//'`]
-                        if test -z "$available_major" ; then
-                                [available_major=0]
-                        fi
-                        [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
-                        [available_minor=`echo $available | sed 's/[^0-9].*//'`]
-                        if test -z "$available_minor" ; then
-                                [available_minor=0]
-                        fi
-                        [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
-                        [available_patch=`echo $available | sed 's/[^0-9].*//'`]
-                        if test -z "$available_patch" ; then
-                                [available_patch=0]
-                        fi
-                        if test $available_major -ne $required_major \
-                                -o $available_minor -ne $required_minor \
-                                -o $available_patch -lt $required_patch ; then
-                                AC_MSG_WARN([SWIG version >= $1 is required if you would like to work on the SWIG bindings.  You have $swig_version. ])
-                                SWIG='no'
-                        else
-                                AC_MSG_NOTICE([SWIG executable is '$SWIG'])
-                                SWIG_LIB=`$SWIG -swiglib`
-                                AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB'])
-                        fi
-                else
-                        AC_MSG_WARN([cannot determine SWIG version])
-                        SWIG='no'
-                fi
-        fi
-        AC_SUBST([SWIG_LIB])
-])
diff --git a/source4/build/m4/env.m4 b/source4/build/m4/env.m4
index 4cde95d..6f582aa 100644
--- a/source4/build/m4/env.m4
+++ b/source4/build/m4/env.m4
@@ -75,10 +75,6 @@ m4_include(build/m4/check_doc.m4)
 
 m4_include(build/m4/check_python.m4)
 
-m4_include(build/m4/ac_pkg_swig.m4)
-
-AC_PROG_SWIG(1.3.36)
-
 AC_SAMBA_PYTHON_DEVEL([
 SMB_EXT_LIB(EXT_LIB_PYTHON, [$PYTHON_LDFLAGS], [$PYTHON_CFLAGS])
 SMB_ENABLE(EXT_LIB_PYTHON,YES)
diff --git a/source4/build/make/python.mk b/source4/build/make/python.mk
index 67a3e86..9b91090 100644
--- a/source4/build/make/python.mk
+++ b/source4/build/make/python.mk
@@ -40,18 +40,6 @@ $$(pythonbuilddir)/$(1): $(2) ;
 $(call python_module_template,$(1))
 endef
 
-# Swig extensions
-swig:: pythonmods
-
-.SUFFIXES: _wrap.c .i .py
-
-%_wrap.c %.py: %.i
-	[ "$(SWIG)" = "no" ] || $(SWIG) -O -Wall -python -keyword  -I../source4 $<
-
-realdistclean::
-	@echo "Removing SWIG output files"
-	# FIXME: Remove _wrap.c files
-
 pythonmods::
 
 clean::
diff --git a/source4/dsdb/samdb/ldb_modules/tests/samba3sam.py b/source4/dsdb/samdb/ldb_modules/tests/samba3sam.py
index be192f8..75aaeb7 100644
--- a/source4/dsdb/samdb/ldb_modules/tests/samba3sam.py
+++ b/source4/dsdb/samdb/ldb_modules/tests/samba3sam.py
@@ -28,7 +28,6 @@ from ldb import SCOPE_DEFAULT, SCOPE_BASE, SCOPE_SUBTREE
 from samba import Ldb, substitute_var
 from samba.tests import LdbTestCase, TestCaseInTempDir, cmdline_loadparm
 import samba.dcerpc.security
-import samba.security
 import samba.ndr
 
 datadir = os.path.join(os.path.dirname(__file__), 
@@ -118,14 +117,8 @@ class MapBaseTestCase(TestCaseInTempDir):
     def assertSidEquals(self, text, ndr_sid):
         sid_obj1 = samba.ndr.ndr_unpack(samba.dcerpc.security.dom_sid,
                                         str(ndr_sid[0]))
-        sid_obj2 = samba.security.Sid(text)
-        # For now, this is the only way we can compare these since the 
-        # classes are in different places. Should reconcile that at some point.
-        self.assertEquals(sid_obj1.sid_rev_num, sid_obj2.sid_rev_num)
-        self.assertEquals(sid_obj1.num_auths, sid_obj2.num_auths)
-        # FIXME: self.assertEquals(sid_obj1.id_auth, sid_obj2.id_auth)
-        # FIXME: self.assertEquals(sid_obj1.sub_auths[:sid_obj1.num_auths], 
-        #                  sid_obj2.sub_auths[:sid_obj2.num_auths])
+        sid_obj2 = samba.dcerpc.security.dom_sid(text)
+        self.assertEquals(sid_obj1, sid_obj2)
 
 
 class Samba3SamTestCase(MapBaseTestCase):
diff --git a/source4/libcli/config.mk b/source4/libcli/config.mk
index 85cba42..9bf262f 100644
--- a/source4/libcli/config.mk
+++ b/source4/libcli/config.mk
@@ -89,17 +89,6 @@ python_netbios_OBJ_FILES = $(libclinbtsrcdir)/pynbt.o
 
 $(python_libcli_nbt_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
 
-[PYTHON::python_libcli_smb]
-LIBRARY_REALNAME = samba/_libcli_smb.$(SHLIBEXT)
-PUBLIC_DEPENDENCIES = LIBCLI_SMB DYNCONFIG LIBSAMBA-HOSTCONFIG
-
-python_libcli_smb_OBJ_FILES = $(libclisrcdir)/swig/libcli_smb_wrap.o
-
-$(eval $(call python_py_module_template,samba/smb.py,$(libclisrcdir)/swig/libcli_smb.py))
-
-$(python_libcli_smb_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
-
-
 [SUBSYSTEM::LIBCLI_DGRAM]
 PUBLIC_DEPENDENCIES = LIBCLI_NBT LIBNDR LIBCLI_RESOLVE LIBCLI_NETLOGON
 
diff --git a/source4/libcli/security/config.mk b/source4/libcli/security/config.mk
index 30b1f32..4b35841 100644
--- a/source4/libcli/security/config.mk
+++ b/source4/libcli/security/config.mk
@@ -6,13 +6,3 @@ LIBSECURITY_OBJ_FILES = $(addprefix $(libclisrcdir)/security/, \
 					   dom_sid.o access_check.o privilege.o sddl.o)
 
 $(eval $(call proto_header_template,$(libclisrcdir)/security/proto.h,$(LIBSECURITY_OBJ_FILES:.o=.c)))
-
-[PYTHON::swig_security]
-LIBRARY_REALNAME = samba/_security.$(SHLIBEXT)
-PRIVATE_DEPENDENCIES = LIBSECURITY
-
-swig_security_OBJ_FILES = $(libclisrcdir)/security/security_wrap.o
-
-$(eval $(call python_py_module_template,samba/security.py,$(libclisrcdir)/security/security.py))
-
-$(swig_security_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
diff --git a/source4/libcli/security/dom_sid.c b/source4/libcli/security/dom_sid.c
index 36e3967..e1a6b8e 100644
--- a/source4/libcli/security/dom_sid.c
+++ b/source4/libcli/security/dom_sid.c
@@ -53,7 +53,7 @@ static int dom_sid_compare_auth(const struct dom_sid *sid1, const struct dom_sid
  Compare two sids.
 *****************************************************************/  
 
-static int dom_sid_compare(const struct dom_sid *sid1, const struct dom_sid *sid2)
+int dom_sid_compare(const struct dom_sid *sid1, const struct dom_sid *sid2)
 {
 	int i;
 
@@ -84,31 +84,26 @@ bool dom_sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2)
 	return dom_sid_compare(sid1, sid2) == 0;
 }
 
-
-/*
-  convert a string to a dom_sid, returning a talloc'd dom_sid
-*/
-struct dom_sid *dom_sid_parse_talloc(TALLOC_CTX *mem_ctx, const char *sidstr)
+bool dom_sid_parse(const char *sidstr, struct dom_sid *ret)
 {
-	struct dom_sid *ret;
 	uint_t rev, ia, num_sub_auths, i;
 	char *p;
   
 	if (strncasecmp(sidstr, "S-", 2)) {
-		return NULL;
+		return false;
 	}
 
 	sidstr += 2;
 
 	rev = strtol(sidstr, &p, 10);
 	if (*p != '-') {
-		return NULL;
+		return false;
 	}
 	sidstr = p+1;
 
 	ia = strtol(sidstr, &p, 10);
 	if (p == sidstr) {
-		return NULL;
+		return false;
 	}
 	sidstr = p;
 
@@ -117,11 +112,6 @@ struct dom_sid *dom_sid_parse_talloc(TALLOC_CTX *mem_ctx, const char *sidstr)
 		if (sidstr[i] == '-') num_sub_auths++;
 	}
 
-	ret = talloc(mem_ctx, struct dom_sid);
-	if (!ret) {
-		return NULL;
-	}
-
 	ret->sid_rev_num = rev;
 	ret->id_auth[0] = 0;
 	ret->id_auth[1] = 0;
@@ -133,16 +123,34 @@ struct dom_sid *dom_sid_parse_talloc(TALLOC_CTX *mem_ctx, const char *sidstr)
 
 	for (i=0;i<num_sub_auths;i++) {
 		if (sidstr[0] != '-') {
-			return NULL;
+			return false;
 		}
 		sidstr++;
 		ret->sub_auths[i] = strtoul(sidstr, &p, 10);
 		if (p == sidstr) {
-			return NULL;
+			return false;
 		}
 		sidstr = p;
 	}
 
+	return true;
+}
+
+/*
+  convert a string to a dom_sid, returning a talloc'd dom_sid
+*/
+struct dom_sid *dom_sid_parse_talloc(TALLOC_CTX *mem_ctx, const char *sidstr)
+{
+	struct dom_sid *ret;
+	ret = talloc(mem_ctx, struct dom_sid);
+	if (!ret) {
+		return NULL;
+	}
+	if (!dom_sid_parse(sidstr, ret)) {
+		talloc_free(ret);
+		return NULL;
+	}
+
 	return ret;
 }
 
diff --git a/source4/libcli/security/security.i b/source4/libcli/security/security.i
deleted file mode 100644
index 80efdc8..0000000
--- a/source4/libcli/security/security.i
+++ /dev/null
@@ -1,182 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2007
-   
-   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 3 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, see <http://www.gnu.org/licenses/>.
-*/
-
-%module(docstring="Security-related classes.",package="samba.security") security
-
-%{
-#include "includes.h"
-#include "libcli/security/security.h"
-
-typedef struct dom_sid dom_sid;
-typedef struct security_token security_token;
-typedef struct security_descriptor security_descriptor;
-%}
-
-%import "../lib/talloc/talloc.i"
-%{
-#include "libcli/util/pyerrors.h"
-%}
-
-%typemap(out,noblock=1) WERROR {
-    if (!W_ERROR_IS_OK($1)) {
-        PyErr_SetWERROR($1);
-        SWIG_fail;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list