Merge branch 'v4-0-trivial' into v4-0-python
authorJelmer Vernooij <jelmer@samba.org>
Sat, 9 Feb 2008 19:06:54 +0000 (20:06 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 9 Feb 2008 19:06:54 +0000 (20:06 +0100)
164 files changed:
.gitignore
PFIF.txt [new file with mode: 0644]
source/auth/auth_sam_reply.c
source/auth/credentials/config.mk
source/auth/credentials/credentials.i
source/auth/credentials/credentials.py
source/auth/credentials/credentials_wrap.c
source/auth/credentials/tests/bindings.py
source/auth/gensec/config.mk
source/auth/gensec/gensec.pc.in [new file with mode: 0644]
source/build/m4/check_make.m4
source/build/m4/public.m4
source/build/smb_build/config_mk.pm
source/build/smb_build/env.pm
source/build/smb_build/main.pl
source/build/smb_build/makefile.pm
source/cldap_server/cldap_server.c
source/cluster/cluster.c
source/cluster/cluster.h
source/cluster/cluster_private.h
source/cluster/ctdb/ctdb_cluster.c
source/cluster/local.c
source/configure.ac
source/dsdb/common/sidmap.c
source/dsdb/repl/drepl_service.c
source/dsdb/repl/replicated_objects.c
source/dsdb/samdb/ldb_modules/extended_dn.c
source/dsdb/samdb/ldb_modules/instancetype.c
source/dsdb/samdb/ldb_modules/kludge_acl.c
source/dsdb/samdb/ldb_modules/ranged_results.c
source/dsdb/samdb/ldb_modules/repl_meta_data.c
source/dsdb/samdb/ldb_modules/samldb.c
source/dsdb/samdb/ldb_modules/schema_fsmo.c
source/dsdb/samdb/samdb.c
source/dsdb/schema/schema_syntax.c
source/kdc/kdc.c
source/ldap_server/ldap_server.c
source/lib/ldb/Makefile.in
source/lib/ldb/config.mk
source/lib/ldb/configure.ac
source/lib/ldb/ldb.i
source/lib/ldb/ldb.py
source/lib/ldb/ldb_wrap.c
source/lib/ldb/tests/python/ldap.py
source/lib/messaging/messaging.c
source/lib/messaging/tests/irpc.c
source/lib/messaging/tests/messaging.c
source/lib/registry/config.mk
source/lib/registry/ldb.c
source/lib/registry/registry.pc.in [new file with mode: 0644]
source/lib/talloc/config.mk
source/lib/tdb/common/tdb.c
source/lib/tdb/common/transaction.c
source/lib/tdb/config.mk
source/lib/tdb/tdb.pc.in
source/lib/util/config.mk
source/lib/util/debug.h
source/lib/util/time.c
source/lib/util/time.h
source/libcli/config.mk
source/libnet/libnet_become_dc.c
source/librpc/config.mk
source/librpc/dcerpc.pc.in [new file with mode: 0644]
source/librpc/dcerpc_samr.pc.in [new file with mode: 0644]
source/librpc/idl/misc.idl
source/librpc/idl/netlogon.idl
source/librpc/idl/samr.idl
source/librpc/idl/spoolss.idl
source/librpc/idl/srvsvc.idl
source/librpc/idl/svcctl.idl
source/librpc/idl/winreg.idl
source/librpc/idl/wkssvc.idl
source/librpc/ndr.pc.in [new file with mode: 0644]
source/main.mk
source/nbt_server/nbt_server.c
source/nsswitch/config.m4
source/param/config.mk
source/param/loadparm.c
source/param/param.i
source/param/param.py
source/param/param_wrap.c
source/param/samba-config.pc.in [new file with mode: 0644]
source/param/tests/bindings.py
source/pidl/idl.yp
source/pidl/lib/Parse/Pidl/CUtil.pm
source/pidl/lib/Parse/Pidl/Compat.pm
source/pidl/lib/Parse/Pidl/IDL.pm
source/pidl/lib/Parse/Pidl/NDR.pm
source/pidl/lib/Parse/Pidl/Samba4/Header.pm
source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
source/pidl/tests/Util.pm
source/pidl/tests/ndr.pl
source/pidl/tests/ndr_compat.pl
source/rpc_server/netlogon/dcerpc_netlogon.c
source/rpc_server/service_rpc.c
source/rules.mk [new file with mode: 0644]
source/samba4-knownfail
source/samba4-skip
source/scripting/bin/winreg.py
source/scripting/ejs/smbcalls_rpc.c
source/scripting/libjs/provision.js
source/scripting/python/STATUS
source/scripting/python/config.m4
source/scripting/python/config.mk
source/scripting/python/misc.i
source/scripting/python/misc.py
source/scripting/python/misc_wrap.c
source/scripting/python/modules.c
source/scripting/python/pyrpc.h
source/scripting/python/samba/__init__.py
source/scripting/python/samba/getopt.py
source/scripting/python/samba/provision.py
source/scripting/python/samba/samdb.py
source/scripting/python/samba/tests/__init__.py
source/scripting/python/samba/tests/provision.py
source/scripting/python/samba/upgrade.py
source/selftest/config.mk
source/selftest/samba4_tests.sh
source/selftest/selftest.pl
source/setup/provision
source/setup/provision.ldif
source/setup/provision.py
source/setup/provision_basedn.ldif
source/setup/provision_basedn_modify.ldif
source/setup/provision_partitions.ldif
source/setup/schema.ldif
source/setup/secrets_dc.ldif
source/setup/upgrade.py
source/setup/vampire.py
source/smb_server/smb/nttrans.c
source/smb_server/smb_server.c
source/smbd/process_model.h
source/smbd/process_model.mk
source/smbd/process_prefork.c [new file with mode: 0644]
source/smbd/process_single.c
source/smbd/process_standard.c
source/smbd/process_thread.c
source/smbd/service.c
source/smbd/service_stream.c
source/smbd/service_task.c
source/torture/config.mk
source/torture/libnet/libnet_BecomeDC.c
source/torture/raw/offline.c [new file with mode: 0644]
source/torture/raw/open.c
source/torture/raw/raw.c
source/torture/rpc/spoolss_notify.c
source/torture/torture.pc.in [new file with mode: 0644]
source/torture/util.c [deleted file]
source/torture/util_smb.c
source/utils/tests/test_nmblookup.sh [moved from testprogs/blackbox/test_nmblookup.sh with 100% similarity]
source/web_server/web_server.c
source/winbind/wb_server.c
source/wrepl_server/wrepl_server.c
testprogs/blackbox/test_kinit.sh
testprogs/ejs/ldap.js
testprogs/ejs/minschema_classes.txt
testprogs/win32/midltests/midltests.acf [new file with mode: 0644]
testprogs/win32/midltests/midltests.c [new file with mode: 0644]
testprogs/win32/midltests/midltests.idl [new file with mode: 0644]
testprogs/win32/midltests/midltests_c_m.c [new file with mode: 0644]
testprogs/win32/midltests/midltests_marshall.c [new file with mode: 0644]
testprogs/win32/midltests/midltests_marshall.h [new file with mode: 0644]
testprogs/win32/midltests/midltests_s_m.c [new file with mode: 0644]
testprogs/win32/midltests/utils.c [new file with mode: 0644]

index 9ed0334ea13a80cb4219e91843b306887fb46ea6..a85553dc492c6ec9515b8723d445bf18c5161441 100644 (file)
@@ -193,3 +193,5 @@ source/lib/util/apidocs
 source/lib/util/util_ldb.h
 source/libcli/ldap/ldap_ndr.h
 source/libcli/resolve/lp_proto.h
+source/apidocs
+*.swp
diff --git a/PFIF.txt b/PFIF.txt
new file mode 100644 (file)
index 0000000..09f1458
--- /dev/null
+++ b/PFIF.txt
@@ -0,0 +1,7 @@
+This code was developed in participation with the Protocol Freedom
+Information Foundation.
+
+Please see 
+  http://protocolfreedom.org/ and
+  http://samba.org/samba/PFIF/ 
+for more details.
index 6ab220498dc8d68f59efd93f1743fbc713d593b9..ea6f0a1f60eb338e9267e5a781c53d2ea1e1609f 100644 (file)
@@ -132,7 +132,7 @@ NTSTATUS auth_convert_server_info_saminfo3(TALLOC_CTX *mem_ctx,
                        continue;
                }
                sam3->sids[sam3->sidcount].sid = talloc_reference(sam3->sids,server_info->domain_groups[i]);
-               sam3->sids[sam3->sidcount].attribute = 
+               sam3->sids[sam3->sidcount].attributes =
                        SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED;
                sam3->sidcount += 1;
        }
index 8d33bdbd554fa35cfdc2e51234f683d301b1d3b7..fee9519ae5b8893287d537c6b7c8a2fab6f3e005 100644 (file)
@@ -14,5 +14,5 @@ PRIVATE_DEPENDENCIES = \
                SECRETS
 
 [PYTHON::swig_credentials]
-PUBLIC_DEPENDENCIES = CREDENTIALS
+PUBLIC_DEPENDENCIES = CREDENTIALS LIBCMDLINE_CREDENTIALS
 SWIG_FILE = credentials.i
index ee09b43a753d46eedc929c8f5242a21681f27227..41ec67580e713365b6a97e3650a28374ac923083 100644 (file)
@@ -27,6 +27,7 @@
 #include "includes.h"
 #include "auth/credentials/credentials.h"
 #include "param/param.h"
+#include "lib/cmdline/credentials.h"
 typedef struct cli_credentials cli_credentials;
 %}
 
