summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/auth/credentials/credentials_files.c3
-rw-r--r--source4/auth/gensec/schannel_state.c1
-rw-r--r--source4/dsdb/common/util.c1
-rw-r--r--source4/dsdb/samdb/cracknames.c3
-rw-r--r--source4/dsdb/samdb/ldb_modules/config.mk60
-rw-r--r--source4/dsdb/samdb/samdb.c3
-rwxr-xr-xsource4/lib/ldb/autogen.sh1
-rw-r--r--source4/lib/ldb/common/ldb.c34
-rw-r--r--source4/lib/ldb/config.mk20
-rw-r--r--source4/lib/ldb/configure.ac1
-rw-r--r--source4/lib/ldb/examples/ldbreader.c2
-rw-r--r--source4/lib/ldb/examples/ldifreader.c2
-rw-r--r--source4/lib/ldb/include/ldb.h4
-rw-r--r--source4/lib/ldb/include/ldb_includes.h1
-rw-r--r--source4/lib/ldb/include/ldb_private.h2
-rw-r--r--source4/lib/ldb/ldb.pc.in2
-rw-r--r--source4/lib/ldb/ldb_wrap.c3
-rw-r--r--source4/lib/ldb/nssldb/ldb-nss.c2
-rw-r--r--source4/lib/ldb/python.mk2
-rwxr-xr-xsource4/lib/ldb/standalone.sh3
-rw-r--r--source4/lib/ldb/tools/ad2oLschema.c2
-rw-r--r--source4/lib/ldb/tools/ldbadd.c2
-rw-r--r--source4/lib/ldb/tools/ldbdel.c2
-rw-r--r--source4/lib/ldb/tools/ldbedit.c2
-rw-r--r--source4/lib/ldb/tools/ldbmodify.c2
-rw-r--r--source4/lib/ldb/tools/ldbrename.c2
-rw-r--r--source4/lib/ldb/tools/ldbsearch.c5
-rw-r--r--source4/lib/ldb/tools/ldbtest.c4
-rw-r--r--source4/lib/ldb/tools/oLschema2ldif.c2
-rw-r--r--source4/lib/ldb_wrap.c23
-rw-r--r--source4/lib/util/util_ldb.c1
-rw-r--r--source4/libcli/ldap/ldap_ndr.c1
-rw-r--r--source4/libcli/util/nterr.c1
-rw-r--r--source4/libnet/libnet_join.c2
-rw-r--r--source4/param/secrets.c9
-rw-r--r--source4/param/secrets.h5
-rw-r--r--source4/rpc_server/lsa/dcesrv_lsa.c4
-rw-r--r--source4/torture/ldap/cldap.c2
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c4
-rw-r--r--source4/torture/nbt/dgram.c4
-rw-r--r--source4/torture/rpc/drsuapi.c8
-rw-r--r--source4/torture/rpc/drsuapi_cracknames.c2
-rw-r--r--source4/torture/rpc/join.c4
-rw-r--r--source4/torture/rpc/lsa.c2
-rw-r--r--source4/torture/rpc/rpc.c2
-rw-r--r--source4/torture/rpc/rpc.h2
-rw-r--r--source4/torture/rpc/samlogon.c8
-rw-r--r--source4/torture/rpc/samr_accessmask.c2
-rw-r--r--source4/torture/rpc/samsync.c6
-rw-r--r--source4/torture/rpc/schannel.c8
-rw-r--r--source4/torture/rpc/testjoin.c18
-rw-r--r--source4/winbind/wb_server.c1
52 files changed, 176 insertions, 116 deletions
diff --git a/source4/auth/credentials/credentials_files.c b/source4/auth/credentials/credentials_files.c
index ab76ea2cde..05b0bf56a8 100644
--- a/source4/auth/credentials/credentials_files.c
+++ b/source4/auth/credentials/credentials_files.c
@@ -22,6 +22,7 @@
*/
#include "includes.h"
+#include "lib/events/events.h"
#include "lib/ldb/include/ldb.h"
#include "librpc/gen_ndr/samr.h" /* for struct samrPassword */
#include "param/secrets.h"
@@ -215,7 +216,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
if (!ldb) {
/* Local secrets are stored in secrets.ldb */
- ldb = secrets_db_connect(mem_ctx, lp_ctx);
+ ldb = secrets_db_connect(mem_ctx, event_ctx, lp_ctx);
if (!ldb) {
/* set anonymous as the fallback, if the machine account won't work */
cli_credentials_set_anonymous(cred);
diff --git a/source4/auth/gensec/schannel_state.c b/source4/auth/gensec/schannel_state.c
index 0f7c4ca11d..f0710c5581 100644
--- a/source4/auth/gensec/schannel_state.c
+++ b/source4/auth/gensec/schannel_state.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "lib/events/events.h"
#include "lib/ldb/include/ldb.h"
#include "lib/ldb/include/ldb_errors.h"
#include "dsdb/samdb/samdb.h"
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 5164f7d181..b98112304c 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -22,6 +22,7 @@
*/
#include "includes.h"
+#include "events.h"
#include "ldb.h"
#include "ldb_errors.h"
#include "lib/util/util_ldb.h"
diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c
index da10cbb057..369b06c305 100644
--- a/source4/dsdb/samdb/cracknames.c
+++ b/source4/dsdb/samdb/cracknames.c
@@ -24,6 +24,7 @@
#include "includes.h"
#include "librpc/gen_ndr/drsuapi.h"
#include "rpc_server/common/common.h"
+#include "lib/events/events.h"
#include "lib/ldb/include/ldb.h"
#include "lib/ldb/include/ldb_errors.h"
#include "system/kerberos.h"
@@ -358,7 +359,7 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
struct smb_krb5_context *smb_krb5_context;
ret = smb_krb5_init_context(mem_ctx,
- (struct event_context *)ldb_get_opaque(sam_ctx, "EventContext"),
+ ldb_get_event_context(sam_ctx),
(struct loadparm_context *)ldb_get_opaque(sam_ctx, "loadparm"),
&smb_krb5_context);
diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk
index 388b67c6d1..d8dc0516f6 100644
--- a/source4/dsdb/samdb/ldb_modules/config.mk
+++ b/source4/dsdb/samdb/ldb_modules/config.mk
@@ -3,7 +3,7 @@
[MODULE::ldb_objectguid]
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR NDR_MISC
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBNDR NDR_MISC
INIT_FUNCTION = LDB_MODULE(objectguid)
# End MODULE ldb_objectguid
################################################
@@ -15,8 +15,9 @@ ldb_objectguid_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/objectguid.o
[MODULE::ldb_repl_meta_data]
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC LIBNDR NDR_MISC NDR_DRSUAPI \
- NDR_DRSBLOBS LIBNDR
+PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC LIBEVENTS \
+ LIBNDR NDR_MISC NDR_DRSUAPI \
+ NDR_DRSBLOBS LIBNDR
INIT_FUNCTION = LDB_MODULE(repl_meta_data)
# End MODULE ldb_repl_meta_data
################################################
@@ -29,7 +30,7 @@ ldb_repl_meta_data_OBJ_FILES = \
[MODULE::ldb_dsdb_cache]
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC
+PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC LIBEVENTS
INIT_FUNCTION = LDB_MODULE(dsdb_cache)
# End MODULE ldb_dsdb_cache
################################################
@@ -42,7 +43,7 @@ ldb_dsdb_cache_OBJ_FILES = \
[MODULE::ldb_schema_fsmo]
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC
+PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC LIBEVENTS
INIT_FUNCTION = LDB_MODULE(schema_fsmo)
# End MODULE ldb_schema_fsmo
################################################
@@ -55,7 +56,7 @@ ldb_schema_fsmo_OBJ_FILES = \
[MODULE::ldb_naming_fsmo]
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC
+PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC LIBEVENTS
INIT_FUNCTION = LDB_MODULE(naming_fsmo)
# End MODULE ldb_naming_fsmo
################################################
@@ -68,7 +69,7 @@ ldb_naming_fsmo_OBJ_FILES = \
[MODULE::ldb_pdc_fsmo]
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC
+PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC LIBEVENTS
INIT_FUNCTION = LDB_MODULE(pdc_fsmo)
# End MODULE ldb_pdc_fsmo
################################################
@@ -81,7 +82,7 @@ ldb_pdc_fsmo_OBJ_FILES = \
[MODULE::ldb_samldb]
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = LIBTALLOC LDAP_ENCODE NDR_MISC SAMDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LDAP_ENCODE NDR_MISC SAMDB
INIT_FUNCTION = LDB_MODULE(samldb)
#
# End MODULE ldb_samldb
@@ -96,8 +97,8 @@ ldb_samldb_OBJ_FILES = \
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
INIT_FUNCTION = LDB_MODULE(samba3sam)
-PRIVATE_DEPENDENCIES = LIBTALLOC SMBPASSWD NSS_WRAPPER LIBSECURITY \
- NDR_SECURITY
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS SMBPASSWD \
+ NSS_WRAPPER LIBSECURITY NDR_SECURITY
# End MODULE ldb_samldb
################################################
@@ -110,7 +111,7 @@ ldb_samba3sam_OBJ_FILES = \
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
INIT_FUNCTION = LDB_MODULE(simple_ldap_map)
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR NDR_MISC
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBNDR NDR_MISC
ENABLE = YES
ALIASES = entryuuid nsuniqueid
# End MODULE ldb_entryuuid
@@ -135,7 +136,7 @@ ldb_simple_ldap_map_OBJ_FILES = \
# Start MODULE ldb_rootdse
[MODULE::ldb_rootdse]
SUBSYSTEM = LIBLDB
-PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS SAMDB
OUTPUT_TYPE = SHARED_LIBRARY
INIT_FUNCTION = LDB_MODULE(rootdse)
# End MODULE ldb_rootdse
@@ -149,8 +150,9 @@ ldb_rootdse_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/rootdse.o
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
INIT_FUNCTION = LDB_MODULE(password_hash)
-PRIVATE_DEPENDENCIES = HEIMDAL_HDB_KEYS LIBTALLOC HEIMDAL_KRB5 LDAP_ENCODE \
- LIBCLI_AUTH NDR_DRSBLOBS KERBEROS SAMDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS SAMDB LDAP_ENCODE \
+ LIBCLI_AUTH NDR_DRSBLOBS KERBEROS \
+ HEIMDAL_HDB_KEYS HEIMDAL_KRB5
# End MODULE ldb_password_hash
################################################
@@ -159,7 +161,7 @@ ldb_password_hash_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/password_hash.o
################################################
# Start MODULE ldb_local_password
[MODULE::ldb_local_password]
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR SAMDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBNDR SAMDB
OUTPUT_TYPE = SHARED_LIBRARY
SUBSYSTEM = LIBLDB
INIT_FUNCTION = LDB_MODULE(local_password)
@@ -171,7 +173,7 @@ ldb_local_password_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/local_password.o
################################################
# Start MODULE ldb_kludge_acl
[MODULE::ldb_kludge_acl]
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBSECURITY SAMDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSECURITY SAMDB
OUTPUT_TYPE = SHARED_LIBRARY
SUBSYSTEM = LIBLDB
INIT_FUNCTION = LDB_MODULE(kludge_acl)
@@ -186,7 +188,7 @@ ldb_kludge_acl_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/kludge_acl.o
[MODULE::ldb_extended_dn]
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR LIBSECURITY SAMDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBNDR LIBSECURITY SAMDB
INIT_FUNCTION = LDB_MODULE(extended_dn)
# End MODULE ldb_extended_dn
################################################
@@ -198,7 +200,7 @@ ldb_extended_dn_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/extended_dn.o
[MODULE::ldb_show_deleted]
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = LIBTALLOC
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
INIT_FUNCTION = LDB_MODULE(show_deleted)
# End MODULE ldb_show_deleted
################################################
@@ -210,7 +212,7 @@ ldb_show_deleted_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/show_deleted.o
[MODULE::ldb_partition]
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS SAMDB
INIT_FUNCTION = LDB_MODULE(partition)
# End MODULE ldb_partition
################################################
@@ -222,7 +224,7 @@ ldb_partition_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/partition.o
[MODULE::ldb_schema]
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBLDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBLDB
INIT_FUNCTION = LDB_MODULE(schema)
# End MODULE ldb_schema
################################################
@@ -234,7 +236,7 @@ ldb_schema_OBJ_FILES = $(addprefix $(dsdbsrcdir)/samdb/ldb_modules/, schema.o sc
[MODULE::ldb_update_keytab]
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = LIBTALLOC CREDENTIALS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS CREDENTIALS
#Also depends on credentials, but that would loop
INIT_FUNCTION = LDB_MODULE(update_kt)
# End MODULE ldb_update_kt
@@ -248,7 +250,7 @@ ldb_update_keytab_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/update_keytab.o
INIT_FUNCTION = LDB_MODULE(objectclass)
OUTPUT_TYPE = SHARED_LIBRARY
CFLAGS = -Ilib/ldb/include
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBSECURITY NDR_SECURITY SAMDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSECURITY NDR_SECURITY SAMDB
SUBSYSTEM = LIBLDB
# End MODULE ldb_objectclass
################################################
@@ -260,7 +262,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
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
SUBSYSTEM = LIBLDB
# End MODULE ldb_subtree_rename
################################################
@@ -272,7 +274,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
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
SUBSYSTEM = LIBLDB
# End MODULE ldb_subtree_rename
################################################
@@ -285,7 +287,7 @@ ldb_subtree_delete_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/subtree_delete.o
INIT_FUNCTION = LDB_MODULE(linked_attributes)
CFLAGS = -Ilib/ldb/include
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS SAMDB
SUBSYSTEM = LIBLDB
# End MODULE ldb_linked_attributes
################################################
@@ -297,7 +299,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
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
SUBSYSTEM = LIBLDB
# End MODULE ldb_ranged_results
################################################
@@ -310,7 +312,7 @@ ldb_ranged_results_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/ranged_results.o
INIT_FUNCTION = LDB_MODULE(anr)
CFLAGS = -Ilib/ldb/include
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL SAMDB
SUBSYSTEM = LIBLDB
# End MODULE ldb_anr
################################################
@@ -323,7 +325,7 @@ ldb_anr_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/anr.o
INIT_FUNCTION = LDB_MODULE(normalise)
CFLAGS = -Ilib/ldb/include
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL SAMDB
SUBSYSTEM = LIBLDB
# End MODULE ldb_normalise
################################################
@@ -336,7 +338,7 @@ ldb_normalise_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/normalise.o
INIT_FUNCTION = LDB_MODULE(instancetype)
CFLAGS = -Ilib/ldb/include
OUTPUT_TYPE = SHARED_LIBRARY
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL SAMDB
SUBSYSTEM = LIBLDB
# End MODULE ldb_instancetype
################################################
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index 9154f5382b..4557b6c9cc 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -25,6 +25,7 @@
#include "librpc/gen_ndr/ndr_netlogon.h"
#include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/gen_ndr/ndr_security.h"
+#include "lib/events/events.h"
#include "lib/ldb/include/ldb.h"
#include "lib/ldb/include/ldb_errors.h"
#include "libcli/security/security.h"
@@ -114,7 +115,7 @@ int samdb_copy_template(struct ldb_context *ldb,
return LDB_ERR_OPERATIONS_ERROR;
}
- event_ctx = (struct event_context *)ldb_get_opaque(ldb, "EventContext");
+ event_ctx = ldb_get_event_context(ldb);
lp_ctx = (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm");
/* FIXME: need to remove this wehn we finally pass the event
diff --git a/source4/lib/ldb/autogen.sh b/source4/lib/ldb/autogen.sh
index cb837b3af9..b81e5b094e 100755
--- a/source4/lib/ldb/autogen.sh
+++ b/source4/lib/ldb/autogen.sh
@@ -4,6 +4,7 @@ rm -rf autom4te.cache
rm -f configure config.h.in
IPATHS="-I libreplace -I lib/replace -I ../libreplace -I ../replace"
+IPATHS="$IPATHS -I lib/events -I events -I ../events"
IPATHS="$IPATHS -I lib/talloc -I talloc -I ../talloc"
IPATHS="$IPATHS -I lib/tdb -I tdb -I ../tdb"
IPATHS="$IPATHS -I lib/popt -I popt -I ../popt"
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index b51c288993..bfce12bdd3 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -1,13 +1,13 @@
-/*
+/*
ldb database library
Copyright (C) Andrew Tridgell 2004
- Copyright (C) Simo Sorce 2005-2006
+ Copyright (C) Simo Sorce 2005-2008
** 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
@@ -34,15 +34,21 @@
#include "ldb_includes.h"
-/*
+/*
initialise a ldb context
- The mem_ctx is optional
+ The mem_ctx is required
+ The event_ctx is required
*/
-struct ldb_context *ldb_init(void *mem_ctx)
+struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx)
{
- struct ldb_context *ldb = talloc_zero(mem_ctx, struct ldb_context);
+ struct ldb_context *ldb;
int ret;
+ ldb = talloc_zero(mem_ctx, struct ldb_context);
+ if (ev_ctx == NULL) {
+ ev_ctx = event_context_init(ldb);
+ }
+
ret = ldb_setup_wellknown_attributes(ldb);
if (ret != 0) {
talloc_free(ldb);
@@ -52,6 +58,10 @@ struct ldb_context *ldb_init(void *mem_ctx)
ldb_set_utf8_default(ldb);
ldb_set_create_perms(ldb, 0666);
ldb_set_modules_dir(ldb, LDB_MODULESDIR);
+ ldb_set_event_context(ldb, ev_ctx);
+
+ /* TODO: get timeout from options if available there */
+ ldb->default_timeout = 300; /* set default to 5 minutes */
return ldb;
}
@@ -568,6 +578,16 @@ void ldb_set_create_perms(struct ldb_context *ldb, unsigned int perms)
ldb->create_perms = perms;
}
+void ldb_set_event_context(struct ldb_context *ldb, struct event_context *ev)
+{
+ ldb->ev_ctx = ev;
+}
+
+struct event_context * ldb_get_event_context(struct ldb_context *ldb)
+{
+ return ldb->ev_ctx;
+}
+
/*
start an ldb request
NOTE: the request must be a talloc context.
diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk
index cc8f1e36ab..40b4e31cc7 100644
--- a/source4/lib/ldb/config.mk
+++ b/source4/lib/ldb/config.mk
@@ -1,7 +1,7 @@
################################################
# Start MODULE ldb_asq
[MODULE::ldb_asq]
-PRIVATE_DEPENDENCIES = LIBTALLOC
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
CFLAGS = -I$(ldbdir)/include
INIT_FUNCTION = LDB_MODULE(asq)
SUBSYSTEM = LIBLDB
@@ -13,7 +13,7 @@ ldb_asq_OBJ_FILES = $(ldbdir)/modules/asq.o
################################################
# Start MODULE ldb_server_sort
[MODULE::ldb_server_sort]
-PRIVATE_DEPENDENCIES = LIBTALLOC
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
CFLAGS = -I$(ldbdir)/include
INIT_FUNCTION = LDB_MODULE(server_sort)
SUBSYSTEM = LIBLDB
@@ -27,7 +27,7 @@ ldb_server_sort_OBJ_FILES = $(ldbdir)/modules/sort.o
[MODULE::ldb_paged_results]
INIT_FUNCTION = LDB_MODULE(paged_results)
CFLAGS = -I$(ldbdir)/include
-PRIVATE_DEPENDENCIES = LIBTALLOC
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
SUBSYSTEM = LIBLDB
# End MODULE ldb_paged_results
################################################
@@ -39,7 +39,7 @@ ldb_paged_results_OBJ_FILES = $(ldbdir)/modules/paged_results.o
[MODULE::ldb_paged_searches]
INIT_FUNCTION = LDB_MODULE(paged_searches)
CFLAGS = -I$(ldbdir)/include
-PRIVATE_DEPENDENCIES = LIBTALLOC
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
SUBSYSTEM = LIBLDB
# End MODULE ldb_paged_results
################################################
@@ -51,7 +51,7 @@ ldb_paged_searches_OBJ_FILES = $(ldbdir)/modules/paged_searches.o
[MODULE::ldb_operational]
SUBSYSTEM = LIBLDB
CFLAGS = -I$(ldbdir)/include
-PRIVATE_DEPENDENCIES = LIBTALLOC
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
INIT_FUNCTION = LDB_MODULE(operational)
# End MODULE ldb_operational
################################################
@@ -63,7 +63,7 @@ ldb_operational_OBJ_FILES = $(ldbdir)/modules/operational.o
[MODULE::ldb_rdn_name]
SUBSYSTEM = LIBLDB
CFLAGS = -I$(ldbdir)/include
-PRIVATE_DEPENDENCIES = LIBTALLOC
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
INIT_FUNCTION = LDB_MODULE(rdn_name)
# End MODULE ldb_rdn_name
################################################
@@ -79,7 +79,7 @@ $(ldb_map_OBJ_FILES): CFLAGS+=-I$(ldbdir)/ldb_map
[MODULE::ldb_skel]
SUBSYSTEM = LIBLDB
CFLAGS = -I$(ldbdir)/include
-PRIVATE_DEPENDENCIES = LIBTALLOC
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
INIT_FUNCTION = LDB_MODULE(skel)
# End MODULE ldb_skel
################################################
@@ -91,7 +91,7 @@ ldb_skel_OBJ_FILES = $(ldbdir)/modules/skel.o
[MODULE::ldb_sqlite3]
SUBSYSTEM = LIBLDB
CFLAGS = -I$(ldbdir)/include
-PRIVATE_DEPENDENCIES = LIBTALLOC SQLITE3 LIBTALLOC
+PRIVATE_DEPENDENCIES = LIBTALLOC SQLITE3 LIBEVENTS
# End MODULE ldb_sqlite3
################################################
@@ -103,7 +103,7 @@ ldb_sqlite3_OBJ_FILES = $(ldbdir)/ldb_sqlite3/ldb_sqlite3.o
SUBSYSTEM = LIBLDB
CFLAGS = -I$(ldbdir)/include -I$(ldbdir)/ldb_tdb
PRIVATE_DEPENDENCIES = \
- LIBTDB LIBTALLOC
+ LIBTDB LIBTALLOC LIBEVENTS
# End MODULE ldb_tdb
################################################
@@ -116,7 +116,7 @@ ldb_tdb_OBJ_FILES = $(addprefix $(ldbdir)/ldb_tdb/, ldb_tdb.o ldb_search.o ldb_p
CFLAGS = -I$(ldbdir)/include
INIT_FUNCTION_TYPE = extern const struct ldb_module_ops
PUBLIC_DEPENDENCIES = \
- LIBTALLOC
+ LIBTALLOC LIBEVENTS
PRIVATE_DEPENDENCIES = \
SOCKET_WRAPPER
diff --git a/source4/lib/ldb/configure.ac b/source4/lib/ldb/configure.ac
index 4d9444ad10..4a703e8139 100644
--- a/source4/lib/ldb/configure.ac
+++ b/source4/lib/ldb/configure.ac
@@ -46,6 +46,7 @@ EXTRA_OBJ=""
m4_include(libpopt.m4)
m4_include(libtalloc.m4)
m4_include(libtdb.m4)
+m4_include(libevents.m4)
m4_include(ldap.m4)
if test x"$with_ldap_support" = x"yes"; then
diff --git a/source4/lib/ldb/examples/ldbreader.c b/source4/lib/ldb/examples/ldbreader.c
index c8f26c3860..6e58114531 100644
--- a/source4/lib/ldb/examples/ldbreader.c
+++ b/source4/lib/ldb/examples/ldbreader.c
@@ -67,7 +67,7 @@ int main(int argc, const char **argv)
Note that you can use the context structure as a parent
for talloc allocations as well
*/
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
/*
We now open the database. In this example we just hard code the connection path.
diff --git a/source4/lib/ldb/examples/ldifreader.c b/source4/lib/ldb/examples/ldifreader.c
index 926d99f838..12e7a1a6fd 100644
--- a/source4/lib/ldb/examples/ldifreader.c
+++ b/source4/lib/ldb/examples/ldifreader.c
@@ -71,7 +71,7 @@ int main(int argc, const char **argv)
Note that you can use the context structure as a parent
for talloc allocations as well
*/
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
fileStream = fopen(argv[1], "r");
if (0 == fileStream) {
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index 2e13a774b9..c43d425585 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -782,6 +782,8 @@ int ldb_set_timeout(struct ldb_context *ldb, struct ldb_request *req, int timeou
int ldb_set_timeout_from_prev_req(struct ldb_context *ldb, struct ldb_request *oldreq, struct ldb_request *newreq);
void ldb_set_create_perms(struct ldb_context *ldb, unsigned int perms);
void ldb_set_modules_dir(struct ldb_context *ldb, const char *path);
+void ldb_set_event_context(struct ldb_context *ldb, struct event_context *ev);
+struct event_context * ldb_get_event_context(struct ldb_context *ldb);
/**
Initialise ldbs' global information
@@ -803,7 +805,7 @@ int ldb_global_init(void);
\return pointer to ldb_context that should be free'd (using talloc_free())
at the end of the program.
*/
-struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx);
+struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx);
/**
Connect to a database.
diff --git a/source4/lib/ldb/include/ldb_includes.h b/source4/lib/ldb/include/ldb_includes.h
index cc9b46ac1f..29c7b2dc5a 100644
--- a/source4/lib/ldb/include/ldb_includes.h
+++ b/source4/lib/ldb/include/ldb_includes.h
@@ -20,6 +20,7 @@
#include "system/filesys.h"
#include "system/time.h"
#include "talloc.h"
+#include "events.h"
#include "ldb.h"
#include "ldb_errors.h"
#include "ldb_private.h"
diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h
index ea8533bc38..d7c2efe8a1 100644
--- a/source4/lib/ldb/include/ldb_private.h
+++ b/source4/lib/ldb/include/ldb_private.h
@@ -133,6 +133,8 @@ struct ldb_context {
unsigned int create_perms;
char *modules_dir;
+
+ struct event_context *ev_ctx;
};
#ifndef ARRAY_SIZE
diff --git a/source4/lib/ldb/ldb.pc.in b/source4/lib/ldb/ldb.pc.in
index 248fb05c4f..8d1e3cabe3 100644
--- a/source4/lib/ldb/ldb.pc.in
+++ b/source4/lib/ldb/ldb.pc.in
@@ -8,7 +8,7 @@ Name: ldb
Description: An LDAP-like embedded database
Version: @PACKAGE_VERSION@
Requires.private: tdb
-Requires: talloc
+Requires: talloc events
Libs: -L${libdir} -lldb
Libs.private: @LDAP_LIBS@
Cflags: -I${includedir}
diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c
index 744033cbf6..ee374b85be 100644
--- a/source4/lib/ldb/ldb_wrap.c
+++ b/source4/lib/ldb/ldb_wrap.c
@@ -2546,6 +2546,7 @@ static swig_module_info swig_module = {swig_types, 24, 0, 0, 0, 0};
#include <stdint.h>
#include <stdbool.h>
#include "talloc.h"
+#include "events.h"
#include "ldb.h"
#include "ldb_errors.h"
#include "ldb_private.h"
@@ -3066,7 +3067,7 @@ static void py_ldb_debug(void *context, enum ldb_debug_level level, const char *
PyObject *PyExc_LdbError;
-SWIGINTERN ldb *new_ldb(){ return ldb_init(NULL); }
+SWIGINTERN ldb *new_ldb(){ return ldb_init(NULL, NULL); }
SWIGINTERN int
SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val)
diff --git a/source4/lib/ldb/nssldb/ldb-nss.c b/source4/lib/ldb/nssldb/ldb-nss.c
index e256f41a4d..8f7321031b 100644
--- a/source4/lib/ldb/nssldb/ldb-nss.c
+++ b/source4/lib/ldb/nssldb/ldb-nss.c
@@ -45,7 +45,7 @@ NSS_STATUS _ldb_nss_init(void)
_ldb_nss_ctx->pid = mypid;
- _ldb_nss_ctx->ldb = ldb_init(_ldb_nss_ctx);
+ _ldb_nss_ctx->ldb = ldb_init(_ldb_nss_ctx, NULL);
if (_ldb_nss_ctx->ldb == NULL) {
goto failed;
}
diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk
index 8d48f5d810..45f4f044ba 100644
--- a/source4/lib/ldb/python.mk
+++ b/source4/lib/ldb/python.mk
@@ -1,6 +1,6 @@
[PYTHON::swig_ldb]
LIBRARY_REALNAME = _ldb.$(SHLIBEXT)
-PUBLIC_DEPENDENCIES = LIBLDB
+PUBLIC_DEPENDENCIES = LIBLDB LIBEVENTS
swig_ldb_OBJ_FILES = $(ldbsrcdir)/ldb_wrap.o
$(swig_ldb_OBJ_FILES): CFLAGS+=-I$(ldbsrcdir)/include
diff --git a/source4/lib/ldb/standalone.sh b/source4/lib/ldb/standalone.sh
index fa1b9bafe3..8ab081e0f3 100755
--- a/source4/lib/ldb/standalone.sh
+++ b/source4/lib/ldb/standalone.sh
@@ -9,6 +9,9 @@ make clean
cd ../tdb
make clean
+cd ../events
+make clean
+
cd ../ldb
make clean
diff --git a/source4/lib/ldb/tools/ad2oLschema.c b/source4/lib/ldb/tools/ad2oLschema.c
index 0a89656fa2..ac343c783f 100644
--- a/source4/lib/ldb/tools/ad2oLschema.c
+++ b/source4/lib/ldb/tools/ad2oLschema.c
@@ -657,7 +657,7 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_
enum convert_target target;
ctx = talloc_new(NULL);
- ldb = ldb_init(ctx);
+ ldb = ldb_init(ctx, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c
index 4ee66c4fc0..15376e7342 100644
--- a/source4/lib/ldb/tools/ldbadd.c
+++ b/source4/lib/ldb/tools/ldbadd.c
@@ -88,7 +88,7 @@ int main(int argc, const char **argv)
int i, ret=0, count=0;
struct ldb_cmdline *options;
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c
index 184172b22b..e66d4fb973 100644
--- a/source4/lib/ldb/tools/ldbdel.c
+++ b/source4/lib/ldb/tools/ldbdel.c
@@ -77,7 +77,7 @@ int main(int argc, const char **argv)
int ret = 0, i;
struct ldb_cmdline *options;
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index a9fd064bf8..e58a5a271e 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -279,7 +279,7 @@ int main(int argc, const char **argv)
const char *expression = "(|(objectClass=*)(distinguishedName=*))";
const char * const * attrs = NULL;
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c
index dd6206b824..6e355a10cf 100644
--- a/source4/lib/ldb/tools/ldbmodify.c
+++ b/source4/lib/ldb/tools/ldbmodify.c
@@ -89,7 +89,7 @@ int main(int argc, const char **argv)
int i, ret=LDB_SUCCESS;
struct ldb_cmdline *options;
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbrename.c b/source4/lib/ldb/tools/ldbrename.c
index b36310a500..a5feb7a091 100644
--- a/source4/lib/ldb/tools/ldbrename.c
+++ b/source4/lib/ldb/tools/ldbrename.c
@@ -56,7 +56,7 @@ int main(int argc, const char **argv)
struct ldb_cmdline *options;
struct ldb_dn *dn1, *dn2;
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index e25bd19965..b3d1f934a6 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -276,7 +276,10 @@ int main(int argc, const char **argv)
int ret = -1;
const char *expression = "(|(objectClass=*)(distinguishedName=*))";
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
+ if (ldb == NULL) {
+ return -1;
+ }
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c
index 57a7848733..6d141478ad 100644
--- a/source4/lib/ldb/tools/ldbtest.c
+++ b/source4/lib/ldb/tools/ldbtest.c
@@ -344,7 +344,7 @@ static void start_test_index(struct ldb_context **ldb)
exit(1);
}
- (*ldb) = ldb_init(options);
+ (*ldb) = ldb_init(options, NULL);
ret = ldb_connect(*ldb, options->url, flags, NULL);
if (ret != 0) {
@@ -393,7 +393,7 @@ int main(int argc, const char **argv)
TALLOC_CTX *mem_ctx = talloc_new(NULL);
struct ldb_context *ldb;
- ldb = ldb_init(mem_ctx);
+ ldb = ldb_init(mem_ctx, NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/oLschema2ldif.c b/source4/lib/ldb/tools/oLschema2ldif.c
index 1846a2c852..3c31f37c55 100644
--- a/source4/lib/ldb/tools/oLschema2ldif.c
+++ b/source4/lib/ldb/tools/oLschema2ldif.c
@@ -561,7 +561,7 @@ static void usage(void)
FILE *in = stdin;
FILE *out = stdout;
ctx = talloc_new(NULL);
- ldb_ctx = ldb_init(ctx);
+ ldb_ctx = ldb_init(ctx, NULL);
setenv("LDB_URL", "NONE", 1);
options = ldb_cmdline_process(ldb_ctx, argc, argv, usage);
diff --git a/source4/lib/ldb_wrap.c b/source4/lib/ldb_wrap.c
index f47d0d5d39..883597108a 100644
--- a/source4/lib/ldb_wrap.c
+++ b/source4/lib/ldb_wrap.c
@@ -107,22 +107,31 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
char *real_url = NULL;
size_t *startup_blocks;
- ldb = ldb_init(mem_ctx);
- if (ldb == NULL) {
+ /* we want to use the existing event context if possible. This
+ relies on the fact that in smbd, everything is a child of
+ the main event_context */
+ if (ev == NULL) {
return NULL;
}
- ldb_set_modules_dir(ldb,
- talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(lp_ctx)));
-
- if (ev == NULL) {
+ ldb = ldb_init(mem_ctx, ev);
+ if (ldb == NULL) {
return NULL;
}
- if (ldb_set_opaque(ldb, "EventContext", ev)) {
+ ldb_set_modules_dir(ldb,
+ talloc_asprintf(ldb,
+ "%s/ldb",
+ lp_modulesdir(lp_ctx)));
+
+#if 0
+ if (ev) {
+ ldb_event_sys_op_init(ldb, ev);
+ } else {
talloc_free(ldb);
return NULL;
}
+#endif
if (ldb_set_opaque(ldb, "sessionInfo", session_info)) {
talloc_free(ldb);
diff --git a/source4/lib/util/util_ldb.c b/source4/lib/util/util_ldb.c
index 38f53c2c66..0a7433696e 100644
--- a/source4/lib/util/util_ldb.c
+++ b/source4/lib/util/util_ldb.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "lib/events/events.h"
#include "lib/ldb/include/ldb.h"
#include "lib/ldb/include/ldb_errors.h"
#include "lib/util/util_ldb.h"
diff --git a/source4/libcli/ldap/ldap_ndr.c b/source4/libcli/ldap/ldap_ndr.c
index 3f7cb8f538..a10f80ae2c 100644
--- a/source4/libcli/ldap/ldap_ndr.c
+++ b/source4/libcli/ldap/ldap_ndr.c
@@ -21,6 +21,7 @@
*/
#include "includes.h"
+#include "lib/events/events.h"
#include "libcli/ldap/ldap.h"
#include "librpc/gen_ndr/ndr_security.h"
#include "librpc/gen_ndr/ndr_misc.h"
diff --git a/source4/libcli/util/nterr.c b/source4/libcli/util/nterr.c
index b1f345016d..7629a14106 100644
--- a/source4/libcli/util/nterr.c
+++ b/source4/libcli/util/nterr.c
@@ -20,6 +20,7 @@
/* NT error codes. please read nterr.h */
#include "includes.h"
+#include "lib/events/events.h"
#include "libcli/ldap/ldap.h"
typedef struct
diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c
index b5b28df81d..5776888cb0 100644
--- a/source4/libnet/libnet_join.c
+++ b/source4/libnet/libnet_join.c
@@ -865,7 +865,7 @@ NTSTATUS libnet_set_join_secrets(struct libnet_context *ctx,
}
/* Open the secrets database */
- ldb = secrets_db_connect(tmp_mem, ctx->lp_ctx);
+ ldb = secrets_db_connect(tmp_mem, ctx->event_ctx, ctx->lp_ctx);
if (!ldb) {
r->out.error_string
= talloc_asprintf(mem_ctx,
diff --git a/source4/param/secrets.c b/source4/param/secrets.c
index 06dc850c8e..16fbb3b108 100644
--- a/source4/param/secrets.c
+++ b/source4/param/secrets.c
@@ -85,7 +85,9 @@ struct tdb_wrap *secrets_init(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_c
/**
connect to the secrets ldb
*/
-struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
+struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx)
{
char *path;
const char *url;
@@ -103,7 +105,7 @@ struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_cont
/* Secrets.ldb *must* always be local. If we call for a
* system_session() we will recurse */
- ldb = ldb_init(mem_ctx);
+ ldb = ldb_init(mem_ctx, ev_ctx);
if (!ldb) {
talloc_free(path);
return NULL;
@@ -127,6 +129,7 @@ struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_cont
* @return pointer to a SID object if the SID could be obtained, NULL otherwise
*/
struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
const char *domain)
{
@@ -138,7 +141,7 @@ struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx,
const struct ldb_val *v;
enum ndr_err_code ndr_err;
- ldb = secrets_db_connect(mem_ctx, lp_ctx);
+ ldb = secrets_db_connect(mem_ctx, ev_ctx, lp_ctx);
if (ldb == NULL) {
DEBUG(5, ("secrets_db_connect failed\n"));
return NULL;
diff --git a/source4/param/secrets.h b/source4/param/secrets.h
index bd6ff4a401..fa162ea66a 100644
--- a/source4/param/secrets.h
+++ b/source4/param/secrets.h
@@ -43,9 +43,10 @@ struct machine_acct_pass {
* @note Not called by systems with a working /dev/urandom.
*/
struct loadparm_context;
+struct event_context;
struct tdb_wrap *secrets_init(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx);
-struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx);
-struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *domain);
+struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx, struct loadparm_context *lp_ctx);
+struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx, struct loadparm_context *lp_ctx, const char *domain);
#endif /* _SECRETS_H */
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c
index 429c413b98..eb60f426d8 100644
--- a/source4/rpc_server/lsa/dcesrv_lsa.c
+++ b/source4/rpc_server/lsa/dcesrv_lsa.c
@@ -1757,7 +1757,7 @@ static NTSTATUS dcesrv_lsa_CreateSecret(struct dcesrv_call_state *dce_call, TALL
}
secret_state->sam_ldb = talloc_reference(secret_state,
- secrets_db_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
+ secrets_db_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx));
/* search for the secret record */
ret = gendb_search(secret_state->sam_ldb, mem_ctx,
ldb_dn_new(mem_ctx, secret_state->sam_ldb, "cn=LSA Secrets"),
@@ -1887,7 +1887,7 @@ static NTSTATUS dcesrv_lsa_OpenSecret(struct dcesrv_call_state *dce_call, TALLOC
} else {
secret_state->global = false;
secret_state->sam_ldb = talloc_reference(secret_state,
- secrets_db_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
+ secrets_db_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx));
name = r->in.name.string;
if (strlen(name) < 1) {
diff --git a/source4/torture/ldap/cldap.c b/source4/torture/ldap/cldap.c
index 5d4acd581b..1631297793 100644
--- a/source4/torture/ldap/cldap.c
+++ b/source4/torture/ldap/cldap.c
@@ -256,7 +256,7 @@ static void cldap_dump_results(struct cldap_search *search)
}
/* we need a ldb context to use ldb_ldif_write_file() */
- ldb = ldb_init(NULL);
+ ldb = ldb_init(NULL, NULL);
ZERO_STRUCT(ldif);
ldif.msg = ldap_msg_to_ldb(ldb, ldb, search->out.response);
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index bc92b4ebc2..97a5ca9d71 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -593,7 +593,7 @@ bool torture_net_become_dc(struct torture_context *torture)
s->ctx = libnet_context_init(torture->ev, torture->lp_ctx);
s->ctx->cred = cmdline_credentials;
- s->ldb = ldb_init(s);
+ s->ldb = ldb_init(s, torture->ev);
ZERO_STRUCT(b);
b.in.domain_dns_name = torture_join_dom_dns_name(s->tj);
@@ -691,7 +691,7 @@ cleanup:
}
/* Leave domain. */
- torture_leave_domain(s->tj);
+ torture_leave_domain(torture, s->tj);
talloc_free(s);
return ret;
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index 887c6f32ab..665a08bd5c 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -413,7 +413,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
torture_assert_int_equal(tctx, response->samlogon.nt5_ex.command, LOGON_SAM_LOGON_USER_UNKNOWN, "Got incorrect netlogon response command");
- torture_leave_domain(join_ctx);
+ torture_leave_domain(tctx, join_ctx);
return true;
}
@@ -604,7 +604,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
torture_assert_int_equal(tctx, response->response_type, NETLOGON_GET_PDC, "Got incorrect type of ntlogon response");
torture_assert_int_equal(tctx, response->get_pdc.command, NETLOGON_RESPONSE_FROM_PDC, "Got incorrect ntlogon response command");
- torture_leave_domain(join_ctx);
+ torture_leave_domain(tctx, join_ctx);
/* setup (another) temporary mailslot listener for replies */
dgmslot = dgram_mailslot_temp(dgmsock, NBT_MAILSLOT_GETDC,
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index 5e01c2050c..bbdb73ed55 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -709,7 +709,7 @@ bool torture_rpc_drsuapi(struct torture_context *torture)
&p,
&ndr_table_drsuapi);
if (!NT_STATUS_IS_OK(status)) {
- torture_leave_domain(priv.join);
+ torture_leave_domain(torture, priv.join);
torture_fail(torture, "Unable to connect to DRSUAPI pipe");
}
@@ -733,7 +733,7 @@ bool torture_rpc_drsuapi(struct torture_context *torture)
ret &= test_DsUnbind(p, torture, &priv);
- torture_leave_domain(priv.join);
+ torture_leave_domain(torture, priv.join);
return ret;
}
@@ -761,7 +761,7 @@ bool torture_rpc_drsuapi_cracknames(struct torture_context *torture)
&p,
&ndr_table_drsuapi);
if (!NT_STATUS_IS_OK(status)) {
- torture_leave_domain(priv.join);
+ torture_leave_domain(torture, priv.join);
torture_fail(torture, "Unable to connect to DRSUAPI pipe");
}
@@ -776,7 +776,7 @@ bool torture_rpc_drsuapi_cracknames(struct torture_context *torture)
ret &= test_DsUnbind(p, torture, &priv);
}
- torture_leave_domain(priv.join);
+ torture_leave_domain(torture, priv.join);
return ret;
}
diff --git a/source4/torture/rpc/drsuapi_cracknames.c b/source4/torture/rpc/drsuapi_cracknames.c
index 89d9b7bd34..fbda69df57 100644
--- a/source4/torture/rpc/drsuapi_cracknames.c
+++ b/source4/torture/rpc/drsuapi_cracknames.c
@@ -325,7 +325,7 @@ bool test_DsCrackNames(struct torture_context *tctx,
return ret;
}
- ldb = ldb_init(mem_ctx);
+ ldb = ldb_init(mem_ctx, tctx->ev);
realm_dn_str = r.out.ctr.ctr1->array[0].result_name;
realm_dn = ldb_dn_new(mem_ctx, ldb, realm_dn_str);
diff --git a/source4/torture/rpc/join.c b/source4/torture/rpc/join.c
index cd5eb32fa8..77da32d572 100644
--- a/source4/torture/rpc/join.c
+++ b/source4/torture/rpc/join.c
@@ -48,7 +48,7 @@ bool torture_rpc_join(struct torture_context *torture)
smbcli_tdis(cli);
/* Leave domain. */
- torture_leave_domain(tj);
+ torture_leave_domain(torture, tj);
/* Join domain as a domain controller. */
tj = torture_join_domain(torture, TORTURE_NETBIOS_NAME,
@@ -75,7 +75,7 @@ bool torture_rpc_join(struct torture_context *torture)
smbcli_tdis(cli);
/* Leave domain. */
- torture_leave_domain(tj);
+ torture_leave_domain(torture, tj);
return true;
}
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 04d13a97c1..a4e702f759 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -2280,7 +2280,7 @@ bool torture_rpc_lsa(struct torture_context *tctx)
ret = false;
}
- torture_leave_domain(join);
+ torture_leave_domain(tctx, join);
} else {
if (!test_many_LookupSids(p, tctx, handle)) {
diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c
index acc1220ccc..23867f2a77 100644
--- a/source4/torture/rpc/rpc.c
+++ b/source4/torture/rpc/rpc.c
@@ -33,7 +33,7 @@ static bool torture_rpc_teardown (struct torture_context *tcase,
struct torture_rpc_tcase_data *tcase_data =
(struct torture_rpc_tcase_data *)data;
if (tcase_data->join_ctx != NULL)
- torture_leave_domain(tcase_data->join_ctx);
+ torture_leave_domain(tcase, tcase_data->join_ctx);
talloc_free(tcase_data);
return true;
}
diff --git a/source4/torture/rpc/rpc.h b/source4/torture/rpc/rpc.h
index 48db814b7a..29b1ebee54 100644
--- a/source4/torture/rpc/rpc.h
+++ b/source4/torture/rpc/rpc.h
@@ -51,7 +51,7 @@ struct test_join *torture_join_domain(struct torture_context *tctx,
uint32_t acct_flags,
struct cli_credentials **machine_credentials);
const struct dom_sid *torture_join_sid(struct test_join *join);
-void torture_leave_domain(struct test_join *join);
+void torture_leave_domain(struct torture_context *tctx, struct test_join *join);
struct torture_rpc_tcase *torture_suite_add_rpc_iface_tcase(struct torture_suite *suite,
const char *name,
const struct ndr_interface_table *table);
diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c
index ab3283a952..e2558ff0a9 100644
--- a/source4/torture/rpc/samlogon.c
+++ b/source4/torture/rpc/samlogon.c
@@ -1847,9 +1847,9 @@ bool torture_rpc_samlogon(struct torture_context *torture)
failed:
talloc_free(mem_ctx);
- torture_leave_domain(join_ctx);
- torture_leave_domain(user_ctx);
- torture_leave_domain(user_ctx_wrong_wks);
- torture_leave_domain(user_ctx_wrong_time);
+ torture_leave_domain(torture, join_ctx);
+ torture_leave_domain(torture, user_ctx);
+ torture_leave_domain(torture, user_ctx_wrong_wks);
+ torture_leave_domain(torture, user_ctx_wrong_time);
return ret;
}
diff --git a/source4/torture/rpc/samr_accessmask.c b/source4/torture/rpc/samr_accessmask.c
index 97fe16101d..f496f6300c 100644
--- a/source4/torture/rpc/samr_accessmask.c
+++ b/source4/torture/rpc/samr_accessmask.c
@@ -639,7 +639,7 @@ static bool test_samr_connect(struct torture_context *tctx,
/* remove the test user */
- torture_leave_domain(testuser);
+ torture_leave_domain(tctx, testuser);
return ret;
}
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index 9705f7b0de..7114756460 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -1629,9 +1629,9 @@ bool torture_rpc_samsync(struct torture_context *torture)
}
failed:
- torture_leave_domain(join_ctx);
- torture_leave_domain(join_ctx2);
- torture_leave_domain(user_ctx);
+ torture_leave_domain(torture, join_ctx);
+ torture_leave_domain(torture, join_ctx2);
+ torture_leave_domain(torture, user_ctx);
talloc_free(mem_ctx);
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index a8f70b2ea9..fae0093e4d 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -385,7 +385,7 @@ static bool test_schannel(struct torture_context *tctx,
torture_assert(tctx, test_netlogon_ops(p_netlogon3, tctx, credentials, creds),
"Failed to processed NOT schannel secured NETLOGON ops without new ServerAuth");
- torture_leave_domain(join_ctx);
+ torture_leave_domain(tctx, join_ctx);
return true;
}
@@ -482,7 +482,7 @@ bool torture_rpc_schannel2(struct torture_context *torture)
if (!test_netlogon_ex_ops(p2, torture, credentials2, NULL))
return false;
- torture_leave_domain(join_ctx);
+ torture_leave_domain(torture, join_ctx);
return true;
}
@@ -829,7 +829,7 @@ bool torture_rpc_schannel_bench1(struct torture_context *torture)
(unsigned long long)s->total,
(unsigned)s->total/s->timelimit);
- torture_leave_domain(s->join_ctx1);
- torture_leave_domain(s->join_ctx2);
+ torture_leave_domain(torture, s->join_ctx1);
+ torture_leave_domain(torture, s->join_ctx2);
return true;
}
diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c
index 51efd99bd8..9fd9d2f0c6 100644
--- a/source4/torture/rpc/testjoin.c
+++ b/source4/torture/rpc/testjoin.c
@@ -246,7 +246,7 @@ again:
if (!NT_STATUS_IS_OK(status)) {
printf("SetUserInfo level %u - no session key - %s\n",
s.in.level, nt_errstr(status));
- torture_leave_domain(join);
+ torture_leave_domain(torture, join);
goto failed;
}
@@ -294,7 +294,7 @@ again:
return join;
failed:
- torture_leave_domain(join);
+ torture_leave_domain(torture, join);
return NULL;
}
@@ -425,7 +425,9 @@ struct policy_handle *torture_join_samr_user_policy(struct test_join *join)
return &join->user_handle;
}
-static NTSTATUS torture_leave_ads_domain(TALLOC_CTX *mem_ctx, struct libnet_JoinDomain *libnet_r)
+static NTSTATUS torture_leave_ads_domain(struct torture_context *torture,
+ TALLOC_CTX *mem_ctx,
+ struct libnet_JoinDomain *libnet_r)
{
int rtn;
TALLOC_CTX *tmp_ctx;
@@ -446,7 +448,7 @@ static NTSTATUS torture_leave_ads_domain(TALLOC_CTX *mem_ctx, struct libnet_Join
return NT_STATUS_NO_MEMORY;
}
- ldb_ctx = ldb_init(tmp_ctx);
+ ldb_ctx = ldb_init(tmp_ctx, torture->ev);
if (!ldb_ctx) {
libnet_r->out.error_string = NULL;
talloc_free(tmp_ctx);
@@ -494,7 +496,7 @@ static NTSTATUS torture_leave_ads_domain(TALLOC_CTX *mem_ctx, struct libnet_Join
leave the domain, deleting the machine acct
*/
-_PUBLIC_ void torture_leave_domain(struct test_join *join)
+_PUBLIC_ void torture_leave_domain(struct torture_context *torture, struct test_join *join)
{
struct samr_DeleteUser d;
NTSTATUS status;
@@ -504,8 +506,8 @@ _PUBLIC_ void torture_leave_domain(struct test_join *join)
}
d.in.user_handle = &join->user_handle;
d.out.user_handle = &join->user_handle;
-
- /* Delete machine account */
+
+ /* Delete machine account */
status = dcerpc_samr_DeleteUser(join->p, join, &d);
if (!NT_STATUS_IS_OK(status)) {
printf("Delete of machine account %s failed\n",
@@ -516,7 +518,7 @@ _PUBLIC_ void torture_leave_domain(struct test_join *join)
}
if (join->libnet_r) {
- status = torture_leave_ads_domain(join, join->libnet_r);
+ status = torture_leave_ads_domain(torture, join, join->libnet_r);
}
talloc_free(join);
diff --git a/source4/winbind/wb_server.c b/source4/winbind/wb_server.c
index f84dece11c..14d62b8568 100644
--- a/source4/winbind/wb_server.c
+++ b/source4/winbind/wb_server.c
@@ -141,6 +141,7 @@ static void winbind_task_init(struct task_server *task)
service->task = task;
service->primary_sid = secrets_get_domain_sid(service,
+ task->event_ctx,
task->lp_ctx,
lp_workgroup(task->lp_ctx));
if (service->primary_sid == NULL) {