The branch, master has been updated
       via  7552dd8 rpc_ndr_netlogon: Add missing dependency on tevent.
       via  fd718c9 samdb: Remove dependency on unknown subsystem.
       via  904a6c3 util: Link headers to correct subsystem, fix formatting.
       via  aa6d7cc dsdb: add missing dependency on samba_socket.
       via  e2f3e10 ldb-samba: Rename samdb_relative_path to ldb_relative_path, 
as it's not samdb-specific.
       via  33c4b85 dsdb: Move attr_in_list to SAMDB_COMMON to avoid circular 
dependency between SAMDB_COMMON and DSDB_MODULE_HELPERS.
       via  8f6ca48 gensec: Support building without any linked-in modules.
       via  7ba7ca7 idmap: Add missing dependency on ldbsamba.
       via  be1f2c4 secrets: Add missing dependency on ldbsamba.
       via  c4c2985 cldapd: Add missing dependency on ldbsamba.
       via  c1884f3 ldb-samba: Add ldb_wrap_add, remove last schema reference 
from ldb_wrap.
       via  7f68870 ldb-samba: Split up ldb_wrap_connect() a bit.
       via  938cb40 ldb-samba: Add convenience function for doing a Samba-style 
LDB init.
       via  93126b3 samdb: Add flags argument to samdb_connect().
       via  6280725 samdb: Handle schema setup in samdb, not in more generic 
ldbsamba.
       via  614c8ea tls: add missing dependency on util_tevent.
       via  a20f025 wafsamba: Fix init function when building modules as shared 
objects.
      from  9b94894 socket_wrapper: Make it work on freebsd for udp packets

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


- Log -----------------------------------------------------------------
commit 7552dd8d1e5f844fbf71580f1a34d50dcb4f3fbc
Author: Jelmer Vernooij <[email protected]>
Date:   Mon Oct 11 00:22:42 2010 +0200

    rpc_ndr_netlogon: Add missing dependency on tevent.
    
    Autobuild-User: Jelmer Vernooij <[email protected]>
    Autobuild-Date: Sun Oct 10 23:04:13 UTC 2010 on sn-devel-104

commit fd718c96f0bcbcdff0c931a117392ee6a4bc6ed9
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 23:59:04 2010 +0200

    samdb: Remove dependency on unknown subsystem.

commit 904a6c376105e084789a66894644c9a498574778
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 18:39:07 2010 +0200

    util: Link headers to correct subsystem, fix formatting.

commit aa6d7ccc44e226a65fc1b56c6d973a375c482811
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 23:00:59 2010 +0200

    dsdb: add missing dependency on samba_socket.

commit e2f3e10b1a47e195e9b329ac244be93c2fcdf0a0
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 23:45:23 2010 +0200

    ldb-samba: Rename samdb_relative_path to ldb_relative_path, as it's not 
samdb-specific.

commit 33c4b85058f21ab9865bc7cf1b49b7bd38e0275d
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 17:02:10 2010 +0200

    dsdb: Move attr_in_list to SAMDB_COMMON to avoid circular dependency 
between SAMDB_COMMON and DSDB_MODULE_HELPERS.

commit 8f6ca4859c4d377974fa61a3de10d6304b562986
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 16:46:55 2010 +0200

    gensec: Support building without any linked-in modules.

commit 7ba7ca7062cf7d239c169eda4aa779eaaa2bb780
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 18:42:14 2010 +0200

    idmap: Add missing dependency on ldbsamba.

commit be1f2c4d0212efeddbc8e66359bbbb20b1c6a152
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 18:41:57 2010 +0200

    secrets: Add missing dependency on ldbsamba.

commit c4c298591d2930f3c355c3fa36699a5ab074d04e
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 22:57:18 2010 +0200

    cldapd: Add missing dependency on ldbsamba.

