[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1968-g8d966fa

Jelmer Vernooij jelmer at samba.org
Tue Jun 2 16:06:31 GMT 2009


The branch, master has been updated
       via  8d966fac41ff88f8c26c221fb03da4f9afba5897 (commit)
       via  ac9ff3574d6acac4f52c1d4d588cc9a7a3f919d6 (commit)
       via  00bfe9c286b7156f30a5cad4ee6d42557f3c7835 (commit)
       via  688efbbc687bf96c6801afe55deb55a7002a9bf3 (commit)
       via  2c84685a3d58a3e6baac5383e78eff2605ec7c02 (commit)
       via  6ace18904d638f1fb49c31041ba23353d97b40cb (commit)
       via  fe2b04b4bba6585ee5377d44b8e2627d32d404c4 (commit)
       via  42fa7ec8236fcacdc02a7f3f275cbe01791df43d (commit)
       via  4602cc0ac15b6e41158ed3f01da3061693628b60 (commit)
       via  f90782f228316e0107157d8e196e0bb652a49c42 (commit)
      from  15e10c6a84c450fd5bc1b50a45bb1cfa049fb00d (commit)

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


- Log -----------------------------------------------------------------
commit 8d966fac41ff88f8c26c221fb03da4f9afba5897
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Tue Jun 2 15:00:41 2009 +0200

    Fix unresolved symbol in python messaging module.

commit ac9ff3574d6acac4f52c1d4d588cc9a7a3f919d6
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Tue Jun 2 13:57:08 2009 +0200

    Fix pythonpath so subunit can be found.

commit 00bfe9c286b7156f30a5cad4ee6d42557f3c7835
Author: Brad Hards <bradh at frogmouth.net>
Date:   Mon Jun 1 16:26:43 2009 +0200

    Add support for double type in pidl.
    
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>

commit 688efbbc687bf96c6801afe55deb55a7002a9bf3
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Apr 23 11:23:06 2009 +0200

    Fix finding the LDB header files in the system in pyldb_util.

commit 2c84685a3d58a3e6baac5383e78eff2605ec7c02
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Apr 23 11:22:07 2009 +0200

    Build modules statically by default, as there still seem to be a lot of
    issues with those even if shared libs work.

commit 6ace18904d638f1fb49c31041ba23353d97b40cb
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Apr 23 01:21:47 2009 +0200

    Fix more unresolved symbols.

commit fe2b04b4bba6585ee5377d44b8e2627d32d404c4
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Apr 23 01:20:20 2009 +0200

    python: Move helper functions for using param into a separate file rather
    than linking against the python module.

commit 42fa7ec8236fcacdc02a7f3f275cbe01791df43d
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Apr 20 18:14:17 2009 +0200

    Split up Python code a little bit so we don't hav eto link python modules
    to each other.

commit 4602cc0ac15b6e41158ed3f01da3061693628b60
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Apr 20 13:47:31 2009 +0200

    Build libsamba-util as a shared library.

commit f90782f228316e0107157d8e196e0bb652a49c42
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Apr 20 12:28:02 2009 +0200

    Fix dependencies when using shared libraries.

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

Summary of changes:
 lib/util/config.mk                         |    5 ++-
 librpc/ndr/ndr_basic.c                     |   31 +++++++++++++-
 pidl/lib/Parse/Pidl/NDR.pm                 |    1 +
 pidl/lib/Parse/Pidl/Typelist.pm            |    1 +
 pidl/tests/ndr.pl                          |    3 +-
 pidl/tests/typelist.pl                     |    8 +++-
 source4/auth/config.mk                     |    3 +-
 source4/auth/credentials/config.mk         |    2 +-
 source4/auth/credentials/pycredentials.c   |    9 ----
 source4/auth/credentials/pycredentials.h   |    2 +-
 source4/auth/gensec/config.mk              |    2 +-
 source4/build/smb_build/main.pl            |    3 +-
 source4/cldap_server/config.mk             |   18 +++++---
 source4/dsdb/config.mk                     |    7 ++-
 source4/dsdb/samdb/ldb_modules/config.mk   |   14 +++---
 source4/lib/ldb/ldb.mk                     |    7 ++-
 source4/lib/ldb/pyldb.c                    |   64 ++++++++++++---------------
 source4/lib/ldb/pyldb.h                    |   18 +++----
 source4/lib/ldb/pyldb_util.c               |   39 +++++++++++++++++
 source4/lib/ldb/python.mk                  |   10 ++++-
 source4/lib/messaging/config.mk            |    2 +-
 source4/lib/messaging/pymessaging.c        |    4 +-
 source4/lib/registry/config.mk             |    2 +-
 source4/librpc/config.mk                   |   34 +++++++-------
 source4/librpc/rpc/pyrpc.c                 |    3 +-
 source4/nbt_server/config.mk               |    2 +-
 source4/param/config.mk                    |    7 +++-
 source4/param/pyparam.c                    |   33 --------------
 source4/param/pyparam.h                    |    1 +
 source4/param/pyparam_util.c               |   65 ++++++++++++++++++++++++++++
 source4/scripting/python/config.mk         |    2 +-
 source4/scripting/python/pyglue.c          |   26 +++++++----
 source4/scripting/python/samba/__init__.py |    2 +-
 source4/selftest/tests.sh                  |    2 +-
 34 files changed, 279 insertions(+), 153 deletions(-)
 create mode 100644 source4/lib/ldb/pyldb_util.c
 create mode 100644 source4/param/pyparam_util.c


Changeset truncated at 500 lines:

diff --git a/lib/util/config.mk b/lib/util/config.mk
index 3ae8a22..70e8340 100644
--- a/lib/util/config.mk
+++ b/lib/util/config.mk
@@ -1,9 +1,12 @@
-[SUBSYSTEM::LIBSAMBA-UTIL]
+[LIBRARY::LIBSAMBA-UTIL]
 PUBLIC_DEPENDENCIES = \
 		LIBTALLOC LIBCRYPTO \
 		SOCKET_WRAPPER LIBREPLACE_NETWORK \
 		CHARSET EXECINFO
 
+LIBSAMBA-UTIL_VERSION = 0.0.1
+LIBSAMBA-UTIL_SOVERSION = 0.0.1
+
 LIBSAMBA-UTIL_OBJ_FILES = $(addprefix $(libutilsrcdir)/, \
 		xfile.o \
 		debug.o \
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index b6cc44c..d46590f 100644
--- a/librpc/ndr/ndr_basic.c
+++ b/librpc/ndr/ndr_basic.c
@@ -126,6 +126,18 @@ _PUBLIC_ enum ndr_err_code ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags,
 }
 
 /*
+  parse a double
+*/
+_PUBLIC_ enum ndr_err_code ndr_pull_double(struct ndr_pull *ndr, int ndr_flags, double *v)
+{
+	NDR_PULL_ALIGN(ndr, 8);
+	NDR_PULL_NEED_BYTES(ndr, 8);
+	memcpy(v, ndr->data+ndr->offset, 8);
+	ndr->offset += 8;
+	return NDR_ERR_SUCCESS;
+}
+
+/*
   parse a pointer referent identifier
 */
 _PUBLIC_ enum ndr_err_code ndr_pull_generic_ptr(struct ndr_pull *ndr, uint32_t *v)
@@ -389,6 +401,18 @@ _PUBLIC_ enum ndr_err_code ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, u
 }
 
 /*
+  push a double
+*/
+_PUBLIC_ enum ndr_err_code ndr_push_double(struct ndr_push *ndr, int ndr_flags, double v)
+{
+	NDR_PUSH_ALIGN(ndr, 8);
+	NDR_PUSH_NEED_BYTES(ndr, 8);
+	memcpy(ndr->data+ndr->offset, &v, 8);
+	ndr->offset += 8;
+	return NDR_ERR_SUCCESS;
+}
+
+/*
   push a pointer
 */
 _PUBLIC_ enum ndr_err_code ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v)
