[SCM] Samba Shared Repository - branch master updated

Jelmer Vernooij jelmer at samba.org
Mon May 31 11:23:37 MDT 2010


The branch, master has been updated
       via  7f75ee0... ldb: Install ldb_handlers.h header.
       via  fe8302b... ldb: Remove Samba-specific symbols.
       via  1bc53f0... ldb: Move utility functions to separate file.
       via  82d56b9... ldb: Fix dependencies when building with system ldb.
      from  471ed70... s3:smbd map_username() doesn't need sconn anymore

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


- Log -----------------------------------------------------------------
commit 7f75ee025ff9c02763fb9201d94af4b2739c8e03
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon May 31 18:29:11 2010 +0200

    ldb: Install ldb_handlers.h header.

commit fe8302b235197e359a20ba0489eb72b54793963e
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon May 31 18:28:09 2010 +0200

    ldb: Remove Samba-specific symbols.

commit 1bc53f0213b04e30ebf2ac60695c84c5781e4e72
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon May 31 18:12:05 2010 +0200

    ldb: Move utility functions to separate file.

commit 82d56b937445585b9e60451daf660aee5ace0523
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon May 31 16:05:41 2010 +0200

    ldb: Fix dependencies when building with system ldb.

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

Summary of changes:
 source4/auth/wscript_build                 |    2 +-
 source4/dsdb/wscript_build                 |    2 +-
 source4/lib/ldb/ABI/ldb-samba4-0.9.11.sigs |    5 --
 source4/lib/ldb/pyldb_util.c               |   81 ++++++++++++++++++++++++++++
 source4/lib/ldb/tools/cmdline.c            |   10 ++--
 source4/lib/ldb/tools/ldbedit.c            |    7 +++
 source4/lib/ldb/tools/ldbsearch.c          |    6 ++
 source4/lib/ldb/tools/ldbtest.c            |    5 ++
 source4/lib/ldb/wscript                    |   25 ++++++---
 source4/scripting/python/wscript_build     |    2 +-
 10 files changed, 124 insertions(+), 21 deletions(-)
 create mode 100644 source4/lib/ldb/pyldb_util.c


Changeset truncated at 500 lines:

diff --git a/source4/auth/wscript_build b/source4/auth/wscript_build
index 349171e..db8fdf8 100644
--- a/source4/auth/wscript_build
+++ b/source4/auth/wscript_build
@@ -12,7 +12,7 @@ bld.SAMBA_SUBSYSTEM('auth_session',
 	public_deps='CREDENTIALS',
 	public_headers='session.h',
         header_path='samba',
-	deps='SAMDB'
+	deps='SAMDB auth_sam'
 	)
 
 