commit c1884f31ea13618cd3a94a30f9c413d176d1e258
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 23:25:38 2010 +0200

    ldb-samba: Add ldb_wrap_add, remove last schema reference from ldb_wrap.

commit 7f68870bc939e33df958f708ec7f46253fefadd9
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 17:34:21 2010 +0200

    ldb-samba: Split up ldb_wrap_connect() a bit.

commit 938cb40290af72bdd887d964f46ccc00d80ab744
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 17:15:11 2010 +0200

    ldb-samba: Add convenience function for doing a Samba-style LDB init.

commit 93126b3315a70d1beaeaa64d05cdbfb167acbabe
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 17:00:45 2010 +0200

    samdb: Add flags argument to samdb_connect().

commit 6280725b47391c69dd7db1133c15bd0ce7418da6
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 16:56:55 2010 +0200

    samdb: Handle schema setup in samdb, not in more generic ldbsamba.

commit 614c8ea98650405b461a6ce034ee5e5acc45a952
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 23:08:12 2010 +0200

    tls: add missing dependency on util_tevent.

commit a20f025ff611d541b82b83791013f2713c999235
Author: Jelmer Vernooij <[email protected]>
Date:   Sun Oct 10 22:52:35 2010 +0200

    wafsamba: Fix init function when building modules as shared objects.
    
    Signed-off-by: Jelmer Vernooij <[email protected]>

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