@@ -51,7 +52,7 @@ typedef struct cli_credentials cli_credentials;
 typedef struct cli_credentials {
     %extend {
         cli_credentials(void) {
-            return cli_credentials_init(NULL);
+            return cli_credentials_init_anon(NULL);
         }
         /* username */
         const char *get_username(void);
@@ -93,6 +94,8 @@ typedef struct cli_credentials {
         bool authentication_requested(void);
 
         bool wrong_password(void);
+
+        bool set_cmdline_callbacks();
     }
 } cli_credentials;
 
index 0d91526b8fd4e92fb79611eb9c5da18ac59fdc43..14526af9100274c20024e226b724dfdbbffd8528 100644 (file)
@@ -82,6 +82,7 @@ Credentials.is_anonymous = new_instancemethod(_credentials.Credentials_is_anonym
 Credentials.get_nt_hash = new_instancemethod(_credentials.Credentials_get_nt_hash,None,Credentials)
 Credentials.authentication_requested = new_instancemethod(_credentials.Credentials_authentication_requested,None,Credentials)
 Credentials.wrong_password = new_instancemethod(_credentials.Credentials_wrong_password,None,Credentials)
+Credentials.set_cmdline_callbacks = new_instancemethod(_credentials.Credentials_set_cmdline_callbacks,None,Credentials)
 Credentials_swigregister = _credentials.Credentials_swigregister
 Credentials_swigregister(Credentials)
 
index 146a81abafaa71894bc81a53744b4641a84d68cd..b1b904c8a3a68e6c0142931602b59a3d98704abd 100644 (file)
@@ -2521,13 +2521,14 @@ static swig_module_info swig_module = {swig_types, 16, 0, 0, 0, 0};
 #include "includes.h"
 #include "auth/credentials/credentials.h"
 #include "param/param.h"
+#include "lib/cmdline/credentials.h"
 typedef struct cli_credentials cli_credentials;
 
 
 #include "librpc/gen_ndr/samr.h" /* for struct samr_Password */
 
 SWIGINTERN cli_credentials *new_cli_credentials(){
-            return cli_credentials_init(NULL);
+            return cli_credentials_init_anon(NULL);
         }
 
 SWIGINTERN swig_type_info*
@@ -3486,6 +3487,34 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_Credentials_set_cmdline_callbacks(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+  PyObject *resultobj = 0;
+  cli_credentials *arg1 = (cli_credentials *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  char *  kwnames[] = {
+    (char *) "self", NULL 
+  };
+  
+  arg1 = NULL;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_set_cmdline_callbacks",kwnames,&obj0)) SWIG_fail;
+  if (obj0) {
+    res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_set_cmdline_callbacks" "', argument " "1"" of type '" "cli_credentials *""'"); 
+    }
+    arg1 = (cli_credentials *)(argp1);
+  }
+  result = (bool)cli_credentials_set_cmdline_callbacks(arg1);
+  resultobj = SWIG_From_bool((bool)(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_delete_Credentials(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   cli_credentials *arg1 = (cli_credentials *) 0 ;
@@ -3545,6 +3574,7 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"Credentials_get_nt_hash", (PyCFunction) _wrap_Credentials_get_nt_hash, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_authentication_requested", (PyCFunction) _wrap_Credentials_authentication_requested, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_wrong_password", (PyCFunction) _wrap_Credentials_wrong_password, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Credentials_set_cmdline_callbacks", (PyCFunction) _wrap_Credentials_set_cmdline_callbacks, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"delete_Credentials", (PyCFunction) _wrap_delete_Credentials, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_swigregister", Credentials_swigregister, METH_VARARGS, NULL},
         { (char *)"Credentials_swiginit", Credentials_swiginit, METH_VARARGS, NULL},
index 8312e77e9ea716eb838f0f3d9ffbccd29644e5e8..d2ca68d11578276b4b75df0375e5b4b0859c596a 100644 (file)
@@ -83,6 +83,9 @@ class CredentialsTests(unittest.TestCase):
         # Just check the method is there and doesn't raise an exception
         self.creds.guess()
 
+    def test_set_cmdline_callbacks(self):
+        self.creds.set_cmdline_callbacks()
+
     def test_authentication_requested(self):
         self.creds.set_username("")
         self.assertFalse(self.creds.authentication_requested())
index fea157c40b31dba7507033bc1f9c47997d72cebd..a53dff8bfe7c56b3eef5773a6c29753ae848e9e1 100644 (file)
@@ -1,9 +1,9 @@
 #################################
 # Start SUBSYSTEM gensec
 [LIBRARY::gensec]
+PC_FILE = gensec.pc
 VERSION = 0.0.1
 SO_VERSION = 0
-DESCRIPTION = Generic Security Library
 PUBLIC_HEADERS = gensec.h spnego.h
 PUBLIC_PROTO_HEADER = gensec_proto.h
 OBJ_FILES = gensec.o socket.o
diff --git a/source/auth/gensec/gensec.pc.in b/source/auth/gensec/gensec.pc.in
new file mode 100644 (file)
index 0000000..faf772a
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+modulesdir=${prefix}/modules/gensec
+
+Name: gensec
+Description: Generic Security Library
+Version: 0.0.1
+Libs: -L${libdir} -lgensec 
+Cflags: -I${includedir}  -DHAVE_IMMEDIATE_STRUCTURES=1
index 4780f43e1cbe652a2368d6d4400197174276d1be..d7799649a7fd0c5e971e83e66831b97b59823ce7 100644 (file)
@@ -46,3 +46,11 @@ AC_ARG_ENABLE(automatic-dependencies,
 [ automatic_dependencies=no ])
 AC_MSG_RESULT($automatic_dependencies)
 AC_SUBST(automatic_dependencies)
+
+FIRST_PREREQ="\$*.c"
+AC_SUBST(FIRST_PREREQ)
+
+if test x$GNU_MAKE = xyes; then
+       FIRST_PREREQ="\$<"
+fi
+
index 6d693eaeeea9a5fbf4a2958a6cb250f2e4044ad0..4192128bbdc16f5ca7d8f90a3ae5ee9c82fd81a5 100644 (file)
@@ -34,21 +34,20 @@ ENABLE = YES
 "
 ])
 
-dnl SMB_LIBRARY(name,description,obj_files,required_subsystems,version,so_version,cflags,ldflags,pcname)
+dnl SMB_LIBRARY(name,obj_files,required_subsystems,version,so_version,cflags,ldflags,pcname)
 AC_DEFUN([SMB_LIBRARY],
 [
 SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES
 ###################################
 # Start Library $1
 @<:@LIBRARY::$1@:>@
-DESCRIPTION = $2
-OBJ_FILES = $3
-PRIVATE_DEPENDENCIES = $4
-VERSION = $5
-SO_VERSION = $6 
-CFLAGS = $7
-LDFLAGS = $8
-PC_NAME = $9
+OBJ_FILES = $2
+PRIVATE_DEPENDENCIES = $3
+VERSION = $4
+SO_VERSION = $5 
+CFLAGS = $6
+LDFLAGS = $7
+PC_NAME = $8
 ENABLE = YES
 # End Library $1
 ###################################
@@ -65,30 +64,28 @@ AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG],
        fi
 
        if test "$PKG_CONFIG" = "no" ; then
-               echo "*** The pkg-config script could not be found. Make sure it is"
-               echo "*** in your path, or set the PKG_CONFIG environment variable"
-               echo "*** to the full path to pkg-config."
-               echo "*** Or see http://pkg-config.freedesktop.org/ to get pkg-config."
+               echo "*** The pkg-config script could not be found. Make sure it is"
+               echo "*** in your path, or set the PKG_CONFIG environment variable"
+               echo "*** to the full path to pkg-config."
+               echo "*** Or see http://pkg-config.freedesktop.org/ to get pkg-config."
                        ac_cv_$1_found=no
        else
                if $PKG_CONFIG --atleast-pkgconfig-version 0.9.0; then
-                       AC_MSG_CHECKING(for $2)
+                       AC_MSG_CHECKING(for $2)
 
-                       if $PKG_CONFIG --exists '$2' ; then
+                       if $PKG_CONFIG --exists '$2' ; then
                                AC_MSG_RESULT(yes)
 
-
                                $1_CFLAGS="`$PKG_CONFIG --cflags '$2'`"
-                       OLD_CFLAGS="$CFLAGS"
-                       CFLAGS="$CFLAGS $$1_CFLAGS"
-                       AC_MSG_CHECKING([that the C compiler can use the $1_CFLAGS])
-                       AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"],
+                               OLD_CFLAGS="$CFLAGS"
+                               CFLAGS="$CFLAGS $$1_CFLAGS"
+                               AC_MSG_CHECKING([that the C compiler can use the $1_CFLAGS])
+                               AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"],
                                        SMB_ENABLE($1, YES)
-                               AC_MSG_RESULT(yes),
+                                       AC_MSG_RESULT(yes),
                                        AC_MSG_RESULT(no),
                                        AC_MSG_WARN([cannot run when cross-compiling]))
-                       CFLAGS="$OLD_CFLAGS"
-
+                               CFLAGS="$OLD_CFLAGS"
 
                                SMB_EXT_LIB($1, 
                                        [`$PKG_CONFIG --libs-only-l '$2'`], 
@@ -98,17 +95,17 @@ AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG],
                                        [ $2 ])
                                ac_cv_$1_found=yes
 
-                       else
+                       else
                                AC_MSG_RESULT(no)
-                               $PKG_CONFIG --errors-to-stdout --print-errors '$2'
+                               $PKG_CONFIG --errors-to-stdout --print-errors '$2'
                                ac_cv_$1_found=no
-                       fi
-               else
-                       echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
-                               echo "*** See http://pkg-config.freedesktop.org/"
-                               ac_cv_$1_found=no
-               fi
-       fi
+                       fi
+               else
+                       echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+                       echo "*** See http://pkg-config.freedesktop.org/"
+                       ac_cv_$1_found=no
+               fi
+       fi
        if test x$ac_cv_$1_found = x"yes"; then
                ifelse([$3], [], [echo -n ""], [$3])
        else
index d07660ba1d826365c39a06f8bd3b7e9bdbc26a76..b7dc9697a9667f74bc113de9e1004e408a8041d6 100644 (file)
@@ -91,6 +91,7 @@ my $section_types = {
                "LIBRARY_REALNAME" => "string",
 
                "PC_NAME" => "string",
+               "PC_FILE" => "string",
                
                "INIT_FUNCTION_TYPE"    => "string",
                "INIT_FUNCTION_SENTINEL" => "string",
@@ -98,8 +99,6 @@ my $section_types = {
 
                "OBJ_FILES"             => "list",
 
-               "DESCRIPTION"           => "string",
-
                "PRIVATE_DEPENDENCIES"  => "list",
                "PUBLIC_DEPENDENCIES"   => "list",
 
@@ -252,6 +251,8 @@ sub run_config_mk($$$$)
                        next;
                }
 
+               $line =~ s/^mkinclude /include /;
+
                # empty line
                if ($line =~ /^[ \t]*$/) {
                        $section = "GLOBAL";
index 8fbbe9cfd5b6ce7589cd6f34333b65e03831c1ef..76cd8d1a266f8d74395fdfd814bcc457a9525c0e 100644 (file)
@@ -54,64 +54,4 @@ sub _set_config($$)
        $self->{automatic_deps} = ($self->{config}->{automatic_dependencies} eq "yes");
 }
 
-sub PkgConfig($$$$$$$$$$$$)
-{
-       my ($self,$path,$name,$libs,$privlibs,$cflags,$version,$desc,$hasmodules,$pubdep,$privdep,$dirs) = @_;
-
-       print __FILE__.": creating $path\n";
-
-       if ($self->{config}->{libreplace_cv_immediate_structures} eq "yes") {
-               $cflags .= " -DHAVE_IMMEDIATE_STRUCTURES=1";
-       }
-
-       mkpath(dirname($path),0,0755);
-       open(OUT, ">$path") or die("Can't open $path: $!");
-
-       foreach (@$dirs) {
-               print OUT "$_\n";
-       }
-       if ($hasmodules) {
-               print OUT "modulesdir=$self->{config}->{modulesdir}/$name\n" ;
-       }
-
-       print OUT "\n";
-
-       print OUT "Name: $name\n";
-       if (defined($desc)) {
-               print OUT "Description: $desc\n";
-       }
-       print OUT "Requires: $pubdep\n" if defined($pubdep);
-       print OUT "Requires.private: $privdep\n" if defined($privdep);
-       print OUT "Version: $version\n";
-       print OUT "Libs: $libs\n";
-       print OUT "Libs.private: $privlibs\n" if (defined($privlibs));
-       print OUT "Cflags: -I\${includedir} $cflags\n";
-
-       close(OUT);
-}
-
-sub Import($$)
-{
-       my ($self,$items) = @_;
-
-       foreach (keys %$items) {
-               if (defined($self->{items})) {
-                       print "Warning: Importing $_ twice!\n";
-               }
-               $self->{items}->{$_} = $items->{$_};
-       }
-}
-
-sub GetInfo($$)
-{
-       my ($self,$name) = @_;
-
-       unless (defined($self->{info}->{$name})) 
-       {
-               $self->{info}->{$name} = $self->{items}->Build($self);
-       }
-
-       return $self->{info}->{$name};
-}
-
 1;
index e084d48a77b8da8a385b5da3395b6e5eed1e53ba..fb769103d05ceeea3f7cf1270dcab000d826d0fd 100644 (file)
@@ -60,8 +60,9 @@ foreach my $key (values %$OUTPUT) {
        next unless defined $key->{OUTPUT_TYPE};
 
        $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
-       $mkenv->PkgConfig($key, $OUTPUT) if $key->{TYPE} eq "LIBRARY" 
-                                   and defined($key->{VERSION});
+       if (defined($key->{PC_FILE})) {
+               push(@{$mkenv->{pc_files}}, "$key->{BASEDIR}/$key->{PC_FILE}");
+       } 
        $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and
                                        grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
        if ($key->{TYPE} eq "LIBRARY" and 
index 7e715b47eb349db20413b0f2d78a90b52d473b70..5799d89c5701ca620fccb2688dbed4c16bfe11a8 100644 (file)
@@ -111,53 +111,9 @@ __EOD__
 sub _prepare_suffix_rules($)
 {
        my ($self) = @_;
-       my $first_prereq = '$*.c';
-
-       if ($self->{config}->{GNU_MAKE} eq 'yes') {
-               $first_prereq = '$<';
-       }
 
        $self->output(<< "__EOD__"
-FIRST_PREREQ = $first_prereq
-
-# Dependencies command
-DEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.o) -MT \$@ \\
-    \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
-    \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@
-# Dependencies for host objects
-HDEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.ho) -MT \$@ \\
-    \$(HOSTCC_FLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
-    \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@
-# Dependencies for precompiled headers
-PCHDEPENDS = \$(CC) -M -MG -MT include/includes.h.gch -MT \$@ \\
-    \$(CFLAGS) \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@
-
-# \$< is broken in older BSD versions:
-# when \$@ is foo/bar.o, \$< could be torture/foo/bar.c
-# if it also exists. So better use \$* which is foo/bar
-# and append .c manually to get foo/bar.c
-#
-# If we have GNU Make, it is safe to use \$<, which also lets
-# building with \$srcdir != \$builddir work.
-
-# Run a static analysis checker
-CHECK = \$(CC_CHECKER) \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
-    \$(PICFLAG) \$(CPPLAGS) -c \$(FIRST_PREREQ) -o \$@
-
-# Run the configured compiler
-COMPILE = \$(CC) \$(CFLAGS)  \$(PICFLAG) \\
-          `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
-                 \$(CPPFLAGS) \\
-                 -c \$(FIRST_PREREQ) -o \$@
-
-# Run the compiler for the build host
-HCOMPILE = \$(HOSTCC) \$(HOSTCC_FLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
-        \$(CPPFLAGS) -c \$(FIRST_PREREQ) -o \$@
-
-# Precompile headers
-PCHCOMPILE = @\$(CC) -Ilib/replace \\
-    \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
-    \$(PICFLAG) \$(CPPFLAGS) -c \$(FIRST_PREREQ) -o \$@
+FIRST_PREREQ = $self->{config}->{FIRST_PREREQ}
 
 __EOD__
 );
@@ -500,7 +456,6 @@ sub Binary($$)
                push (@{$self->{torture_progs}}, "$installdir/$ctx->{BINARY}");
        }
 
-
        push (@{$self->{binaries}}, "$localdir/$ctx->{BINARY}");
 
        $self->_prepare_list($ctx, "OBJ_LIST");
@@ -552,115 +507,6 @@ sub Manpage($$)
        push (@{$self->{manpages}}, $path);
 }
 
-sub PkgConfig($$$)
-{
-       my ($self,$ctx,$other) = @_;
-       
-       my $link_name = $ctx->{NAME};
-
-       $link_name =~ s/^LIB//g;
-       $link_name = lc($link_name);
-
-       return if (not defined($ctx->{DESCRIPTION}));
-
-       my $path = output::add_dir_str($ctx->{BASEDIR}, "$link_name.pc");
-
-       push (@{$self->{pc_files}}, $path);
-
-       my $pubs;
-       my $privs;
-       my $privlibs;
-       my $publibs = "";
-
-       if (defined($ctx->{PUBLIC_DEPENDENCIES})) {
-               foreach (@{$ctx->{PUBLIC_DEPENDENCIES}}) {
-                       next if ($other->{$_}->{ENABLE} eq "NO");
-                       if (defined($other->{$_}->{PC_NAME})) {
-                               $pubs .= "$other->{$_}->{PC_NAME} ";
-                       } elsif ($other->{$_}->{TYPE} eq "EXT_LIB") {
-                               my $e = $other->{$_};
-                               my $ldflags = join(" ", @{$e->{LDFLAGS}});
-                               $ldflags .= " " unless $ldflags eq "";
-                               my $libs = join(" ", @{$e->{LIBS}});
-                               $libs .= " " unless $libs eq "";
-
-                               $publibs .= $ldflags.$libs;
-                       } else {
-                               s/^LIB//g;
-                               $_ = lc($_);
-
-                               $privlibs .= "-l$_ ";
-                       }
-               }
-       }
-
-       if (defined($ctx->{PRIVATE_DEPENDENCIES})) {
-               foreach (@{$ctx->{PRIVATE_DEPENDENCIES}}) {
-                       next if ($other->{$_}->{ENABLE} eq "NO");
-                       if ($other->{$_}->{TYPE} eq "EXT_LIB") {
-                               my $e = $other->{$_};
-
-                               my $ldflags = join(" ", @{$e->{LDFLAGS}});
-                               $ldflags .= " " unless $ldflags eq "";
-                               my $libs = join(" ", @{$e->{LIBS}});
-                               $libs .= " " unless $libs eq "";
-
-                               $privlibs .= $ldflags.$libs;
-                       } elsif ($other->{$_}->{TYPE} eq "LIBRARY") {
-                               s/^LIB//g;
-                               $_ = lc($_);
-
-                               $privs .= "$_ ";
-                       } else {
-                               s/^LIB//g;
-                               $_ = lc($_);
-
-                               $privlibs .= "-l$_ ";
-                       }
-               }
-       }
-
-       smb_build::env::PkgConfig($self,
-               $path,
-               $link_name,
-               "-L\${libdir} -l$link_name $publibs",
-               $privlibs,
-               "",
-               "$ctx->{VERSION}",
-               $ctx->{DESCRIPTION},
-               defined($ctx->{INIT_FUNCTIONS}),
-               $pubs,
-               "",
-               [
-                       "prefix=$self->{config}->{prefix}",
-                       "exec_prefix=$self->{config}->{exec_prefix}",
-                       "libdir=$self->{config}->{libdir}",
-                       "includedir=$self->{config}->{includedir}"
-               ]
-       ); 
-       my $abs_srcdir = abs_path($self->{config}->{srcdir});
-       smb_build::env::PkgConfig($self,
-               "bin/pkgconfig/$link_name-uninstalled.pc",
-               $link_name,
-               "-Lbin/shared -Lbin/static -l$link_name",
-               $privlibs,
-               join(' ', 
-                       "-I$abs_srcdir",
-                       "-I$abs_srcdir/include",
-                       "-I$abs_srcdir/lib",
-                       "-I$abs_srcdir/lib/replace"),
-               "$ctx->{VERSION}",
-               $ctx->{DESCRIPTION},
-               defined($ctx->{INIT_FUNCTIONS}),
-               $pubs,
-               $privs,
-               [
-                       "prefix=bin/",
-                       "includedir=$ctx->{BASEDIR}"
-               ]
-       ); 
-}
-
 sub ProtoHeader($$)
 {
        my ($self,$ctx) = @_;
index d68637104db3b5eea582e7d9053dbd8e7dacb78a..7858ee2cf0a13e54e48db48fb00ac0b557c70490 100644 (file)
@@ -204,19 +204,10 @@ static void cldapd_task_init(struct task_server *task)
 }
 
 
-/*
-  initialise the cldapd server
- */
-static NTSTATUS cldapd_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
-{
-       return task_server_startup(event_ctx, lp_ctx, model_ops, cldapd_task_init);
-}
-
-
 /*
   register ourselves as a available server
 */
 NTSTATUS server_service_cldapd_init(void)
 {
-       return register_server_service("cldap", cldapd_init);
+       return register_server_service("cldap", cldapd_task_init);
 }
index 6bac1dcbe504f79597c3c0d29155232abd7ca9b6..cc61974cbd06adcadbd9dcdf96ffc75b7ab6eee4 100644 (file)
@@ -47,12 +47,12 @@ static void cluster_init(void)
 }
 
 /*
-  server a server_id for the local node
+  create a server_id for the local node
 */
-struct server_id cluster_id(uint32_t id)
+struct server_id cluster_id(uint64_t id, uint32_t id2)
 {
        cluster_init();
-       return ops->cluster_id(ops, id);
+       return ops->cluster_id(ops, id, id2);
 }
 
 
index 7cd31282cc10aab94252197f78dd47c45d4d8eb1..7545757f2cfb3b60ae5ddd03b51cd52207c0c86b 100644 (file)
@@ -25,7 +25,9 @@
 /*
   test for same cluster id
 */
-#define cluster_id_equal(id1, id2) ((id1)->id == (id2)->id && (id1)->node == (id2)->node)
+#define cluster_id_equal(id_1, id_2) ((id_1)->id == (id_2)->id \
+                                   && (id_1)->id2 == (id_2)->id2 \
+                                   && (id_1)->node == (id_2)->node)
 
 /*
   test for same cluster node
@@ -36,7 +38,7 @@ struct messaging_context;
 typedef void (*cluster_message_fn_t)(struct messaging_context *, DATA_BLOB);
 
 /* prototypes */
-struct server_id cluster_id(uint32_t id);
+struct server_id cluster_id(uint64_t id, uint32_t id2);
 const char *cluster_id_string(TALLOC_CTX *mem_ctx, struct server_id id);
 struct tdb_wrap *cluster_tdb_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *dbname, int flags);
 void *cluster_backend_handle(void);
index 1c895b8640d54e1d46f323280fd813c5c4d6ade5..79394b46dbc1565be9af80cc754c9598a7462a78 100644 (file)
@@ -23,7 +23,7 @@
 #define _CLUSTER_PRIVATE_H_
 
 struct cluster_ops {
-       struct server_id (*cluster_id)(struct cluster_ops *ops, uint32_t id);
+       struct server_id (*cluster_id)(struct cluster_ops *ops, uint64_t id, uint32_t id2);
        const char *(*cluster_id_string)(struct cluster_ops *ops, 
                                         TALLOC_CTX *, struct server_id );
        struct tdb_wrap *(*cluster_tdb_tmp_open)(struct cluster_ops *,
index 53df1e968e7f45ec07125be1dc2574c14d51a5c4..ce295c4474ff9a88981488d81f7a80920947c4b0 100644 (file)
@@ -52,13 +52,14 @@ struct cluster_state {
 /*
   return a server_id for a ctdb node
 */
-static struct server_id ctdb_id(struct cluster_ops *ops, uint32_t id)
+static struct server_id ctdb_id(struct cluster_ops *ops, uint64_t id, uint32_t id2)
 {
        struct cluster_state *state = (struct cluster_state *)ops->private;
        struct ctdb_context *ctdb = state->ctdb;
        struct server_id server_id;
        server_id.node = ctdb_get_vnn(ctdb);
        server_id.id = id;
+       server_id.id2 = id2;
        return server_id;
 }
 
@@ -69,7 +70,7 @@ static struct server_id ctdb_id(struct cluster_ops *ops, uint32_t id)
 static const char *ctdb_id_string(struct cluster_ops *ops, 
                                  TALLOC_CTX *mem_ctx, struct server_id id)
 {
-       return talloc_asprintf(mem_ctx, "%u.%u", id.node, id.id);
+       return talloc_asprintf(mem_ctx, "%u.%llu.%u", id.node, (unsigned long long)id.id, id.id2);
 }
 
 /*
index 539e47d271318342d6b97487ef768cd22f45ce78..96636927f13a27de40b5304eaadf7db2d1676680 100644 (file)
 /*
   server a server_id for the local node
 */
-static struct server_id local_id(struct cluster_ops *ops, uint32_t id)
+static struct server_id local_id(struct cluster_ops *ops, uint64_t id, uint32_t id2)
 {
        struct server_id server_id;
        ZERO_STRUCT(server_id);
        server_id.id = id;
+       server_id.id2 = id2;
        return server_id;
 }
 
@@ -46,7 +47,7 @@ static struct server_id local_id(struct cluster_ops *ops, uint32_t id)
 static const char *local_id_string(struct cluster_ops *ops,
                                   TALLOC_CTX *mem_ctx, struct server_id id)
 {
-       return talloc_asprintf(mem_ctx, "%u.%u", id.node, id.id);
+       return talloc_asprintf(mem_ctx, "%u.%llu.%u", id.node, (unsigned long long)id.id, id.id2);
 }
 
 
index 164a21e82380e654bc2dcbaf9c3d14e35ebe011e..ed74bc1251ffa70d553c32593f1ef194c05470d7 100644 (file)
@@ -27,11 +27,20 @@ m4_include(lib/charset/config.m4)
 m4_include(lib/socket/config.m4)
 m4_include(nsswitch/nsstest.m4)
 
+AC_CONFIG_FILES(lib/registry/registry.pc)
+AC_CONFIG_FILES(librpc/dcerpc.pc)
+AC_CONFIG_FILES(librpc/ndr.pc)
+AC_CONFIG_FILES(torture/torture.pc)
+AC_CONFIG_FILES(auth/gensec/gensec.pc)
+AC_CONFIG_FILES(param/samba-config.pc)
+AC_CONFIG_FILES(librpc/dcerpc_samr.pc)
+
 SMB_EXT_LIB_FROM_PKGCONFIG(LIBTALLOC, talloc >= 1.1.0,
        [],
        [
                m4_include(lib/talloc/libtalloc.m4)
                SMB_INCLUDE_MK(lib/talloc/config.mk)
+               AC_CONFIG_FILES(lib/talloc/talloc.pc)
        ]
 )
 
@@ -40,6 +49,7 @@ SMB_EXT_LIB_FROM_PKGCONFIG(LIBTDB, tdb >= 1.1.0,
        [
                m4_include(lib/tdb/libtdb.m4)
                SMB_INCLUDE_MK(lib/tdb/config.mk)
+               AC_CONFIG_FILES(lib/tdb/tdb.pc)
        ]
 )
 
@@ -73,6 +83,7 @@ SMB_EXT_LIB_FROM_PKGCONFIG(LIBLDB, ldb >= 0.9.1,
                m4_include(lib/ldb/sqlite3.m4)
                m4_include(lib/ldb/libldb.m4)
                SMB_INCLUDE_MK(lib/ldb/config.mk)
+               AC_CONFIG_FILES(lib/ldb/ldb.pc)
        ]
 )
 SMB_INCLUDE_MK(lib/ldb/python.mk) 
index 5c170463bbec13fad6f4b89a712ebb780e8d1c4f..088dc6bd9670b25eb9275e52054e4e84f4d4a0d9 100644 (file)
@@ -123,10 +123,10 @@ static NTSTATUS sidmap_primary_domain_sid(struct sidmap_context *sidmap,
 /*
   map a sid to a unix uid
 */
-_PUBLIC_ NTSTATUS sidmap_sid_to_unixuid(struct sidmap_context *sidmap, 
-                                       struct dom_sid *sid, uid_t *uid)
+_PUBLIC_ NTSTATUS sidmap_sid_to_unixuid(struct sidmap_context *sidmap,
+                                       const struct dom_sid *sid, uid_t *uid)
 {
-       const char *attrs[] = { "sAMAccountName", "uidNumber", 
+       const char *attrs[] = { "sAMAccountName", "uidNumber",
                                "sAMAccountType", "unixName", NULL };
        int ret;
        const char *s;
@@ -137,15 +137,17 @@ _PUBLIC_ NTSTATUS sidmap_sid_to_unixuid(struct sidmap_context *sidmap,
 
        tmp_ctx = talloc_new(sidmap);
 
-       ret = gendb_search(sidmap->samctx, tmp_ctx, NULL, &res, attrs, 
-                          "objectSid=%s", ldap_encode_ndr_dom_sid(tmp_ctx, sid));
+       ret = gendb_search(sidmap->samctx, tmp_ctx, NULL, &res, attrs,
+                          "objectSid=%s",
+                          ldap_encode_ndr_dom_sid(tmp_ctx, sid));
+
        if (ret != 1) {
                goto allocated_sid;
        }
 
        /* make sure its a user, not a group */
        if (!is_user_account(res[0])) {
-               DEBUG(0,("sid_to_unixuid: sid %s is not an account!\n", 
+               DEBUG(0,("sid_to_unixuid: sid %s is not an account!\n",
                         dom_sid_string(tmp_ctx, sid)));
                talloc_free(tmp_ctx);
                return NT_STATUS_INVALID_SID;
@@ -261,9 +263,9 @@ _PUBLIC_ bool sidmap_sid_is_group(struct sidmap_context *sidmap, struct dom_sid
   map a sid to a unix gid
 */
 _PUBLIC_ NTSTATUS sidmap_sid_to_unixgid(struct sidmap_context *sidmap,
-                                       struct dom_sid *sid, gid_t *gid)
+                                       const struct dom_sid *sid, gid_t *gid)
 {
-       const char *attrs[] = { "sAMAccountName", "gidNumber", 
+       const char *attrs[] = { "sAMAccountName", "gidNumber",
                                "unixName", "sAMAccountType", NULL };
        int ret;
        const char *s;
@@ -355,7 +357,7 @@ allocated_sid:
 */
 _PUBLIC_ NTSTATUS sidmap_uid_to_sid(struct sidmap_context *sidmap,
                                    TALLOC_CTX *mem_ctx,
-                                   uid_t uid, struct dom_sid **sid)
+                                   const uid_t uid, struct dom_sid **sid)
 {
        const char *attrs[] = { "sAMAccountName", "objectSid", "sAMAccountType", NULL };
        int ret, i;
@@ -453,7 +455,7 @@ allocate_sid:
 */
 _PUBLIC_ NTSTATUS sidmap_gid_to_sid(struct sidmap_context *sidmap,
                                    TALLOC_CTX *mem_ctx,
-                                   gid_t gid, struct dom_sid **sid)
+                                   const gid_t gid, struct dom_sid **sid)
 {
        const char *attrs[] = { "sAMAccountName", "objectSid", "sAMAccountType", NULL };
        int ret, i;
index e212407e2406483920b15bee9b6a8b9cdddf9a2e..3375059e99e00e58976f4a0af4e59105ad4dcd63 100644 (file)
@@ -180,18 +180,10 @@ static void dreplsrv_task_init(struct task_server *task)
        irpc_add_name(task->msg_ctx, "dreplsrv");
 }
 
-/*
-  initialise the dsdb replicator service
- */
-static NTSTATUS dreplsrv_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
-{
-       return task_server_startup(event_ctx, lp_ctx, model_ops, dreplsrv_task_init);
-}
-
 /*
   register ourselves as a available server
 */
 NTSTATUS server_service_drepl_init(void)
 {
-       return register_server_service("drepl", dreplsrv_init);
+       return register_server_service("drepl", dreplsrv_task_init);
 }
index 8aff1340a5a7513ca0c5a8186b51c64bd527df25..552d83f411ce30de257d7c58ef3c45501867bd34 100644 (file)
@@ -400,8 +400,8 @@ WERROR dsdb_extended_replicated_objects_commit(struct ldb_context *ldb,
 
        ret = ldb_extended(ldb, DSDB_EXTENDED_REPLICATED_OBJECTS_OID, out, &ext_res);
        if (ret != LDB_SUCCESS) {
-               DEBUG(0,("Failed to apply records: %d: %s\n",
-                       ret, ldb_strerror(ret)));
+               DEBUG(0,("Failed to apply records: %s: %s\n",
+                        ldb_errstring(ldb), ldb_strerror(ret)));
                talloc_free(out);
                return WERR_FOOBAR;
        }
index b62e806398dbf4520d4a5312e74626c42abd2a92..802f86570bb34555e0ed7883852c056d851c2a93 100644 (file)
@@ -256,6 +256,7 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req)
 
        ac = talloc(req, struct extended_context);
        if (ac == NULL) {
+               ldb_oom(module->ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
@@ -273,6 +274,7 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req)
 
        down_req = talloc_zero(req, struct ldb_request);
        if (down_req == NULL) {
+               ldb_oom(module->ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
@@ -291,8 +293,10 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req)
                }
                if (ac->remove_guid || ac->remove_sid) {
                        new_attrs = copy_attrs(down_req, req->op.search.attrs);
-                       if (new_attrs == NULL)
+                       if (new_attrs == NULL) {
+                               ldb_oom(module->ldb);
                                return LDB_ERR_OPERATIONS_ERROR;
+                       }
                        
                        if (ac->remove_guid) {
                                if (!add_attrs(down_req, &new_attrs, "objectGUID"))
@@ -339,6 +343,7 @@ static int extended_init(struct ldb_module *module)
 
        req = talloc(module, struct ldb_request);
        if (req == NULL) {
+               ldb_oom(module->ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
index 064c28ec6501b83ea6af601ae614a53027d6b332..65df294e90e00f88f2b56a8b5c38b52ac79c19f7 100644 (file)
@@ -72,6 +72,7 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
 
        down_req = talloc(req, struct ldb_request);
        if (down_req == NULL) {
+               ldb_oom(module->ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
@@ -81,6 +82,7 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
        down_req->op.add.message = msg = ldb_msg_copy_shallow(down_req, req->op.add.message);
        if (msg == NULL) {
                talloc_free(down_req);
+               ldb_oom(module->ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
index 97130495a3adde2df3d54a8427cc366c0080a530..ea33548b919bcfad154c08296129531d004a8da3 100644 (file)
@@ -316,6 +316,7 @@ static int kludge_acl_search(struct ldb_module *module, struct ldb_request *req)
 
        ac = talloc(req, struct kludge_acl_context);
        if (ac == NULL) {
+               ldb_oom(module->ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
@@ -329,6 +330,7 @@ static int kludge_acl_search(struct ldb_module *module, struct ldb_request *req)
 
        down_req = talloc_zero(req, struct ldb_request);
        if (down_req == NULL) {
+               ldb_oom(module->ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
@@ -417,6 +419,7 @@ static int kludge_acl_init(struct ldb_module *module)
 
        data = talloc(module, struct kludge_private_data);
        if (data == NULL) {
+               ldb_oom(module->ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
@@ -424,6 +427,7 @@ static int kludge_acl_init(struct ldb_module *module)
        module->private_data = data;
 
        if (!mem_ctx) {
+               ldb_oom(module->ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
@@ -453,6 +457,7 @@ static int kludge_acl_init(struct ldb_module *module)
        data->password_attrs = talloc_array(data, const char *, password_attributes->num_values + 1);
        if (!data->password_attrs) {
                talloc_free(mem_ctx);
+               ldb_oom(module->ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
        for (i=0; i < password_attributes->num_values; i++) {
index 345b8b84407b22b424a52b271a21892ce978a031..c527afc6db30a9e8094825ed19964d19d056d92d 100644 (file)
@@ -153,8 +153,10 @@ static int rr_search(struct ldb_module *module, struct ldb_request *req)
                if (strncasecmp(p, ";range=", strlen(";range=")) != 0) {
                        continue;
                }
-               if (sscanf(p, ";range=%u-*", &start) == 1) {
-               } else if (sscanf(p, ";range=%u-%u", &start, &end) != 2) {
+               if (sscanf(p, ";range=%u-%u", &start, &end) == 2) {
+               } else if (sscanf(p, ";range=%u-*", &start) == 1) {
+                       end = (unsigned int)-1;
+               } else {
                        ldb_asprintf_errstring(module->ldb, "range request error: range requst malformed");
                        return LDB_ERR_UNWILLING_TO_PERFORM;
                }
index 5a3cc4bef449f1ade1303d2e1a75d54484ffc07b..441dbc95983a9167079140c2949352ecc552a3ba 100644 (file)
@@ -240,12 +240,9 @@ static int replmd_prepare_originating(struct ldb_module *module, struct ldb_requ
                                      struct ldb_dn *dn, const char *fn_name,
                                      int (*fn)(struct ldb_module *,
                                                struct ldb_request *,
-                                               const struct dsdb_schema *,
-                                               const struct dsdb_control_current_partition *))
+                                               const struct dsdb_schema *))
 {
        const struct dsdb_schema *schema;
-       const struct ldb_control *partition_ctrl;
-       const struct dsdb_control_current_partition *partition;
  
        /* do not manipulate our control entries */
        if (ldb_dn_is_special(dn)) {
@@ -260,46 +257,16 @@ static int replmd_prepare_originating(struct ldb_module *module, struct ldb_requ
                return LDB_ERR_CONSTRAINT_VIOLATION;
        }
 
-       partition_ctrl = ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID);
-       if (!partition_ctrl) {
-               ldb_debug_set(module->ldb, LDB_DEBUG_FATAL,
-                             "%s: no current partition control found",
-                             fn_name);
-               return LDB_ERR_CONSTRAINT_VIOLATION;
-       }
-
-       partition = talloc_get_type(partition_ctrl->data,
-                                   struct dsdb_control_current_partition);
-       if (!partition) {
-               ldb_debug_set(module->ldb, LDB_DEBUG_FATAL,
-                             "%s: current partition control contains invalid data",
-                             fn_name);
-               return LDB_ERR_CONSTRAINT_VIOLATION;
-       }
-
-       if (partition->version != DSDB_CONTROL_CURRENT_PARTITION_VERSION) {
-               ldb_debug_set(module->ldb, LDB_DEBUG_FATAL,
-                             "%s: current partition control contains invalid version [%u != %u]\n",
-                             fn_name, partition->version, DSDB_CONTROL_CURRENT_PARTITION_VERSION);
-               return LDB_ERR_CONSTRAINT_VIOLATION;
-       }
-
-       return fn(module, req, schema, partition);
+       return fn(module, req, schema);
 }
 
 static int replmd_add_originating(struct ldb_module *module,
                                  struct ldb_request *req,
-                                 const struct dsdb_schema *schema,
-                                 const struct dsdb_control_current_partition *partition)
+                                 const struct dsdb_schema *schema)
 {
        enum ndr_err_code ndr_err;
        struct ldb_request *down_req;
        struct ldb_message *msg;
-       uint32_t instance_type;
-       struct ldb_dn *new_dn;
-       const char *rdn_name;
-       const char *rdn_name_upper;
-       const struct ldb_val *rdn_value = NULL;
        const struct dsdb_attribute *rdn_attr = NULL;
        struct GUID guid;
        struct ldb_val guid_value;
@@ -321,12 +288,6 @@ static int replmd_add_originating(struct ldb_module *module,
                return LDB_ERR_UNWILLING_TO_PERFORM;
        }
 
-       if (ldb_msg_find_element(req->op.add.message, "instanceType")) {
-               ldb_debug_set(module->ldb, LDB_DEBUG_ERROR,
-                             "replmd_add_originating: it's not allowed to add an object with instanceType\n");
-               return LDB_ERR_UNWILLING_TO_PERFORM;
-       }
-
        /* Get a sequence number from the backend */
        ret = ldb_sequence_number(module->ldb, LDB_SEQ_NEXT, &seq_num);
        if (ret != LDB_SUCCESS) {
@@ -368,102 +329,24 @@ static int replmd_add_originating(struct ldb_module *module,
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-       /*
-        * get details of the rdn name
-        */
-       rdn_name        = ldb_dn_get_rdn_name(msg->dn);
-       if (!rdn_name) {
-               talloc_free(down_req);
-               ldb_oom(module->ldb);
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-       rdn_attr        = dsdb_attribute_by_lDAPDisplayName(schema, rdn_name);
-       if (!rdn_attr) {
-               talloc_free(down_req);
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-       rdn_value       = ldb_dn_get_rdn_val(msg->dn);
-       if (!rdn_value) {
-               talloc_free(down_req);
-               ldb_oom(module->ldb);
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-
        /* 
         * remove autogenerated attributes
         */
-       ldb_msg_remove_attr(msg, rdn_name);
-       ldb_msg_remove_attr(msg, "name");
        ldb_msg_remove_attr(msg, "whenCreated");
        ldb_msg_remove_attr(msg, "whenChanged");
        ldb_msg_remove_attr(msg, "uSNCreated");
        ldb_msg_remove_attr(msg, "uSNChanged");
        ldb_msg_remove_attr(msg, "replPropertyMetaData");
 
-       /*
-        * TODO: construct a new DN out of:
-        *       - the parent DN
-        *       - the upper case of rdn_attr->LDAPDisplayName
-        *       - rdn_value
-        */
-       new_dn = ldb_dn_copy(msg, msg->dn);
-       if (!new_dn) {
-               talloc_free(down_req);
-               ldb_oom(module->ldb);
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-       rdn_name_upper = strupper_talloc(msg, rdn_attr->lDAPDisplayName);
-       if (!rdn_name_upper) {
-               talloc_free(down_req);
-               ldb_oom(module->ldb);
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-       ret = ldb_dn_set_component(new_dn, 0, rdn_name_upper, *rdn_value);
-       if (ret != LDB_SUCCESS) {
-               talloc_free(down_req);
-               ldb_oom(module->ldb);
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-       msg->dn = new_dn;
-
-       /*
-        * TODO: calculate correct instance type
-        */
-       instance_type = INSTANCE_TYPE_WRITE;
-       if (ldb_dn_compare(partition->dn, msg->dn) == 0) {
-               instance_type |= INSTANCE_TYPE_IS_NC_HEAD;
-               if (ldb_dn_compare(msg->dn, samdb_base_dn(module->ldb)) != 0) {
-                       instance_type |= INSTANCE_TYPE_NC_ABOVE;
-               }
-       }
-
        /*
         * readd replicated attributes
         */
-       ret = ldb_msg_add_value(msg, rdn_attr->lDAPDisplayName, rdn_value, NULL);
-       if (ret != LDB_SUCCESS) {
-               talloc_free(down_req);
-               ldb_oom(module->ldb);
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-       ret = ldb_msg_add_value(msg, "name", rdn_value, NULL);
-       if (ret != LDB_SUCCESS) {
-               talloc_free(down_req);
-               ldb_oom(module->ldb);
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
        ret = ldb_msg_add_string(msg, "whenCreated", time_str);
        if (ret != LDB_SUCCESS) {
                talloc_free(down_req);
                ldb_oom(module->ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
-       ret = ldb_msg_add_fmt(msg, "instanceType", "%u", instance_type);
-       if (ret != LDB_SUCCESS) {
-               talloc_free(down_req);
-               ldb_oom(module->ldb);
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
 
        /* build the replication meta_data */
        ZERO_STRUCT(nmd);
@@ -508,6 +391,10 @@ static int replmd_add_originating(struct ldb_module *module,
                m->originating_usn              = seq_num;
                m->local_usn                    = seq_num;
                ni++;
+
+               if (ldb_attr_cmp(e->name, ldb_dn_get_rdn_name(msg->dn))) {
+                       rdn_attr = sa;
+               }
        }
 
        /* fix meta data count */
@@ -598,8 +485,7 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req)
 
 static int replmd_modify_originating(struct ldb_module *module,
                                     struct ldb_request *req,
-                                    const struct dsdb_schema *schema,
-                                    const struct dsdb_control_current_partition *partition)
+                                    const struct dsdb_schema *schema)
 {
        struct ldb_request *down_req;
        struct ldb_message *msg;
@@ -623,6 +509,18 @@ static int replmd_modify_originating(struct ldb_module *module,
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
+       /* TODO:
+        * - get the whole old object
+        * - if the old object doesn't exist report an error
+        * - give an error when a readonly attribute should
+        *   be modified
+        * - merge the changed into the old object
+        *   if the caller set values to the same value
+        *   ignore the attribute, return success when no
+        *   attribute was changed
+        * - calculate the new replPropertyMetaData attribute
+        */
+
        if (add_time_element(msg, "whenChanged", t) != 0) {
                talloc_free(down_req);
                return LDB_ERR_OPERATIONS_ERROR;
@@ -637,6 +535,11 @@ static int replmd_modify_originating(struct ldb_module *module,
                }
        }
 
+       /* TODO:
+        * - sort the attributes by attid with replmd_ldb_message_sort()
+        * - replace the old object with the newly constructed one
+        */
+
        ldb_set_timeout_from_prev_req(module->ldb, req, down_req);
 
        /* go on with the call chain */
@@ -806,10 +709,16 @@ static int replmd_replicated_apply_add(struct replmd_replicated_request *ar)
        return ldb_next_request(ar->module, ar->sub.change_req);
 #else
        ret = ldb_next_request(ar->module, ar->sub.change_req);
-       if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret);
+       if (ret != LDB_SUCCESS) {
+               ldb_asprintf_errstring(ar->module->ldb, "Failed to add replicated object %s: %s", ldb_dn_get_linearized(ar->sub.change_req->op.add.message->dn), 
+                                      ldb_errstring(ar->module->ldb));
+               return replmd_replicated_request_error(ar, ret);
+       }
 
-       ar->sub.change_ret = ldb_wait(ar->sub.search_req->handle, LDB_WAIT_ALL);
+       ar->sub.change_ret = ldb_wait(ar->sub.change_req->handle, LDB_WAIT_ALL);
        if (ar->sub.change_ret != LDB_SUCCESS) {
+               ldb_asprintf_errstring(ar->module->ldb, "Failed while waiting on add replicated object %s: %s", ldb_dn_get_linearized(ar->sub.change_req->op.add.message->dn), 
+                                      ldb_errstring(ar->module->ldb));
                return replmd_replicated_request_error(ar, ar->sub.change_ret);
        }
 
@@ -1053,7 +962,7 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
        ret = ldb_next_request(ar->module, ar->sub.change_req);
        if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret);
 
-       ar->sub.change_ret = ldb_wait(ar->sub.search_req->handle, LDB_WAIT_ALL);
+       ar->sub.change_ret = ldb_wait(ar->sub.change_req->handle, LDB_WAIT_ALL);
        if (ar->sub.change_ret != LDB_SUCCESS) {
                return replmd_replicated_request_error(ar, ar->sub.change_ret);
        }
@@ -1137,7 +1046,7 @@ static int replmd_replicated_apply_search(struct replmd_replicated_request *ar)
        if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret);
 
        ar->sub.search_ret = ldb_wait(ar->sub.search_req->handle, LDB_WAIT_ALL);
-       if (ar->sub.search_ret != LDB_SUCCESS) {
+       if (ar->sub.search_ret != LDB_SUCCESS && ar->sub.search_ret != LDB_ERR_NO_SUCH_OBJECT) {
                return replmd_replicated_request_error(ar, ar->sub.search_ret);
        }
        if (ar->sub.search_msg) {
index 8a80260a692d50e8d7fa7a15da84aeb2d3c3d65f..baf419c750def7db6486ab1c11c45a2ad819a7cc 100644 (file)
@@ -72,7 +72,7 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
 
        if (new_id == 0) {
                /* out of IDs ! */
-               ldb_debug(ldb, LDB_DEBUG_FATAL, "Are we out of valid IDs ?\n");
+               ldb_set_errstring(ldb, "Are we out of valid IDs ?\n");
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
@@ -81,6 +81,7 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
        ZERO_STRUCT(msg);
        msg.dn = ldb_dn_copy(mem_ctx, dn);
        if (!msg.dn) {
+               ldb_oom(ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
        msg.num_elements = 2;
@@ -91,6 +92,7 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
        els[0].flags = LDB_FLAG_MOD_DELETE;
        els[0].name = talloc_strdup(mem_ctx, "nextRid");
        if (!els[0].name) {
+               ldb_oom(ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
@@ -101,12 +103,14 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
 
        vals[0].data = (uint8_t *)talloc_asprintf(mem_ctx, "%u", old_id);
        if (!vals[0].data) {
+               ldb_oom(ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
        vals[0].length = strlen((char *)vals[0].data);
 
        vals[1].data = (uint8_t *)talloc_asprintf(mem_ctx, "%u", new_id);
        if (!vals[1].data) {
+               ldb_oom(ldb);
                return LDB_ERR_OPERATIONS_ERROR;
        }
        vals[1].length = strlen((char *)vals[1].data);
index 559c91bd2d863b5049d49851860da58a9ea58738..f9dd131fd4f8327ab323aa0f2c57fb22913a0c12 100644 (file)
@@ -59,6 +59,7 @@ static int schema_fsmo_init(struct ldb_module *module)
 
        schema_dn = samdb_schema_dn(module->ldb);
        if (!schema_dn) {
+               ldb_reset_err_string(module->ldb);
                ldb_debug(module->ldb, LDB_DEBUG_WARNING,
                          "schema_fsmo_init: no schema dn present: (skip schema loading)\n");
                return ldb_next_init(module);
@@ -91,6 +92,7 @@ static int schema_fsmo_init(struct ldb_module *module)
                         NULL, schema_attrs,
                         &schema_res);
        if (ret == LDB_ERR_NO_SUCH_OBJECT) {
+               ldb_reset_err_string(module->ldb);
                ldb_debug(module->ldb, LDB_DEBUG_WARNING,
                          "schema_fsmo_init: no schema head present: (skip schema loading)\n");
                talloc_free(mem_ctx);
index c11eea1757c99a0649c6f79251d6aba413eeb010..a01e4425878a4e134c75b6b6f55f6d9fb5fb8eb7 100644 (file)
@@ -103,8 +103,8 @@ int samdb_copy_template(struct ldb_context *ldb,
 
        if (!templates_ldb) {
                templates_ldb_path = samdb_relative_path(ldb, 
-                                                       msg, 
-                                                       "templates.ldb");
+                                                        msg, 
+                                                        "templates.ldb");
                if (!templates_ldb_path) {
                        *errstring = talloc_asprintf(msg, "samdb_copy_template: ERROR: Failed to contruct path for template db");
                        return LDB_ERR_OPERATIONS_ERROR;
@@ -115,6 +115,8 @@ int samdb_copy_template(struct ldb_context *ldb,
                                                NULL, 0, NULL);
                talloc_free(templates_ldb_path);
                if (!templates_ldb) {
+                       *errstring = talloc_asprintf(msg, "samdb_copy_template: ERROR: Failed to connect to templates db at: %s",
+                                            templates_ldb_path);
                        return LDB_ERR_OPERATIONS_ERROR;
                }
                
index 9bc51c676ee3dc266cd5d02738e049168db2cea2..2c133b64242185ddd9fe125e816d304b7115ba6f 100644 (file)
@@ -939,7 +939,7 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(const struct dsdb_schema *sch
                }
 
                ndr_err = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob,
-                                                  out->values, NULL, &id3b,
+                                                  out->values, lp_iconv_convenience(global_loadparm), &id3b,
                                                   (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3Binary);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
@@ -997,7 +997,7 @@ static WERROR dsdb_syntax_DN_BINARY_ldb_to_drsuapi(const struct dsdb_schema *sch
                id3b.dn         = (const char *)in->values[i].data;
                id3b.binary     = data_blob(NULL, 0);
 
-               ndr_err = ndr_push_struct_blob(&blobs[i], blobs, NULL, &id3b,
+               ndr_err = ndr_push_struct_blob(&blobs[i], blobs, lp_iconv_convenience(global_loadparm), &id3b,
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3Binary);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
index 04e7ddd2ff1ceef58087fdb89f9333936366c76f..52ee4758625ae975adae437d26892c27e44a006b 100644 (file)
@@ -660,18 +660,8 @@ static void kdc_task_init(struct task_server *task)
 }
 
 
-/*
-  called on startup of the KDC service 
-*/
-static NTSTATUS kdc_init(struct event_context *event_ctx, 
-                        struct loadparm_context *lp_ctx,
-                        const struct model_ops *model_ops)
-{      
-       return task_server_startup(event_ctx, lp_ctx, model_ops, kdc_task_init);
-}
-
 /* called at smbd startup - register ourselves as a server service */
 NTSTATUS server_service_kdc_init(void)
 {
-       return register_server_service("kdc", kdc_init);
+       return register_server_service("kdc", kdc_task_init);
 }
index 8380775c287dfd6a580ab88b390733c0a4dee981..5b2519c035a7845d9d152c3bccdea1da867562c4 100644 (file)
@@ -576,20 +576,8 @@ failed:
        task_server_terminate(task, "Failed to startup ldap server task");      
 }
 
-/*
-  called on startup of the web server service It's job is to start
-  listening on all configured sockets
-*/
-static NTSTATUS ldapsrv_init(struct event_context *event_context, 
-                            struct loadparm_context *lp_ctx,
-                            const struct model_ops *model_ops)
-{      
-       return task_server_startup(event_context, lp_ctx, model_ops, 
-                                  ldapsrv_task_init);
-}
-
 
 NTSTATUS server_service_ldap_init(void)
 {
-       return register_server_service("ldap", ldapsrv_init);
+       return register_server_service("ldap", ldapsrv_task_init);
 }
index 8be5d11958ae252076356ed69cdc1e023f7a96bc..7bd719cdd98a9c88c373fc4c2f2b49644ca20d56 100644 (file)
@@ -213,7 +213,7 @@ valgrindtest: all
 
 installcheck: install test
 
-install:: all installdirs installheaders installlibs installbin installdoc \
+install:: all installdirs installheaders installlibs installbin installdocs \
                @PYTHON_INSTALL_TARGET@
 
 installdirs:
index a3b10a22d5a9741c7e209770663e7879a0613f3a..75ce89d6cfeee1c0d97cfdc9c2038ccb9c7ee6d0 100644 (file)
@@ -130,7 +130,7 @@ VERSION = 0.0.1
 SO_VERSION = 0
 OUTPUT_TYPE = SHARED_LIBRARY
 CFLAGS = -Ilib/ldb/include
-DESCRIPTION = LDAP-like embedded database library
+PC_FILE = ldb.pc
 INIT_FUNCTION_TYPE = int (*) (void)
 OBJ_FILES = \
                common/ldb.o \
index 62a840e561c3551134da6a0d6489da987110c701..176cef0f3e067b5c0938c1b09c6f6df52701494b 100644 (file)
@@ -11,7 +11,7 @@ AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""])
 AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""])
 AC_DEFUN([SMB_EXT_LIB], [echo -n ""])
 AC_DEFUN([SMB_ENABLE], [echo -n ""])
-AC_INIT(ldb, 0.9.1)
+AC_INIT(ldb, 0.9.2)
 AC_CONFIG_SRCDIR([common/ldb.c])
 
 AC_LIBREPLACE_ALL_CHECKS
index 560142eb6deb0822a566501d32a499cd4b642616..336100c4f0a8bbfad118e67f2016f89b98301c0b 100644 (file)
@@ -5,7 +5,7 @@
 
    Copyright (C) 2005,2006 Tim Potter <tpot@samba.org>
    Copyright (C) 2006 Simo Sorce <idra@samba.org>
-   Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org>
+   Copyright (C) 2007-2008 Jelmer Vernooij <jelmer@samba.org>
 
      ** NOTE! The following LGPL license applies to the ldb
      ** library. This does NOT imply that all of Samba is released
@@ -102,8 +102,44 @@ typedef int ldb_error;
        $1->data = PyString_AsString($input);
 }
 
+%inline %{
+PyObject *ldb_val_to_py_object(struct ldb_context *ldb_ctx, 
+                               struct ldb_message_element *el, 
+                               struct ldb_val *val)
+{
+        const struct ldb_schema_attribute *a;
+        struct ldb_val new_val;
+        TALLOC_CTX *mem_ctx = talloc_new(NULL);
+        PyObject *ret;
+        
+        new_val = *val;
+        
+        if (ldb_ctx != NULL) {        
+               a = ldb_schema_attribute_by_name(ldb_ctx, el->name);
+        
+               if (a != NULL) {
+                       if (a->syntax->ldif_write_fn(ldb_ctx, mem_ctx, val, &new_val) != 0) {
+                               talloc_free(mem_ctx);
+                               return NULL;
+                       }
+               }
+        } 
+        
+       ret = PyString_FromStringAndSize((const char *)new_val.data, new_val.length);
+       
+       talloc_free(mem_ctx);
+       
+       return ret;
+}
+
+%}
+
+%typemap(out,noblock=1) struct ldb_val * {
+       $result = PyString_FromStringAndSize((const char *)$1->data, $1->length)
+}
+
 %typemap(out,noblock=1) struct ldb_val {
-       $result = PyString_FromStringAndSize((const char *)$1.data, $1.length);
+       $result = PyString_FromStringAndSize((const char *)$1.data, $1.length)
 }
 
 /*
@@ -259,7 +295,8 @@ ldb_msg_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx,
     return me;
 }
 
-PyObject *ldb_msg_element_to_set(ldb_msg_element *me)
+PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx, 
+                                 ldb_msg_element *me)
 {
     int i;
     PyObject *result;
@@ -269,8 +306,7 @@ PyObject *ldb_msg_element_to_set(ldb_msg_element *me)
 
     for (i = 0; i < me->num_values; i++) {
         PyList_SetItem(result, i,
-            PyString_FromStringAndSize((const char *)me->values[i].data, 
-                                       me->values[i].length));
+            ldb_val_to_py_object(ldb_ctx, me, &me->values[i]));
     }
 
     return result;
@@ -287,12 +323,12 @@ typedef struct ldb_message_element {
 #ifdef SWIGPYTHON
         PyObject *__iter__(void)
         {
-            return PyObject_GetIter(ldb_msg_element_to_set($self));
+            return PyObject_GetIter(ldb_msg_element_to_set(NULL, $self));
         }
 
         PyObject *__set__(void)
         {
-            return ldb_msg_element_to_set($self);
+            return ldb_msg_element_to_set(NULL, $self);
         }
 
         ldb_msg_element(PyObject *set_obj, int flags=0, const char *name = NULL)
@@ -311,9 +347,7 @@ typedef struct ldb_message_element {
             if (i < 0 || i >= $self->num_values)
                 return Py_None;
 
-            return PyString_FromStringAndSize(
-                        (const char *)$self->values[i].data, 
-                        $self->values[i].length);
+            return ldb_val_to_py_object(NULL, $self, &$self->values[i]);
         }
 
         ~ldb_msg_element() { talloc_free($self); }
@@ -622,6 +656,35 @@ typedef struct ldb_context {
         ldb_dn *get_root_basedn();
         ldb_dn *get_schema_basedn();
         ldb_dn *get_default_basedn();
+        PyObject *schema_format_value(const char *element_name, PyObject *val)
+        {
+               const struct ldb_schema_attribute *a;
+               struct ldb_val old_val;
+               struct ldb_val new_val;
+               TALLOC_CTX *mem_ctx = talloc_new(NULL);
+               PyObject *ret;
+               
+               old_val.data = PyString_AsString(val);
+               old_val.length = PyString_Size(val);
+                
+               a = ldb_schema_attribute_by_name($self, element_name);
+        
+               if (a == NULL) {
+                       return Py_None;
+               }
+               
+               if (a->syntax->ldif_write_fn($self, mem_ctx, &old_val, &new_val) != 0) {
+                       talloc_free(mem_ctx);
+                       return Py_None;
+                }
+        
+               ret = PyString_FromStringAndSize((const char *)new_val.data, new_val.length);
+               
+               talloc_free(mem_ctx);
+               
+               return ret;
+        }
+
         const char *errstring();
         void set_create_perms(unsigned int perms);
         void set_modules_dir(const char *path);
@@ -633,7 +696,10 @@ typedef struct ldb_context {
         ldb_error transaction_start();
         ldb_error transaction_commit();
         ldb_error transaction_cancel();
-
+        void schema_attribute_remove(const char *name);
+        ldb_error schema_attribute_add(const char *attribute, unsigned flags, const char *syntax);
+       ldb_error setup_wellknown_attributes(void);
+       
 #ifdef SWIGPYTHON
         %typemap(in,numinputs=0,noblock=1) struct ldb_result **result_as_bool (struct ldb_result *tmp) { $1 = &tmp; }
         %typemap(argout,noblock=1) struct ldb_result **result_as_bool { $result = ((*$1)->count > 0)?Py_True:Py_False; }
index ab2a68a4b31c986cf520188ab6d6edc7e256c3ae..0bcfd36779b806cac759448b86e0d58ad763a596 100644 (file)
@@ -65,6 +65,7 @@ CHANGETYPE_NONE = _ldb.CHANGETYPE_NONE
 CHANGETYPE_ADD = _ldb.CHANGETYPE_ADD
 CHANGETYPE_DELETE = _ldb.CHANGETYPE_DELETE
 CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY
+ldb_val_to_py_object = _ldb.ldb_val_to_py_object
 class Dn(object):
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
     __repr__ = _swig_repr
@@ -218,6 +219,7 @@ Ldb.get_config_basedn = new_instancemethod(_ldb.Ldb_get_config_basedn,None,Ldb)
 Ldb.get_root_basedn = new_instancemethod(_ldb.Ldb_get_root_basedn,None,Ldb)
 Ldb.get_schema_basedn = new_instancemethod(_ldb.Ldb_get_schema_basedn,None,Ldb)
 Ldb.get_default_basedn = new_instancemethod(_ldb.Ldb_get_default_basedn,None,Ldb)
+Ldb.schema_format_value = new_instancemethod(_ldb.Ldb_schema_format_value,None,Ldb)
 Ldb.errstring = new_instancemethod(_ldb.Ldb_errstring,None,Ldb)
 Ldb.set_create_perms = new_instancemethod(_ldb.Ldb_set_create_perms,None,Ldb)
 Ldb.set_modules_dir = new_instancemethod(_ldb.Ldb_set_modules_dir,None,Ldb)
@@ -227,6 +229,9 @@ Ldb.get_opaque = new_instancemethod(_ldb.Ldb_get_opaque,None,Ldb)
 Ldb.transaction_start = new_instancemethod(_ldb.Ldb_transaction_start,None,Ldb)
 Ldb.transaction_commit = new_instancemethod(_ldb.Ldb_transaction_commit,None,Ldb)
 Ldb.transaction_cancel = new_instancemethod(_ldb.Ldb_transaction_cancel,None,Ldb)
+Ldb.schema_attribute_remove = new_instancemethod(_ldb.Ldb_schema_attribute_remove,None,Ldb)
+Ldb.schema_attribute_add = new_instancemethod(_ldb.Ldb_schema_attribute_add,None,Ldb)
+Ldb.setup_wellknown_attributes = new_instancemethod(_ldb.Ldb_setup_wellknown_attributes,None,Ldb)
 Ldb.__contains__ = new_instancemethod(_ldb.Ldb___contains__,None,Ldb)
 Ldb.parse_ldif = new_instancemethod(_ldb.Ldb_parse_ldif,None,Ldb)
 Ldb_swigregister = _ldb.Ldb_swigregister
index c833246ead01514310c24ec976dba098ac1f971e..51022e5930e2e2980e574636f0281481c973c2ce 100644 (file)
@@ -2470,20 +2470,21 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
 #define SWIGTYPE_p_ldb_message_element swig_types[8]
 #define SWIGTYPE_p_ldb_module_ops swig_types[9]
 #define SWIGTYPE_p_ldb_result swig_types[10]
-#define SWIGTYPE_p_long_long swig_types[11]
-#define SWIGTYPE_p_p_char swig_types[12]
-#define SWIGTYPE_p_p_ldb_control swig_types[13]
-#define SWIGTYPE_p_p_ldb_result swig_types[14]
-#define SWIGTYPE_p_short swig_types[15]
-#define SWIGTYPE_p_signed_char swig_types[16]
-#define SWIGTYPE_p_unsigned_char swig_types[17]
-#define SWIGTYPE_p_unsigned_int swig_types[18]
-#define SWIGTYPE_p_unsigned_long swig_types[19]
-#define SWIGTYPE_p_unsigned_long_long swig_types[20]
-#define SWIGTYPE_p_unsigned_short swig_types[21]
-#define SWIGTYPE_p_void swig_types[22]
-static swig_type_info *swig_types[24];
-static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0};
+#define SWIGTYPE_p_ldb_val swig_types[11]
+#define SWIGTYPE_p_long_long swig_types[12]
+#define SWIGTYPE_p_p_char swig_types[13]
+#define SWIGTYPE_p_p_ldb_control swig_types[14]
+#define SWIGTYPE_p_p_ldb_result swig_types[15]
+#define SWIGTYPE_p_short swig_types[16]
+#define SWIGTYPE_p_signed_char swig_types[17]
+#define SWIGTYPE_p_unsigned_char swig_types[18]
+#define SWIGTYPE_p_unsigned_int swig_types[19]
+#define SWIGTYPE_p_unsigned_long swig_types[20]
+#define SWIGTYPE_p_unsigned_long_long swig_types[21]
+#define SWIGTYPE_p_unsigned_short swig_types[22]
+#define SWIGTYPE_p_void swig_types[23]
+static swig_type_info *swig_types[25];
+static swig_module_info swig_module = {swig_types, 24, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -2550,6 +2551,37 @@ SWIG_From_int  (int value)
 }
 
 
+PyObject *ldb_val_to_py_object(struct ldb_context *ldb_ctx, 
+                               struct ldb_message_element *el, 
+                               struct ldb_val *val)
+{
+        const struct ldb_schema_attribute *a;
+        struct ldb_val new_val;
+        TALLOC_CTX *mem_ctx = talloc_new(NULL);
+        PyObject *ret;
+        
+        new_val = *val;
+        
+        if (ldb_ctx != NULL) {        
+               a = ldb_schema_attribute_by_name(ldb_ctx, el->name);
+        
+               if (a != NULL) {
+                       if (a->syntax->ldif_write_fn(ldb_ctx, mem_ctx, val, &new_val) != 0) {
+                               talloc_free(mem_ctx);
+                               return NULL;
+                       }
+               }
+        } 
+        
+       ret = PyString_FromStringAndSize((const char *)new_val.data, new_val.length);
+       
+       talloc_free(mem_ctx);
+       
+       return ret;
+}
+
+
+
 SWIGINTERN swig_type_info*
 SWIG_pchar_descriptor(void)
 {
@@ -2719,7 +2751,8 @@ ldb_msg_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx,
     return me;
 }
 
-PyObject *ldb_msg_element_to_set(ldb_msg_element *me)
+PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx, 
+                                 ldb_msg_element *me)
 {
     int i;
     PyObject *result;
@@ -2729,8 +2762,7 @@ PyObject *ldb_msg_element_to_set(ldb_msg_element *me)
 
     for (i = 0; i < me->num_values; i++) {
         PyList_SetItem(result, i,
-            PyString_FromStringAndSize((const char *)me->values[i].data, 
-                                       me->values[i].length));
+            ldb_val_to_py_object(ldb_ctx, me, &me->values[i]));
     }
 
     return result;
@@ -2738,10 +2770,10 @@ PyObject *ldb_msg_element_to_set(ldb_msg_element *me)
 
 
 SWIGINTERN PyObject *ldb_msg_element___iter__(ldb_msg_element *self){
-            return PyObject_GetIter(ldb_msg_element_to_set(self));
+            return PyObject_GetIter(ldb_msg_element_to_set(NULL, self));
         }
 SWIGINTERN PyObject *ldb_msg_element___set__(ldb_msg_element *self){
-            return ldb_msg_element_to_set(self);
+            return ldb_msg_element_to_set(NULL, self);
         }
 
 #include <limits.h>
@@ -2898,9 +2930,7 @@ SWIGINTERN PyObject *ldb_msg_element_get(ldb_msg_element *self,int i){
             if (i < 0 || i >= self->num_values)
                 return Py_None;
 
-            return PyString_FromStringAndSize(
-                        (const char *)self->values[i].data, 
-                        self->values[i].length);
+            return ldb_val_to_py_object(NULL, self, &self->values[i]);
         }
 SWIGINTERN void delete_ldb_msg_element(ldb_msg_element *self){ talloc_free(self); }
 
@@ -3129,6 +3159,33 @@ SWIGINTERN ldb_error ldb_add__SWIG_1(ldb *self,PyObject *py_msg){
             fail:
             return 80;
         }
+SWIGINTERN PyObject *ldb_schema_format_value(ldb *self,char const *element_name,PyObject *val){
+               const struct ldb_schema_attribute *a;
+               struct ldb_val old_val;
+               struct ldb_val new_val;
+               TALLOC_CTX *mem_ctx = talloc_new(NULL);
+               PyObject *ret;
+               
+               old_val.data = PyString_AsString(val);
+               old_val.length = PyString_Size(val);
+                
+               a = ldb_schema_attribute_by_name(self, element_name);
+        
+               if (a == NULL) {
+                       return Py_None;
+               }
+               
+               if (a->syntax->ldif_write_fn(self, mem_ctx, &old_val, &new_val) != 0) {
+                       talloc_free(mem_ctx);
+                       return Py_None;
+                }
+        
+               ret = PyString_FromStringAndSize((const char *)new_val.data, new_val.length);
+               
+               talloc_free(mem_ctx);
+               
+               return ret;
+        }
 SWIGINTERN ldb_error ldb___contains__(ldb *self,ldb_dn *dn,struct ldb_result **result_as_bool){
             return ldb_search(self, dn, LDB_SCOPE_BASE, NULL, NULL, 
                              result_as_bool);
@@ -3153,6 +3210,52 @@ static char *timestring(time_t t)
 #ifdef __cplusplus
 extern "C" {
 #endif
+SWIGINTERN PyObject *_wrap_ldb_val_to_py_object(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+  PyObject *resultobj = 0;
+  struct ldb_context *arg1 = (struct ldb_context *) 0 ;
+  struct ldb_message_element *arg2 = (struct ldb_message_element *) 0 ;
+  struct ldb_val *arg3 = (struct ldb_val *) 0 ;
+  PyObject *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  void *argp3 = 0 ;
+  int res3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  char *  kwnames[] = {
+    (char *) "ldb_ctx",(char *) "el",(char *) "val", NULL 
+  };
+  
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ldb_val_to_py_object",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_val_to_py_object" "', argument " "1"" of type '" "struct ldb_context *""'"); 
+  }
+  arg1 = (struct ldb_context *)(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_message_element, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_val_to_py_object" "', argument " "2"" of type '" "struct ldb_message_element *""'"); 
+  }
+  arg2 = (struct ldb_message_element *)(argp2);
+  res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_ldb_val, 0 |  0 );
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ldb_val_to_py_object" "', argument " "3"" of type '" "struct ldb_val *""'"); 
+  }
+  arg3 = (struct ldb_val *)(argp3);
+  if (arg1 == NULL)
+  SWIG_exception(SWIG_ValueError, 
+    "ldb context must be non-NULL");
+  result = (PyObject *)ldb_val_to_py_object(arg1,arg2,arg3);
+  resultobj = result;
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_new_Dn(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   ldb *arg1 = (ldb *) 0 ;
@@ -4875,6 +4978,49 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_Ldb_schema_format_value(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+  PyObject *resultobj = 0;
+  ldb *arg1 = (ldb *) 0 ;
+  char *arg2 = (char *) 0 ;
+  PyObject *arg3 = (PyObject *) 0 ;
+  PyObject *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  char *  kwnames[] = {
+    (char *) "self",(char *) "element_name",(char *) "val", NULL 
+  };
+  
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Ldb_schema_format_value",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_schema_format_value" "', argument " "1"" of type '" "ldb *""'"); 
+  }
+  arg1 = (ldb *)(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_schema_format_value" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = (char *)(buf2);
+  arg3 = obj2;
+  if (arg1 == NULL)
+  SWIG_exception(SWIG_ValueError, 
+    "ldb context must be non-NULL");
+  result = (PyObject *)ldb_schema_format_value(arg1,(char const *)arg2,arg3);
+  resultobj = result;
+  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_Ldb_errstring(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   ldb *arg1 = (ldb *) 0 ;
@@ -5197,6 +5343,140 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_Ldb_schema_attribute_remove(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+  PyObject *resultobj = 0;
+  ldb *arg1 = (ldb *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  char *  kwnames[] = {
+    (char *) "self",(char *) "name", NULL 
+  };
+  
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb_schema_attribute_remove",kwnames,&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_schema_attribute_remove" "', argument " "1"" of type '" "ldb *""'"); 
+  }
+  arg1 = (ldb *)(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_schema_attribute_remove" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = (char *)(buf2);
+  if (arg1 == NULL)
+  SWIG_exception(SWIG_ValueError, 
+    "ldb context must be non-NULL");
+  ldb_schema_attribute_remove(arg1,(char const *)arg2);
+  resultobj = SWIG_Py_Void();
+  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Ldb_schema_attribute_add(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+  PyObject *resultobj = 0;
+  ldb *arg1 = (ldb *) 0 ;
+  char *arg2 = (char *) 0 ;
+  unsigned int arg3 ;
+  char *arg4 = (char *) 0 ;
+  ldb_error result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  unsigned int val3 ;
+  int ecode3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
+  char *  kwnames[] = {
+    (char *) "self",(char *) "attribute",(char *) "flags",(char *) "syntax", NULL 
+  };
+  
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOOO:Ldb_schema_attribute_add",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_schema_attribute_add" "', argument " "1"" of type '" "ldb *""'"); 
+  }
+  arg1 = (ldb *)(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_schema_attribute_add" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = (char *)(buf2);
+  ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Ldb_schema_attribute_add" "', argument " "3"" of type '" "unsigned int""'");
+  } 
+  arg3 = (unsigned int)(val3);
+  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Ldb_schema_attribute_add" "', argument " "4"" of type '" "char const *""'");
+  }
+  arg4 = (char *)(buf4);
+  if (arg1 == NULL)
+  SWIG_exception(SWIG_ValueError, 
+    "ldb context must be non-NULL");
+  result = ldb_schema_attribute_add(arg1,(char const *)arg2,arg3,(char const *)arg4);
+  if (result != 0) {
+    PyErr_SetObject(PyExc_LdbError, Py_BuildValue((char *)"(i,s)", result, ldb_strerror(result)));
+    SWIG_fail;
+  }
+  resultobj = Py_None;
+  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+  if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+  if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Ldb_setup_wellknown_attributes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ldb *arg1 = (ldb *) 0 ;
+  ldb_error result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject *swig_obj[1] ;
+  
+  if (!args) SWIG_fail;
+  swig_obj[0] = args;
+  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_setup_wellknown_attributes" "', argument " "1"" of type '" "ldb *""'"); 
+  }
+  arg1 = (ldb *)(argp1);
+  if (arg1 == NULL)
+  SWIG_exception(SWIG_ValueError, 
+    "ldb context must be non-NULL");
+  result = ldb_setup_wellknown_attributes(arg1);
+  if (result != 0) {
+    PyErr_SetObject(PyExc_LdbError, Py_BuildValue((char *)"(i,s)", result, ldb_strerror(result)));
+    SWIG_fail;
+  }
+  resultobj = Py_None;
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_Ldb___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   ldb *arg1 = (ldb *) 0 ;
@@ -5400,6 +5680,7 @@ fail:
 
 
 static PyMethodDef SwigMethods[] = {
+        { (char *)"ldb_val_to_py_object", (PyCFunction) _wrap_ldb_val_to_py_object, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"new_Dn", (PyCFunction) _wrap_new_Dn, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"delete_Dn", (PyCFunction)_wrap_delete_Dn, METH_O, NULL},
         { (char *)"Dn_validate", (PyCFunction)_wrap_Dn_validate, METH_O, NULL},
@@ -5454,6 +5735,7 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"Ldb_get_root_basedn", (PyCFunction)_wrap_Ldb_get_root_basedn, METH_O, NULL},
         { (char *)"Ldb_get_schema_basedn", (PyCFunction)_wrap_Ldb_get_schema_basedn, METH_O, NULL},
         { (char *)"Ldb_get_default_basedn", (PyCFunction)_wrap_Ldb_get_default_basedn, METH_O, NULL},
+        { (char *)"Ldb_schema_format_value", (PyCFunction) _wrap_Ldb_schema_format_value, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Ldb_errstring", (PyCFunction)_wrap_Ldb_errstring, METH_O, NULL},
         { (char *)"Ldb_set_create_perms", (PyCFunction) _wrap_Ldb_set_create_perms, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Ldb_set_modules_dir", (PyCFunction) _wrap_Ldb_set_modules_dir, METH_VARARGS | METH_KEYWORDS, NULL},
@@ -5463,6 +5745,9 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"Ldb_transaction_start", (PyCFunction)_wrap_Ldb_transaction_start, METH_O, NULL},
         { (char *)"Ldb_transaction_commit", (PyCFunction)_wrap_Ldb_transaction_commit, METH_O, NULL},
         { (char *)"Ldb_transaction_cancel", (PyCFunction)_wrap_Ldb_transaction_cancel, METH_O, NULL},
+        { (char *)"Ldb_schema_attribute_remove", (PyCFunction) _wrap_Ldb_schema_attribute_remove, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Ldb_schema_attribute_add", (PyCFunction) _wrap_Ldb_schema_attribute_add, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Ldb_setup_wellknown_attributes", (PyCFunction)_wrap_Ldb_setup_wellknown_attributes, METH_O, NULL},
         { (char *)"Ldb___contains__", (PyCFunction) _wrap_Ldb___contains__, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Ldb_parse_ldif", (PyCFunction) _wrap_Ldb_parse_ldif, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Ldb_swigregister", Ldb_swigregister, METH_VARARGS, NULL},
@@ -5488,6 +5773,7 @@ static swig_type_info _swigt__p_ldb_message = {"_p_ldb_message", "ldb_msg *|stru
 static swig_type_info _swigt__p_ldb_message_element = {"_p_ldb_message_element", "struct ldb_message_element *|ldb_msg_element *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_module_ops = {"_p_ldb_module_ops", "struct ldb_module_ops *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_result = {"_p_ldb_result", "struct ldb_result *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_ldb_val = {"_p_ldb_val", "struct ldb_val *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_ldb_control = {"_p_p_ldb_control", "struct ldb_control **", 0, 0, (void*)0, 0};
@@ -5513,6 +5799,7 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_ldb_message_element,
   &_swigt__p_ldb_module_ops,
   &_swigt__p_ldb_result,
+  &_swigt__p_ldb_val,
   &_swigt__p_long_long,
   &_swigt__p_p_char,
   &_swigt__p_p_ldb_control,
@@ -5538,6 +5825,7 @@ static swig_cast_info _swigc__p_ldb_message[] = {  {&_swigt__p_ldb_message, 0, 0
 static swig_cast_info _swigc__p_ldb_message_element[] = {  {&_swigt__p_ldb_message_element, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_ldb_module_ops[] = {  {&_swigt__p_ldb_module_ops, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_ldb_result[] = {  {&_swigt__p_ldb_result, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_ldb_val[] = {  {&_swigt__p_ldb_val, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_long_long[] = {  {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_p_char[] = {  {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_p_ldb_control[] = {  {&_swigt__p_p_ldb_control, 0, 0, 0},{0, 0, 0, 0}};
@@ -5563,6 +5851,7 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_ldb_message_element,
   _swigc__p_ldb_module_ops,
   _swigc__p_ldb_result,
+  _swigc__p_ldb_val,
   _swigc__p_long_long,
   _swigc__p_p_char,
   _swigc__p_p_ldb_control,
index 01b66a389041f5eabe59a14cdaef45042650e179..f75bb8124d95fd0e81f745665eb3cf9fc703191c 100755 (executable)
@@ -6,20 +6,21 @@ import getopt
 import optparse
 import sys
 
-# Add path to the library for in-tree use
-sys.path.append("scripting/python")
 import samba.getopt as options
 
 from auth import system_session
 from ldb import (SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError,
                  LDB_ERR_NO_SUCH_OBJECT, LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS,
                  LDB_ERR_ENTRY_ALREADY_EXISTS, LDB_ERR_UNWILLING_TO_PERFORM,
-                 LDB_ERR_NOT_ALLOWED_ON_NON_LEAF)
+                 LDB_ERR_NOT_ALLOWED_ON_NON_LEAF, LDB_ERR_OTHER)
 from samba import Ldb
+from subunit import SubunitTestRunner
 import param
+import unittest
 
 parser = optparse.OptionParser("ldap [options] <host>")
-parser.add_option_group(options.SambaOptions(parser))
+sambaopts = options.SambaOptions(parser)
+parser.add_option_group(sambaopts)
 parser.add_option_group(options.VersionOptions(parser))
 # use command line creds if available
 credopts = options.CredentialsOptions(parser)
@@ -33,126 +34,124 @@ if len(args) < 1:
 
 host = args[0]
 
-lp = param.LoadParm()
-if opts.configfile:
-    lp.load(opts.configfile)
+lp = sambaopts.get_loadparm()
 
-def delete_force(ldb, dn):
-    try:
-        ldb.delete(dn)
-    except LdbError, (num, _): 
-        if num != LDB_ERR_NO_SUCH_OBJECT:
-            assert False
-
-def assertEquals(a1, a2):
-    assert a1 == a2, "Expected %r == %r" % (a1, a2)
+class BasicTests(unittest.TestCase):
+    def delete_force(self, ldb, dn):
+        try:
+            ldb.delete(dn)
+        except LdbError, (num, _): 
+            self.assertEquals(num, LDB_ERR_NO_SUCH_OBJECT)
+
+    def find_basedn(self, ldb):
+        res = ldb.search(base="", expression="", scope=SCOPE_BASE, 
+                         attrs=["defaultNamingContext"])
+        self.assertEquals(len(res), 1)
+        return res[0]["defaultNamingContext"][0]
+
+    def find_configurationdn(self, ldb):
+        res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["configurationNamingContext"])
+        self.assertEquals(len(res), 1)
+        return res[0]["configurationNamingContext"][0]
+
+    def find_schemadn(self, ldb):
+        res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["schemaNamingContext"])
+        self.assertEquals(len(res), 1)
+        return res[0]["schemaNamingContext"][0]
+
+    def setUp(self):
+        self.ldb = ldb
+        self.gc_ldb = gc_ldb
+        self.base_dn = self.find_basedn(ldb)
+        self.configuration_dn = self.find_configurationdn(ldb)
+        self.schema_dn = self.find_schemadn(ldb)
+
+        print "baseDN: %s\n" % self.base_dn
+
+        self.delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
+        self.delete_force(self.ldb, "cn=ldaptestgroup,cn=users," + self.base_dn)
+
+    def test_group_add_invalid_member(self):
+        """Testing group add with invalid member"""
+        try:
+            self.ldb.add({
+                "dn": "cn=ldaptestgroup,cn=uSers," + self.base_dn,
+                "objectclass": "group",
+                "member": "cn=ldaptestuser,cn=useRs," + self.base_dn})
+            self.fail()
+        except LdbError, (num, _): 
+            self.assertEquals(num, LDB_ERR_NO_SUCH_OBJECT)
 
-def basic_tests(ldb, gc_ldb, base_dn, configuration_dn, schema_dn):
-    print "Running basic tests"
+    def test_all(self):
+        """Basic tests"""
 
-    delete_force(ldb, "cn=ldaptestuser,cn=users," + base_dn)
-    delete_force(ldb, "cn=ldaptestgroup,cn=users," + base_dn)
+        self.delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
 
-    print "Testing group add with invalid member"
-    try:
-        ldb.add({
-        "dn": "cn=ldaptestgroup,cn=uSers," + base_dn,
-        "objectclass": "group",
-        "member": "cn=ldaptestuser,cn=useRs," + base_dn})
-    except LdbError, (num, _): 
-        if num != LDB_ERR_NO_SUCH_OBJECT:
-            assert False
-    else:
-        assert False
-
-    print "Testing user add"
-    try:
+        print "Testing user add"
         ldb.add({
-        "dn": "cn=ldaptestuser,cn=uSers," + base_dn,
+        "dn": "cn=ldaptestuser,cn=uSers," + self.base_dn,
         "objectclass": ["user", "person"],
         "cN": "LDAPtestUSER",
         "givenname": "ldap",
         "sn": "testy"})
-    except LdbError:
-        ldb.delete("cn=ldaptestuser,cn=users," + base_dn)
-        ldb.add({
-            "dn": "cn=ldaptestuser,cn=uSers," + base_dn,
-            "objectclass": ["user", "person"],
-            "cN": "LDAPtestUSER",
-            "givenname": "ldap",
-            "sn": "testy"})
-
-    ldb.add({
-        "dn": "cn=ldaptestgroup,cn=uSers," + base_dn,
-        "objectclass": "group",
-        "member": "cn=ldaptestuser,cn=useRs," + base_dn})
-
-    try:
-        ldb.add({
-        "dn": "cn=ldaptestcomputer,cn=computers," + base_dn,
-        "objectclass": "computer",
-        "cN": "LDAPtestCOMPUTER"})
-    except LdbError:
-        ldb.delete("cn=ldaptestcomputer,cn=computers," + base_dn)
+
         ldb.add({
-            "dn": "cn=ldaptestcomputer,cn=computers," + base_dn,
-            "objectClass": "computer",
-            "cn": "LDAPtestCOMPUTER"})
-
-    try:
-        ldb.add({"dn": "cn=ldaptest2computer,cn=computers," + base_dn,
-        "objectClass": "computer",
-        "cn": "LDAPtest2COMPUTER",
-        "userAccountControl": "4096",
-        "displayname": "ldap testy"})
-    except LdbError:
-        ldb.delete("cn=ldaptest2computer,cn=computers," + base_dn)
+            "dn": "cn=ldaptestgroup,cn=uSers," + self.base_dn,
+            "objectclass": "group",
+            "member": "cn=ldaptestuser,cn=useRs," + self.base_dn})
+
+        self.delete_force(ldb, "cn=ldaptestcomputer,cn=computers," + self.base_dn)
         ldb.add({
-            "dn": "cn=ldaptest2computer,cn=computers," + base_dn,
+            "dn": "cn=ldaptestcomputer,cn=computers," + self.base_dn,
+            "objectclass": "computer",
+            "cN": "LDAPtestCOMPUTER"})
+
+        self.delete_force(self.ldb, "cn=ldaptest2computer,cn=computers," + self.base_dn)
+        ldb.add({"dn": "cn=ldaptest2computer,cn=computers," + self.base_dn,
             "objectClass": "computer",
             "cn": "LDAPtest2COMPUTER",
             "userAccountControl": "4096",
             "displayname": "ldap testy"})
 
-    print "Testing attribute or value exists behaviour"
-    try:
-        ldb.modify_ldif("""
-dn: cn=ldaptest2computer,cn=computers,""" + base_dn + """
+        print "Testing attribute or value exists behaviour"
+        try:
+            ldb.modify_ldif("""
+dn: cn=ldaptest2computer,cn=computers,""" + self.base_dn + """
 changetype: modify
 replace: servicePrincipalName
 servicePrincipalName: host/ldaptest2computer
 servicePrincipalName: host/ldaptest2computer
 servicePrincipalName: cifs/ldaptest2computer
 """)
-    except LdbError, (num, msg):
-        assert num == LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS
+        except LdbError, (num, msg):
+            self.assertEquals(num, LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS)
 
-        ldb.modify_ldif("""
-dn: cn=ldaptest2computer,cn=computers,""" + base_dn + """
+            ldb.modify_ldif("""
+dn: cn=ldaptest2computer,cn=computers,""" + self.base_dn + """
 changetype: modify
 replace: servicePrincipalName
 servicePrincipalName: host/ldaptest2computer
 servicePrincipalName: cifs/ldaptest2computer
 """)
-        try:
-            ldb.modify_ldif("""
-dn: cn=ldaptest2computer,cn=computers,""" + base_dn + """
+            try:
+                ldb.modify_ldif("""
+dn: cn=ldaptest2computer,cn=computers,""" + self.base_dn + """
 changetype: modify
 add: servicePrincipalName
 servicePrincipalName: host/ldaptest2computer
 """)
-        except LdbError, (num, msg):
-            assert num == LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS
-        
-        print "Testing ranged results"
-        ldb.modify_ldif("""
-dn: cn=ldaptest2computer,cn=computers,""" + base_dn + """
+            except LdbError, (num, msg):
+                self.assertEquals(num, LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS)
+            
+            print "Testing ranged results"
+            ldb.modify_ldif("""
+dn: cn=ldaptest2computer,cn=computers,""" + self.base_dn + """
 changetype: modify
 replace: servicePrincipalName
 """)
-        
-        ldb.modify_ldif("""
-dn: cn=ldaptest2computer,cn=computers,""" + base_dn + """
+            
+            ldb.modify_ldif("""
+dn: cn=ldaptest2computer,cn=computers,""" + self.base_dn + """
 changetype: modify
 add: servicePrincipalName
 servicePrincipalName: host/ldaptest2computer0
@@ -187,730 +186,685 @@ servicePrincipalName: host/ldaptest2computer28
 servicePrincipalName: host/ldaptest2computer29
 """)
 
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, 
-                         attrs=["servicePrincipalName;range=0-*"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        #print len(res[0]["servicePrincipalName;range=0-*"])
-        assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
-
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-19"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-#        print res[0]["servicePrincipalName;range=0-19"].length
-        assertEquals(len(res[0]["servicePrincipalName;range=0-19"]), 20)
-
-        
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-30"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
-
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-40"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
-
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=30-40"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        assertEquals(len(res[0]["servicePrincipalName;range=30-*"]), 0)
-
-        
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=10-40"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        assertEquals(len(res[0]["servicePrincipalName;range=10-*"]), 20)
-#        pos_11 = res[0]["servicePrincipalName;range=10-*"][18]
-
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=11-40"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        assertEquals(len(res[0]["servicePrincipalName;range=11-*"]), 19)
-#        print res[0]["servicePrincipalName;range=11-*"][18]
-#        print pos_11
-#        assertEquals((res[0]["servicePrincipalName;range=11-*"][18]), pos_11)
-
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=11-15"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        assertEquals(len(res[0]["servicePrincipalName;range=11-15"]), 5)
-#        assertEquals(res[0]["servicePrincipalName;range=11-15"][4], pos_11)
-
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-#        print res[0]["servicePrincipalName"][18]
-#        print pos_11
-        assertEquals(len(res[0]["servicePrincipalName"]), 30)
-#        assertEquals(res[0]["servicePrincipalName"][18], pos_11)
-
-    try:
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, 
+                             attrs=["servicePrincipalName;range=0-*"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            #print len(res[0]["servicePrincipalName;range=0-*"])
+            self.assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
+
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-19"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            # print res[0]["servicePrincipalName;range=0-19"].length
+            self.assertEquals(len(res[0]["servicePrincipalName;range=0-19"]), 20)
+
+            
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-30"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            self.assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
+
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-40"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            self.assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
+
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=30-40"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            self.assertEquals(len(res[0]["servicePrincipalName;range=30-*"]), 0)
+
+            
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=10-40"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            self.assertEquals(len(res[0]["servicePrincipalName;range=10-*"]), 20)
+            # pos_11 = res[0]["servicePrincipalName;range=10-*"][18]
+
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=11-40"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            self.assertEquals(len(res[0]["servicePrincipalName;range=11-*"]), 19)
+            # print res[0]["servicePrincipalName;range=11-*"][18]
+            # print pos_11
+            # self.assertEquals((res[0]["servicePrincipalName;range=11-*"][18]), pos_11)
+
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=11-15"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            self.assertEquals(len(res[0]["servicePrincipalName;range=11-15"]), 5)
+            # self.assertEquals(res[0]["servicePrincipalName;range=11-15"][4], pos_11)
+
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            # print res[0]["servicePrincipalName"][18]
+            # print pos_11
+            self.assertEquals(len(res[0]["servicePrincipalName"]), 30)
+            # self.assertEquals(res[0]["servicePrincipalName"][18], pos_11)
+
+        self.delete_force(self.ldb, "cn=ldaptestuser2,cn=users," + self.base_dn)
         ldb.add({
-        "dn": "cn=ldaptestuser2,cn=useRs," + base_dn,
-        "objectClass": ["person", "user"],
-        "cn": "LDAPtestUSER2",
-        "givenname": "testy",
-        "sn": "ldap user2"})
-    except LdbError:
-        ldb.delete("cn=ldaptestuser2,cn=users," + base_dn)
-        ldb.add({
-                "dn": "cn=ldaptestuser2,cn=useRs," + base_dn,
-                "objectClass": ["person", "user"],
-                "cn": "LDAPtestUSER2",
-                "givenname": "testy",
-                "sn": "ldap user2"})
-
-    print "Testing Ambigious Name Resolution"
-#   Testing ldb.search for (&(anr=ldap testy)(objectClass=user))
-    res = ldb.search(expression="(&(anr=ldap testy)(objectClass=user))")
-    assert len(res) == 3, "Could not find (&(anr=ldap testy)(objectClass=user))"
-
-#   Testing ldb.search for (&(anr=testy ldap)(objectClass=user))
-    res = ldb.search(expression="(&(anr=testy ldap)(objectClass=user))")
-    assert len(res) == 2, "Found only %d for (&(anr=testy ldap)(objectClass=user))" % len(res)
-
-#   Testing ldb.search for (&(anr=ldap)(objectClass=user))
-    res = ldb.search(expression="(&(anr=ldap)(objectClass=user))")
-    assert len(res) == 4, "Found only %d for (&(anr=ldap)(objectClass=user))" % len(res)
-
-#   Testing ldb.search for (&(anr==ldap)(objectClass=user))
-    res = ldb.search(expression="(&(anr==ldap)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(anr==ldap)(objectClass=user)). Found only %d for (&(anr=ldap)(objectClass=user))" % len(res)
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"][0], "ldaptestuser")
-    assertEquals(res[0]["name"], "ldaptestuser")
-
-#   Testing ldb.search for (&(anr=testy)(objectClass=user))
-    res = ldb.search(expression="(&(anr=testy)(objectClass=user))")
-    assert len(res) == 2, "Found only %d for (&(anr=testy)(objectClass=user))" % len(res)
-
-#   Testing ldb.search for (&(anr=ldap testy)(objectClass=user))
-    res = ldb.search(expression="(&(anr=testy ldap)(objectClass=user))")
-    assert len(res) == 2, "Found only %d for (&(anr=ldap testy)(objectClass=user))" % len(res)
-
-#   Testing ldb.search for (&(anr==ldap testy)(objectClass=user))
-    res = ldb.search(expression="(&(anr==testy ldap)(objectClass=user))")
-    assert len(res) == 1, "Found only %d for (&(anr==ldap testy)(objectClass=user))" % len(res)
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"][0], "ldaptestuser")
-    assertEquals(res[0]["name"][0], "ldaptestuser")
-
-# Testing ldb.search for (&(anr==testy ldap)(objectClass=user))
-    res = ldb.search(expression="(&(anr==testy ldap)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(anr==testy ldap)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"][0], "ldaptestuser")
-    assertEquals(res[0]["name"][0], "ldaptestuser")
-
-    # Testing ldb.search for (&(anr=testy ldap user)(objectClass=user))
-    res = ldb.search(expression="(&(anr=testy ldap user)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(anr=testy ldap user)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestuser2")
-    assertEquals(res[0]["name"], "ldaptestuser2")
-
-    # Testing ldb.search for (&(anr==testy ldap user2)(objectClass=user))
-    res = ldb.search(expression="(&(anr==testy ldap user2)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(anr==testy ldap user2)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestuser2")
-    assertEquals(res[0]["name"], "ldaptestuser2")
-
-    # Testing ldb.search for (&(anr==ldap user2)(objectClass=user))
-    res = ldb.search(expression="(&(anr==ldap user2)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(anr==ldap user2)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestuser2")
-    assertEquals(res[0]["name"], "ldaptestuser2")
-
-    # Testing ldb.search for (&(anr==not ldap user2)(objectClass=user))
-    res = ldb.search(expression="(&(anr==not ldap user2)(objectClass=user))")
-    assert len(res) == 0, "Must not find (&(anr==not ldap user2)(objectClass=user))"
-
-    # Testing ldb.search for (&(anr=not ldap user2)(objectClass=user))
-    res = ldb.search(expression="(&(anr=not ldap user2)(objectClass=user))")
-    assert len(res) == 0, "Must not find (&(anr=not ldap user2)(objectClass=user))"
-
-    print "Testing Group Modifies"
-    ldb.modify_ldif("""
-dn: cn=ldaptestgroup,cn=users,""" + base_dn + """
+            "dn": "cn=ldaptestuser2,cn=useRs," + self.base_dn,
+            "objectClass": ["person", "user"],
+            "cn": "LDAPtestUSER2",
+            "givenname": "testy",
+            "sn": "ldap user2"})
+
+        print "Testing Ambigious Name Resolution"
+        # Testing ldb.search for (&(anr=ldap testy)(objectClass=user))
+        res = ldb.search(expression="(&(anr=ldap testy)(objectClass=user))")
+        self.assertEquals(len(res), 3, "Could not find (&(anr=ldap testy)(objectClass=user))")
+
+        # Testing ldb.search for (&(anr=testy ldap)(objectClass=user))
+        res = ldb.search(expression="(&(anr=testy ldap)(objectClass=user))")
+        self.assertEquals(len(res), 2, "Found only %d for (&(anr=testy ldap)(objectClass=user))" % len(res))
+
+        # Testing ldb.search for (&(anr=ldap)(objectClass=user))
+        res = ldb.search(expression="(&(anr=ldap)(objectClass=user))")
+        self.assertEquals(len(res), 4, "Found only %d for (&(anr=ldap)(objectClass=user))" % len(res))
+
+        # Testing ldb.search for (&(anr==ldap)(objectClass=user))
+        res = ldb.search(expression="(&(anr==ldap)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(anr==ldap)(objectClass=user)). Found only %d for (&(anr=ldap)(objectClass=user))" % len(res))
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"][0], "ldaptestuser")
+        self.assertEquals(res[0]["name"], "ldaptestuser")
+
+        # Testing ldb.search for (&(anr=testy)(objectClass=user))
+        res = ldb.search(expression="(&(anr=testy)(objectClass=user))")
+        self.assertEquals(len(res), 2, "Found only %d for (&(anr=testy)(objectClass=user))" % len(res))
+
+        # Testing ldb.search for (&(anr=ldap testy)(objectClass=user))
+        res = ldb.search(expression="(&(anr=testy ldap)(objectClass=user))")
+        self.assertEquals(len(res), 2, "Found only %d for (&(anr=ldap testy)(objectClass=user))" % len(res))
+
+        # Testing ldb.search for (&(anr==ldap testy)(objectClass=user))
+        res = ldb.search(expression="(&(anr==testy ldap)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Found only %d for (&(anr==ldap testy)(objectClass=user))" % len(res))
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"][0], "ldaptestuser")
+        self.assertEquals(res[0]["name"][0], "ldaptestuser")
+
+        # Testing ldb.search for (&(anr==testy ldap)(objectClass=user))
+        res = ldb.search(expression="(&(anr==testy ldap)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(anr==testy ldap)(objectClass=user))")
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"][0], "ldaptestuser")
+        self.assertEquals(res[0]["name"][0], "ldaptestuser")
+
+        # Testing ldb.search for (&(anr=testy ldap user)(objectClass=user))
+        res = ldb.search(expression="(&(anr=testy ldap user)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(anr=testy ldap user)(objectClass=user))")
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestuser2")
+        self.assertEquals(res[0]["name"], "ldaptestuser2")
+
+        # Testing ldb.search for (&(anr==testy ldap user2)(objectClass=user))
+        res = ldb.search(expression="(&(anr==testy ldap user2)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(anr==testy ldap user2)(objectClass=user))")
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestuser2")
+        self.assertEquals(res[0]["name"], "ldaptestuser2")
+
+        # Testing ldb.search for (&(anr==ldap user2)(objectClass=user))
+        res = ldb.search(expression="(&(anr==ldap user2)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(anr==ldap user2)(objectClass=user))")
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestuser2")
+        self.assertEquals(res[0]["name"], "ldaptestuser2")
+
+        # Testing ldb.search for (&(anr==not ldap user2)(objectClass=user))
+        res = ldb.search(expression="(&(anr==not ldap user2)(objectClass=user))")
+        self.assertEquals(len(res), 0, "Must not find (&(anr==not ldap user2)(objectClass=user))")
+
+        # Testing ldb.search for (&(anr=not ldap user2)(objectClass=user))
+        res = ldb.search(expression="(&(anr=not ldap user2)(objectClass=user))")
+        self.assertEquals(len(res), 0, "Must not find (&(anr=not ldap user2)(objectClass=user))")
+
+        print "Testing Group Modifies"
+        ldb.modify_ldif("""
+dn: cn=ldaptestgroup,cn=users,""" + self.base_dn + """
 changetype: modify
 add: member
-member: cn=ldaptestuser2,cn=users,""" + base_dn + """
-member: cn=ldaptestcomputer,cn=computers,""" + base_dn + """
+member: cn=ldaptestuser2,cn=users,""" + self.base_dn + """
+member: cn=ldaptestcomputer,cn=computers,""" + self.base_dn + """
 """)
 
-    delete_force(ldb, "cn=ldaptestuser3,cn=users," + base_dn)
+        self.delete_force(ldb, "cn=ldaptestuser3,cn=users," + self.base_dn)
 
-    print "Testing adding non-existent user to a group"
-    try:
-        ldb.modify_ldif("""
-dn: cn=ldaptestgroup,cn=users,""" + base_dn + """
+        print "Testing adding non-existent user to a group"
+        try:
+            ldb.modify_ldif("""
+dn: cn=ldaptestgroup,cn=users,""" + self.base_dn + """
 changetype: modify
 add: member
-member: cn=ldaptestuser3,cn=users,""" + base_dn + """
+member: cn=ldaptestuser3,cn=users,""" + self.base_dn + """
 """)
-    except LdbError, (num, _):
-        assert num == LDB_ERR_NO_SUCH_OBJECT
-    else:
-        assert False
-
-    print "Testing Renames"
-
-    ldb.rename("cn=ldaptestuser2,cn=users," + base_dn, "cn=ldaptestuser3,cn=users," + base_dn)
-
-    ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser3,cn=users," + base_dn)
-
-    ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestUSER3,cn=users," + base_dn)
-
-    print "Testing ldb.search for (&(cn=ldaptestuser3)(objectClass=user))"
-    res = ldb.search(expression="(&(cn=ldaptestuser3)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(cn=ldaptestuser3)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestUSER3,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestUSER3")
-    assertEquals(res[0]["name"], "ldaptestUSER3")
-
-# This is a Samba special, and does not exist in real AD
-#    print "Testing ldb.search for (dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")"
-#    res = ldb.search("(dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")")
-#    if (res.error != 0 || len(res) != 1) {
-#        print "Could not find (dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")"
-#        assertEquals(len(res), 1)
-#    }
-#    assertEquals(res[0].dn, ("CN=ldaptestUSER3,CN=Users," + base_dn))
-#    assertEquals(res[0].cn, "ldaptestUSER3")
-#    assertEquals(res[0].name, "ldaptestUSER3")
-
-    print "Testing ldb.search for (distinguishedName=CN=ldaptestUSER3,CN=Users," + base_dn + ")"
-    res = ldb.search(expression="(distinguishedName=CN=ldaptestUSER3,CN=Users," + base_dn + ")")
-    assert len(res) == 1, "Could not find (dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")"
-    assertEquals(str(res[0].dn), ("CN=ldaptestUSER3,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestUSER3")
-    assertEquals(res[0]["name"], "ldaptestUSER3")
-
-    # ensure we cannot add it again
-    try:
-        ldb.add({"dn": "cn=ldaptestuser3,cn=userS," + base_dn,
-                  "objectClass": ["person", "user"],
-                  "cn": "LDAPtestUSER3"})
-    except LdbError, (num, _):
-        assert num == LDB_ERR_ENTRY_ALREADY_EXISTS
-    else:
-        assert False
-
-    # rename back
-    ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser2,cn=users," + base_dn)
-
-    # ensure we cannnot rename it twice
-    try:
-        ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser2,cn=users," + base_dn)
-    except LdbError, (num, _): 
-        assert num == LDB_ERR_NO_SUCH_OBJECT
-    else:
-        assert False
-
-    # ensure can now use that name
-    ldb.add({"dn": "cn=ldaptestuser3,cn=users," + base_dn,
-                  "objectClass": ["person", "user"],
-                  "cn": "LDAPtestUSER3"})
-    
-    # ensure we now cannnot rename
-    try:
-        ldb.rename("cn=ldaptestuser2,cn=users," + base_dn, "cn=ldaptestuser3,cn=users," + base_dn)
-    except LdbError, (num, _):
-        assert num == LDB_ERR_ENTRY_ALREADY_EXISTS
-    else:
-        assert False
-    try:
-        ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser3,cn=configuration," + base_dn)
-    except LdbError, (num, _):
-        assert num in (71, 64)
-    else:
-        assert False
-
-    ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser5,cn=users," + base_dn)
-
-    ldb.delete("cn=ldaptestuser5,cn=users," + base_dn)
-
-    delete_force(ldb, "cn=ldaptestgroup2,cn=users," + base_dn)
-
-    ldb.rename("cn=ldaptestgroup,cn=users," + base_dn, "cn=ldaptestgroup2,cn=users," + base_dn)
-
-    print "Testing subtree Renames"
-
-    ldb.add({"dn": "cn=ldaptestcontainer," + base_dn, 
-             "objectClass": "container"})
-    
-    try:
-        ldb.add({"dn": "CN=ldaptestuser4,CN=ldaptestcontainer," + base_dn, 
-             "objectClass": ["person", "user"],
-             "cn": "LDAPtestUSER4"})
-    except LdbError:
-        ldb.delete("cn=ldaptestuser4,cn=ldaptestcontainer," + base_dn)
-        ldb.add({"dn": "CN=ldaptestuser4,CN=ldaptestcontainer," + base_dn,
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, LDB_ERR_NO_SUCH_OBJECT)
+
+        print "Testing Renames"
+
+        ldb.rename("cn=ldaptestuser2,cn=users," + self.base_dn, "cn=ldaptestuser3,cn=users," + self.base_dn)
+
+        ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestuser3,cn=users," + self.base_dn)
+
+        ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestUSER3,cn=users," + self.base_dn)
+
+        print "Testing ldb.search for (&(cn=ldaptestuser3)(objectClass=user))"
+        res = ldb.search(expression="(&(cn=ldaptestuser3)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptestuser3)(objectClass=user))")
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestUSER3,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestUSER3")
+        self.assertEquals(res[0]["name"], "ldaptestUSER3")
+
+        # This is a Samba special, and does not exist in real AD
+        #    print "Testing ldb.search for (dn=CN=ldaptestUSER3,CN=Users," + self.base_dn + ")"
+        #    res = ldb.search("(dn=CN=ldaptestUSER3,CN=Users," + self.base_dn + ")")
+        #    if (res.error != 0 || len(res) != 1) {
+        #        print "Could not find (dn=CN=ldaptestUSER3,CN=Users," + self.base_dn + ")"
+        #        self.assertEquals(len(res), 1)
+        #    }
+        #    self.assertEquals(res[0].dn, ("CN=ldaptestUSER3,CN=Users," + self.base_dn))
+        #    self.assertEquals(res[0].cn, "ldaptestUSER3")
+        #    self.assertEquals(res[0].name, "ldaptestUSER3")
+
+        print "Testing ldb.search for (distinguishedName=CN=ldaptestUSER3,CN=Users," + self.base_dn + ")"
+        res = ldb.search(expression="(distinguishedName=CN=ldaptestUSER3,CN=Users," + self.base_dn + ")")
+        self.assertEquals(len(res), 1, "Could not find (dn=CN=ldaptestUSER3,CN=Users," + self.base_dn + ")")
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestUSER3,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestUSER3")
+        self.assertEquals(res[0]["name"], "ldaptestUSER3")
+
+        # ensure we cannot add it again
+        try:
+            ldb.add({"dn": "cn=ldaptestuser3,cn=userS," + self.base_dn,
                       "objectClass": ["person", "user"],
-                      "cn": "LDAPtestUSER4"})
+                      "cn": "LDAPtestUSER3"})
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, LDB_ERR_ENTRY_ALREADY_EXISTS)
+
+        # rename back
+        ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestuser2,cn=users," + self.base_dn)
+
+        # ensure we cannnot rename it twice
+        try:
+            ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, 
+                       "cn=ldaptestuser2,cn=users," + self.base_dn)
+            self.fail()
+        except LdbError, (num, _): 
+            self.assertEquals(num, LDB_ERR_NO_SUCH_OBJECT)
+
+        # ensure can now use that name
+        ldb.add({"dn": "cn=ldaptestuser3,cn=users," + self.base_dn,
+                      "objectClass": ["person", "user"],
+                      "cn": "LDAPtestUSER3"})
+        
+        # ensure we now cannnot rename
+        try:
+            ldb.rename("cn=ldaptestuser2,cn=users," + self.base_dn, "cn=ldaptestuser3,cn=users," + self.base_dn)
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, LDB_ERR_ENTRY_ALREADY_EXISTS)
+        try:
+            ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestuser3,cn=configuration," + self.base_dn)
+            self.fail()
+        except LdbError, (num, _):
+            self.assertTrue(num in (71, 64))
+
+        ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestuser5,cn=users," + self.base_dn)
 
-    ldb.modify_ldif("""
-dn: cn=ldaptestgroup2,cn=users,""" + base_dn + """
+        ldb.delete("cn=ldaptestuser5,cn=users," + self.base_dn)
+
+        self.delete_force(ldb, "cn=ldaptestgroup2,cn=users," + self.base_dn)
+
+        ldb.rename("cn=ldaptestgroup,cn=users," + self.base_dn, "cn=ldaptestgroup2,cn=users," + self.base_dn)
+
+        print "Testing subtree Renames"
+
+        ldb.add({"dn": "cn=ldaptestcontainer," + self.base_dn, 
+                 "objectClass": "container"})
+        
+        self.delete_force(self.ldb, "cn=ldaptestuser4,cn=ldaptestcontainer," + self.base_dn)
+        ldb.add({"dn": "CN=ldaptestuser4,CN=ldaptestcontainer," + self.base_dn, 
+                 "objectClass": ["person", "user"],
+                 "cn": "LDAPtestUSER4"})
+
+        ldb.modify_ldif("""
+dn: cn=ldaptestgroup2,cn=users,""" + self.base_dn + """
 changetype: modify
 add: member
-member: cn=ldaptestuser4,cn=ldaptestcontainer,""" + base_dn + """
+member: cn=ldaptestuser4,cn=ldaptestcontainer,""" + self.base_dn + """
 """)
-    
-    print "Testing ldb.rename of cn=ldaptestcontainer," + base_dn + " to cn=ldaptestcontainer2," + base_dn
-    ldb.rename("CN=ldaptestcontainer," + base_dn, "CN=ldaptestcontainer2," + base_dn)
-
-    print "Testing ldb.search for (&(cn=ldaptestuser4)(objectClass=user))"
-    res = ldb.search(expression="(&(cn=ldaptestuser4)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(cn=ldaptestuser4)(objectClass=user))"
-
-    print "Testing subtree ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in (just renamed from) cn=ldaptestcontainer," + base_dn
-    try:
-        ldb.search("cn=ldaptestcontainer," + base_dn, 
-                expression="(&(cn=ldaptestuser4)(objectClass=user))", 
-                scope=SCOPE_SUBTREE)
-    except LdbError, (num, _):
-        assert num == LDB_ERR_NO_SUCH_OBJECT
-    else:
-        assert False
-
-    print "Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in (just renamed from) cn=ldaptestcontainer," + base_dn
-    try:
-        res = ldb.search("cn=ldaptestcontainer," + base_dn, expression="(&(cn=ldaptestuser4)(objectClass=user))", scope=SCOPE_ONELEVEL)
-    except LdbError, (num, _):
-        assert num == LDB_ERR_NO_SUCH_OBJECT
-    else:
-        assert False
-
-    print "Testing ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in renamed container"
-    res = ldb.search("cn=ldaptestcontainer2," + base_dn, expression="(&(cn=ldaptestuser4)(objectClass=user))", scope=SCOPE_SUBTREE)
-    assert len(res) == 1, "Could not find (&(cn=ldaptestuser4)(objectClass=user)) under cn=ldaptestcontainer2," + base_dn
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn))
-    assertEquals(res[0]["memberOf"][0].upper(), ("CN=ldaptestgroup2,CN=Users," + base_dn).upper())
-
-    print "Testing ldb.search for (&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn + ")(objectclass=group)) to check subtree renames and linked attributes"
-    res = ldb.search(base_dn, expression="(&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn + ")(objectclass=group))", scope=SCOPE_SUBTREE)
-    assert len(res) == 1, "Could not find (&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn + ")(objectclass=group)), perhaps linked attributes are not conistant with subtree renames?"
-
-    print "Testing ldb.rename (into itself) of cn=ldaptestcontainer2," + base_dn + " to cn=ldaptestcontainer,cn=ldaptestcontainer2," + base_dn
-    try:
-        ldb.rename("cn=ldaptestcontainer2," + base_dn, "cn=ldaptestcontainer,cn=ldaptestcontainer2," + base_dn)
-    except LdbError, (num, _):
-        assert num == LDB_ERR_UNWILLING_TO_PERFORM
-    else:
-        assert False
-
-    print "Testing ldb.rename (into non-existent container) of cn=ldaptestcontainer2," + base_dn + " to cn=ldaptestcontainer,cn=ldaptestcontainer3," + base_dn
-    try:
-        ldb.rename("cn=ldaptestcontainer2," + base_dn, "cn=ldaptestcontainer,cn=ldaptestcontainer3," + base_dn)
-    except LdbError, (num, _):
-        assert num in (53, 80)
-    else:
-        assert False
-
-    print "Testing delete (should fail, not a leaf node) of renamed cn=ldaptestcontainer2," + base_dn
-    try:
-        ldb.delete("cn=ldaptestcontainer2," + base_dn)
-    except LdbError, (num, _):
-        assert num == LDB_ERR_NOT_ALLOWED_ON_NON_LEAF
-    else:
-        assert False
-
-    print "Testing base ldb.search for CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn
-    res = ldb.search(expression="(objectclass=*)", base=("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn), scope=SCOPE_BASE)
-    assert len(res) == 1
-    res = ldb.search(expression="(cn=ldaptestuser40)", base=("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn), scope=SCOPE_BASE)
-    assert len(res) == 0
-
-    print "Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in cn=ldaptestcontainer2," + base_dn
-    res = ldb.search(expression="(&(cn=ldaptestuser4)(objectClass=user))", base="cn=ldaptestcontainer2," + base_dn, scope=SCOPE_ONELEVEL)
-    # FIXME: assert len(res) == 0
-
-    print "Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in cn=ldaptestcontainer2," + base_dn
-    res = ldb.search(expression="(&(cn=ldaptestuser4)(objectClass=user))", base="cn=ldaptestcontainer2," + base_dn, scope=SCOPE_SUBTREE)
-    #FIXME: assert len(res) == 0
-
-    print "Testing delete of subtree renamed "+("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn)
-    ldb.delete(("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn))
-    print "Testing delete of renamed cn=ldaptestcontainer2," + base_dn
-    ldb.delete("cn=ldaptestcontainer2," + base_dn)
-    
-    try:
-        ldb.add({"dn": "cn=ldaptestutf8user èùéìòà ,cn=users," + base_dn, "objectClass": "user"})
-    except LdbError, (num, _):
-        ldb.delete("cn=ldaptestutf8user èùéìòà ,cn=users," + base_dn)
-        ldb.add({"dn": "cn=ldaptestutf8user èùéìòà ,cn=users," + base_dn, "objectClass": "user"})
-
-    try:
-        ldb.add({"dn": "cn=ldaptestutf8user2  èùéìòà ,cn=users," + base_dn, "objectClass": "user"})
-    except LdbError, (num, _):
-        ldb.delete("cn=ldaptestutf8user2  èùéìòà ,cn=users," + base_dn)
-        ldb.add({"dn": "cn=ldaptestutf8user2  èùéìòà ,cn=users," + base_dn,
-                  "objectClass": "user"})
-
-    print "Testing ldb.search for (&(cn=ldaptestuser)(objectClass=user))"
-    res = ldb.search(expression="(&(cn=ldaptestuser)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(cn=ldaptestuser)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestuser")
-    assertEquals(res[0]["name"], "ldaptestuser")
-    assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user"])
-    assert("objectGUID" in res[0])
-    assert("whenCreated" in res[0])
-    assertEquals(res[0]["objectCategory"], ("CN=Person,CN=Schema,CN=Configuration," + base_dn))
-    assertEquals(int(res[0]["sAMAccountType"][0]), 805306368)
-#    assertEquals(res[0].userAccountControl, 546)
-    assertEquals(res[0]["memberOf"][0], ("CN=ldaptestgroup2,CN=Users," + base_dn))
-    assertEquals(len(res[0]["memberOf"]), 1)
-    print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))"
-    res2 = ldb.search(expression="(&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))")
-    assert len(res2) == 1, "Could not find (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + base_dn + "))"
-
-    assertEquals(res[0].dn, res2[0].dn)
-
-    print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon))"
-    res3 = ldb.search(expression="(&(cn=ldaptestuser)(objectCategory=PerSon))")
-    assert len(res3) == 1, "Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)): matched " + len(res3)
-
-    assertEquals(res[0].dn, res3[0].dn)
-
-    if gc_ldb is not None:
-        print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog"
-        res3gc = gc_ldb.search(expression="(&(cn=ldaptestuser)(objectCategory=PerSon))")
-        assert len(res3gc) == 1
-    
-        assertEquals(res[0].dn, res3gc[0].dn)
-
-    print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon)) in with 'phantom root' control"
-    
-    res3control = gc_ldb.search(base_dn, expression="(&(cn=ldaptestuser)(objectCategory=PerSon))", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["search_options:1:2"])
-    assert len(res3control) == 1, "Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog"
-    
-    assertEquals(res[0].dn, res3control[0].dn)
-
-    ldb.delete(res[0].dn)
-
-    print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectClass=user))"
-    res = ldb.search(expression="(&(cn=ldaptestcomputer)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(cn=ldaptestuser)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestcomputer,CN=Computers," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestcomputer")
-    assertEquals(res[0]["name"], "ldaptestcomputer")
-    assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user", "computer"])
-    assert("objectGUID" in res[0])
-    assert("whenCreated" in res[0])
-    assertEquals(res[0]["objectCategory"], ("CN=Computer,CN=Schema,CN=Configuration," + base_dn))
-    assertEquals(int(res[0]["primaryGroupID"][0]), 513)
-#    assertEquals(res[0].sAMAccountType, 805306368)
-#    assertEquals(res[0].userAccountControl, 546)
-    assertEquals(res[0]["memberOf"][0], "CN=ldaptestgroup2,CN=Users," + base_dn)
-    assertEquals(len(res[0]["memberOf"]), 1)
-
-    print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))"
-    res2 = ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))")
-    assert len(res2) == 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))"
-
-    assertEquals(res[0].dn, res2[0].dn)
-
-    if gc_ldb is not None:
-        print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + ")) in Global Catlog"
-        res2gc = gc_ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + "))")
-        assert len(res2gc) == 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + base_dn + ")) in Global Catlog"
-
-        assertEquals(res[0].dn, res2gc[0].dn)
-
-    print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=compuTER))"
-    res3 = ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=compuTER))")
-    assert len(res3) == 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=compuTER))"
-
-    assertEquals(res[0].dn, res3[0].dn)
-
-    if gc_ldb is not None:
-        print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog"
-        res3gc = gc_ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=compuTER))")
-        assert len(res3gc) == 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog"
-
-        assertEquals(res[0].dn, res3gc[0].dn)
-
-    print "Testing ldb.search for (&(cn=ldaptestcomp*r)(objectCategory=compuTER))"
-    res4 = ldb.search(expression="(&(cn=ldaptestcomp*r)(objectCategory=compuTER))")
-    assert len(res4) == 1, "Could not find (&(cn=ldaptestcomp*r)(objectCategory=compuTER))"
-
-    assertEquals(res[0].dn, res4[0].dn)
-
-    print "Testing ldb.search for (&(cn=ldaptestcomput*)(objectCategory=compuTER))"
-    res5 = ldb.search(expression="(&(cn=ldaptestcomput*)(objectCategory=compuTER))")
-    assert len(res5) == 1, "Could not find (&(cn=ldaptestcomput*)(objectCategory=compuTER))"
-
-    assertEquals(res[0].dn, res5[0].dn)
-
-    print "Testing ldb.search for (&(cn=*daptestcomputer)(objectCategory=compuTER))"
-    res6 = ldb.search(expression="(&(cn=*daptestcomputer)(objectCategory=compuTER))")
-    assert len(res6) == 1, "Could not find (&(cn=*daptestcomputer)(objectCategory=compuTER))"
-
-    assertEquals(res[0].dn, res6[0].dn)
-
-    ldb.delete(res[0].dn)
-
-    print "Testing ldb.search for (&(cn=ldaptest2computer)(objectClass=user))"
-    res = ldb.search(expression="(&(cn=ldaptest2computer)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(cn=ldaptest2computer)(objectClass=user))"
-
-    assertEquals(res[0].dn, ("CN=ldaptest2computer,CN=Computers," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptest2computer")
-    assertEquals(res[0]["name"], "ldaptest2computer")
-    assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user", "computer"])
-    assert("objectGUID" in res[0])
-    assert("whenCreated" in res[0])
-    assertEquals(res[0]["objectCategory"][0], "CN=Computer,CN=Schema,CN=Configuration," + base_dn)
-    assertEquals(int(res[0]["sAMAccountType"][0]), 805306369)
-#    assertEquals(res[0].userAccountControl, 4098)
-
-    ldb.delete(res[0].dn)
-
-    attrs = ["cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor", "memberOf"]
-    print "Testing ldb.search for (&(cn=ldaptestUSer2)(objectClass=user))"
-    res = ldb.search(base_dn, expression="(&(cn=ldaptestUSer2)(objectClass=user))", scope=SCOPE_SUBTREE, attrs=attrs)
-    assert len(res) == 1, "Could not find (&(cn=ldaptestUSer2)(objectClass=user))"
-
-    assertEquals(res[0].dn, ("CN=ldaptestuser2,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestuser2")
-    assertEquals(res[0]["name"], "ldaptestuser2")
-    assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user"])
-    assert("objectGUID" in res[0])
-    assert("whenCreated" in res[0])
-    assert("nTSecurityDescriptor" in res[0])
-    assertEquals(res[0]["memberOf"][0], ("CN=ldaptestgroup2,CN=Users," + base_dn))
-
-    attrs = ["cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor", "member"]
-    print "Testing ldb.search for (&(cn=ldaptestgroup2)(objectClass=group))"
-    res = ldb.search(base_dn, expression="(&(cn=ldaptestgroup2)(objectClass=group))", scope=SCOPE_SUBTREE, attrs=attrs)
-    assert len(res) == 1, "Could not find (&(cn=ldaptestgroup2)(objectClass=group))"
-
-    assertEquals(res[0].dn, ("CN=ldaptestgroup2,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestgroup2")
-    assertEquals(res[0]["name"], "ldaptestgroup2")
-    assertEquals(res[0]["objectClass"], ["top", "group"])
-    assert("objectGuid" not in res[0])
-    assert("whenCreated" in res[0])
-    assert("nTSecurityDescriptor" in res[0])
-    assertEquals(res[0]["member"], ["CN=ldaptestuser2,CN=Users," + base_dn])
-
-    ldb.modify_ldif("""
-dn: cn=ldaptestgroup2,cn=users,""" + base_dn + """
+        
+        print "Testing ldb.rename of cn=ldaptestcontainer," + self.base_dn + " to cn=ldaptestcontainer2," + self.base_dn
+        ldb.rename("CN=ldaptestcontainer," + self.base_dn, "CN=ldaptestcontainer2," + self.base_dn)
+
+        print "Testing ldb.search for (&(cn=ldaptestuser4)(objectClass=user))"
+        res = ldb.search(expression="(&(cn=ldaptestuser4)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptestuser4)(objectClass=user))")
+
+        print "Testing subtree ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in (just renamed from) cn=ldaptestcontainer," + self.base_dn
+        try:
+            ldb.search("cn=ldaptestcontainer," + self.base_dn, 
+                    expression="(&(cn=ldaptestuser4)(objectClass=user))", 
+                    scope=SCOPE_SUBTREE)
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, LDB_ERR_NO_SUCH_OBJECT)
+
+        print "Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in (just renamed from) cn=ldaptestcontainer," + self.base_dn
+        try:
+            res = ldb.search("cn=ldaptestcontainer," + self.base_dn, 
+                    expression="(&(cn=ldaptestuser4)(objectClass=user))", scope=SCOPE_ONELEVEL)
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, LDB_ERR_NO_SUCH_OBJECT)
+
+        print "Testing ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in renamed container"
+        res = ldb.search("cn=ldaptestcontainer2," + self.base_dn, expression="(&(cn=ldaptestuser4)(objectClass=user))", scope=SCOPE_SUBTREE)
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptestuser4)(objectClass=user)) under cn=ldaptestcontainer2," + self.base_dn)
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser4,CN=ldaptestcontainer2," + self.base_dn))
+        self.assertEquals(res[0]["memberOf"][0].upper(), ("CN=ldaptestgroup2,CN=Users," + self.base_dn).upper())
+
+        print "Testing ldb.search for (&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + self.base_dn + ")(objectclass=group)) to check subtree renames and linked attributes"
+        res = ldb.search(self.base_dn, expression="(&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + self.base_dn + ")(objectclass=group))", scope=SCOPE_SUBTREE)
+        self.assertEquals(len(res), 1, "Could not find (&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + self.base_dn + ")(objectclass=group)), perhaps linked attributes are not conistant with subtree renames?")
+
+        print "Testing ldb.rename (into itself) of cn=ldaptestcontainer2," + self.base_dn + " to cn=ldaptestcontainer,cn=ldaptestcontainer2," + self.base_dn
+        try:
+            ldb.rename("cn=ldaptestcontainer2," + self.base_dn, "cn=ldaptestcontainer,cn=ldaptestcontainer2," + self.base_dn)
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, LDB_ERR_UNWILLING_TO_PERFORM)
+
+        print "Testing ldb.rename (into non-existent container) of cn=ldaptestcontainer2," + self.base_dn + " to cn=ldaptestcontainer,cn=ldaptestcontainer3," + self.base_dn
+        try:
+            ldb.rename("cn=ldaptestcontainer2," + self.base_dn, "cn=ldaptestcontainer,cn=ldaptestcontainer3," + self.base_dn)
+            self.fail()
+        except LdbError, (num, _):
+            self.assertTrue(num in (LDB_ERR_UNWILLING_TO_PERFORM, LDB_ERR_OTHER))
+
+        print "Testing delete (should fail, not a leaf node) of renamed cn=ldaptestcontainer2," + self.base_dn
+        try:
+            ldb.delete("cn=ldaptestcontainer2," + self.base_dn)
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, LDB_ERR_NOT_ALLOWED_ON_NON_LEAF)
+
+        print "Testing base ldb.search for CN=ldaptestuser4,CN=ldaptestcontainer2," + self.base_dn
+        res = ldb.search(expression="(objectclass=*)", base=("CN=ldaptestuser4,CN=ldaptestcontainer2," + self.base_dn), scope=SCOPE_BASE)
+        self.assertEquals(len(res), 1)
+        res = ldb.search(expression="(cn=ldaptestuser40)", base=("CN=ldaptestuser4,CN=ldaptestcontainer2," + self.base_dn), scope=SCOPE_BASE)
+        self.assertEquals(len(res), 0)
+
+        print "Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in cn=ldaptestcontainer2," + self.base_dn
+        res = ldb.search(expression="(&(cn=ldaptestuser4)(objectClass=user))", base=("cn=ldaptestcontainer2," + self.base_dn), scope=SCOPE_ONELEVEL)
+        # FIXME: self.assertEquals(len(res), 0)
+
+        print "Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in cn=ldaptestcontainer2," + self.base_dn
+        res = ldb.search(expression="(&(cn=ldaptestuser4)(objectClass=user))", base=("cn=ldaptestcontainer2," + self.base_dn), scope=SCOPE_SUBTREE)
+        # FIXME: self.assertEquals(len(res), 0)
+
+        print "Testing delete of subtree renamed "+("CN=ldaptestuser4,CN=ldaptestcontainer2," + self.base_dn)
+        ldb.delete(("CN=ldaptestuser4,CN=ldaptestcontainer2," + self.base_dn))
+        print "Testing delete of renamed cn=ldaptestcontainer2," + self.base_dn
+        ldb.delete("cn=ldaptestcontainer2," + self.base_dn)
+        
+        self.delete_force(self.ldb, "cn=ldaptestutf8user èùéìòà ,cn=users," + self.base_dn)
+        ldb.add({"dn": "cn=ldaptestutf8user èùéìòà ,cn=users," + self.base_dn, "objectClass": "user"})
+
+        self.delete_force(self.ldb, "cn=ldaptestutf8user2  èùéìòà ,cn=users," + self.base_dn)
+        ldb.add({"dn": "cn=ldaptestutf8user2  èùéìòà ,cn=users," + self.base_dn, "objectClass": "user"})
+
+        print "Testing ldb.search for (&(cn=ldaptestuser)(objectClass=user))"
+        res = ldb.search(expression="(&(cn=ldaptestuser)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptestuser)(objectClass=user))")
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestuser")
+        self.assertEquals(res[0]["name"], "ldaptestuser")
+        self.assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user"])
+        self.assertTrue("objectGUID" in res[0])
+        self.assertTrue("whenCreated" in res[0])
+        self.assertEquals(res[0]["objectCategory"], ("CN=Person,CN=Schema,CN=Configuration," + self.base_dn))
+        self.assertEquals(int(res[0]["sAMAccountType"][0]), 805306368)
+        # self.assertEquals(res[0].userAccountControl, 546)
+        self.assertEquals(res[0]["memberOf"][0], ("CN=ldaptestgroup2,CN=Users," + self.base_dn))
+        self.assertEquals(len(res[0]["memberOf"]), 1)
+     
+        print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + self.base_dn + "))"
+        res2 = ldb.search(expression="(&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + self.base_dn + "))")
+        self.assertEquals(len(res2), 1, "Could not find (&(cn=ldaptestuser)(objectCategory=cn=person,cn=schema,cn=configuration," + self.base_dn + "))")
+
+        self.assertEquals(res[0].dn, res2[0].dn)
+
+        print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon))"
+        res3 = ldb.search(expression="(&(cn=ldaptestuser)(objectCategory=PerSon))")
+        self.assertEquals(len(res3), 1, "Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)): matched %d" % len(res3))
+
+        self.assertEquals(res[0].dn, res3[0].dn)
+
+        if gc_ldb is not None:
+            print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog"
+            res3gc = gc_ldb.search(expression="(&(cn=ldaptestuser)(objectCategory=PerSon))")
+            self.assertEquals(len(res3gc), 1)
+        
+            self.assertEquals(res[0].dn, res3gc[0].dn)
+
+        print "Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon)) in with 'phantom root' control"
+        
+        res3control = gc_ldb.search(self.base_dn, expression="(&(cn=ldaptestuser)(objectCategory=PerSon))", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["search_options:1:2"])
+        self.assertEquals(len(res3control), 1, "Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog")
+        
+        self.assertEquals(res[0].dn, res3control[0].dn)
+
+        ldb.delete(res[0].dn)
+
+        print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectClass=user))"
+        res = ldb.search(expression="(&(cn=ldaptestcomputer)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptestuser)(objectClass=user))")
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestcomputer,CN=Computers," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestcomputer")
+        self.assertEquals(res[0]["name"], "ldaptestcomputer")
+        self.assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user", "computer"])
+        self.assertTrue("objectGUID" in res[0])
+        self.assertTrue("whenCreated" in res[0])
+        self.assertEquals(res[0]["objectCategory"], ("CN=Computer,CN=Schema,CN=Configuration," + self.base_dn))
+        self.assertEquals(int(res[0]["primaryGroupID"][0]), 513)
+        # self.assertEquals(res[0].sAMAccountType, 805306368)
+        # self.assertEquals(res[0].userAccountControl, 546)
+        self.assertEquals(res[0]["memberOf"][0], "CN=ldaptestgroup2,CN=Users," + self.base_dn)
+        self.assertEquals(len(res[0]["memberOf"]), 1)
+
+        print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + self.base_dn + "))"
+        res2 = ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + self.base_dn + "))")
+        self.assertEquals(len(res2), 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + self.base_dn + "))")
+
+        self.assertEquals(res[0].dn, res2[0].dn)
+
+        if gc_ldb is not None:
+            print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + self.base_dn + ")) in Global Catlog"
+            res2gc = gc_ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + self.base_dn + "))")
+            self.assertEquals(len(res2gc), 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=cn=computer,cn=schema,cn=configuration," + self.base_dn + ")) in Global Catlog")
+
+            self.assertEquals(res[0].dn, res2gc[0].dn)
+
+        print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=compuTER))"
+        res3 = ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=compuTER))")
+        self.assertEquals(len(res3), 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=compuTER))")
+
+        self.assertEquals(res[0].dn, res3[0].dn)
+
+        if gc_ldb is not None:
+            print "Testing ldb.search for (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog"
+            res3gc = gc_ldb.search(expression="(&(cn=ldaptestcomputer)(objectCategory=compuTER))")
+            self.assertEquals(len(res3gc), 1, "Could not find (&(cn=ldaptestcomputer)(objectCategory=compuTER)) in Global Catalog")
+
+            self.assertEquals(res[0].dn, res3gc[0].dn)
+
+        print "Testing ldb.search for (&(cn=ldaptestcomp*r)(objectCategory=compuTER))"
+        res4 = ldb.search(expression="(&(cn=ldaptestcomp*r)(objectCategory=compuTER))")
+        self.assertEquals(len(res4), 1, "Could not find (&(cn=ldaptestcomp*r)(objectCategory=compuTER))")
+
+        self.assertEquals(res[0].dn, res4[0].dn)
+
+        print "Testing ldb.search for (&(cn=ldaptestcomput*)(objectCategory=compuTER))"
+        res5 = ldb.search(expression="(&(cn=ldaptestcomput*)(objectCategory=compuTER))")
+        self.assertEquals(len(res5), 1, "Could not find (&(cn=ldaptestcomput*)(objectCategory=compuTER))")
+
+        self.assertEquals(res[0].dn, res5[0].dn)
+
+        print "Testing ldb.search for (&(cn=*daptestcomputer)(objectCategory=compuTER))"
+        res6 = ldb.search(expression="(&(cn=*daptestcomputer)(objectCategory=compuTER))")
+        self.assertEquals(len(res6), 1, "Could not find (&(cn=*daptestcomputer)(objectCategory=compuTER))")
+
+        self.assertEquals(res[0].dn, res6[0].dn)
+
+        ldb.delete(res[0].dn)
+
+        print "Testing ldb.search for (&(cn=ldaptest2computer)(objectClass=user))"
+        res = ldb.search(expression="(&(cn=ldaptest2computer)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptest2computer)(objectClass=user))")
+
+        self.assertEquals(res[0].dn, ("CN=ldaptest2computer,CN=Computers," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptest2computer")
+        self.assertEquals(res[0]["name"], "ldaptest2computer")
+        self.assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user", "computer"])
+        self.assertTrue("objectGUID" in res[0])
+        self.assertTrue("whenCreated" in res[0])
+        self.assertEquals(res[0]["objectCategory"][0], "CN=Computer,CN=Schema,CN=Configuration," + self.base_dn)
+        self.assertEquals(int(res[0]["sAMAccountType"][0]), 805306369)
+    #    self.assertEquals(res[0].userAccountControl, 4098)
+
+        ldb.delete(res[0].dn)
+
+        attrs = ["cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor", "memberOf"]
+        print "Testing ldb.search for (&(cn=ldaptestUSer2)(objectClass=user))"
+        res = ldb.search(self.base_dn, expression="(&(cn=ldaptestUSer2)(objectClass=user))", scope=SCOPE_SUBTREE, attrs=attrs)
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptestUSer2)(objectClass=user))")
+
+        self.assertEquals(res[0].dn, ("CN=ldaptestuser2,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestuser2")
+        self.assertEquals(res[0]["name"], "ldaptestuser2")
+        self.assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user"])
+        self.assertTrue("objectGUID" in res[0])
+        self.assertTrue("whenCreated" in res[0])
+        self.assertTrue("nTSecurityDescriptor" in res[0])
+        self.assertEquals(res[0]["memberOf"][0], ("CN=ldaptestgroup2,CN=Users," + self.base_dn))
+
+        attrs = ["cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor", "member"]
+        print "Testing ldb.search for (&(cn=ldaptestgroup2)(objectClass=group))"
+        res = ldb.search(self.base_dn, expression="(&(cn=ldaptestgroup2)(objectClass=group))", scope=SCOPE_SUBTREE, attrs=attrs)
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptestgroup2)(objectClass=group))")
+
+        self.assertEquals(res[0].dn, ("CN=ldaptestgroup2,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestgroup2")
+        self.assertEquals(res[0]["name"], "ldaptestgroup2")
+        self.assertEquals(res[0]["objectClass"], ["top", "group"])
+        self.assertTrue("objectGuid" not in res[0])
+        self.assertTrue("whenCreated" in res[0])
+        self.assertTrue("nTSecurityDescriptor" in res[0])
+        self.assertEquals(res[0]["member"], ["CN=ldaptestuser2,CN=Users," + self.base_dn])
+
+        ldb.modify_ldif("""
+dn: cn=ldaptestgroup2,cn=users,""" + self.base_dn + """
 changetype: modify
 replace: member
-member: CN=ldaptestuser2,CN=Users,""" + base_dn + """
-member: CN=ldaptestutf8user èùéìòà,CN=Users,""" + base_dn + """
+member: CN=ldaptestuser2,CN=Users,""" + self.base_dn + """
+member: CN=ldaptestutf8user èùéìòà,CN=Users,""" + self.base_dn + """
 """)
-    
-    print "Testing Linked attribute behaviours"
-    ldb.modify_ldif("""
-dn: cn=ldaptestgroup2,cn=users,""" + base_dn + """
+        
+        print "Testing Linked attribute behaviours"
+        ldb.modify_ldif("""
+dn: cn=ldaptestgroup2,cn=users,""" + self.base_dn + """
 changetype: modify
 delete: member
 """)
 
-    ldb.modify_ldif("""
-dn: cn=ldaptestgroup2,cn=users,""" + base_dn + """
+        ldb.modify_ldif("""
+dn: cn=ldaptestgroup2,cn=users,""" + self.base_dn + """
 changetype: modify
 add: member
-member: CN=ldaptestuser2,CN=Users,""" + base_dn + """
-member: CN=ldaptestutf8user èùéìòà,CN=Users,""" + base_dn + """
+member: CN=ldaptestuser2,CN=Users,""" + self.base_dn + """
+member: CN=ldaptestutf8user èùéìòà,CN=Users,""" + self.base_dn + """
 """)
-    
-    ldb.modify_ldif("""
-dn: cn=ldaptestgroup2,cn=users,""" + base_dn + """
+        
+        ldb.modify_ldif("""
+dn: cn=ldaptestgroup2,cn=users,""" + self.base_dn + """
 changetype: modify
 replace: member
 """)
-    
-    ldb.modify_ldif("""
-dn: cn=ldaptestgroup2,cn=users,""" + base_dn + """
+        
+        ldb.modify_ldif("""
+dn: cn=ldaptestgroup2,cn=users,""" + self.base_dn + """
 changetype: modify
 add: member
-member: CN=ldaptestuser2,CN=Users,""" + base_dn + """
-member: CN=ldaptestutf8user èùéìòà,CN=Users,""" + base_dn + """
+member: CN=ldaptestuser2,CN=Users,""" + self.base_dn + """
+member: CN=ldaptestutf8user èùéìòà,CN=Users,""" + self.base_dn + """
 """)
-    
-    ldb.modify_ldif("""
-dn: cn=ldaptestgroup2,cn=users,""" + base_dn + """
+        
+        ldb.modify_ldif("""
+dn: cn=ldaptestgroup2,cn=users,""" + self.base_dn + """
 changetype: modify
 delete: member
-member: CN=ldaptestutf8user èùéìòà,CN=Users,""" + base_dn + """
+member: CN=ldaptestutf8user èùéìòà,CN=Users,""" + self.base_dn + """
 """)
-    
-    res = ldb.search(base_dn, expression="(&(cn=ldaptestgroup2)(objectClass=group))", scope=SCOPE_SUBTREE, attrs=attrs)
-    assert len(res) == 1, "Could not find (&(cn=ldaptestgroup2)(objectClass=group))"
+        
+        res = ldb.search(self.base_dn, expression="(&(cn=ldaptestgroup2)(objectClass=group))", scope=SCOPE_SUBTREE, attrs=attrs)
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptestgroup2)(objectClass=group))")
+
+        self.assertEquals(res[0].dn, ("CN=ldaptestgroup2,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["member"][0], ("CN=ldaptestuser2,CN=Users," + self.base_dn))
+        self.assertEquals(len(res[0]["member"]), 1)
 
-    assertEquals(res[0].dn, ("CN=ldaptestgroup2,CN=Users," + base_dn))
-    assertEquals(res[0]["member"][0], ("CN=ldaptestuser2,CN=Users," + base_dn))
-    assertEquals(len(res[0]["member"]), 1)
+        ldb.delete(("CN=ldaptestuser2,CN=Users," + self.base_dn))
 
-    ldb.delete(("CN=ldaptestuser2,CN=Users," + base_dn))
+        attrs = ["cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor", "member"]
+        print "Testing ldb.search for (&(cn=ldaptestgroup2)(objectClass=group)) to check linked delete"
+        res = ldb.search(self.base_dn, expression="(&(cn=ldaptestgroup2)(objectClass=group))", scope=SCOPE_SUBTREE, attrs=attrs)
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptestgroup2)(objectClass=group)) to check linked delete")
 
-    attrs = ["cn", "name", "objectClass", "objectGUID", "whenCreated", "nTSecurityDescriptor", "member"]
-    print "Testing ldb.search for (&(cn=ldaptestgroup2)(objectClass=group)) to check linked delete"
-    res = ldb.search(base_dn, expression="(&(cn=ldaptestgroup2)(objectClass=group))", scope=SCOPE_SUBTREE, attrs=attrs)
-    assert len(res) == 1, "Could not find (&(cn=ldaptestgroup2)(objectClass=group)) to check linked delete"
+        self.assertEquals(res[0].dn, ("CN=ldaptestgroup2,CN=Users," + self.base_dn))
+        self.assertTrue("member" not in res[0])
 
-    assertEquals(res[0].dn, ("CN=ldaptestgroup2,CN=Users," + base_dn))
-    assert("member" not in res[0])
+        print "Testing ldb.search for (&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))"
+        res = ldb.search(expression="(&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))")
 
-    print "Testing ldb.search for (&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))"
-    res = ldb.search(expression="(&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))"
+        self.assertEquals(res[0].dn, ("CN=ldaptestutf8user èùéìòà,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestutf8user èùéìòà")
+        self.assertEquals(res[0]["name"], "ldaptestutf8user èùéìòà")
+        self.assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user"])
+        self.assertTrue("objectGUID" in res[0])
+        self.assertTrue("whenCreated" in res[0])
 
-    assertEquals(res[0].dn, ("CN=ldaptestutf8user èùéìòà,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestutf8user èùéìòà")
-    assertEquals(res[0]["name"], "ldaptestutf8user èùéìòà")
-    assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user"])
-    assert("objectGUID" in res[0])
-    assert("whenCreated" in res[0])
+        ldb.delete(res[0].dn)
 
-    ldb.delete(res[0].dn)
+        print "Testing ldb.search for (&(cn=ldaptestutf8user2*)(objectClass=user))"
+        res = ldb.search(expression="(&(cn=ldaptestutf8user2*)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptestutf8user2*)(objectClass=user))")
 
-    print "Testing ldb.search for (&(cn=ldaptestutf8user2*)(objectClass=user))"
-    res = ldb.search(expression="(&(cn=ldaptestutf8user2*)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(cn=ldaptestutf8user2*)(objectClass=user))"
+        ldb.delete(res[0].dn)
 
-    ldb.delete(res[0].dn)
+        ldb.delete(("CN=ldaptestgroup2,CN=Users," + self.base_dn))
 
-    ldb.delete(("CN=ldaptestgroup2,CN=Users," + base_dn))
+        print "Testing ldb.search for (&(cn=ldaptestutf8user2 ÈÙÉÌÒÀ)(objectClass=user))"
+        res = ldb.search(expression="(&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))")
 
-    print "Testing ldb.search for (&(cn=ldaptestutf8user2 ÈÙÉÌÒÀ)(objectClass=user))"
-    res = ldb.search(expression="(&(cn=ldaptestutf8user ÈÙÉÌÒÀ)(objectClass=user))")
+        #FIXME: self.assert len(res) == 1, "Could not find (expect space collapse, win2k3 fails) (&(cn=ldaptestutf8user2 ÈÙÉÌÒÀ)(objectClass=user))"
 
-    #FIXME: assert len(res) == 1, "Could not find (expect space collapse, win2k3 fails) (&(cn=ldaptestutf8user2 ÈÙÉÌÒÀ)(objectClass=user))"
+        print "Testing that we can't get at the configuration DN from the main search base"
+        res = ldb.search(self.base_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"])
+        self.assertEquals(len(res), 0)
 
-    print "Testing that we can't get at the configuration DN from the main search base"
-    res = ldb.search(base_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"])
-    assert len(res) == 0, "Got configuration DN " + res[0].dn + " which should not be able to be seen from main search base"
-    assertEquals(len(res), 0)
+        print "Testing that we can get at the configuration DN from the main search base on the LDAP port with the 'phantom root' search_options control"
+        res = ldb.search(self.base_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["search_options:1:2"])
+        self.assertTrue(len(res) > 0)
 
-    print "Testing that we can get at the configuration DN from the main search base on the LDAP port with the 'phantom root' search_options control"
-    res = ldb.search(base_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["search_options:1:2"])
-    assert(len(res) > 0)
+        if gc_ldb is not None:
+            print "Testing that we can get at the configuration DN from the main search base on the GC port with the search_options control == 0"
+            
+            res = gc_ldb.search(self.base_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["search_options:1:0"])
+            self.assertTrue(len(res) > 0)
 
-    if gc_ldb is not None:
-        print "Testing that we can get at the configuration DN from the main search base on the GC port with the search_options control == 0"
+            print "Testing that we do find configuration elements in the global catlog"
+            res = gc_ldb.search(self.base_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"])
+            self.assertTrue(len(res) > 0)
+        
+            print "Testing that we do find configuration elements and user elements at the same time"
+            res = gc_ldb.search(self.base_dn, expression="(|(objectClass=crossRef)(objectClass=person))", scope=SCOPE_SUBTREE, attrs=["cn"])
+            self.assertTrue(len(res) > 0)
+
+            print "Testing that we do find configuration elements in the global catlog, with the configuration basedn"
+            res = gc_ldb.search(self.configuration_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"])
+            self.assertTrue(len(res) > 0)
+
+        print "Testing that we can get at the configuration DN on the main LDAP port"
+        res = ldb.search(self.configuration_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"])
+        self.assertTrue(len(res) > 0)
+
+        print "Testing objectCategory canonacolisation"
+        res = ldb.search(self.configuration_dn, expression="objectCategory=ntDsDSA", scope=SCOPE_SUBTREE, attrs=["cn"])
+        self.assertTrue(len(res) > 0, "Didn't find any records with objectCategory=ntDsDSA")
+        self.assertTrue(len(res) != 0)
         
-        res = gc_ldb.search(base_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["search_options:1:0"])
-        assert(len(res) > 0)
-
-        print "Testing that we do find configuration elements in the global catlog"
-        res = gc_ldb.search(base_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"])
-        assert (len(res) > 0)
-    
-        print "Testing that we do find configuration elements and user elements at the same time"
-        res = gc_ldb.search(base_dn, expression="(|(objectClass=crossRef)(objectClass=person))", scope=SCOPE_SUBTREE, attrs=["cn"])
-        assert (len(res) > 0)
-
-        print "Testing that we do find configuration elements in the global catlog, with the configuration basedn"
-        res = gc_ldb.search(configuration_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"])
-        assert (len(res) > 0)
-
-    print "Testing that we can get at the configuration DN on the main LDAP port"
-    res = ldb.search(configuration_dn, expression="objectClass=crossRef", scope=SCOPE_SUBTREE, attrs=["cn"])
-    assert (len(res) > 0)
-
-    print "Testing objectCategory canonacolisation"
-    res = ldb.search(configuration_dn, expression="objectCategory=ntDsDSA", scope=SCOPE_SUBTREE, attrs=["cn"])
-    assert len(res) > 0, "Didn't find any records with objectCategory=ntDsDSA"
-    assert(len(res) != 0)
-    
-    res = ldb.search(configuration_dn, expression="objectCategory=CN=ntDs-DSA," + schema_dn, scope=SCOPE_SUBTREE, attrs=["cn"])
-    assert len(res) > 0, "Didn't find any records with objectCategory=CN=ntDs-DSA," + schema_dn
-    assert(len(res) != 0)
-    
-    print "Testing objectClass attribute order on "+ base_dn
-    res = ldb.search(expression="objectClass=domain", base=base_dn, 
-                     scope=SCOPE_BASE, attrs=["objectClass"])
-    assertEquals(len(res), 1)
-
-    assertEquals(res[0]["objectClass"], ["top", "domain", "domainDNS"])
-
-#  check enumeration
-
-    print "Testing ldb.search for objectCategory=person"
-    res = ldb.search(base_dn, expression="objectCategory=person", scope=SCOPE_SUBTREE, attrs=["cn"])
-    assert(len(res) > 0)
-
-    print "Testing ldb.search for objectCategory=person with domain scope control"
-    res = ldb.search(base_dn, expression="objectCategory=person", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["domain_scope:1"])
-    assert(len(res) > 0)
-    print "Testing ldb.search for objectCategory=user"
-    res = ldb.search(base_dn, expression="objectCategory=user", scope=SCOPE_SUBTREE, attrs=["cn"])
-    assert(len(res) > 0)
-
-    
-    print "Testing ldb.search for objectCategory=user with domain scope control"
-    res = ldb.search(base_dn, expression="objectCategory=user", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["domain_scope:1"])
-    assert(len(res) > 0)
-    
-    print "Testing ldb.search for objectCategory=group"
-    res = ldb.search(base_dn, expression="objectCategory=group", scope=SCOPE_SUBTREE, attrs=["cn"])
-    assert(len(res) > 0)
-
-    print "Testing ldb.search for objectCategory=group with domain scope control"
-    res = ldb.search(base_dn, expression="objectCategory=group", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["domain_scope:1"])
-    assert(len(res) > 0)
-
-def basedn_tests(ldb, gc_ldb):
-    print "Testing for all rootDSE attributes"
-    res = ldb.search(scope=SCOPE_BASE, attrs=[])
-    assertEquals(len(res), 1)
-
-    print "Testing for highestCommittedUSN"
-    res = ldb.search("", scope=SCOPE_BASE, attrs=["highestCommittedUSN"])
-    assertEquals(len(res), 1)
-    assert(int(res[0]["highestCommittedUSN"][0]) != 0)
-
-    print "Testing for netlogon via LDAP"
-    res = ldb.search("", scope=SCOPE_BASE, attrs=["netlogon"])
-    assertEquals(len(res), 0)
-
-    print "Testing for netlogon and highestCommittedUSN via LDAP"
-    res = ldb.search("", scope=SCOPE_BASE, 
-            attrs=["netlogon", "highestCommittedUSN"])
-    assertEquals(len(res), 0)
-
-
-def find_basedn(ldb):
-    res = ldb.search(base="", expression="", scope=SCOPE_BASE, 
-                     attrs=["defaultNamingContext"])
-    assertEquals(len(res), 1)
-    return res[0]["defaultNamingContext"][0]
-
-
-def find_configurationdn(ldb):
-    res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["configurationNamingContext"])
-    assertEquals(len(res), 1)
-    return res[0]["configurationNamingContext"][0]
-
-
-def find_schemadn(ldb):
-    res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["schemaNamingContext"])
-    assertEquals(len(res), 1)
-    return res[0]["schemaNamingContext"][0]
+        res = ldb.search(self.configuration_dn, expression="objectCategory=CN=ntDs-DSA," + self.schema_dn, scope=SCOPE_SUBTREE, attrs=["cn"])
+        self.assertTrue(len(res) > 0, "Didn't find any records with objectCategory=CN=ntDs-DSA," + self.schema_dn)
+        self.assertTrue(len(res) != 0)
+        
+        print "Testing objectClass attribute order on "+ self.base_dn
+        res = ldb.search(expression="objectClass=domain", base=self.base_dn, 
+                         scope=SCOPE_BASE, attrs=["objectClass"])
+        self.assertEquals(len(res), 1)
+
+        self.assertEquals(res[0]["objectClass"], ["top", "domain", "domainDNS"])
+
+    #  check enumeration
+
+        print "Testing ldb.search for objectCategory=person"
+        res = ldb.search(self.base_dn, expression="objectCategory=person", scope=SCOPE_SUBTREE, attrs=["cn"])
+        self.assertTrue(len(res) > 0)
+
+        print "Testing ldb.search for objectCategory=person with domain scope control"
+        res = ldb.search(self.base_dn, expression="objectCategory=person", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["domain_scope:1"])
+        self.assertTrue(len(res) > 0)
+     
+        print "Testing ldb.search for objectCategory=user"
+        res = ldb.search(self.base_dn, expression="objectCategory=user", scope=SCOPE_SUBTREE, attrs=["cn"])
+        self.assertTrue(len(res) > 0)
+        
+        print "Testing ldb.search for objectCategory=user with domain scope control"
+        res = ldb.search(self.base_dn, expression="objectCategory=user", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["domain_scope:1"])
+        self.assertTrue(len(res) > 0)
+        
+        print "Testing ldb.search for objectCategory=group"
+        res = ldb.search(self.base_dn, expression="objectCategory=group", scope=SCOPE_SUBTREE, attrs=["cn"])
+        self.assertTrue(len(res) > 0)
+
+        print "Testing ldb.search for objectCategory=group with domain scope control"
+        res = ldb.search(self.base_dn, expression="objectCategory=group", scope=SCOPE_SUBTREE, attrs=["cn"], controls=["domain_scope:1"])
+        self.assertTrue(len(res) > 0)
+
+
+class BaseDnTests(unittest.TestCase):
+    def setUp(self):
+        self.ldb = ldb
+
+    def test_rootdse_attrs(self):
+        """Testing for all rootDSE attributes"""
+        res = self.ldb.search(scope=SCOPE_BASE, attrs=[])
+        self.assertEquals(len(res), 1)
+
+    def test_highestcommittedusn(self):
+        """Testing for highestCommittedUSN"""
+        res = self.ldb.search("", scope=SCOPE_BASE, attrs=["highestCommittedUSN"])
+        self.assertEquals(len(res), 1)
+        self.assertTrue(int(res[0]["highestCommittedUSN"][0]) != 0)
+
+    def test_netlogon(self):
+        """Testing for netlogon via LDAP"""
+        res = self.ldb.search("", scope=SCOPE_BASE, attrs=["netlogon"])
+        self.assertEquals(len(res), 0)
+
+    def test_netlogon_highestcommitted_usn(self):
+        """Testing for netlogon and highestCommittedUSN via LDAP"""
+        res = self.ldb.search("", scope=SCOPE_BASE, 
+                attrs=["netlogon", "highestCommittedUSN"])
+        self.assertEquals(len(res), 0)
+
 
 if not "://" in host:
     host = "ldap://%s" % host
 
 ldb = Ldb(host, credentials=creds, session_info=system_session(), lp=lp)
-base_dn = find_basedn(ldb)
-configuration_dn = find_configurationdn(ldb)
-schema_dn = find_schemadn(ldb)
-
-print "baseDN: %s\n" % base_dn
-
 gc_ldb = Ldb("%s:3268" % host, credentials=creds, 
              session_info=system_session(), lp=lp)
 
-basic_tests(ldb, gc_ldb, base_dn, configuration_dn, schema_dn)
-basedn_tests(ldb, gc_ldb)
+runner = SubunitTestRunner()
+runner.run(unittest.makeSuite(BaseDnTests))
+runner.run(unittest.makeSuite(BasicTests))
index 811d5a85bfdbe330e0210ace345bab3fe93a1deb..6a879ab962774f8008af09b56aea34b949042b37 100644 (file)
@@ -121,8 +121,8 @@ static NTSTATUS irpc_uptime(struct irpc_message *msg,
 */
 static char *messaging_path(struct messaging_context *msg, struct server_id server_id)
 {
-       return talloc_asprintf(msg, "%s/msg.%u.%u", msg->base_path, 
-                              (unsigned)server_id.node, (unsigned)server_id.id);
+       return talloc_asprintf(msg, "%s/msg.%s", msg->base_path, 
+                              cluster_id_string(msg, server_id));
 }
 
 /*
@@ -263,8 +263,10 @@ static void messaging_send_handler(struct messaging_context *msg)
                }
                rec->retries = 0;
                if (!NT_STATUS_IS_OK(status)) {
-                       DEBUG(1,("messaging: Lost message from %u to %u of type %u - %s\n", 
-                                rec->header->from.id, rec->header->to.id, rec->header->msg_type, 
+                       DEBUG(1,("messaging: Lost message from %s to %s of type %u - %s\n", 
+                                cluster_id_string(debug_ctx(), rec->header->from), 
+                                cluster_id_string(debug_ctx(), rec->header->to), 
+                                rec->header->msg_type, 
                                 nt_errstr(status)));
                }
                DLIST_REMOVE(msg->pending, rec);
@@ -1051,7 +1053,7 @@ struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx,
        for (i=0;i<count;i++) {
                ret[i] = ((struct server_id *)rec.dptr)[i];
        }
-       ret[i] = cluster_id(0);
+       ret[i] = cluster_id(0, 0);
        free(rec.dptr);
        tdb_unlock_bystring(t->tdb, name);
        talloc_free(t);
index a2995fc9835148c31eb2c2ae8d6ebc16d9aa76b6..d9b0548643ddbda9c89c47cdcead5a538ea6eed5 100644 (file)
@@ -93,7 +93,7 @@ static bool test_addone(struct torture_context *test, const void *_data,
        r.in.in_data = value;
 
        test_debug = true;
-       status = IRPC_CALL(data->msg_ctx1, cluster_id(MSG_ID2), 
+       status = IRPC_CALL(data->msg_ctx1, cluster_id(0, MSG_ID2), 
                           rpcecho, ECHO_ADDONE, &r, test);
        test_debug = false;
        torture_assert_ntstatus_ok(test, status, "AddOne failed");
@@ -122,7 +122,7 @@ static bool test_echodata(struct torture_context *tctx,
        r.in.in_data = (unsigned char *)talloc_strdup(mem_ctx, "0123456789");
        r.in.len = strlen((char *)r.in.in_data);
 
-       status = IRPC_CALL(data->msg_ctx1, cluster_id(MSG_ID2), 
+       status = IRPC_CALL(data->msg_ctx1, cluster_id(0, MSG_ID2), 
                           rpcecho, ECHO_ECHODATA, &r, 
                           mem_ctx);
        torture_assert_ntstatus_ok(tctx, status, "EchoData failed");
@@ -180,7 +180,7 @@ static bool test_speed(struct torture_context *tctx,
        while (timeval_elapsed(&tv) < timelimit) {
                struct irpc_request *irpc;
 
-               irpc = IRPC_CALL_SEND(data->msg_ctx1, cluster_id(MSG_ID2), 
+               irpc = IRPC_CALL_SEND(data->msg_ctx1, cluster_id(0, MSG_ID2), 
                                      rpcecho, ECHO_ADDONE, 
                                      &r, mem_ctx);
                torture_assert(tctx, irpc != NULL, "AddOne send failed");
@@ -221,7 +221,7 @@ static bool irpc_setup(struct torture_context *tctx, void **_data)
        torture_assert(tctx, data->msg_ctx1 = 
                       messaging_init(tctx, 
                                      lp_messaging_path(tctx, tctx->lp_ctx), 
-                                     cluster_id(MSG_ID1),
+                                     cluster_id(0, MSG_ID1),
                                      lp_iconv_convenience(tctx->lp_ctx),
                                      data->ev),
                       "Failed to init first messaging context");
@@ -229,7 +229,7 @@ static bool irpc_setup(struct torture_context *tctx, void **_data)
        torture_assert(tctx, data->msg_ctx2 = 
                       messaging_init(tctx, 
                                      lp_messaging_path(tctx, tctx->lp_ctx),
-                                     cluster_id(MSG_ID2), 
+                                     cluster_id(0, MSG_ID2), 
                                      lp_iconv_convenience(tctx->lp_ctx),
                                      data->ev),
                       "Failed to init second messaging context");
index 0df04bce2bbc355364c5b4d53d70d2db69336e5c..45b573518cc87d691b81c90686dda96c6af77bb7 100644 (file)
@@ -73,7 +73,7 @@ static bool test_ping_speed(struct torture_context *tctx)
 
        msg_server_ctx = messaging_init(tctx, 
                                        lp_messaging_path(tctx, tctx->lp_ctx), 
-                                       cluster_id(1), 
+                                       cluster_id(0, 1), 
                                        lp_iconv_convenience(tctx->lp_ctx),
                                        ev);
        
@@ -84,7 +84,7 @@ static bool test_ping_speed(struct torture_context *tctx)
 
        msg_client_ctx = messaging_init(tctx, 
                                        lp_messaging_path(tctx, tctx->lp_ctx), 
-                                       cluster_id(2), 
+                                       cluster_id(0, 2), 
                                        lp_iconv_convenience(tctx->lp_ctx),
                                        ev);
 
@@ -103,8 +103,8 @@ static bool test_ping_speed(struct torture_context *tctx)
                data.data = discard_const_p(uint8_t, "testing");
                data.length = strlen((const char *)data.data);
 
-               status1 = messaging_send(msg_client_ctx, cluster_id(1), msg_ping, &data);
-               status2 = messaging_send(msg_client_ctx, cluster_id(1), msg_ping, NULL);
+               status1 = messaging_send(msg_client_ctx, cluster_id(0, 1), msg_ping, &data);
+               status2 = messaging_send(msg_client_ctx, cluster_id(0, 1), msg_ping, NULL);
 
                torture_assert_ntstatus_ok(tctx, status1, "msg1 failed");
                ping_count++;
@@ -124,7 +124,7 @@ static bool test_ping_speed(struct torture_context *tctx)
        }
 
        torture_comment(tctx, "sending exit\n");
-       messaging_send(msg_client_ctx, cluster_id(1), msg_exit, NULL);
+       messaging_send(msg_client_ctx, cluster_id(0, 1), msg_exit, NULL);
 
        torture_assert_int_equal(tctx, ping_count, pong_count, "ping test failed");
 
index f1f50479cbce66e5070bb5adaf55e6e876ba234a..7a9c8fcff167d83c75611884334862e297a9aabb 100644 (file)
@@ -18,8 +18,8 @@ clean::
 # Start SUBSYSTEM registry
 [LIBRARY::registry]
 VERSION = 0.0.1
+PC_FILE = registry.pc
 SO_VERSION = 0
-DESCRIPTION = Windows-style registry library
 OBJ_FILES = \
                interface.o \
                util.o \
index 262859f64b4302395d04cf41f0d0e47b27a4cde1..0c8a55396ee553e15e072f67d3cdb5ab5dab38c3 100644 (file)
@@ -400,7 +400,7 @@ static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent,
                          struct security_descriptor *sd,
                          struct hive_key **newkey)
 {
-       struct ldb_key_data *parentkd = (const struct ldb_key_data *)parent;
+       struct ldb_key_data *parentkd = discard_const_p(struct ldb_key_data, parent);
        struct ldb_message *msg;
        struct ldb_key_data *newkd;
        int ret;
diff --git a/source/lib/registry/registry.pc.in b/source/lib/registry/registry.pc.in
new file mode 100644 (file)
index 0000000..98943a0
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: registry
+Description: Windows-style registry library
+Requires: ldb
+Requires.private: 
+Version: 0.0.1
+Libs: -L${libdir} -lregistry 
+Cflags: -I${includedir}  -DHAVE_IMMEDIATE_STRUCTURES=1
index 942ced6b868d0f58b55dbc6adba9c327692f546e..16b5063f87b71a545c20347b9d28d147502b9250 100644 (file)
@@ -2,7 +2,7 @@
 VERSION = 1.0.0
 SO_VERSION = 1
 OBJ_FILES = talloc.o
+PC_FILE = talloc.pc
 MANPAGE = talloc.3
 CFLAGS = -Ilib/talloc
 PUBLIC_HEADERS = talloc.h
-DESCRIPTION = A hierarchical pool based memory system with destructors
index ea5d9ccc6014ff9cd205e42579b48ed1c3390093..767452c9b34b520a51bed6aace888b3f5b2dcd4f 100644 (file)
@@ -686,21 +686,67 @@ void tdb_enable_seqnum(struct tdb_context *tdb)
 }
 
 
+/*
+  add a region of the file to the freelist. Length is the size of the region in bytes, 
+  which includes the free list header that needs to be added
+ */
+static int tdb_free_region(struct tdb_context *tdb, tdb_off_t offset, ssize_t length)
+{
+       struct list_struct rec;
+       if (length <= sizeof(rec)) {
+               /* the region is not worth adding */
+               return 0;
+       }
+       if (length + offset > tdb->map_size) {
+               TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_free_region: adding region beyond end of file\n"));
+               return -1;              
+       }
+       memset(&rec,'\0',sizeof(rec));
+       rec.rec_len = length - sizeof(rec);
+       if (tdb_free(tdb, offset, &rec) == -1) {
+               TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_free_region: failed to add free record\n"));
+               return -1;
+       }
+       return 0;
+}
+
 /*
   wipe the entire database, deleting all records. This can be done
   very fast by using a global lock. The entire data portion of the
   file becomes a single entry in the freelist.
+
+  This code carefully steps around the recovery area, leaving it alone
  */
 int tdb_wipe_all(struct tdb_context *tdb)
 {
        int i;
        tdb_off_t offset = 0;
        ssize_t data_len;
+       tdb_off_t recovery_head;
+       tdb_len_t recovery_size = 0;
 
        if (tdb_lockall(tdb) != 0) {
                return -1;
        }
 
+       /* see if the tdb has a recovery area, and remember its size
+          if so. We don't want to lose this as otherwise each
+          tdb_wipe_all() in a transaction will increase the size of
+          the tdb by the size of the recovery area */
+       if (tdb_ofs_read(tdb, TDB_RECOVERY_HEAD, &recovery_head) == -1) {
+               TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_wipe_all: failed to read recovery head\n"));
+               goto failed;
+       }
+
+       if (recovery_head != 0) {
+               struct list_struct rec;
+               if (tdb->methods->tdb_read(tdb, recovery_head, &rec, sizeof(rec), DOCONV()) == -1) {
+                       TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_wipe_all: failed to read recovery record\n"));
+                       return -1;
+               }       
+               recovery_size = rec.rec_len + sizeof(rec);
+       }
+
        /* wipe the hashes */
        for (i=0;i<tdb->header.hash_size;i++) {
                if (tdb_ofs_write(tdb, TDB_HASH_TOP(i), &offset) == -1) {
@@ -715,19 +761,30 @@ int tdb_wipe_all(struct tdb_context *tdb)
                goto failed;
        }
 
-       if (tdb_ofs_write(tdb, TDB_RECOVERY_HEAD, &offset) == -1) {
-               TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to write recovery head\n"));
-               goto failed;            
-       }
-
-       /* add all the rest of the file to the freelist */
-       data_len = (tdb->map_size - TDB_DATA_START(tdb->header.hash_size)) - sizeof(struct list_struct);
-       if (data_len > 0) {
-               struct list_struct rec;
-               memset(&rec,'\0',sizeof(rec));
-               rec.rec_len = data_len;
-               if (tdb_free(tdb, TDB_DATA_START(tdb->header.hash_size), &rec) == -1) {
-                       TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to add free record\n"));
+       /* add all the rest of the file to the freelist, possibly leaving a gap 
+          for the recovery area */
+       if (recovery_size == 0) {
+               /* the simple case - the whole file can be used as a freelist */
+               data_len = (tdb->map_size - TDB_DATA_START(tdb->header.hash_size));
+               if (tdb_free_region(tdb, TDB_DATA_START(tdb->header.hash_size), data_len) != 0) {
+                       goto failed;
+               }
+       } else {
+               /* we need to add two freelist entries - one on either
+                  side of the recovery area 
+
+                  Note that we cannot shift the recovery area during
+                  this operation. Only the transaction.c code may
+                  move the recovery area or we risk subtle data
+                  corruption
+               */
+               data_len = (recovery_head - TDB_DATA_START(tdb->header.hash_size));
+               if (tdb_free_region(tdb, TDB_DATA_START(tdb->header.hash_size), data_len) != 0) {
+                       goto failed;
+               }
+               /* and the 2nd free list entry after the recovery area - if any */
+               data_len = tdb->map_size - (recovery_head+recovery_size);
+               if (tdb_free_region(tdb, recovery_head+recovery_size, data_len) != 0) {
                        goto failed;
                }
        }
index c3e7a4e2c065d55492fbc9ddb3c1ff6946bf7057..4e2127be64484cbcb5faee1a6e5682c08425f26a 100644 (file)
@@ -321,6 +321,9 @@ static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off,
 
        if (blk == tdb->transaction->num_blocks-1 &&
            off + len > tdb->transaction->last_block_size) {
+               if (off >= tdb->transaction->last_block_size) {
+                       return 0;
+               }
                len = tdb->transaction->last_block_size - off;
        }
 
index c9e5a67d7bae11e58b65ade038537eaae3cfa05c..820c55e363ef524b2e75f6bd0462a31d6abe68fb 100644 (file)
@@ -3,7 +3,7 @@
 [LIBRARY::LIBTDB]
 VERSION = 0.0.1
 SO_VERSION = 0
-DESCRIPTION = Trivial Database Library
+PC_FILE = tdb.pc
 OBJ_FILES = \
        common/tdb.o common/dump.o common/io.o common/lock.o \
        common/open.o common/traverse.o common/freelist.o \
index bb440f9cf55ee2df2893738331a08302d8340378..6f8f553736c31df3a4f6976c01df5b3e72b825b6 100644 (file)
@@ -8,3 +8,4 @@ Description: A trivial database
 Version: @PACKAGE_VERSION@
 Libs: -L${libdir} -ltdb
 Cflags: -I${includedir} 
+URL: http://tdb.samba.org/
index 53a55bf7afca5e268affdddc3cefdf2273daf497..f3e6cd7acf802b89ad233df6ce2f3b56b9cfb5a7 100644 (file)
@@ -1,7 +1,6 @@
 [SUBSYSTEM::LIBSAMBA-UTIL]
 #VERSION = 0.0.1
 #SO_VERSION = 0
-#DESCRIPTION = Generic utility functions
 PUBLIC_HEADERS = util.h \
                                 attr.h \
                                 byteorder.h \
index 1895ed53adf228ff0c2ee4ff389666d9c793a674..605628174a949589b433303cff2356ad722f410d 100644 (file)
@@ -41,13 +41,17 @@ struct debug_ops {
 
 extern int DEBUGLEVEL;
 
+#define debug_ctx() (_debug_ctx?_debug_ctx:(_debug_ctx=talloc_new(NULL)))
+
 #define DEBUGLVL(level) ((level) <= DEBUGLEVEL)
 #define _DEBUG(level, body, header) do { \
        if (DEBUGLVL(level)) { \
+               void* _debug_ctx=NULL; \
                if (header) { \
                        do_debug_header(level, __location__, __FUNCTION__); \
                } \
                do_debug body; \
+               talloc_free(_debug_ctx); \
        } \
 } while (0)
 /** 
index fc514980098a7877154c02000dbce1d60f1ff608..a18188580619378fe91a6f863cb3a0aa391d663d 100644 (file)
@@ -612,3 +612,11 @@ _PUBLIC_ int get_time_zone(time_t t)
                return 0;
        return tm_diff(&tm_utc,tm);
 }
+
+/**
+  check if 2 NTTIMEs are equal.
+*/
+bool nt_time_equal(NTTIME *t1, NTTIME *t2)
+{
+       return *t1 == *t2;
+}
index 557c5d4eabb5594dd83a53b155fe3fb02d607988..1ab976ca78c1d3428abd461ac3e3028a003e02f2 100644 (file)
@@ -224,6 +224,9 @@ _PUBLIC_ void nttime_to_timeval(struct timeval *tv, NTTIME t);
  */
 _PUBLIC_ int get_time_zone(time_t t);
 
-
+/**
+  check if 2 NTTIMEs are equal.
+*/
+bool nt_time_equal(NTTIME *t1, NTTIME *t2);
 
 #endif /* _SAMBA_TIME_H_ */
index a538d607bbfa09fac69eec2abf946c299d194dd6..cf87e6c045c43d9d0837e9a56956f498c414d8f0 100644 (file)
@@ -39,7 +39,6 @@ OBJ_FILES = nbt/nbtname.o
 [SUBSYSTEM::LIBCLI_NBT]
 #VERSION = 0.0.1
 #SO_VERSION = 0
-#DESCRIPTION = NetBios over TCP/IP client library
 PRIVATE_PROTO_HEADER = nbt/nbt_proto.h
 OBJ_FILES = \
        nbt/nbtsocket.o \
index 862631ffa94fe4c162c7b5b4a38a1383a2742005..c9185c749b4bf0181b0a58437a6f1c2f07dfcfa4 100644 (file)
@@ -1514,10 +1514,10 @@ static void becomeDC_drsuapi_connect_send(struct libnet_BecomeDC_state *s,
 
        if (!drsuapi->binding) {
                if (lp_parm_bool(s->libnet->lp_ctx, NULL, "become_dc", "print", false)) {
-                       binding_str = talloc_asprintf(s, "ncacn_ip_tcp:%s[krb5,print,seal]", s->source_dsa.dns_name);
+                       binding_str = talloc_asprintf(s, "ncacn_ip_tcp:%s[print,seal]", s->source_dsa.dns_name);
                        if (composite_nomem(binding_str, c)) return;
                } else {
-                       binding_str = talloc_asprintf(s, "ncacn_ip_tcp:%s[krb5,seal]", s->source_dsa.dns_name);
+                       binding_str = talloc_asprintf(s, "ncacn_ip_tcp:%s[seal]", s->source_dsa.dns_name);
                        if (composite_nomem(binding_str, c)) return;
                }
                c->status = dcerpc_parse_binding(s, binding_str, &drsuapi->binding);
@@ -1687,6 +1687,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
        struct drsuapi_DsReplicaObjectIdentifier *identifier;
        uint32_t num_attrs, i = 0;
        struct drsuapi_DsReplicaAttribute *attrs;
+       struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(s->libnet->lp_ctx);
        enum ndr_err_code ndr_err;
        bool w2k3;
 
@@ -1785,7 +1786,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
                                               NULL);
                if (composite_nomem(v, c)) return;
 
-               ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, v,(ndr_push_flags_fn_t)ndr_push_security_descriptor);
+               ndr_err = ndr_push_struct_blob(&vd[0], vd, iconv_convenience, v,(ndr_push_flags_fn_t)ndr_push_security_descriptor);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        c->status = ndr_map_error2ntstatus(ndr_err);
                        if (!composite_is_ok(c)) return;
@@ -1844,7 +1845,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
                                                          s->forest.schema_dn_str);
                if (composite_nomem(v[0].dn, c)) return;
 
-               ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, &v[0], 
+               ndr_err = ndr_push_struct_blob(&vd[0], vd, iconv_convenience, &v[0], 
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        c->status = ndr_map_error2ntstatus(ndr_err);
@@ -1874,7 +1875,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
 
                v = &s->dest_dsa.invocation_id;
 
-               ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, v, (ndr_push_flags_fn_t)ndr_push_GUID);
+               ndr_err = ndr_push_struct_blob(&vd[0], vd, iconv_convenience, v, (ndr_push_flags_fn_t)ndr_push_GUID);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        c->status = ndr_map_error2ntstatus(ndr_err);
                        if (!composite_is_ok(c)) return;
@@ -1913,21 +1914,21 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
                v[2].sid                = s->zero_sid;
                v[2].dn                 = s->forest.schema_dn_str;
 
-               ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, &v[0],
+               ndr_err = ndr_push_struct_blob(&vd[0], vd, iconv_convenience, &v[0],
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        c->status = ndr_map_error2ntstatus(ndr_err);
                        if (!composite_is_ok(c)) return;
                }
 
-               ndr_err = ndr_push_struct_blob(&vd[1], vd, NULL, &v[1],
+               ndr_err = ndr_push_struct_blob(&vd[1], vd, iconv_convenience, &v[1],
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        c->status = ndr_map_error2ntstatus(ndr_err);
                        if (!composite_is_ok(c)) return;
                }
 
-               ndr_err = ndr_push_struct_blob(&vd[2], vd, NULL, &v[2],
+               ndr_err = ndr_push_struct_blob(&vd[2], vd, iconv_convenience, &v[2],
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        c->status = ndr_map_error2ntstatus(ndr_err);
@@ -1969,21 +1970,21 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
                v[2].sid                = s->zero_sid;
                v[2].dn                 = s->forest.schema_dn_str;
 
-               ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, &v[0],
+               ndr_err = ndr_push_struct_blob(&vd[0], vd, iconv_convenience, &v[0],
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        c->status = ndr_map_error2ntstatus(ndr_err);
                        if (!composite_is_ok(c)) return;
                }
 
-               ndr_err = ndr_push_struct_blob(&vd[1], vd, NULL, &v[1],
+               ndr_err = ndr_push_struct_blob(&vd[1], vd, iconv_convenience, &v[1],
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        c->status = ndr_map_error2ntstatus(ndr_err);
                        if (!composite_is_ok(c)) return;
                }
 
-               ndr_err = ndr_push_struct_blob(&vd[2], vd, NULL, &v[2],
+               ndr_err = ndr_push_struct_blob(&vd[2], vd, iconv_convenience, &v[2],
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        c->status = ndr_map_error2ntstatus(ndr_err);
@@ -2017,7 +2018,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
                v[0].sid                = s->zero_sid;
                v[0].dn                 = s->forest.schema_dn_str;
 
-               ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, &v[0],
+               ndr_err = ndr_push_struct_blob(&vd[0], vd, iconv_convenience, &v[0],
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        c->status = ndr_map_error2ntstatus(ndr_err);
@@ -2049,7 +2050,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
                v[0].sid                = s->zero_sid;
                v[0].dn                 = s->domain.dn_str;
 
-               ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, &v[0],
+               ndr_err = ndr_push_struct_blob(&vd[0], vd, iconv_convenience, &v[0],
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        c->status = ndr_map_error2ntstatus(ndr_err);
@@ -2131,7 +2132,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
                v[0].sid                = s->zero_sid;
                v[0].dn                 = s->dest_dsa.computer_dn_str;
 
-               ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, &v[0],
+               ndr_err = ndr_push_struct_blob(&vd[0], vd, iconv_convenience, &v[0],
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        c->status = ndr_map_error2ntstatus(ndr_err);
index 4d4167ba04a55bee82320e5e71c7a0931a336342..0f5a65121ccb925aad20795623968c344c1b71af 100644 (file)
@@ -3,7 +3,7 @@
 [LIBRARY::LIBNDR]
 VERSION = 0.0.1
 SO_VERSION = 0
-DESCRIPTION = Network Data Representation Core Library
+PC_FILE = ndr.pc
 PUBLIC_HEADERS = ndr/libndr.h
 PUBLIC_PROTO_HEADER = ndr/libndr_proto.h
 OBJ_FILES = \
@@ -345,10 +345,10 @@ PUBLIC_DEPENDENCIES = dcerpc NDR_UNIXINFO
 
 [LIBRARY::dcerpc_samr]
 OBJ_FILES = gen_ndr/ndr_samr_c.o
+PC_FILE = dcerpc_samr.pc
 PUBLIC_DEPENDENCIES = dcerpc NDR_SAMR 
 VERSION = 0.0.1
 SO_VERSION = 0
-DESCRIPTION = DCE/RPC client library - SAMR
 
 [SUBSYSTEM::RPC_NDR_SPOOLSS]
 OBJ_FILES = gen_ndr/ndr_spoolss_c.o
@@ -458,7 +458,7 @@ PUBLIC_HEADERS = gen_ndr/dcerpc.h gen_ndr/ndr_dcerpc.h
 [LIBRARY::dcerpc]
 VERSION = 0.0.1
 SO_VERSION = 0
-DESCRIPTION = DCE/RPC client library
+PC_FILE = dcerpc.pc
 PUBLIC_HEADERS = rpc/dcerpc.h \
                        gen_ndr/mgmt.h gen_ndr/ndr_mgmt.h gen_ndr/ndr_mgmt_c.h \
                        gen_ndr/epmapper.h gen_ndr/ndr_epmapper.h gen_ndr/ndr_epmapper_c.h
diff --git a/source/librpc/dcerpc.pc.in b/source/librpc/dcerpc.pc.in
new file mode 100644 (file)
index 0000000..3960f2a
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: dcerpc
+Description: DCE/RPC client library
+Requires: ndr
+Version: 0.0.1
+Libs: -L${libdir} -ldcerpc 
+Cflags: -I${includedir} -DHAVE_IMMEDIATE_STRUCTURES=1
diff --git a/source/librpc/dcerpc_samr.pc.in b/source/librpc/dcerpc_samr.pc.in
new file mode 100644 (file)
index 0000000..c410223
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: dcerpc_samr
+Description: DCE/RPC client library - SAMR
+Requires.private: dcerpc ndr
+Version: 0.0.1
+Libs: -L${libdir} -ldcerpc_samr 
+Cflags: -I${includedir}  -DHAVE_IMMEDIATE_STRUCTURES=1
index 0861758187dc280783fc4d4cb7c7bd0d6116f296..8331977398dfe1285992f765ad93512b52e99a58 100644 (file)
@@ -51,7 +51,8 @@ interface misc
 
        /* id used to identify a endpoint, possibly in a cluster */
        typedef [public] struct {
-               uint32 id;
+               hyper id;
+               uint32 id2;
                uint32 node;
        } server_id;
 }
index dcbb647ba01ce55aba1ee28f8af3cf7b2525f5f5..d06c2acdd4aaf6918d22f7c7b59cb07bb489305f 100644 (file)
@@ -12,13 +12,13 @@ import "lsa.idl", "samr.idl", "security.idl", "nbt.idl";
   uuid("12345678-1234-abcd-ef00-01234567cffb"),
   version(1.0),
   endpoint("ncacn_np:[\\pipe\\netlogon]","ncacn_ip_tcp:","ncalrpc:"),
-  pointer_default(unique),
-  pointer_default_top(unique)
+  pointer_default(unique)
 ]
 
 interface netlogon
 {
        typedef bitmap samr_AcctFlags samr_AcctFlags;
+       typedef bitmap samr_GroupAttrs samr_GroupAttrs;
 
        /*****************/
        /* Function 0x00 */
@@ -43,10 +43,10 @@ interface netlogon
        } netr_UasInfo;
 
        WERROR netr_LogonUasLogon(
-               [in]   [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
                [in]   [string,charset(UTF16)] uint16 account_name[],
                [in]   [string,charset(UTF16)] uint16 workstation[],
-               [out netr_UasInfo *info
+               [out,unique] netr_UasInfo *info
                );
 
 
@@ -59,7 +59,7 @@ interface netlogon
        } netr_UasLogoffInfo;
 
        WERROR netr_LogonUasLogoff(
-               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
                [in] [string,charset(UTF16)] uint16 account_name[],
                [in] [string,charset(UTF16)] uint16 workstation[],
                [out] netr_UasLogoffInfo info
@@ -86,13 +86,18 @@ interface netlogon
                [size_is(size/2),length_is(length/2)] uint16 *bindata;
        } netr_AcctLockStr;
 
-       const int MSV1_0_CLEARTEXT_PASSWORD_ALLOWED = 0x002;
-       const int MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT = 0x020;
-       const int MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT = 0x800;
+       typedef [public,bitmap32bit] bitmap {
+               MSV1_0_CLEARTEXT_PASSWORD_ALLOWED       = 0x00000002,
+               MSV1_0_UPDATE_LOGON_STATISTICS          = 0x00000004,
+               MSV1_0_RETURN_USER_PARAMETERS           = 0x00000008,
+               MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT       = 0x00000020,
+               MSV1_0_RETURN_PROFILE_PATH              = 0x00000200,
+               MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT  = 0x00000800
+       } netr_LogonParameterControl;
 
        typedef struct {
                lsa_String  domain_name;
-               uint32      parameter_control; /* see MSV1_0_* */
+               netr_LogonParameterControl parameter_control; /* see MSV1_0_* */
                uint32      logon_id_low;
                uint32      logon_id_high;
                lsa_String  account_name;
@@ -126,11 +131,6 @@ interface netlogon
                [case(6)] netr_NetworkInfo  *network;
        } netr_LogonLevel;
 
-       typedef [public] struct {
-               uint32 rid;
-               uint32 attributes;
-       } netr_GroupMembership;
-
        typedef [public,flag(NDR_PAHEX)] struct {
                uint8 key[16];
        } netr_UserSessionKey;
@@ -187,7 +187,7 @@ interface netlogon
 
        typedef struct {
                dom_sid2 *sid;
-               uint32 attribute;
+               samr_GroupAttrs attributes;
        } netr_SidAttr;
 
        typedef [public] struct {
@@ -239,10 +239,10 @@ interface netlogon
        } netr_Authenticator;
 
        NTSTATUS netr_LogonSamLogon(
-               [in] [string,charset(UTF16)] uint16 *server_name,
-               [in] [string,charset(UTF16)] uint16 *computer_name,
-               [in] netr_Authenticator *credential,
-               [in][out] netr_Authenticator *return_authenticator,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *computer_name,
+               [in,unique] netr_Authenticator *credential,
+               [in,out,unique] netr_Authenticator *return_authenticator,
                [in]  uint16 logon_level,
                [in]  [switch_is(logon_level)] netr_LogonLevel logon,
                [in]  uint16 validation_level,
@@ -255,10 +255,10 @@ interface netlogon
        /* Function 0x03 */
 
        NTSTATUS netr_LogonSamLogoff(
-               [in] [string,charset(UTF16)] uint16 *server_name,
-               [in] [string,charset(UTF16)] uint16 *computer_name,
-               [in]      netr_Authenticator *credential,
-               [in][out] netr_Authenticator *return_authenticator,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *computer_name,
+               [in,unique] netr_Authenticator *credential,
+               [in,out,unique] netr_Authenticator *return_authenticator,
                [in] uint16 logon_level,
                [in] [switch_is(logon_level)] netr_LogonLevel logon
                );
@@ -269,7 +269,7 @@ interface netlogon
        /* Function 0x04 */
 
        [public] NTSTATUS netr_ServerReqChallenge(
-               [in,string,charset(UTF16)] uint16 *server_name,
+               [in,unique,string,charset(UTF16)] uint16 *server_name,
                [in,string,charset(UTF16)] uint16 computer_name[],
                [in,out,ref] netr_Credential *credentials
                );
@@ -281,7 +281,7 @@ interface netlogon
        typedef enum netr_SchannelType netr_SchannelType;
 
        NTSTATUS netr_ServerAuthenticate(
-               [in,string,charset(UTF16)] uint16 *server_name,
+               [in,unique,string,charset(UTF16)] uint16 *server_name,
                [in,string,charset(UTF16)] uint16 account_name[],
                [in]                       netr_SchannelType secure_channel_type,
                [in,string,charset(UTF16)] uint16 computer_name[],
@@ -293,7 +293,7 @@ interface netlogon
        /* Function 0x06 */
 
        NTSTATUS netr_ServerPasswordSet(
-               [in [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
                [in]  [string,charset(UTF16)] uint16 account_name[],
                [in]  netr_SchannelType secure_channel_type,
                [in]  [string,charset(UTF16)] uint16 computer_name[],
@@ -684,7 +684,7 @@ interface netlogon
                [in]      netr_SamDatabaseID database_id,
                [in,out]  udlong sequence_num,
                [in]      uint32 preferredmaximumlength,
-               [out]     netr_DELTA_ENUM_ARRAY *delta_enum_array
+               [out,unique] netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
 
 
@@ -699,7 +699,7 @@ interface netlogon
                [in]     netr_SamDatabaseID database_id,
                [in,out] uint32 sync_context,
                [in]     uint32 preferredmaximumlength,
-               [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
+               [out,unique] netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
 
 
@@ -719,7 +719,7 @@ interface netlogon
        } netr_AccountBuffer;
 
        NTSTATUS netr_AccountDeltas(
-               [in]     [string,charset(UTF16)] uint16 *logon_server,
+               [in,unique] [string,charset(UTF16)] uint16 *logon_server,
                [in]     [string,charset(UTF16)] uint16 computername[],
                [in]     netr_Authenticator credential,
                [in,out] netr_Authenticator return_authenticator,
@@ -738,7 +738,7 @@ interface netlogon
        /* Function 0x0A */
 
        NTSTATUS netr_AccountSync(
-               [in]      [string,charset(UTF16)] uint16 *logon_server,
+               [in,unique] [string,charset(UTF16)] uint16 *logon_server,
                [in]      [string,charset(UTF16)] uint16 computername[],
                [in]      netr_Authenticator credential,
                [in,out]  netr_Authenticator return_authenticator,
@@ -758,8 +758,8 @@ interface netlogon
 
        WERROR netr_GetDcName(
                [in]  [string,charset(UTF16)] uint16 logon_server[],
-               [in [string,charset(UTF16)] uint16 *domainname,
-               [out] [string,charset(UTF16)] uint16 *dcname
+               [in,unique] [string,charset(UTF16)] uint16 *domainname,
+               [out,unique] [string,charset(UTF16)] uint16 *dcname
                );
 
        /*****************/
@@ -802,7 +802,7 @@ interface netlogon
        } netr_LogonControlCode;
 
        WERROR netr_LogonControl(
-               [in]   [string,charset(UTF16)] uint16 *logon_server,
+               [in,unique] [string,charset(UTF16)] uint16 *logon_server,
                [in]   netr_LogonControlCode function_code,
                [in]   uint32 level,
                [out,switch_is(level)]  netr_CONTROL_QUERY_INFORMATION info
@@ -813,9 +813,9 @@ interface netlogon
        /* Function 0x0D */
 
        WERROR netr_GetAnyDCName(
-               [in [string,charset(UTF16)] uint16 *logon_server,
-               [in [string,charset(UTF16)] uint16 *domainname,
-               [out] [string,charset(UTF16)] uint16 *dcname
+               [in,unique] [string,charset(UTF16)] uint16 *logon_server,
+               [in,unique] [string,charset(UTF16)] uint16 *domainname,
+               [out,unique] [string,charset(UTF16)] uint16 *dcname
                );
 
 
@@ -830,7 +830,7 @@ interface netlogon
        } netr_CONTROL_DATA_INFORMATION;
 
        WERROR netr_LogonControl2(
-               [in]    [string,charset(UTF16)] uint16 *logon_server,
+               [in,unique] [string,charset(UTF16)] uint16 *logon_server,
                [in]    uint32 function_code,
                [in]    uint32 level,
                [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
@@ -849,7 +849,7 @@ interface netlogon
        /* Function 0x0F */
 
        NTSTATUS netr_ServerAuthenticate2(
-               [in]         [string,charset(UTF16)] uint16 *server_name,
+               [in,unique]  [string,charset(UTF16)] uint16 *server_name,
                [in]         [string,charset(UTF16)] uint16 account_name[],
                [in]         netr_SchannelType secure_channel_type,
                [in]         [string,charset(UTF16)] uint16 computer_name[],
@@ -870,7 +870,7 @@ interface netlogon
                [in]     uint16 restart_state,
                [in,out] uint32 sync_context,
                [in]     uint32 preferredmaximumlength,
-               [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
+               [out,unique] netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
 
 
@@ -884,9 +884,9 @@ interface netlogon
                [in]     [string,charset(UTF16)] uint16 computername[],
                [in]     netr_Authenticator credential,
                [in,out] netr_Authenticator return_authenticator,
-               [in][size_is(change_log_entry_size)] uint8 *change_log_entry,
+               [in,unique][size_is(change_log_entry_size)] uint8 *change_log_entry,
                [in]     uint32 change_log_entry_size,
-               [out]    netr_DELTA_ENUM_ARRAY *delta_enum_array
+               [out,unique]    netr_DELTA_ENUM_ARRAY *delta_enum_array
                );
 
 
@@ -894,7 +894,7 @@ interface netlogon
        /* Function 0x12 */
 
        WERROR netr_LogonControl2Ex(
-               [in]   [string,charset(UTF16)] uint16 *logon_server,
+               [in,unique] [string,charset(UTF16)] uint16 *logon_server,
                [in]   uint32 function_code,
                [in]   uint32 level,
                [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION  data,
@@ -909,7 +909,7 @@ interface netlogon
        } netr_Blob;
 
        WERROR netr_NetrEnumerateTrustedDomains(
-               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
                [out,ref] netr_Blob *trusted_domains_blob
                );
 
@@ -973,12 +973,12 @@ interface netlogon
        } netr_DsRGetDCNameInfo;
 
        WERROR netr_DsRGetDCName(
-               [in] [string,charset(UTF16)] uint16 *server_unc,
-               [in] [string,charset(UTF16)] uint16 *domain_name,
-               [in] GUID *domain_guid,
-               [in] GUID *site_guid,
+               [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+               [in,unique] [string,charset(UTF16)] uint16 *domain_name,
+               [in,unique] GUID *domain_guid,
+               [in,unique] GUID *site_guid,
                [in] netr_DsRGetDCName_flags flags,
-               [out] netr_DsRGetDCNameInfo *info
+               [out,unique] netr_DsRGetDCNameInfo *info
                );
 
        /*****************/
@@ -991,7 +991,11 @@ interface netlogon
 
        /****************/
        /* Function 0x17 */
-       WERROR netr_NETRLOGONGETTRUSTRID();
+       WERROR netr_LogonGetTrustRid(
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *domain_name,
+               [out,ref] uint32 *rid
+       );
 
        /****************/
        /* Function 0x18 */
@@ -1004,7 +1008,7 @@ interface netlogon
        /****************/
        /* Function 0x1a */
        [public] NTSTATUS netr_ServerAuthenticate3(
-               [in]         [string,charset(UTF16)] uint16 *server_name,
+               [in,unique]         [string,charset(UTF16)] uint16 *server_name,
                [in]         [string,charset(UTF16)] uint16 account_name[],
                [in]         netr_SchannelType secure_channel_type,
                [in]         [string,charset(UTF16)] uint16 computer_name[],
@@ -1017,19 +1021,19 @@ interface netlogon
        /* Function 0x1b */
 
        WERROR netr_DsRGetDCNameEx(
-               [in] [string,charset(UTF16)] uint16 *server_unc,
-               [in] [string,charset(UTF16)] uint16 *domain_name,
-               [in] GUID *domain_guid,
-               [in] [string,charset(UTF16)] uint16 *site_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+               [in,unique] [string,charset(UTF16)] uint16 *domain_name,
+               [in,unique] GUID *domain_guid,
+               [in,unique] [string,charset(UTF16)] uint16 *site_name,
                [in] netr_DsRGetDCName_flags flags,
-               [out] netr_DsRGetDCNameInfo *info
+               [out,unique] netr_DsRGetDCNameInfo *info
                );
 
        /****************/
        /* Function 0x1c */
        WERROR netr_DsRGetSiteName(
-               [in] [string,charset(UTF16)] uint16 *computer_name,
-               [out] [string,charset(UTF16)] uint16 *site
+               [in,unique] [string,charset(UTF16)] uint16 *computer_name,
+               [out,unique] [string,charset(UTF16)] uint16 *site
                );
 
        /****************/
@@ -1085,7 +1089,7 @@ interface netlogon
        
        NTSTATUS netr_LogonGetDomainInfo(
                [in]         [string,charset(UTF16)] uint16 server_name[],
-               [in]         [string,charset(UTF16)] uint16 *computer_name,
+               [in,unique]  [string,charset(UTF16)] uint16 *computer_name,
                [in,ref]     netr_Authenticator *credential,
                [in,out,ref] netr_Authenticator *return_authenticator,
                [in]         uint32 level,
@@ -1101,7 +1105,7 @@ interface netlogon
        /*****************/
        /* Function 0x1e */
        NTSTATUS netr_ServerPasswordSet2(
-               [in [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
                [in]  [string,charset(UTF16)] uint16 account_name[],
                [in]  netr_SchannelType secure_channel_type,
                [in]  [string,charset(UTF16)] uint16 computer_name[],
@@ -1113,7 +1117,7 @@ interface netlogon
        /****************/
        /* Function 0x1f */
        WERROR netr_ServerPasswordGet(
-               [in [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
                [in]  [string,charset(UTF16)] uint16 account_name[],
                [in]  netr_SchannelType secure_channel_type,
                [in]  [string,charset(UTF16)] uint16 computer_name[],
@@ -1139,7 +1143,7 @@ interface netlogon
        } netr_DsRAddress;
 
        WERROR netr_DsRAddressToSitenamesW(
-               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
                [in] [range(0,32000)] uint32 count,
                [in] [size_is(count)] [ref] netr_DsRAddress *addresses,
                [out] [ref] netr_DsRAddressToSitenamesWCtr **ctr
@@ -1148,14 +1152,14 @@ interface netlogon
        /****************/
        /* Function 0x22 */
        WERROR netr_DsRGetDCNameEx2(
-               [in] [string,charset(UTF16)] uint16 *server_unc,
-               [in] [string,charset(UTF16)] uint16 *client_account,
+               [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+               [in,unique] [string,charset(UTF16)] uint16 *client_account,
                [in] samr_AcctFlags mask,
-               [in] [string,charset(UTF16)] uint16 *domain_name,
-               [in] GUID *domain_guid,
-               [in] [string,charset(UTF16)] uint16 *site_name,
+               [in,unique] [string,charset(UTF16)] uint16 *domain_name,
+               [in,unique] GUID *domain_guid,
+               [in,unique] [string,charset(UTF16)] uint16 *site_name,
                [in] netr_DsRGetDCName_flags flags,
-               [out] netr_DsRGetDCNameInfo *info
+               [out,unique] netr_DsRGetDCNameInfo *info
                );
 
        /****************/
@@ -1207,7 +1211,7 @@ interface netlogon
         } netr_DomainTrustList;
 
        WERROR netr_NetrEnumerateTrustedDomainsEx(
-               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
                [out,ref] netr_DomainTrustList *dom_trust_list
        );
 
@@ -1220,7 +1224,7 @@ interface netlogon
        } netr_DsRAddressToSitenamesExWCtr;
 
        WERROR netr_DsRAddressToSitenamesExW(
-               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
                [in] [range(0,32000)] uint32 count,
                [in] [size_is(count)] [ref] netr_DsRAddress *addresses,
                [out] [ref] netr_DsRAddressToSitenamesExWCtr **ctr
@@ -1235,15 +1239,15 @@ interface netlogon
        } DcSitesCtr;
 
        WERROR netr_DsrGetDcSiteCoverageW(
-               [in] [string,charset(UTF16)] uint16 *server_name,
-               [out] DcSitesCtr *ctr
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
+               [out,unique] DcSitesCtr *ctr
                );
 
        /****************/
        /* Function 0x27 */
        NTSTATUS netr_LogonSamLogonEx(
-               [in] [string,charset(UTF16)] uint16 *server_name,
-               [in] [string,charset(UTF16)] uint16 *computer_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *computer_name,
                [in]  uint16 logon_level,
                [in]  [switch_is(logon_level)] netr_LogonLevel logon,
                [in]  uint16 validation_level,
@@ -1256,21 +1260,27 @@ interface netlogon
        /* Function 0x28 */
 
        WERROR netr_DsrEnumerateDomainTrusts(
-               [in]                 [string,charset(UTF16)] uint16           *server_name,
+               [in,unique]          [string,charset(UTF16)] uint16           *server_name,
                [in]                 netr_TrustFlags  trust_flags,
                [out]                uint32           count,
-               [out,size_is(count)] netr_DomainTrust *trusts
+               [out,unique,size_is(count)] netr_DomainTrust *trusts
                );
 
 
        /****************/
        /* Function 0x29 */
-       WERROR netr_DSRDEREGISTERDNSHOSTRECORDS();
+       WERROR netr_DsrDeregisterDNSHostRecords(
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *domain,
+               [in,unique] GUID *domain_guid,
+               [in,unique] GUID *dsa_guid,
+               [in,ref] [string,charset(UTF16)] uint16 *dns_host
+               );
 
        /****************/
        /* Function 0x2a */
        NTSTATUS netr_ServerTrustPasswordsGet(
-               [in]  [string,charset(UTF16)] uint16 *server_name,
+               [in,unique]  [string,charset(UTF16)] uint16 *server_name,
                [in]  [string,charset(UTF16)] uint16 account_name[],
                [in]  netr_SchannelType secure_channel_type,
                [in]  [string,charset(UTF16)] uint16 computer_name[],
@@ -1286,8 +1296,8 @@ interface netlogon
        const int DS_GFTI_UPDATE_TDO = 0x1;
 
        WERROR netr_DsRGetForestTrustInformation(
-               [in] [string,charset(UTF16)] uint16 *server_name,
-               [in] [string,charset(UTF16)] uint16 *trusted_domain_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *trusted_domain_name,
                [in] uint32 flags,
                [out,ref] lsa_ForestTrustInformation **forest_trust_info
                );
@@ -1295,7 +1305,7 @@ interface netlogon
        /****************/
        /* Function 0x2c */
        WERROR netr_GetForestTrustInformation(
-               [in] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
                [in,ref] [string,charset(UTF16)] uint16 *trusted_domain_name,
                [in,ref] netr_Authenticator *credential,
                [out,ref] netr_Authenticator *return_authenticator,
@@ -1308,10 +1318,10 @@ interface netlogon
 
        /* this is the ADS varient. I don't yet know what the "flags" are for */
        NTSTATUS netr_LogonSamLogonWithFlags(
-               [in] [string,charset(UTF16)] uint16 *server_name,
-               [in] [string,charset(UTF16)] uint16 *computer_name,
-               [in] netr_Authenticator *credential,
-               [in][out] netr_Authenticator *return_authenticator,
+               [in,unique] [string,charset(UTF16)] uint16 *server_name,
+               [in,unique] [string,charset(UTF16)] uint16 *computer_name,
+               [in,unique] netr_Authenticator *credential,
+               [in,out,unique] netr_Authenticator *return_authenticator,
                [in]  uint16 logon_level,
                [in]  [switch_is(logon_level)] netr_LogonLevel logon,
                [in]  uint16 validation_level,
index b6d2b9f941e173280161b98fbdb255836e24f7ef..2dc33fa9b90ac8151aa9519eddcda4df86c98ec5 100644 (file)
@@ -12,8 +12,7 @@ import "misc.idl", "lsa.idl", "security.idl";
 [ uuid("12345778-1234-abcd-ef00-0123456789ac"),
   version(1.0),
   endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"),
-  pointer_default(unique),
-  pointer_default_top(unique)
+  pointer_default(unique)
 ] interface samr
 {
        typedef bitmap security_secinfo security_secinfo;
@@ -51,54 +50,54 @@ import "misc.idl", "lsa.idl", "security.idl";
        } samr_ConnectAccessMask;
 
        typedef [bitmap32bit] bitmap {
-               USER_ACCESS_GET_NAME_ETC             = 0x00000001,
-               USER_ACCESS_GET_LOCALE               = 0x00000002,
-               USER_ACCESS_SET_LOC_COM              = 0x00000004,
-               USER_ACCESS_GET_LOGONINFO            = 0x00000008,
-               USER_ACCESS_GET_ATTRIBUTES           = 0x00000010,
-               USER_ACCESS_SET_ATTRIBUTES           = 0x00000020,
-               USER_ACCESS_CHANGE_PASSWORD          = 0x00000040,
-               USER_ACCESS_SET_PASSWORD             = 0x00000080,
-               USER_ACCESS_GET_GROUPS               = 0x00000100,
-               USER_ACCESS_GET_GROUP_MEMBERSHIP     = 0x00000200,
-               USER_ACCESS_CHANGE_GROUP_MEMBERSHIP  = 0x00000400
+               SAMR_USER_ACCESS_GET_NAME_ETC             = 0x00000001,
+               SAMR_USER_ACCESS_GET_LOCALE               = 0x00000002,
+               SAMR_USER_ACCESS_SET_LOC_COM              = 0x00000004,
+               SAMR_USER_ACCESS_GET_LOGONINFO            = 0x00000008,
+               SAMR_USER_ACCESS_GET_ATTRIBUTES           = 0x00000010,
+               SAMR_USER_ACCESS_SET_ATTRIBUTES           = 0x00000020,
+               SAMR_USER_ACCESS_CHANGE_PASSWORD          = 0x00000040,
+               SAMR_USER_ACCESS_SET_PASSWORD             = 0x00000080,
+               SAMR_USER_ACCESS_GET_GROUPS               = 0x00000100,
+               SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP     = 0x00000200,
+               SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP  = 0x00000400
        } samr_UserAccessMask;
 
        typedef [bitmap32bit] bitmap {
-               DOMAIN_ACCESS_LOOKUP_INFO_1  = 0x00000001,
-               DOMAIN_ACCESS_SET_INFO_1     = 0x00000002,
-               DOMAIN_ACCESS_LOOKUP_INFO_2  = 0x00000004,
-               DOMAIN_ACCESS_SET_INFO_2     = 0x00000008,
-               DOMAIN_ACCESS_CREATE_USER    = 0x00000010,
-               DOMAIN_ACCESS_CREATE_GROUP   = 0x00000020,
-               DOMAIN_ACCESS_CREATE_ALIAS   = 0x00000040,
-               DOMAIN_ACCESS_LOOKUP_ALIAS   = 0x00000080,
-               DOMAIN_ACCESS_ENUM_ACCOUNTS  = 0x00000100,
-               DOMAIN_ACCESS_OPEN_ACCOUNT   = 0x00000200,
-               DOMAIN_ACCESS_SET_INFO_3     = 0x00000400
+               SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1  = 0x00000001,
+               SAMR_DOMAIN_ACCESS_SET_INFO_1     = 0x00000002,
+               SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2  = 0x00000004,
+               SAMR_DOMAIN_ACCESS_SET_INFO_2     = 0x00000008,
+               SAMR_DOMAIN_ACCESS_CREATE_USER    = 0x00000010,
+               SAMR_DOMAIN_ACCESS_CREATE_GROUP   = 0x00000020,
+               SAMR_DOMAIN_ACCESS_CREATE_ALIAS   = 0x00000040,
+               SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS   = 0x00000080,
+               SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS  = 0x00000100,
+               SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT   = 0x00000200,
+               SAMR_DOMAIN_ACCESS_SET_INFO_3     = 0x00000400
        } samr_DomainAccessMask;
 
        typedef [bitmap32bit] bitmap {
-               GROUP_ACCESS_LOOKUP_INFO     = 0x00000001,
-               GROUP_ACCESS_SET_INFO        = 0x00000002,
-               GROUP_ACCESS_ADD_MEMBER      = 0x00000004,
-               GROUP_ACCESS_REMOVE_MEMBER   = 0x00000008,
-               GROUP_ACCESS_GET_MEMBERS     = 0x00000010
+               SAMR_GROUP_ACCESS_LOOKUP_INFO     = 0x00000001,
+               SAMR_GROUP_ACCESS_SET_INFO        = 0x00000002,
+               SAMR_GROUP_ACCESS_ADD_MEMBER      = 0x00000004,
+               SAMR_GROUP_ACCESS_REMOVE_MEMBER   = 0x00000008,
+               SAMR_GROUP_ACCESS_GET_MEMBERS     = 0x00000010
        } samr_GroupAccessMask;
 
        typedef [bitmap32bit] bitmap {
-               ALIAS_ACCESS_ADD_MEMBER      = 0x00000001,
-               ALIAS_ACCESS_REMOVE_MEMBER   = 0x00000002,
-               ALIAS_ACCESS_GET_MEMBERS     = 0x00000004,
-               ALIAS_ACCESS_LOOKUP_INFO     = 0x00000008,
-               ALIAS_ACCESS_SET_INFO        = 0x00000010
+               SAMR_ALIAS_ACCESS_ADD_MEMBER      = 0x00000001,
+               SAMR_ALIAS_ACCESS_REMOVE_MEMBER   = 0x00000002,
+               SAMR_ALIAS_ACCESS_GET_MEMBERS     = 0x00000004,
+               SAMR_ALIAS_ACCESS_LOOKUP_INFO     = 0x00000008,
+               SAMR_ALIAS_ACCESS_SET_INFO        = 0x00000010
        } samr_AliasAccessMask;
 
        /******************/
        /* Function: 0x00 */
        NTSTATUS samr_Connect (
                /* notice the lack of [string] */
-               [in]       uint16 *system_name,
+               [in,unique] uint16 *system_name,
                [in]       samr_ConnectAccessMask access_mask,
                [out,ref]  policy_handle *connect_handle
                );
@@ -125,7 +124,7 @@ import "misc.idl", "lsa.idl", "security.idl";
        NTSTATUS samr_QuerySecurity (
                [in,ref]          policy_handle *handle,
                [in]              security_secinfo sec_info,
-               [out]             sec_desc_buf *sdbuf
+               [out,unique]      sec_desc_buf *sdbuf
                );
 
        /******************/
@@ -143,7 +142,7 @@ import "misc.idl", "lsa.idl", "security.idl";
        NTSTATUS samr_LookupDomain (
                [in,ref]  policy_handle *connect_handle,                
                [in,ref]  lsa_String *domain_name,
-               [out]     dom_sid2 *sid
+               [out,unique] dom_sid2 *sid
                );
 
 
@@ -164,7 +163,7 @@ import "misc.idl", "lsa.idl", "security.idl";
                [in,ref]      policy_handle *connect_handle,
                [in,out,ref]  uint32 *resume_handle,
                [in]          uint32 buf_size,
-               [out]         samr_SamArray *sam,
+               [out,unique]  samr_SamArray *sam,
                [out]         uint32 num_entries
                );
 
@@ -288,7 +287,7 @@ import "misc.idl", "lsa.idl", "security.idl";
        NTSTATUS samr_QueryDomainInfo(
                [in,ref]      policy_handle *domain_handle,
                [in]          uint16 level,
-               [out,switch_is(level)] samr_DomainInfo *info
+               [out,switch_is(level),unique] samr_DomainInfo *info
                );
 
        /************************/
@@ -321,7 +320,7 @@ import "misc.idl", "lsa.idl", "security.idl";
                [in,ref]      policy_handle *domain_handle,
                [in,out,ref]  uint32 *resume_handle,
                [in]          uint32 max_size,
-               [out]         samr_SamArray *sam,
+               [out,unique]  samr_SamArray *sam,
                [out]         uint32 num_entries
                );
 
@@ -349,7 +348,7 @@ import "misc.idl", "lsa.idl", "security.idl";
                [in,out,ref]  uint32 *resume_handle,
                [in]          samr_AcctFlags acct_flags,
                [in]          uint32 max_size,
-               [out]         samr_SamArray *sam,
+               [out,unique]  samr_SamArray *sam,
                [out]         uint32 num_entries
                );
 
@@ -369,7 +368,7 @@ import "misc.idl", "lsa.idl", "security.idl";
                [in,ref]      policy_handle *domain_handle,
                [in,out,ref]  uint32 *resume_handle,
                [in]          samr_AcctFlags acct_flags,
-               [out]         samr_SamArray *sam,
+               [out,unique]  samr_SamArray *sam,
                [out]         uint32 num_entries
                );
 
@@ -466,7 +465,7 @@ import "misc.idl", "lsa.idl", "security.idl";
        NTSTATUS samr_QueryGroupInfo(
                [in,ref]                  policy_handle *group_handle,
                [in]                      samr_GroupInfoEnum level,
-               [out,switch_is(level)]    samr_GroupInfo *info
+               [out,switch_is(level),unique] samr_GroupInfo *info
                );
 
        /************************/
@@ -509,7 +508,7 @@ import "misc.idl", "lsa.idl", "security.idl";
 
        NTSTATUS samr_QueryGroupMember(
                [in,ref]  policy_handle *group_handle,
-               [out]     samr_RidTypeArray *rids
+               [out,unique] samr_RidTypeArray *rids
                );
 
 
@@ -563,7 +562,7 @@ import "misc.idl", "lsa.idl", "security.idl";
        NTSTATUS samr_QueryAliasInfo(
                [in,ref]                  policy_handle  *alias_handle,
                [in]                      samr_AliasInfoEnum      level,
-               [out,switch_is(level)]    samr_AliasInfo *info
+               [out,switch_is(level),unique] samr_AliasInfo *info
                );
 
        /************************/
@@ -862,7 +861,7 @@ import "misc.idl", "lsa.idl", "security.idl";
        [public] NTSTATUS samr_QueryUserInfo(
                [in,ref]                  policy_handle *user_handle,
                [in]                      uint16 level,
-               [out,switch_is(level)]    samr_UserInfo *info
+               [out,unique,switch_is(level)] samr_UserInfo *info
                );
 
 
@@ -887,15 +886,15 @@ import "misc.idl", "lsa.idl", "security.idl";
        NTSTATUS samr_ChangePasswordUser(
                [in,ref]    policy_handle *user_handle,
                [in]        boolean8 lm_present,
-               [in]        samr_Password *old_lm_crypted,
-               [in]        samr_Password *new_lm_crypted,
+               [in,unique] samr_Password *old_lm_crypted,
+               [in,unique] samr_Password *new_lm_crypted,
                [in]        boolean8 nt_present,
-               [in]        samr_Password *old_nt_crypted,
-               [in]        samr_Password *new_nt_crypted,
+               [in,unique] samr_Password *old_nt_crypted,
+               [in,unique] samr_Password *new_nt_crypted,
                [in]        boolean8 cross1_present,
-               [in]        samr_Password *nt_cross,
+               [in,unique] samr_Password *nt_cross,
                [in]        boolean8 cross2_present,
-               [in]        samr_Password *lm_cross
+               [in,unique] samr_Password *lm_cross
                );
 
        /************************/
@@ -913,7 +912,7 @@ import "misc.idl", "lsa.idl", "security.idl";
 
        NTSTATUS samr_GetGroupsForUser(
                [in,ref]   policy_handle *user_handle,
-               [out]      samr_RidWithAttributeArray  *rids
+               [out,unique] samr_RidWithAttributeArray  *rids
                );
 
        /************************/
@@ -1061,7 +1060,7 @@ import "misc.idl", "lsa.idl", "security.idl";
        NTSTATUS samr_QueryDomainInfo2(
                [in,ref]      policy_handle *domain_handle,
                [in]          uint16 level,
-               [out,switch_is(level)] samr_DomainInfo *info
+               [out,unique,switch_is(level)] samr_DomainInfo *info
                );
 
        /************************/
@@ -1073,7 +1072,7 @@ import "misc.idl", "lsa.idl", "security.idl";
        NTSTATUS samr_QueryUserInfo2(
                [in,ref]                  policy_handle *user_handle,
                [in]                      uint16 level,
-               [out,switch_is(level)]    samr_UserInfo *info
+               [out,unique,switch_is(level)]    samr_UserInfo *info
                );
 
        /************************/
@@ -1155,35 +1154,35 @@ import "misc.idl", "lsa.idl", "security.idl";
        /* Function    0x36     */
 
        NTSTATUS samr_OemChangePasswordUser2(
-               [in]              lsa_AsciiString *server,
+               [in,unique]       lsa_AsciiString *server,
                [in,ref]          lsa_AsciiString *account,
-               [in]              samr_CryptPassword *password,
-               [in]              samr_Password *hash
+               [in,unique]       samr_CryptPassword *password,
+               [in,unique]       samr_Password *hash
                );
 
        /************************/
        /* Function    0x37     */
        NTSTATUS samr_ChangePasswordUser2(
-               [in]              lsa_String *server,
+               [in,unique]       lsa_String *server,
                [in,ref]          lsa_String *account,
-               [in]              samr_CryptPassword *nt_password,
-               [in]              samr_Password *nt_verifier,
+               [in,unique]       samr_CryptPassword *nt_password,
+               [in,unique]       samr_Password *nt_verifier,
                [in]              boolean8 lm_change,
-               [in]              samr_CryptPassword *lm_password,
-               [in]              samr_Password *lm_verifier
+               [in,unique]       samr_CryptPassword *lm_password,
+               [in,unique]       samr_Password *lm_verifier
                );
 
        /************************/
        /* Function    0x38     */
        NTSTATUS samr_GetDomPwInfo(
-               [in]        lsa_String *domain_name,
+               [in,unique] lsa_String *domain_name,
                [out]       samr_PwInfo info
                );
 
        /************************/
        /* Function    0x39     */
        NTSTATUS samr_Connect2(
-               [in,string,charset(UTF16)] uint16 *system_name,
+               [in,unique,string,charset(UTF16)] uint16 *system_name,
                [in] samr_ConnectAccessMask access_mask,
                [out,ref]  policy_handle *connect_handle
                );
@@ -1221,7 +1220,7 @@ import "misc.idl", "lsa.idl", "security.idl";
        /************************/
        /* Function    0x3d     */
        NTSTATUS samr_Connect3(
-               [in,string,charset(UTF16)] uint16 *system_name,
+               [in,unique,string,charset(UTF16)] uint16 *system_name,
                /* this unknown value seems to be completely ignored by w2k3 */
                [in] uint32 unknown,
                [in] samr_ConnectAccessMask access_mask,
@@ -1231,7 +1230,7 @@ import "misc.idl", "lsa.idl", "security.idl";
        /************************/
        /* Function    0x3e     */
        NTSTATUS samr_Connect4(
-               [in,string,charset(UTF16)] uint16 *system_name,
+               [in,unique,string,charset(UTF16)] uint16 *system_name,
                [in] uint32 unknown,
                [in] samr_ConnectAccessMask access_mask,
                [out,ref]  policy_handle *connect_handle
@@ -1249,16 +1248,16 @@ import "misc.idl", "lsa.idl", "security.idl";
        } samr_ChangeReject;
 
        NTSTATUS samr_ChangePasswordUser3(
-               [in]              lsa_String *server,
+               [in,unique]       lsa_String *server,
                [in,ref]          lsa_String *account,
-               [in]              samr_CryptPassword *nt_password,
-               [in]              samr_Password *nt_verifier,
+               [in,unique]       samr_CryptPassword *nt_password,
+               [in,unique]       samr_Password *nt_verifier,
                [in]              boolean8 lm_change,
-               [in]              samr_CryptPassword *lm_password,
-               [in]              samr_Password *lm_verifier,
-               [in]              samr_CryptPassword *password3,
-               [out]             samr_DomInfo1 *dominfo,
-               [out]             samr_ChangeReject *reject
+               [in,unique]       samr_CryptPassword *lm_password,
+               [in,unique]       samr_Password *lm_verifier,
+               [in,unique]       samr_CryptPassword *password3,
+               [out,unique]      samr_DomInfo1 *dominfo,
+               [out,unique]      samr_ChangeReject *reject
                );
 
        /************************/
@@ -1274,7 +1273,7 @@ import "misc.idl", "lsa.idl", "security.idl";
        } samr_ConnectInfo;
 
        [public] NTSTATUS samr_Connect5(
-               [in,string,charset(UTF16)] uint16 *system_name,
+               [in,unique,string,charset(UTF16)] uint16 *system_name,
                [in]       samr_ConnectAccessMask  access_mask,
                [in,out]   uint32             level,
                [in,out,switch_is(level),ref] samr_ConnectInfo *info,
@@ -1286,7 +1285,7 @@ import "misc.idl", "lsa.idl", "security.idl";
        NTSTATUS samr_RidToSid(
                [in,ref]    policy_handle *domain_handle,
                [in]        uint32        rid,
-               [out]       dom_sid2      *sid
+               [out,unique] dom_sid2      *sid
                );
 
 
@@ -1300,9 +1299,9 @@ import "misc.idl", "lsa.idl", "security.idl";
        */
 
        NTSTATUS samr_SetDsrmPassword(
-               [in]       lsa_String *name,
+               [in,unique] lsa_String *name,
                [in]       uint32 unknown,
-               [in]       samr_Password *hash
+               [in,unique] samr_Password *hash
                );
 
 
@@ -1401,6 +1400,6 @@ import "misc.idl", "lsa.idl", "security.idl";
        NTSTATUS samr_ValidatePassword(
                [in] samr_ValidatePasswordLevel level,
                [in,switch_is(level)] samr_ValidatePasswordReq req,
-               [out,switch_is(level)] samr_ValidatePasswordRep *rep
+               [out,unique,switch_is(level)] samr_ValidatePasswordRep *rep
                );
 }
index 7d40861a52622801e0bb6751f9eb94e52b37e4b0..114c06a00d7d635254258795f775357c637655fd 100644 (file)
@@ -9,7 +9,6 @@ import "security.idl", "winreg.idl";
   version(1.0),
   endpoint("ncacn_np:[\\pipe\\spoolss]"),
   pointer_default(unique),
-  pointer_default_top(unique),
   helpstring("Spooler SubSystem"),
   helper("librpc/ndr/ndr_spoolss_buf.h")
 ] interface spoolss
@@ -254,11 +253,11 @@ import "security.idl", "winreg.idl";
        /* we are using this as internal parsing code */
        [public,noopnum,noprint] WERROR _spoolss_EnumPrinters(
                [in] spoolss_EnumPrinterFlags flags,
-               [in] [string,charset(UTF16)] uint16 *server,
+               [in,unique] [string,charset(UTF16)] uint16 *server,
                [in] uint32 level,
-               [in] DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in] uint32 offered,
-               [out] DATA_BLOB *info,
+               [out,unique] DATA_BLOB *info,
                [out] uint32 needed,
                [out] uint32 count
        );
@@ -269,14 +268,14 @@ import "security.idl", "winreg.idl";
        );
        [nopull,nopush] WERROR spoolss_EnumPrinters(
                [in] spoolss_EnumPrinterFlags flags,
-               [in] [string,charset(UTF16)] uint16 *server,
+               [in,unique] [string,charset(UTF16)] uint16 *server,
                [in] uint32 level,
-               [in] DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in] uint32 offered,
                /* what we have here is a subcontext containing an array of no discriminant unions
                 * and the array has no size in front
                 */
-               [out,switch_is(level),size_is(count)] spoolss_PrinterInfo *info,
+               [out,unique,switch_is(level),size_is(count)] spoolss_PrinterInfo *info,
                [out] uint32 needed,
                [out] uint32 count
        );
@@ -289,8 +288,8 @@ import "security.idl", "winreg.idl";
        } spoolss_DevmodeContainer;
 
        [public] WERROR spoolss_OpenPrinter(
-               [in] [string,charset(UTF16)] uint16 *printername,
-               [in] [string,charset(UTF16)] uint16 *datatype,
+               [in,unique] [string,charset(UTF16)] uint16 *printername,
+               [in,unique] [string,charset(UTF16)] uint16 *datatype,
                [in] spoolss_DevmodeContainer devmode_ctr,
                [in] uint32 access_mask,
                [out,ref] policy_handle *handle
@@ -339,7 +338,7 @@ import "security.idl", "winreg.idl";
        WERROR spoolss_SetJob(
                [in,ref] policy_handle *handle,
                [in] uint32 job_id,
-               [in] spoolss_JobInfoContainer *ctr,
+               [in,unique] spoolss_JobInfoContainer *ctr,
                [in] spoolss_JobControl command
        );
 
@@ -349,9 +348,9 @@ import "security.idl", "winreg.idl";
                [in,ref] policy_handle *handle,
                [in]     uint32 job_id,
                [in]     uint32 level,
-               [in]     DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in]     uint32 offered,
-               [out,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_JobInfo *info,
+               [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_JobInfo *info,
                [out]    uint32 needed
        );
 
@@ -362,9 +361,9 @@ import "security.idl", "winreg.idl";
                [in]     uint32 firstjob,
                [in]     uint32 numjobs,
                [in]     uint32 level,
-               [in]     DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in]     uint32 offered,
-               [out]    DATA_BLOB *info,
+               [out,unique] DATA_BLOB *info,
                [out]    uint32 needed,
                [out]    uint32 count
        );
@@ -378,9 +377,9 @@ import "security.idl", "winreg.idl";
                [in]     uint32 firstjob,
                [in]     uint32 numjobs,
                [in]     uint32 level,
-               [in]     DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in]     uint32 offered,
-               [out,switch_is(level),size_is(count)] spoolss_JobInfo *info,
+               [out,unique,switch_is(level),size_is(count)] spoolss_JobInfo *info,
                [out]    uint32 needed,
                [out]    uint32 count
        );
@@ -435,9 +434,9 @@ import "security.idl", "winreg.idl";
        [public] WERROR spoolss_GetPrinter(
                [in,ref] policy_handle *handle,
                [in]     uint32 level,
-               [in]     DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in]     uint32 offered,
-               [out,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrinterInfo *info,
+               [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrinterInfo *info,
                [out]    uint32 needed
        );
 
@@ -538,12 +537,12 @@ import "security.idl", "winreg.idl";
        /******************/
        /* Function: 0x0a */
        [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDrivers(
-               [in] [string,charset(UTF16)] uint16 *server,
-               [in] [string,charset(UTF16)] uint16 *environment,
+               [in,unique] [string,charset(UTF16)] uint16 *server,
+               [in,unique] [string,charset(UTF16)] uint16 *environment,
                [in] uint32 level,
-               [in] DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in] uint32 offered,
-               [out] DATA_BLOB *info,
+               [out,unique] DATA_BLOB *info,
                [out] uint32 needed,
                [out] uint32 count
        );
@@ -553,12 +552,12 @@ import "security.idl", "winreg.idl";
                [out,switch_is(level)] spoolss_DriverInfo info[count]
        );
        [nopull,nopush] WERROR spoolss_EnumPrinterDrivers(
-               [in] [string,charset(UTF16)] uint16 *server,
-               [in] [string,charset(UTF16)] uint16 *environment,
+               [in,unique] [string,charset(UTF16)] uint16 *server,
+               [in,unique] [string,charset(UTF16)] uint16 *environment,
                [in] uint32 level,
-               [in] DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in] uint32 offered,
-               [out,switch_is(level),size_is(count)] spoolss_DriverInfo *info,
+               [out,unique,switch_is(level),size_is(count)] spoolss_DriverInfo *info,
                [out] uint32 needed,
                [out] uint32 count
        );
@@ -583,12 +582,12 @@ import "security.idl", "winreg.idl";
        } spoolss_DriverDirectoryInfo;
 
        [public] WERROR spoolss_GetPrinterDriverDirectory(
-               [in] [string,charset(UTF16)] uint16 *server,
-               [in] [string,charset(UTF16)] uint16 *environment,
+               [in,unique] [string,charset(UTF16)] uint16 *server,
+               [in,unique] [string,charset(UTF16)] uint16 *environment,
                [in] uint32 level,
-               [in] DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in] uint32 offered,
-               [out,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverDirectoryInfo *info,
+               [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverDirectoryInfo *info,
                [out] uint32 needed
        );
 
@@ -596,7 +595,7 @@ import "security.idl", "winreg.idl";
        /* Function: 0x0d */
        WERROR spoolss_DeletePrinterDriver(
                [in,ref] policy_handle *handle,
-               [in] [string,charset(UTF16)] uint16 *server,
+               [in,unique] [string,charset(UTF16)] uint16 *server,
                [in] [string,charset(UTF16)] uint16 architecture[],
                [in] [string,charset(UTF16)] uint16 driver[]
        );
@@ -618,12 +617,12 @@ import "security.idl", "winreg.idl";
        } spoolss_PrintProcessorInfo;
 
        [public,noopnum,noprint] WERROR _spoolss_EnumPrintProcessors(
-               [in] [string,charset(UTF16)] uint16 *servername,
-               [in] [string,charset(UTF16)] uint16 *environment,
+               [in,unique] [string,charset(UTF16)] uint16 *servername,
+               [in,unique] [string,charset(UTF16)] uint16 *environment,
                [in] uint32 level,
-               [in] DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in] uint32 offered,
-               [out] DATA_BLOB *info,
+               [out,unique] DATA_BLOB *info,
                [out] uint32 needed,
                [out] uint32 count
        );
@@ -633,12 +632,12 @@ import "security.idl", "winreg.idl";
                [out,switch_is(level)] spoolss_PrintProcessorInfo info[count]
        );
        [nopull,nopush] WERROR spoolss_EnumPrintProcessors(
-               [in] [string,charset(UTF16)] uint16 *servername,
-               [in] [string,charset(UTF16)] uint16 *environment,
+               [in,unique] [string,charset(UTF16)] uint16 *servername,
+               [in,unique] [string,charset(UTF16)] uint16 *environment,
                [in] uint32 level,
-               [in] DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in] uint32 offered,
-               [out,switch_is(level),size_is(count)] spoolss_PrintProcessorInfo *info,
+               [out,unique,switch_is(level),size_is(count)] spoolss_PrintProcessorInfo *info,
                [out] uint32 needed,
                [out] uint32 count
        );
@@ -878,9 +877,9 @@ import "security.idl", "winreg.idl";
                [in,ref] policy_handle *handle,
                [in] [string,charset(UTF16)] uint16 form_name[],
                [in] uint32 level,
-               [in] DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in] uint32 offered,
-               [out,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_FormInfo *info,
+               [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_FormInfo *info,
                [out] uint32 needed
        );
 
@@ -898,9 +897,9 @@ import "security.idl", "winreg.idl";
        [public,noopnum,noprint] WERROR _spoolss_EnumForms(
                [in,ref] policy_handle *handle,
                [in]     uint32 level,
-               [in]     DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in]     uint32 offered,
-               [out]    DATA_BLOB *info,
+               [out,unique] DATA_BLOB *info,
                [out]    uint32 needed,
                [out]    uint32 count
        );
@@ -912,9 +911,9 @@ import "security.idl", "winreg.idl";
        [nopull,nopush] WERROR spoolss_EnumForms(
                [in,ref] policy_handle *handle,
                [in]     uint32 level,
-               [in]     DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in]     uint32 offered,
-               [out,switch_is(level),size_is(count)] spoolss_FormInfo *info,
+               [out,unique,switch_is(level),size_is(count)] spoolss_FormInfo *info,
                [out] uint32 needed,
                [out] uint32 count
        );
@@ -948,11 +947,11 @@ import "security.idl", "winreg.idl";
        /******************/
        /* Function: 0x23 */
        [public,noopnum,noprint] WERROR _spoolss_EnumPorts(
-               [in] [string,charset(UTF16)] uint16 *servername,
+               [in,unique] [string,charset(UTF16)] uint16 *servername,
                [in] uint32 level,
-               [in] DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in] uint32 offered,
-               [out] DATA_BLOB *info,
+               [out,unique] DATA_BLOB *info,
                [out] uint32 needed,
                [out] uint32 count
        );
@@ -962,11 +961,11 @@ import "security.idl", "winreg.idl";
                [out,switch_is(level)] spoolss_PortInfo info[count]
        );
        [nopull,nopush] WERROR spoolss_EnumPorts(
-               [in] [string,charset(UTF16)] uint16 *servername,
+               [in,unique] [string,charset(UTF16)] uint16 *servername,
                [in] uint32 level,
-               [in] DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in] uint32 offered,
-               [out,switch_is(level),size_is(count)] spoolss_PortInfo *info,
+               [out,unique,switch_is(level),size_is(count)] spoolss_PortInfo *info,
                [out] uint32 needed,
                [out] uint32 count
        );
@@ -990,11 +989,11 @@ import "security.idl", "winreg.idl";
        } spoolss_MonitorInfo;
 
        [public,noopnum,noprint] WERROR _spoolss_EnumMonitors(
-               [in] [string,charset(UTF16)] uint16 *servername,
+               [in,unique] [string,charset(UTF16)] uint16 *servername,
                [in] uint32 level,
-               [in] DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in] uint32 offered,
-               [out] DATA_BLOB *info,
+               [out,unique] DATA_BLOB *info,
                [out] uint32 needed,
                [out] uint32 count
        );
@@ -1004,11 +1003,11 @@ import "security.idl", "winreg.idl";
                [out,switch_is(level)] spoolss_MonitorInfo info[count]
        );
        [nopull,nopush] WERROR spoolss_EnumMonitors(
-               [in] [string,charset(UTF16)] uint16 *servername,
+               [in,unique] [string,charset(UTF16)] uint16 *servername,
                [in] uint32 level,
-               [in] DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in] uint32 offered,
-               [out,switch_is(level),size_is(count)] spoolss_MonitorInfo *info,
+               [out,unique,switch_is(level),size_is(count)] spoolss_MonitorInfo *info,
                [out] uint32 needed,
                [out] uint32 count
        );
@@ -1016,7 +1015,7 @@ import "security.idl", "winreg.idl";
        /******************/
        /* Function: 0x25 */
        WERROR spoolss_AddPort(
-              [in] [string,charset(UTF16)] uint16 *server_name,
+              [in,unique] [string,charset(UTF16)] uint16 *server_name,
               [in] uint32 unknown,
               [in] [string,charset(UTF16)] uint16 monitor_name[]
        );
@@ -1102,13 +1101,13 @@ import "security.idl", "winreg.idl";
        /* Function: 0x35 */
        WERROR spoolss_GetPrinterDriver2(
                [in,ref] policy_handle *handle,
-               [in]     [string,charset(UTF16)] uint16 *architecture,
+               [in,unique] [string,charset(UTF16)] uint16 *architecture,
                [in]     uint32 level,
-               [in]     DATA_BLOB *buffer,
+               [in,unique] DATA_BLOB *buffer,
                [in]     uint32 offered,
                [in]     uint32 client_major_version,
                [in]     uint32 client_minor_version,
-               [out]    DATA_BLOB *info,
+               [out,unique] DATA_BLOB *info,
                [out]    uint32 needed,
                [out]    uint32 server_major_version,
                [out]    uint32 server_minor_version
@@ -1233,9 +1232,9 @@ import "security.idl", "winreg.idl";
                [in,ref] policy_handle *handle,
                [in] uint32 flags,
                [in] uint32 options,
-               [in] [string,charset(UTF16)] uint16 *str,
+               [in,unique] [string,charset(UTF16)] uint16 *str,
                [in] uint32 printer_local,
-               [in] spoolss_NotifyOptionsContainer *t1
+               [in,unique] spoolss_NotifyOptionsContainer *t1
        );
 
        /******************/
@@ -1377,8 +1376,8 @@ import "security.idl", "winreg.idl";
        /******************/
        /* Function: 0x45 */
        [public] WERROR spoolss_OpenPrinterEx(
-               [in]                  [string,charset(UTF16)] uint16 *printername,
-               [in]                  [string,charset(UTF16)] uint16 *datatype,
+               [in,unique]           [string,charset(UTF16)] uint16 *printername,
+               [in,unique]           [string,charset(UTF16)] uint16 *datatype,
                [in]                  spoolss_DevmodeContainer devmode_ctr,
                [in]                  uint32 access_mask,
                [in]                  uint32 level,
@@ -1389,11 +1388,11 @@ import "security.idl", "winreg.idl";
        /******************/
        /* Function: 0x46 */
        WERROR spoolss_AddPrinterEx(
-               [in] [string,charset(UTF16)] uint16 *server,
+               [in,unique] [string,charset(UTF16)] uint16 *server,
                [in] uint32 level,
-               [in,switch_is(level)] spoolss_PrinterInfo *info,
+               [in,unique,switch_is(level)] spoolss_PrinterInfo *info,
                [in] spoolss_DevmodeContainer devmode_ctr,
-               [in] security_descriptor *secdesc,
+               [in,unique] security_descriptor *secdesc,
                [in] uint32 ulevel,
                [in,switch_is(ulevel)] spoolss_UserLevel userlevel
        );
index c3f0bd51a78c33c4f3ba0470e667a64719bc2dd7..66c52fa43f3a653417899f4bcb2b5b50c105d5a0 100644 (file)
@@ -9,7 +9,6 @@ import "security.idl", "svcctl.idl";
   version(3.0),
   endpoint("ncacn_np:[\\pipe\\srvsvc]", "ncacn_ip_tcp:", "ncalrpc:"),
   pointer_default(unique),
-  pointer_default_top(unique),
   helpstring("Server Service")
 ] interface srvsvc
 {
@@ -55,18 +54,18 @@ import "security.idl", "svcctl.idl";
        /******************/
        /* Function: 0x00 */
        WERROR srvsvc_NetCharDevEnum(
-               [in]   [string,charset(UTF16)] uint16 *server_unc, 
+               [in,unique]   [string,charset(UTF16)] uint16 *server_unc,
                [in,out]   uint32 level,
                [in,out,switch_is(level)]   srvsvc_NetCharDevCtr ctr,
                [in]   uint32 max_buffer,
                [out]   uint32 totalentries,
-               [in,out]   uint32 *resume_handle
+               [in,out,unique]   uint32 *resume_handle
                );
 
        /******************/
        /* Function: 0x01 */
        WERROR srvsvc_NetCharDevGetInfo(
-               [in]   [string,charset(UTF16)] uint16 *server_unc,
+               [in,unique]   [string,charset(UTF16)] uint16 *server_unc,
                [in]   [string,charset(UTF16)] uint16 device_name[],
                [in]   uint32 level,
                [out,switch_is(level)]   srvsvc_NetCharDevInfo info
@@ -75,7 +74,7 @@ import "security.idl", "svcctl.idl";
        /******************/
        /* Function: 0x02 */
        WERROR srvsvc_NetCharDevControl(
-               [in]   [string,charset(UTF16)] uint16 *server_unc,
+               [in,unique]   [string,charset(UTF16)] uint16 *server_unc,
                [in]   [string,charset(UTF16)] uint16 device_name[],
                [in]   uint32 opcode
                );
@@ -120,19 +119,19 @@ import "security.idl", "svcctl.idl";
        /******************/
        /* Function: 0x03 */
        WERROR srvsvc_NetCharDevQEnum(
-               [in]   [string,charset(UTF16)] uint16 *server_unc,
-               [in]   [string,charset(UTF16)] uint16 *user,
+               [in,unique]   [string,charset(UTF16)] uint16 *server_unc,
+               [in,unique]   [string,charset(UTF16)] uint16 *user,
                [in,out]   uint32 level,
                [in,out,switch_is(level)]   srvsvc_NetCharDevQCtr ctr,
                [in]   uint32 max_buffer,
                [out]   uint32 totalentries,
-               [in,out]   uint32 *resume_handle
+               [in,out,unique]   uint32 *resume_handle
                );
 
        /******************/
        /* Function: 0x04 */