diff --git a/source4/dsdb/wscript_build b/source4/dsdb/wscript_build
index 1bf8413..0a1ea1c 100644
--- a/source4/dsdb/wscript_build
+++ b/source4/dsdb/wscript_build
@@ -51,6 +51,6 @@ bld.SAMBA_MODULE('DNS_UPDATE_SRV',
 
 bld.SAMBA_PYTHON('python_dsdb',
                  source='pydsdb.c',
-                 deps='SAMDB pyldb',
+                 deps='SAMDB pyldb_util',
                  realname='samba/dsdb.so'
                  )
diff --git a/source4/lib/ldb/ABI/ldb-samba4-0.9.11.sigs b/source4/lib/ldb/ABI/ldb-samba4-0.9.11.sigs
index 4639220..2206e79 100644
--- a/source4/lib/ldb/ABI/ldb-samba4-0.9.11.sigs
+++ b/source4/lib/ldb/ABI/ldb-samba4-0.9.11.sigs
@@ -166,7 +166,6 @@ ldb_parse_tree_copy_shallow: struct ldb_parse_tree *(TALLOC_CTX *, const struct
 ldb_qsort: void (void * const, size_t, size_t, void *, ldb_qsort_cmp_fn_t)
 ldb_register_backend: int (const char *, ldb_connect_fn)
 ldb_register_module: int (const struct ldb_module_ops *)
-ldb_register_samba_handlers: int (struct ldb_context *)
 ldb_rename: int (struct ldb_context *, struct ldb_dn *, struct ldb_dn *)
 ldb_reply_add_control: int (struct ldb_reply *, const char *, bool, void *)
 ldb_reply_get_control: struct ldb_control *(struct ldb_reply *, const char *)
@@ -177,8 +176,6 @@ ldb_request_get_control: struct ldb_control *(struct ldb_request *, const char *
 ldb_request_get_status: int (struct ldb_request *)
 ldb_request_set_state: void (struct ldb_request *, int)
 ldb_reset_err_string: void (struct ldb_context *)
-ldb_samba_syntax_by_lDAPDisplayName: const struct ldb_schema_syntax *(struct ldb_context *, const char *)
-ldb_samba_syntax_by_name: const struct ldb_schema_syntax *(struct ldb_context *, const char *)
 ldb_schema_attribute_add: int (struct ldb_context *, const char *, unsigned int, const char *)
 ldb_schema_attribute_add_with_syntax: int (struct ldb_context *, const char *, unsigned int, const struct ldb_schema_syntax *)
 ldb_schema_attribute_by_name: const struct ldb_schema_attribute *(struct ldb_context *, const char *)
@@ -220,5 +217,3 @@ ldb_val_map_remote: struct ldb_val (struct ldb_module *, void *, const struct ld
 ldb_val_to_time: int (const struct ldb_val *, time_t *)
 ldb_valid_attr_name: int (const char *)
 ldb_wait: int (struct ldb_handle *, enum ldb_wait_type)
-ldb_wrap_connect: struct ldb_context *(TALLOC_CTX *, struct tevent_context *, struct loadparm_context *, const char *, struct auth_session_info *, struct cli_credentials *, unsigned int)
-ldb_wrap_fork_hook: void (void)
diff --git a/source4/lib/ldb/pyldb_util.c b/source4/lib/ldb/pyldb_util.c
new file mode 100644
index 0000000..fb06946
--- /dev/null
+++ b/source4/lib/ldb/pyldb_util.c
@@ -0,0 +1,81 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   Python interface to ldb - utility functions.
+
+   Copyright (C) 2007-2010 Jelmer Vernooij <jelmer at samba.org>
+
+	 ** NOTE! The following LGPL license applies to the ldb
+	 ** library. This does NOT imply that all of Samba is released
+	 ** under the LGPL
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <Python.h>
+#include "replace.h"
+#include "pyldb.h"
+#include <ldb.h>
+
+static PyObject *ldb_module = NULL;
+
+/* There's no Py_ssize_t in 2.4, apparently */
+#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5
+typedef int Py_ssize_t;
+typedef inquiry lenfunc;
+typedef intargfunc ssizeargfunc;
+#endif
+
+#ifndef Py_RETURN_NONE
+#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
+#endif
+
+/**
+ * Obtain a ldb DN from a Python object.
+ *
+ * @param mem_ctx Memory context
+ * @param object Python object
+ * @param ldb_ctx LDB context
+ * @return Whether or not the conversion succeeded
+ */
+bool PyObject_AsDn(TALLOC_CTX *mem_ctx, PyObject *object, 
+		   struct ldb_context *ldb_ctx, struct ldb_dn **dn)
+{
+	struct ldb_dn *odn;
+	PyObject *PyLdb_Dn_Type;
+
+	if (ldb_ctx != NULL && PyString_Check(object)) {
+		odn = ldb_dn_new(mem_ctx, ldb_ctx, PyString_AsString(object));
+		*dn = odn;
+		return true;
+	}
+
+	if (ldb_module == NULL) {
+		ldb_module = PyImport_ImportModule("ldb");
+		if (ldb_module == NULL)
+			return false;
+	}
+
+	PyLdb_Dn_Type = PyObject_GetAttrString(ldb_module, "Dn");
+	if (PyLdb_Dn_Type == NULL)
+		return false;
+
+	if (PyObject_TypeCheck(object, PyLdb_Dn_Type)) {
+		*dn = PyLdbDn_AsDn(object);
+		return true;
+	}
+
+	PyErr_SetString(PyExc_TypeError, "Expected DN");
+	return false;
+}
diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c
index 180923f..c2b595f 100644
--- a/source4/lib/ldb/tools/cmdline.c
+++ b/source4/lib/ldb/tools/cmdline.c
@@ -21,12 +21,9 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "ldb_includes.h"
-#include "ldb.h"
-#include "tools/cmdline.h"
-
 #if (_SAMBA_BUILD_ >= 4)
 #include "includes.h"
+#include <ldb.h>
 #include "lib/cmdline/popt_common.h"
 #include "lib/ldb-samba/ldif_handlers.h"
 #include "auth/gensec/gensec.h"
@@ -36,8 +33,13 @@
 #include "librpc/gen_ndr/drsblobs.h"
 #include "dsdb/schema/schema.h"
 #include "dsdb/common/proto.h"
+#else
+#include "ldb_includes.h"
+#include "ldb.h"
 #endif
 
+#include "tools/cmdline.h"
+
 static struct ldb_cmdline options; /* needs to be static for older compilers */
 
 static struct poptOption popt_options[] = {
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index 6635466..f28964b 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -30,7 +30,14 @@
  *
  *  Author: Andrew Tridgell
  */
+
+#ifdef _SAMBA_BUILD_
+#include "includes.h"
+#include <system/filesys.h>
+#else
 #include "ldb_includes.h"
+#endif
+
 #include "ldb.h"
 #include "tools/cmdline.h"
 #include "tools/ldbutil.h"
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index 179646c..55144a7 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -31,8 +31,14 @@
  *  Author: Andrew Tridgell
  */
 
+#ifdef _SAMBA_BUILD_
+#include "includes.h"
+#include <ldb.h>
+#else
 #include "ldb_includes.h"
 #include "ldb.h"
+#endif
+
 #include "tools/cmdline.h"
 
 static void usage(void)
diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c
index 077eb98..b76889c 100644
--- a/source4/lib/ldb/tools/ldbtest.c
+++ b/source4/lib/ldb/tools/ldbtest.c
@@ -31,7 +31,12 @@
  *  Author: Andrew Tridgell
  */
 
+#ifdef _SAMBA_BUILD_
+#include "includes.h"
+#else
 #include "ldb_includes.h"
+#endif
+
 #include "ldb.h"
 #include "tools/cmdline.h"
 
diff --git a/source4/lib/ldb/wscript b/source4/lib/ldb/wscript
index 2d54b61..dbe2ae4 100644
--- a/source4/lib/ldb/wscript
+++ b/source4/lib/ldb/wscript
@@ -150,21 +150,23 @@ def build(bld):
         bld.env.PACKAGE_VERSION = VERSION
         bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
 
-    ldb_deps = 'tevent LIBLDB'
     if s4_build:
-        ldb_deps += ' LDBSAMBA POPT_CREDENTIALS POPT_SAMBA LIBCMDLINE_CREDENTIALS gensec'
         abi_file='ABI/ldb-samba4-%s.sigs' % VERSION
     else:
         abi_file='ABI/ldb-%s.sigs' % VERSION
 
+    bld.SAMBA_PYTHON('pyldb_util',
+            deps='ldb LIBPYTHON',
+            source='pyldb_util.c')
+
     if not bld.CONFIG_SET('USING_SYSTEM_LDB'):
         modules_dir = bld.EXPAND_VARIABLES('${LDB_MODULESDIR}')
         bld.SAMBA_LIBRARY('ldb',
                           COMMON_SRC + ' ' + LDB_MAP_SRC,
-                          deps=ldb_deps,
+                          deps='tevent LIBLDB',
                           includes='include',
                           public_headers='include/ldb.h include/ldb_errors.h '\
-                                         'include/ldb_module.h',
+                              'include/ldb_module.h include/ldb_handlers.h',
                           pc_files='ldb.pc',
                           cflags='-DLDB_MODULESDIR=\"%s\"' % modules_dir,
                           abi_file=abi_file,
@@ -172,9 +174,18 @@ def build(bld):
                           vnum=VERSION, manpages='man/ldb.3',
                           is_bundled=not bld.env.standalone_ldb)
 
+        bld.SAMBA_PYTHON('pyldb', 'pyldb.c',
+                         deps='ldb pyldb_util',
+                         realname='ldb.so')
+
+    extra_cmdline_deps = ''
+    if s4_build:
+        extra_cmdline_deps += ' LDBSAMBA POPT_SAMBA POPT_CREDENTIALS ' \
+                'LIBCMDLINE_CREDENTIALS gensec'
+
     bld.SAMBA_SUBSYSTEM('LIBLDB_CMDLINE',
                         'tools/ldbutil.c tools/cmdline.c',
-                        'ldb dl popt')
+                        'ldb dl popt' + extra_cmdline_deps)
 
     LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename'
     for t in LDB_TOOLS.split():
@@ -185,10 +196,6 @@ def build(bld):
     bld.SAMBA_BINARY('ldbtest', 'tools/ldbtest.c', deps='LIBLDB_CMDLINE',
                      install=False)
 
-    bld.SAMBA_PYTHON('pyldb', 'pyldb.c',
-                     deps='ldb',
-                     realname='ldb.so')
-
 
 def test(ctx):
     '''run ldb testsuite'''
diff --git a/source4/scripting/python/wscript_build b/source4/scripting/python/wscript_build
index 0709c42..af3c6ed 100644
--- a/source4/scripting/python/wscript_build
+++ b/source4/scripting/python/wscript_build
@@ -24,7 +24,7 @@ bld.SAMBA_PYTHON('python_uuid',
 
 bld.SAMBA_PYTHON('python_glue',
                  source='pyglue.c',
-                 deps='LIBNDR ldb SAMDB CREDENTIALS pyldb python_dcerpc_misc python_dcerpc_security pyauth pyldb_util pyparam_util',
+                 deps='LIBNDR ldb SAMDB CREDENTIALS python_dcerpc_misc python_dcerpc_security pyauth pyldb_util pyparam_util',
                  realname='samba/_glue.so'
 	)
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list