@@ -506,7 +530,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags,
 }
 
 /*
-  push a NTTIME
+  push a NTTIME_1sec
 */
 _PUBLIC_ enum ndr_err_code ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t)
 {
@@ -679,6 +703,11 @@ _PUBLIC_ void ndr_print_dlong(struct ndr_print *ndr, const char *name, int64_t v
 	ndr->print(ndr, "%-25s: 0x%016llx (%lld)", name, (unsigned long long)v, (long long)v);
 }
 
+_PUBLIC_ void ndr_print_double(struct ndr_print *ndr, const char *name, double v)
+{
+	ndr->print(ndr, "%-25s: %f", name, v);
+}
+
 _PUBLIC_ void ndr_print_hyper(struct ndr_print *ndr, const char *name, uint64_t v)
 {
 	ndr_print_dlong(ndr, name, v);
diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm
index 5ee26d1..95cd4b9 100644
--- a/pidl/lib/Parse/Pidl/NDR.pm
+++ b/pidl/lib/Parse/Pidl/NDR.pm
@@ -53,6 +53,7 @@ my $scalar_alignment = {
 	'int32' => 4,
 	'uint32' => 4,
 	'hyper' => 8,
+	'double' => 8,
 	'pointer' => 8,
 	'dlong' => 4,
 	'udlong' => 4,
diff --git a/pidl/lib/Parse/Pidl/Typelist.pm b/pidl/lib/Parse/Pidl/Typelist.pm
index 4f9d982..e63b3c9 100644
--- a/pidl/lib/Parse/Pidl/Typelist.pm
+++ b/pidl/lib/Parse/Pidl/Typelist.pm
@@ -38,6 +38,7 @@ my %scalars = (
 	"dlong"		=> "int64_t",
 	"udlong"	=> "uint64_t",
 	"udlongr"	=> "uint64_t",
+	"double"	=> "double",
 	"pointer"	=> "void*",
 	"DATA_BLOB"	=> "DATA_BLOB",
 	"string"	=> "const char *",
diff --git a/pidl/tests/ndr.pl b/pidl/tests/ndr.pl
index 504b7ec..53b8cb8 100755
--- a/pidl/tests/ndr.pl
+++ b/pidl/tests/ndr.pl
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 46;
+use Test::More tests => 47;
 use FindBin qw($RealBin);
 use lib "$RealBin";
 use Util;
@@ -480,6 +480,7 @@ $ne = ParseElement($e, undef);
 is($ne->{REPRESENTATION_TYPE}, "uint8");
 
 is(align_type("hyper"), 8);
+is(align_type("double"), 8);
 is(align_type("uint32"), 4);
 is(align_type("uint16"), 2);
 is(align_type("uint8"), 1);
diff --git a/pidl/tests/typelist.pl b/pidl/tests/typelist.pl
index 80ee868..28bf394 100755
--- a/pidl/tests/typelist.pl
+++ b/pidl/tests/typelist.pl
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 54;
+use Test::More tests => 56;
 use FindBin qw($RealBin);
 use lib "$RealBin";
 use Util;
@@ -21,6 +21,7 @@ is("int32", expandAlias("int32"));
 is("uint32_t", mapScalarType("uint32"));
 is("void", mapScalarType("void"));
 is("uint64_t", mapScalarType("hyper"));
+is("double", mapScalarType("double"));
 
 my $x = { TYPE => "ENUM", NAME => "foo", EXTRADATA => 1 };
 addType($x);
@@ -34,6 +35,11 @@ is_deeply(getType("uint16"), {
 		TYPE => "TYPEDEF",
 		DATA => { NAME => "uint16", TYPE => "SCALAR" }});
 
+is_deeply(getType("double"), {
+		NAME => "double",
+		TYPE => "TYPEDEF",
+		DATA => { NAME => "double", TYPE => "SCALAR" }});
+
 is(0, typeIs("someUnknownType", "ENUM"));
 is(0, typeIs("foo", "ENUM"));
 addType({NAME => "mytypedef", TYPE => "TYPEDEF", DATA => { TYPE => "ENUM" }});
diff --git a/source4/auth/config.mk b/source4/auth/config.mk
index 7d50509..573f197 100644
--- a/source4/auth/config.mk
+++ b/source4/auth/config.mk
@@ -8,6 +8,7 @@ mkinclude credentials/config.mk
 
 [SUBSYSTEM::auth_session]
 PUBLIC_DEPENDENCIES = CREDENTIALS
+PRIVATE_DEPENDENCIES = SAMDB
 
 PUBLIC_HEADERS += $(authsrcdir)/session.h
 
@@ -44,7 +45,7 @@ $(eval $(call proto_header_template,$(authsrcdir)/auth_sam_reply.h,$(auth_sam_re
 [PYTHON::pyauth]
 LIBRARY_REALNAME = samba/auth.$(SHLIBEXT)
 PUBLIC_DEPENDENCIES = auth_system_session
-PRIVATE_DEPENDENCIES = SAMDB PYTALLOC param
+PRIVATE_DEPENDENCIES = SAMDB PYTALLOC pyparam_util
 
 pyauth_OBJ_FILES = $(authsrcdir)/pyauth.o
 
diff --git a/source4/auth/credentials/config.mk b/source4/auth/credentials/config.mk
index 2402c73..6b051ef 100644
--- a/source4/auth/credentials/config.mk
+++ b/source4/auth/credentials/config.mk
@@ -15,6 +15,6 @@ PUBLIC_HEADERS += $(authsrcdir)/credentials/credentials.h
 
 [PYTHON::pycredentials]
 LIBRARY_REALNAME = samba/credentials.$(SHLIBEXT)
-PUBLIC_DEPENDENCIES = CREDENTIALS LIBCMDLINE_CREDENTIALS PYTALLOC param
+PUBLIC_DEPENDENCIES = CREDENTIALS LIBCMDLINE_CREDENTIALS PYTALLOC pyparam_util
 
 pycredentials_OBJ_FILES = $(authsrcdir)/credentials/pycredentials.o
diff --git a/source4/auth/credentials/pycredentials.c b/source4/auth/credentials/pycredentials.c
index 3eacf9a..de5cc87 100644
--- a/source4/auth/credentials/pycredentials.c
+++ b/source4/auth/credentials/pycredentials.c
@@ -29,15 +29,6 @@
 #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
 #endif
 
-struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj)
-{
-    if (py_obj == Py_None) {
-        return cli_credentials_init_anon(NULL);
-    }
-
-    return PyCredentials_AsCliCredentials(py_obj);
-}
-
 static PyObject *PyString_FromStringOrNULL(const char *str)
 {
 	if (str == NULL)
diff --git a/source4/auth/credentials/pycredentials.h b/source4/auth/credentials/pycredentials.h
index f2e15fa..1889248 100644
--- a/source4/auth/credentials/pycredentials.h
+++ b/source4/auth/credentials/pycredentials.h
@@ -23,8 +23,8 @@
 #include "pytalloc.h"
 
 PyAPI_DATA(PyTypeObject) PyCredentials;
-struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj);
 #define PyCredentials_Check(py_obj) PyObject_TypeCheck(py_obj, &PyCredentials)
 #define PyCredentials_AsCliCredentials(py_obj) py_talloc_get_type(py_obj, struct cli_credentials)
+#define cli_credentials_from_py_object(py_obj) (py_obj == Py_None)?cli_credentials_init_anon(NULL):PyCredentials_AsCliCredentials(py_obj)
 
 #endif /*  _PYCREDENTIALS_H_ */
diff --git a/source4/auth/gensec/config.mk b/source4/auth/gensec/config.mk
index a9ce228..d2e41da 100644
--- a/source4/auth/gensec/config.mk
+++ b/source4/auth/gensec/config.mk
@@ -67,7 +67,7 @@ $(eval $(call proto_header_template,$(gensecsrcdir)/spnego_proto.h,$(gensec_spne
 [MODULE::gensec_schannel]
 SUBSYSTEM = gensec
 INIT_FUNCTION = gensec_schannel_init
-PRIVATE_DEPENDENCIES = SCHANNELDB NDR_SCHANNEL CREDENTIALS LIBNDR
+PRIVATE_DEPENDENCIES = SCHANNELDB NDR_SCHANNEL CREDENTIALS LIBNDR auth_session
 OUTPUT_TYPE = MERGED_OBJ
 # End MODULE gensec_schannel
 ################################################
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index 0d19e41..fbea269 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -43,7 +43,8 @@ if ($useshared eq "true") {
 
 my $module_output_type;
 if ($useshared eq "true") {
-	$module_output_type = ["SHARED_LIBRARY"];
+	#$module_output_type = ["SHARED_LIBRARY"];
+	$module_output_type = ["MERGED_OBJ"];
 } else {
 	$module_output_type = ["MERGED_OBJ"];
 }
diff --git a/source4/cldap_server/config.mk b/source4/cldap_server/config.mk
index 045fca3..49d2a1f 100644
--- a/source4/cldap_server/config.mk
+++ b/source4/cldap_server/config.mk
@@ -1,17 +1,23 @@
 # CLDAP server subsystem
-
-#######################
-# Start SUBSYSTEM CLDAPD
-[MODULE::CLDAPD]
+#
+[MODULE::service_cldap]
 INIT_FUNCTION = server_service_cldapd_init
 SUBSYSTEM = service
 PRIVATE_DEPENDENCIES = \
-		LIBCLI_CLDAP LIBNETIF process_model
+		CLDAPD process_model LIBNETIF
+
+service_cldap_OBJ_FILES = $(addprefix $(cldap_serversrcdir)/, \
+		cldap_server.o)
+
+
+#######################
+# Start SUBSYSTEM CLDAPD
+[SUBSYSTEM::CLDAPD]
+PRIVATE_DEPENDENCIES = LIBCLI_CLDAP
 # End SUBSYSTEM CLDAPD
 #######################
 
 CLDAPD_OBJ_FILES = $(addprefix $(cldap_serversrcdir)/, \
-		cldap_server.o \
 		netlogon.o \
 		rootdse.o)
 
diff --git a/source4/dsdb/config.mk b/source4/dsdb/config.mk
index 0895a1d..0438647 100644
--- a/source4/dsdb/config.mk
+++ b/source4/dsdb/config.mk
@@ -5,11 +5,11 @@ mkinclude samdb/ldb_modules/config.mk
 ################################################
 # Start SUBSYSTEM SAMDB
 [SUBSYSTEM::SAMDB]
-PUBLIC_DEPENDENCIES = HEIMDAL_KRB5 
+PUBLIC_DEPENDENCIES = HEIMDAL_KRB5  
 PRIVATE_DEPENDENCIES = LIBNDR NDR_DRSUAPI NDR_DRSBLOBS NSS_WRAPPER \
 					   auth_system_session LDAP_ENCODE LIBCLI_AUTH LIBNDR \
 					   SAMDB_SCHEMA LDB_WRAP SAMDB_COMMON \
-						LIBCLI_DRSUAPI
+						LIBCLI_DRSUAPI LIBCLI_LDAP_NDR LIBSAMBA-UTIL 
 
 
 SAMDB_OBJ_FILES = $(addprefix $(dsdbsrcdir)/, \
@@ -52,7 +52,8 @@ INIT_FUNCTION = server_service_drepl_init
 SUBSYSTEM = service
 PRIVATE_DEPENDENCIES = \
 		SAMDB \
-		process_model 
+		process_model \
+		RPC_NDR_DRSUAPI
 # End SUBSYSTEM DREPL_SRV
 #######################
 
diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk
index 583d1dc..c039dda 100644
--- a/source4/dsdb/samdb/ldb_modules/config.mk
+++ b/source4/dsdb/samdb/ldb_modules/config.mk
@@ -174,7 +174,7 @@ ldb_kludge_acl_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/kludge_acl.o
 # Start MODULE ldb_extended_dn_in
 [MODULE::ldb_extended_dn_in]
 SUBSYSTEM = LIBLDB
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL
 INIT_FUNCTION = LDB_MODULE(extended_dn_in)
 # End MODULE ldb_extended_dn_in
 ################################################
@@ -185,7 +185,7 @@ ldb_extended_dn_in_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/extended_dn_in.o
 # Start MODULE ldb_extended_dn_out
 [MODULE::ldb_extended_dn_out]
 SUBSYSTEM = LIBLDB
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBNDR LIBSAMBA-UTIL SAMDB
 INIT_FUNCTION = LDB_MODULE(extended_dn_out_ldb),LDB_MODULE(extended_dn_out_dereference)
 ENABLE = YES
 ALIASES = extended_dn_out_ldb extended_dn_out_dereference
@@ -198,7 +198,7 @@ ldb_extended_dn_out_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/extended_dn_out.
 # Start MODULE ldb_extended_dn_store
 [MODULE::ldb_extended_dn_store]
 SUBSYSTEM = LIBLDB
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL SAMDB
 INIT_FUNCTION = LDB_MODULE(extended_dn_store)
 # End MODULE ldb_extended_dn_store
 ################################################
@@ -209,7 +209,7 @@ ldb_extended_dn_store_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/extended_dn_st
 # Start MODULE ldb_show_deleted
 [MODULE::ldb_show_deleted]
 SUBSYSTEM = LIBLDB
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL
 INIT_FUNCTION = LDB_MODULE(show_deleted)
 # End MODULE ldb_show_deleted
 ################################################
@@ -256,7 +256,7 @@ ldb_objectclass_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/objectclass.o
 [MODULE::ldb_subtree_rename]
 INIT_FUNCTION = LDB_MODULE(subtree_rename)
 CFLAGS = -Ilib/ldb/include
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL
 SUBSYSTEM = LIBLDB
 # End MODULE ldb_subtree_rename
 ################################################
@@ -268,7 +268,7 @@ ldb_subtree_rename_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/subtree_rename.o
 [MODULE::ldb_subtree_delete]
 INIT_FUNCTION = LDB_MODULE(subtree_delete)
 CFLAGS = -Ilib/ldb/include
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL
 SUBSYSTEM = LIBLDB
 # End MODULE ldb_subtree_rename
 ################################################
@@ -292,7 +292,7 @@ ldb_linked_attributes_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/linked_attribu
 [MODULE::ldb_ranged_results]
 INIT_FUNCTION = LDB_MODULE(ranged_results)
 CFLAGS = -Ilib/ldb/include
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL
 SUBSYSTEM = LIBLDB
 # End MODULE ldb_ranged_results
 ################################################
diff --git a/source4/lib/ldb/ldb.mk b/source4/lib/ldb/ldb.mk
index 0589baf..a9a6dad 100644
--- a/source4/lib/ldb/ldb.mk
+++ b/source4/lib/ldb/ldb.mk
@@ -67,8 +67,11 @@ build-python:: ldb.$(SHLIBEXT)
 pyldb.o: $(ldbdir)/pyldb.c
 	$(CC) $(PICFLAG) -c $(ldbdir)/pyldb.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
 
-ldb.$(SHLIBEXT): pyldb.o
-	$(SHLD) $(SHLD_FLAGS) -o ldb.$(SHLIBEXT) pyldb.o $(LIB_FLAGS) `$(PYTHON_CONFIG) --ldflags`
+pyldb_util.o: $(ldbdir)/pyldb_util.c
+	$(CC) $(PICFLAG) -c $(ldbdir)/pyldb_util.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
+
+ldb.$(SHLIBEXT): pyldb.o pyldb_util.o
+	$(SHLD) $(SHLD_FLAGS) -o ldb.$(SHLIBEXT) pyldb.o pyldb_util.o $(LIB_FLAGS) `$(PYTHON_CONFIG) --ldflags`
 
 install-python:: build-python
 	mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index bceda05..bfa152b 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -1,7 +1,7 @@
 /*
    Unix SMB/CIFS implementation.
 
-   Swig interface to ldb.
+   Python interface to ldb.
 
    Copyright (C) 2005,2006 Tim Potter <tpot at samba.org>
    Copyright (C) 2006 Simo Sorce <idra at samba.org>
@@ -41,25 +41,19 @@ typedef intargfunc ssizeargfunc;
 #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
 #endif
 
-/* Picked out of thin air. To do this properly, we should probably have some part of the 
- * errors in LDB be allocated to bindings ? */
-#define LDB_ERR_PYTHON_EXCEPTION	142
-
 static PyObject *PyExc_LdbError;
 
-void PyErr_SetLdbError(int ret, struct ldb_context *ldb_ctx)
-{
-	if (ret == LDB_ERR_PYTHON_EXCEPTION)
-		return; /* Python exception should already be set, just keep that */
-	PyErr_SetObject(PyExc_LdbError, Py_BuildValue(discard_const_p(char, "(i,s)"),
-			ret, ldb_ctx == NULL?ldb_strerror(ret):ldb_errstring(ldb_ctx)));
-}
+PyAPI_DATA(PyTypeObject) PyLdbMessage;
+PyAPI_DATA(PyTypeObject) PyLdbModule;
+PyAPI_DATA(PyTypeObject) PyLdbDn;
+PyAPI_DATA(PyTypeObject) PyLdb;
+PyAPI_DATA(PyTypeObject) PyLdbMessageElement;
+PyAPI_DATA(PyTypeObject) PyLdbTree;
 
 static PyObject *PyObject_FromLdbValue(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;
@@ -390,7 +384,7 @@ static PyObject *py_ldb_set_debug(PyLdbObject *self, PyObject *args)
 
 	Py_INCREF(cb);
 	/* FIXME: Where do we DECREF cb ? */
-	PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_set_debug(self->ldb_ctx, py_ldb_debug, cb), PyLdb_AsLdbContext(self));
+	PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_set_debug(self->ldb_ctx, py_ldb_debug, cb), PyLdb_AsLdbContext(self));
 	
 	Py_RETURN_NONE;
 }
@@ -419,25 +413,25 @@ static PyObject *py_ldb_set_modules_dir(PyTypeObject *self, PyObject *args)
 
 static PyObject *py_ldb_transaction_start(PyLdbObject *self)
 {
-	PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_start(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
+	PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_transaction_start(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
 	Py_RETURN_NONE;
 }
 
 static PyObject *py_ldb_transaction_commit(PyLdbObject *self)
 {
-	PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_commit(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
+	PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_transaction_commit(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
 	Py_RETURN_NONE;
 }
 
 static PyObject *py_ldb_transaction_cancel(PyLdbObject *self)
 {
-	PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_cancel(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
+	PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_transaction_cancel(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
 	Py_RETURN_NONE;
 }
 
 static PyObject *py_ldb_setup_wellknown_attributes(PyLdbObject *self)
 {
-	PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_setup_wellknown_attributes(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
+	PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_setup_wellknown_attributes(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
 	Py_RETURN_NONE;
 }
 
@@ -529,7 +523,7 @@ static int py_ldb_init(PyLdbObject *self, PyObject *args, PyObject *kwargs)
 	if (url != NULL) {
 		ret = ldb_connect(ldb, url, flags, options);
 		if (ret != LDB_SUCCESS) {
-			PyErr_SetLdbError(ret, ldb);
+			PyErr_SetLdbError(PyExc_LdbError, ret, ldb);
 			return -1;
 		}
 	}
@@ -582,7 +576,7 @@ static PyObject *py_ldb_connect(PyLdbObject *self, PyObject *args, PyObject *kwa
 	ret = ldb_connect(PyLdb_AsLdbContext(self), url, flags, options);
 	talloc_free(options);
 
-	PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self));
+	PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, PyLdb_AsLdbContext(self));
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list