Summary of changes:
 buildtools/wafsamba/wafsamba.py                 |    3 +
 lib/util/wscript_build                          |   24 ++--
 librpc/wscript_build                            |    2 +-
 source4/auth/gensec/gensec.c                    |    4 +
 source4/auth/ntlm/auth.c                        |    2 +-
 source4/cldap_server/cldap_server.c             |    2 +-
 source4/cldap_server/wscript_build              |    2 +-
 source4/dsdb/common/util.c                      |   13 ++-
 source4/dsdb/common/util.h                      |    2 +
 source4/dsdb/dns/dns_update.c                   |    2 +-
 source4/dsdb/kcc/kcc_service.c                  |    2 +-
 source4/dsdb/repl/drepl_service.c               |    2 +-
 source4/dsdb/samdb/cracknames.c                 |    2 +-
 source4/dsdb/samdb/ldb_modules/partition_init.c |    3 +-
 source4/dsdb/samdb/ldb_modules/util.c           |   12 --
 source4/dsdb/samdb/samdb.c                      |   69 ++++----
 source4/dsdb/wscript_build                      |    4 +-
 source4/kdc/db-glue.c                           |    2 +-
 source4/kdc/kpasswdd.c                          |    6 +-
 source4/ldap_server/ldap_backend.c              |    4 +-
 source4/ldap_server/ldap_server.c               |    2 +-
 source4/lib/ldb-samba/ldb_wrap.c                |  217 +++++++++++++++--------
 source4/lib/ldb-samba/ldb_wrap.h                |   24 +++
 source4/lib/ldb-samba/ldif_handlers.c           |    3 +-
 source4/lib/ldb-samba/wscript_build             |    2 +-
 source4/lib/tls/wscript                         |    2 +-
 source4/libnet/libnet_samsync_ldb.c             |    3 +-
 source4/nbt_server/nbt_server.c                 |    2 +-
 source4/nbt_server/wins/winsdb.c                |    2 +-
 source4/ntp_signd/ntp_signd.c                   |    2 +-
 source4/param/secrets.c                         |    2 +-
 source4/param/wscript_build                     |    2 +-
 source4/rpc_server/common/server_info.c         |    2 +-
 source4/rpc_server/drsuapi/dcesrv_drsuapi.c     |    4 +-
 source4/rpc_server/lsa/dcesrv_lsa.c             |    4 +-
 source4/rpc_server/lsa/lsa_init.c               |    2 +-
 source4/rpc_server/netlogon/dcerpc_netlogon.c   |   26 ++--
 source4/rpc_server/samr/dcesrv_samr.c           |    4 +-
 source4/rpc_server/samr/samr_password.c         |   12 +-
 source4/smb_server/smb/trans2.c                 |    2 +-
 source4/smbd/server.c                           |    2 +-
 source4/winbind/wscript_build                   |    2 +-
 42 files changed, 291 insertions(+), 194 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 9c2c7be..02bb966 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -366,6 +366,9 @@ def SAMBA_MODULE(bld, modname, source,
 
         build_link_name = "modules/%s/%s" % (subsystem, realname)
 
+        if init_function:
+            cflags += " -D%s=samba_init_module" % init_function
+
         bld.SAMBA_LIBRARY(modname,
                           source,
                           deps=deps,
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 457dee2..0b2991a 100644
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -2,10 +2,10 @@
 
 bld.SAMBA_LIBRARY('LIBSAMBA-UTIL',
        source='xfile.c debug.c fault.c signal.c system.c time.c genrand.c 
dprintf.c util_str.c rfc1738.c substitute.c util_strlist.c util_file.c 
data_blob.c util.c blocking.c util_net.c fsusage.c ms_fnmatch.c mutex.c 
idtree.c become_daemon.c rbtree.c talloc_stack.c smb_threads.c params.c 
parmlist.c util_id.c select.c',
-       public_deps='talloc LIBCRYPTO CHARSET execinfo UID_WRAPPER tevent',
-       public_headers='attr.h byteorder.h data_blob.h debug.h memory.h mutex.h 
safe_string.h time.h talloc_stack.h xfile.h dlinklist.h util.h 
tevent_ntstatus.h tevent_unix.h',
-        header_path= [ ('dlinklist.h util.h', '.'), ('*', 'util') ],
-        local_include=False,
+       public_deps='talloc LIBCRYPTO CHARSET execinfo UID_WRAPPER',
+       public_headers='attr.h byteorder.h data_blob.h debug.h memory.h mutex.h 
safe_string.h time.h talloc_stack.h xfile.h dlinklist.h util.h',
+       header_path= [ ('dlinklist.h util.h', '.'), ('*', 'util') ],
+       local_include=False,
        vnum='0.0.1',
        pc_files='samba-util.pc'
        )
@@ -21,29 +21,29 @@ bld.SAMBA_SUBSYSTEM('UNIX_PRIVS',
        source='unix_privs.c',
        autoproto='unix_privs.h',
        deps='UID_WRAPPER',
-        local_include=False,
+       local_include=False,
        )
 
 
 bld.SAMBA_SUBSYSTEM('WRAP_XATTR',
        source='wrap_xattr.c',
        public_deps='XATTR',
-        deps='talloc',
-        local_include=False
+       deps='talloc',
+       local_include=False
        )
 
 
 bld.SAMBA_SUBSYSTEM('UTIL_TDB',
        source='util_tdb.c',
-        local_include=False,
+       local_include=False,
        public_deps='tdb talloc'
        )
 
-
 bld.SAMBA_SUBSYSTEM('UTIL_TEVENT',
        source='tevent_unix.c tevent_ntstatus.c',
-        local_include=False,
-       public_deps='tevent'
+       local_include=False,
+       public_deps='tevent',
+       public_headers='tevent_ntstatus.h tevent_unix.h',
        )
 
 
@@ -57,7 +57,7 @@ bld.SAMBA_SUBSYSTEM('UTIL_LDB',
 
 bld.SAMBA_SUBSYSTEM('UTIL_RUNCMD',
        source='util_runcmd.c',
-        local_include=False,
+       local_include=False,
        public_deps='tevent'
        )
 
diff --git a/librpc/wscript_build b/librpc/wscript_build
index 477f6dd..0e6c8c0 100644
--- a/librpc/wscript_build
+++ b/librpc/wscript_build
@@ -460,7 +460,7 @@ bld.SAMBA_SUBSYSTEM('RPC_NDR_NTSVCS',
 
 bld.SAMBA_SUBSYSTEM('RPC_NDR_NETLOGON',
        source='../librpc/gen_ndr/ndr_netlogon_c.c',
-       public_deps='NDR_STANDARD'
+       public_deps='NDR_STANDARD tevent'
        )
 
 bld.SAMBA_SUBSYSTEM('RPC_NDR_TRKWKS',
diff --git a/source4/auth/gensec/gensec.c b/source4/auth/gensec/gensec.c
index 7f76643..606e4f1 100644
--- a/source4/auth/gensec/gensec.c
+++ b/source4/auth/gensec/gensec.c
@@ -1394,6 +1394,10 @@ bool gensec_setting_bool(struct gensec_settings 
*settings, const char *mechanism
        return lpcfg_parm_bool(settings->lp_ctx, NULL, mechanism, name, 
default_value);
 }
 
+#ifndef STATIC_gensec_MODULES
+#define STATIC_gensec_MODULES NULL
+#endif
+
 /*
   initialise the GENSEC subsystem
 */
diff --git a/source4/auth/ntlm/auth.c b/source4/auth/ntlm/auth.c
index b34b8ac..46fd887 100644
--- a/source4/auth/ntlm/auth.c
+++ b/source4/auth/ntlm/auth.c
@@ -447,7 +447,7 @@ _PUBLIC_ NTSTATUS auth_context_create_methods(TALLOC_CTX 
*mem_ctx, const char **
        if (sam_ctx) {
                ctx->sam_ctx = sam_ctx;
        } else {
-               ctx->sam_ctx = samdb_connect(ctx, ctx->event_ctx, ctx->lp_ctx, 
system_session(ctx->lp_ctx));
+               ctx->sam_ctx = samdb_connect(ctx, ctx->event_ctx, ctx->lp_ctx, 
system_session(ctx->lp_ctx), 0);
        }
 
        for (i=0; methods[i] ; i++) {
diff --git a/source4/cldap_server/cldap_server.c 
b/source4/cldap_server/cldap_server.c
index 286af05..8b39684 100644
--- a/source4/cldap_server/cldap_server.c
+++ b/source4/cldap_server/cldap_server.c
@@ -212,7 +212,7 @@ static void cldapd_task_init(struct task_server *task)
        }
 
        cldapd->task = task;
-       cldapd->samctx = samdb_connect(cldapd, task->event_ctx, task->lp_ctx, 
system_session(task->lp_ctx));
+       cldapd->samctx = samdb_connect(cldapd, task->event_ctx, task->lp_ctx, 
system_session(task->lp_ctx), 0);
        if (cldapd->samctx == NULL) {
                task_server_terminate(task, "cldapd failed to open samdb", 
true);
                return;
diff --git a/source4/cldap_server/wscript_build 
b/source4/cldap_server/wscript_build
index 3eb8369..85a9798 100644
--- a/source4/cldap_server/wscript_build
+++ b/source4/cldap_server/wscript_build
@@ -11,6 +11,6 @@ bld.SAMBA_MODULE('service_cldap',
 bld.SAMBA_SUBSYSTEM('CLDAPD',
        source='netlogon.c rootdse.c',
        autoproto='proto.h',
-       deps='LIBCLI_CLDAP'
+       deps='LIBCLI_CLDAP LDBSAMBA'
        )
 
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 7121521..0a00219 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -42,7 +42,6 @@
 #include "lib/util/tsort.h"
 #include "dsdb/common/util.h"
 #include "lib/socket/socket.h"
-#include "dsdb/samdb/ldb_modules/util.h"
 #include "librpc/gen_ndr/irpc.h"
 
 /*
@@ -4253,3 +4252,15 @@ bool dsdb_attr_in_parse_tree(struct ldb_parse_tree *tree,
        return false;
 }
 
+bool is_attr_in_list(const char * const * attrs, const char *attr)
+{
+       unsigned int i;
+
+       for (i = 0; attrs[i]; i++) {
+               if (ldb_attr_cmp(attrs[i], attr) == 0)
+                       return true;
+       }
+
+       return false;
+}
+
diff --git a/source4/dsdb/common/util.h b/source4/dsdb/common/util.h
index 7ae46ae..7dabef8 100644
--- a/source4/dsdb/common/util.h
+++ b/source4/dsdb/common/util.h
@@ -34,3 +34,5 @@
 #define DSDB_TREE_DELETE                     0x0100
 #define DSDB_SEARCH_ONE_ONLY                 0x0200 /* give an error unless 1 
record */
 #define DSDB_SEARCH_SHOW_RECYCLED            0x0400
+
+bool is_attr_in_list(const char * const * attrs, const char *attr);
diff --git a/source4/dsdb/dns/dns_update.c b/source4/dsdb/dns/dns_update.c
index fbfca19..68ad03f 100644
--- a/source4/dsdb/dns/dns_update.c
+++ b/source4/dsdb/dns/dns_update.c
@@ -575,7 +575,7 @@ static void dnsupdate_task_init(struct task_server *task)
        }
 
        service->samdb = samdb_connect(service, service->task->event_ctx, 
task->lp_ctx,
-                                      service->system_session_info);
+                                      service->system_session_info, 0);
        if (!service->samdb) {
                task_server_terminate(task, "dnsupdate: Failed to connect to 
local samdb\n",
                                      true);
diff --git a/source4/dsdb/kcc/kcc_service.c b/source4/dsdb/kcc/kcc_service.c
index 0d78443..0205cbe 100644
--- a/source4/dsdb/kcc/kcc_service.c
+++ b/source4/dsdb/kcc/kcc_service.c
@@ -55,7 +55,7 @@ static WERROR kccsrv_connect_samdb(struct kccsrv_service 
*service, struct loadpa
 {
        const struct GUID *ntds_guid;
 
-       service->samdb = samdb_connect(service, service->task->event_ctx, 
lp_ctx, service->system_session_info);
+       service->samdb = samdb_connect(service, service->task->event_ctx, 
lp_ctx, service->system_session_info, 0);
        if (!service->samdb) {
                return WERR_DS_UNAVAILABLE;
        }
diff --git a/source4/dsdb/repl/drepl_service.c 
b/source4/dsdb/repl/drepl_service.c
index e122d0a..11f81bb 100644
--- a/source4/dsdb/repl/drepl_service.c
+++ b/source4/dsdb/repl/drepl_service.c
@@ -65,7 +65,7 @@ static WERROR dreplsrv_connect_samdb(struct dreplsrv_service 
*service, struct lo
        const struct GUID *ntds_guid;
        struct drsuapi_DsBindInfo28 *bind_info28;
 
-       service->samdb = samdb_connect(service, service->task->event_ctx, 
lp_ctx, service->system_session_info);
+       service->samdb = samdb_connect(service, service->task->event_ctx, 
lp_ctx, service->system_session_info, 0);
        if (!service->samdb) {
                return WERR_DS_UNAVAILABLE;
        }
diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c
index e642984..3fac49f 100644
--- a/source4/dsdb/samdb/cracknames.c
+++ b/source4/dsdb/samdb/cracknames.c
@@ -1235,7 +1235,7 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx,
                return NT_STATUS_OK;
        }
 
-       ldb = samdb_connect(mem_ctx, ev_ctx, lp_ctx, system_session(lp_ctx));
+       ldb = samdb_connect(mem_ctx, ev_ctx, lp_ctx, system_session(lp_ctx), 0);
        if (ldb == NULL) {
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
diff --git a/source4/dsdb/samdb/ldb_modules/partition_init.c 
b/source4/dsdb/samdb/ldb_modules/partition_init.c
index 0ab8bad..775e566 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_init.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_init.c
@@ -31,6 +31,7 @@
 
 #include "dsdb/samdb/ldb_modules/partition.h"
 #include "lib/util/tsort.h"
+#include "lib/ldb-samba/ldb_wrap.h"
 
 static int partition_sort_compare(const void *v1, const void *v2)
 {
@@ -218,7 +219,7 @@ static int new_partition_from_dn(struct ldb_context *ldb, 
struct partition_priva
                (*partition)->backend_url = data->ldapBackend;
        } else {
                /* the backend LDB is the DN (base64 encoded if not 'plain') 
followed by .ldb */
-               backend_url = samdb_relative_path(ldb, 
+               backend_url = ldb_relative_path(ldb, 
                                                  *partition, 
                                                  filename);
                if (!backend_url) {
diff --git a/source4/dsdb/samdb/ldb_modules/util.c 
b/source4/dsdb/samdb/ldb_modules/util.c
index 74825a5..569c967 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -954,18 +954,6 @@ int dsdb_recyclebin_enabled(struct ldb_module *module, 
bool *enabled)
        return LDB_SUCCESS;
 }
 
-bool is_attr_in_list(const char * const * attrs, const char *attr)
-{
-       unsigned int i;
-
-       for (i = 0; attrs[i]; i++) {
-               if (ldb_attr_cmp(attrs[i], attr) == 0)
-                       return true;
-       }
-
-       return false;
-}
-
 int dsdb_msg_constrainted_update_int32(struct ldb_module *module,
                                       struct ldb_message *msg,
                                       const char *attr,
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index 637da4f..57de27a 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -43,33 +43,6 @@
 #include "param/secrets.h"
 #include "auth/auth.h"
 
-char *samdb_relative_path(struct ldb_context *ldb,
-                                TALLOC_CTX *mem_ctx, 
-                                const char *name) 
-{
-       const char *base_url = 
-               (const char *)ldb_get_opaque(ldb, "ldb_url");
-       char *path, *p, *full_name;
-       if (name == NULL) {
-               return NULL;
-       }
-       if (strncmp("tdb://", base_url, 6) == 0) {
-               base_url = base_url+6;
-       }
-       path = talloc_strdup(mem_ctx, base_url);
-       if (path == NULL) {
-               return NULL;
-       }
-       if ( (p = strrchr(path, '/')) != NULL) {
-               p[0] = '\0';
-               full_name = talloc_asprintf(mem_ctx, "%s/%s", path, name);
-       } else {
-               full_name = talloc_asprintf(mem_ctx, "./%s", name);
-       }
-       talloc_free(path);
-       return full_name;
-}
-
 /*
   make sure the static credentials are not freed
  */
@@ -123,16 +96,46 @@ struct cli_credentials *samdb_credentials(struct 
tevent_context *event_ctx,
 struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx, 
                                  struct tevent_context *ev_ctx,
                                  struct loadparm_context *lp_ctx,
-                                 struct auth_session_info *session_info)
+                                 struct auth_session_info *session_info,
+                                 int flags)
 {
        struct ldb_context *ldb;
-       ldb = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx,
-                              lpcfg_sam_url(lp_ctx), session_info,
-                              samdb_credentials(ev_ctx, lp_ctx),
-                              0);
-       if (!ldb) {
+       struct dsdb_schema *schema;
+       const char *url;
+       struct cli_credentials *credentials;
+       int ret;
+
+       url  = lpcfg_sam_url(lp_ctx);
+       credentials = samdb_credentials(ev_ctx, lp_ctx);
+
+       ldb = ldb_wrap_find(url, ev_ctx, lp_ctx, session_info, credentials, 
flags);
+       if (ldb != NULL)
+               return talloc_reference(mem_ctx, ldb);
+
+       ldb = samba_ldb_init(mem_ctx, ev_ctx, lp_ctx, session_info, 
credentials);
+
+       if (ldb == NULL)
+               return NULL;
+
+       dsdb_set_global_schema(ldb);
+
+       ret = samba_ldb_connect(ldb, lp_ctx, url, flags);
+       if (ret != LDB_SUCCESS) {
+               talloc_free(ldb);
                return NULL;
        }
+
+       schema = dsdb_get_schema(ldb, NULL);
+       /* make the resulting schema global */
+       if (schema) {
+               dsdb_make_schema_global(ldb, schema);
+       }
+
+       if (!ldb_wrap_add(url, ev_ctx, lp_ctx, session_info, credentials, 
flags, ldb)) {
+               talloc_free(ldb);
+               return NULL;
+       }
+
        return ldb;
 }
 
diff --git a/source4/dsdb/wscript_build b/source4/dsdb/wscript_build
index 784d93b..90d265f 100644
--- a/source4/dsdb/wscript_build
+++ b/source4/dsdb/wscript_build
@@ -6,14 +6,14 @@ bld.SAMBA_SUBSYSTEM('SAMDB',
        source='samdb/samdb.c samdb/samdb_privilege.c samdb/cracknames.c 
repl/replicated_objects.c',
        autoproto='samdb/samdb_proto.h',
        public_deps='krb5',
-       deps='LIBNDR NDR_DRSUAPI NDR_DRSBLOBS NSS_WRAPPER auth_system_session 
LIBCLI_AUTH LIBNDR SAMDB_SCHEMA LDBSAMBA SAMDB_COMMON LIBCLI_DRSUAPI 
LIBCLI_LDAP_NDR LIBSAMBA-UTIL com_err'
+       deps='LIBNDR NDR_DRSUAPI NDR_DRSBLOBS NSS_WRAPPER auth_system_session 
LIBCLI_AUTH LIBNDR SAMDB_SCHEMA LDBSAMBA SAMDB_COMMON LIBCLI_DRSUAPI 
LIBCLI_LDAP_NDR LIBSAMBA-UTIL com_err KERBEROS CREDENTIALS'
        )
 
 
 bld.SAMBA_SUBSYSTEM('SAMDB_COMMON',
        source='common/util.c common/util_samr.c common/dsdb_dn.c 
common/dsdb_access.c ../../libds/common/flag_mapping.c',
        autoproto='common/proto.h',
-       deps='ldb NDR_DRSBLOBS LIBCLI_LDAP_NDR UTIL_LDB LIBCLI_AUTH 
DSDB_MODULE_HELPERS'
+       deps='ldb NDR_DRSBLOBS LIBCLI_LDAP_NDR UTIL_LDB LIBCLI_AUTH LIBTSOCKET 
samba_socket'
        )
 
 
diff --git a/source4/kdc/db-glue.c b/source4/kdc/db-glue.c
index 10d25ee..9d6a230 100644
--- a/source4/kdc/db-glue.c
+++ b/source4/kdc/db-glue.c
@@ -1660,7 +1660,7 @@ NTSTATUS samba_kdc_setup_db_ctx(TALLOC_CTX *mem_ctx, 
struct samba_kdc_base_conte
 
        /* Setup the link to LDB */
        kdc_db_ctx->samdb = samdb_connect(kdc_db_ctx, base_ctx->ev_ctx,
-                                         base_ctx->lp_ctx, session_info);
+                                         base_ctx->lp_ctx, session_info, 0);
        if (kdc_db_ctx->samdb == NULL) {
                DEBUG(1, ("hdb_samba4_create: Cannot open samdb for KDC 
backend!"));
                talloc_free(kdc_db_ctx);
diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c
index 7148428..1ccae10 100644
--- a/source4/kdc/kpasswdd.c
+++ b/source4/kdc/kpasswdd.c
@@ -180,7 +180,7 @@ static bool kpasswdd_change_password(struct kdc_server *kdc,
        /* Connect to a SAMDB with system privileges for fetching the old pw
         * hashes. */
        samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, kdc->task->lp_ctx,
-                             system_session(kdc->task->lp_ctx));
+                             system_session(kdc->task->lp_ctx), 0);
        if (!samdb) {
                return kpasswdd_make_error_reply(kdc, mem_ctx,
                                                KRB5_KPASSWD_HARDERROR,
@@ -213,7 +213,7 @@ static bool kpasswdd_change_password(struct kdc_server *kdc,
 
        /* Start a SAM with user privileges for the password change */
        samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, kdc->task->lp_ctx,
-                             session_info);
+                             session_info, 0);
        if (!samdb) {
                return kpasswdd_make_error_reply(kdc, mem_ctx,
                                                KRB5_KPASSWD_HARDERROR,
@@ -371,7 +371,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc,
                }
                krb5_free_principal(context, principal);
 
-               samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, 
kdc->task->lp_ctx, session_info);
+               samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, 
kdc->task->lp_ctx, session_info, 0);
                if (!samdb) {
                        return kpasswdd_make_error_reply(kdc, mem_ctx,
                                                         KRB5_KPASSWD_HARDERROR,
diff --git a/source4/ldap_server/ldap_backend.c 
b/source4/ldap_server/ldap_backend.c
index 6a518e4..6f2a764 100644
--- a/source4/ldap_server/ldap_backend.c
+++ b/source4/ldap_server/ldap_backend.c
@@ -194,12 +194,10 @@ static int map_ldb_error(TALLOC_CTX *mem_ctx, int ldb_err,
 */
 NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn) 
 {
-       conn->ldb = ldb_wrap_connect(conn, 
+       conn->ldb = samdb_connect(conn, 
                                     conn->connection->event.ctx,
                                     conn->lp_ctx,
-                                    lpcfg_sam_url(conn->lp_ctx),
                                     conn->session_info,
-                                    
samdb_credentials(conn->connection->event.ctx, conn->lp_ctx),
                                     conn->global_catalog ? LDB_FLG_RDONLY : 0);
        if (conn->ldb == NULL) {
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
diff --git a/source4/ldap_server/ldap_server.c 
b/source4/ldap_server/ldap_server.c
index e196fbf..ba5a268 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -841,7 +841,7 @@ static NTSTATUS add_socket(struct tevent_context 
*event_context,
 
        /* Load LDAP database, but only to read our settings */
        ldb = samdb_connect(ldap_service, ldap_service->task->event_ctx, 
-                           lp_ctx, system_session(lp_ctx));
+                           lp_ctx, system_session(lp_ctx), 0);
        if (!ldb) {
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
diff --git a/source4/lib/ldb-samba/ldb_wrap.c b/source4/lib/ldb-samba/ldb_wrap.c
index ebc1818..b09e68c 100644
--- a/source4/lib/ldb-samba/ldb_wrap.c
+++ b/source4/lib/ldb-samba/ldb_wrap.c
@@ -61,7 +61,7 @@ static void ldb_wrap_debug(void *context, enum 
ldb_debug_level level,
        case LDB_DEBUG_TRACE:
                samba_level = 5;
                break;
-               
+
        };
        vasprintf(&s, fmt, ap);
        if (!s) return;
@@ -94,20 +94,6 @@ static struct ldb_wrap {
        struct ldb_context *ldb;
 } *ldb_wrap_list;
 
-/*
-  see if two database opens are equivalent
- */
-static bool ldb_wrap_same_context(const struct ldb_wrap_context *c1,
-                                 const struct ldb_wrap_context *c2)
-{
-       return (c1->ev == c2->ev &&
-               c1->lp_ctx == c2->lp_ctx &&
-               c1->session_info == c2->session_info &&
-               c1->credentials == c2->credentials &&
-               c1->flags == c2->flags &&
-               (c1->url == c2->url || strcmp(c1->url, c2->url) == 0));
-}
-
 /* 
    free a ldb_wrap structure
  */


-- 
Samba Shared Repository

Reply via email to