summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/auth/auth_sam.c2
-rw-r--r--source4/auth/auth_simple.c2
-rw-r--r--source4/auth/credentials/credentials.c22
-rw-r--r--source4/auth/credentials/credentials.h16
-rw-r--r--source4/auth/credentials/credentials_files.c14
-rw-r--r--source4/auth/credentials/credentials_krb5.c35
-rw-r--r--source4/auth/credentials/credentials_krb5.h1
-rw-r--r--source4/auth/gensec/gensec_gssapi.c14
-rw-r--r--source4/auth/gensec/gensec_krb5.c16
-rw-r--r--source4/auth/gensec/schannel.c5
-rw-r--r--source4/auth/gensec/schannel_state.c11
-rw-r--r--source4/auth/ntlmssp/ntlmssp_server.c2
-rw-r--r--source4/auth/sam.c3
-rw-r--r--source4/auth/session.c8
-rw-r--r--source4/auth/session.h3
-rw-r--r--source4/cldap_server/cldap_server.c2
-rw-r--r--source4/client/client.c3
-rw-r--r--source4/dsdb/common/sidmap.c5
-rw-r--r--source4/dsdb/repl/drepl_service.c2
-rw-r--r--source4/dsdb/samdb/cracknames.c6
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c3
-rw-r--r--source4/dsdb/samdb/ldb_modules/update_keytab.c4
-rw-r--r--source4/dsdb/samdb/samdb.c13
-rw-r--r--source4/dsdb/samdb/samdb.h1
-rw-r--r--source4/dsdb/samdb/samdb_privilege.c5
-rw-r--r--source4/kdc/hdb-ldb.c6
-rw-r--r--source4/kdc/kdc.c2
-rw-r--r--source4/kdc/kpasswdd.c6
-rw-r--r--source4/ldap_server/ldap_backend.c2
-rw-r--r--source4/ldap_server/ldap_bind.c2
-rw-r--r--source4/ldap_server/ldap_server.c5
-rw-r--r--source4/lib/appweb/mpr/miniMpr.c6
-rw-r--r--source4/lib/appweb/mpr/miniMpr.h2
-rw-r--r--source4/lib/ldb_wrap.c9
-rw-r--r--source4/lib/ldb_wrap.h2
-rw-r--r--source4/lib/registry/hive.c3
-rw-r--r--source4/lib/registry/ldb.c3
-rw-r--r--source4/lib/registry/registry.h4
-rw-r--r--source4/lib/registry/registry.i5
-rw-r--r--source4/lib/registry/registry.py1
-rw-r--r--source4/lib/registry/registry_wrap.c170
-rw-r--r--source4/lib/registry/samba.c14
-rw-r--r--source4/lib/registry/tests/hive.c2
-rw-r--r--source4/lib/registry/tests/registry.c2
-rw-r--r--source4/lib/registry/tools/common.c9
-rw-r--r--source4/lib/registry/tools/regdiff.c10
-rw-r--r--source4/lib/registry/tools/regpatch.c6
-rw-r--r--source4/lib/registry/tools/regshell.c7
-rw-r--r--source4/lib/registry/tools/regtree.c7
-rw-r--r--source4/libnet/libnet_become_dc.c2
-rw-r--r--source4/libnet/libnet_join.c2
-rw-r--r--source4/libnet/libnet_samdump_keytab.c7
-rw-r--r--source4/libnet/libnet_samsync_ldb.c2
-rw-r--r--source4/libnet/libnet_unbecome_dc.c2
-rw-r--r--source4/libnet/libnet_vampire.c7
-rw-r--r--source4/librpc/rpc/dcerpc_util.c15
-rw-r--r--source4/nbt_server/dgram/netlogon.c4
-rw-r--r--source4/nbt_server/nbt_server.c2
-rw-r--r--source4/nbt_server/wins/winsdb.c13
-rw-r--r--source4/nbt_server/wins/winsserver.c3
-rw-r--r--source4/ntptr/ntptr.h1
-rw-r--r--source4/ntptr/ntptr_base.c4
-rw-r--r--source4/ntptr/simple_ldb/ntptr_simple_ldb.c6
-rw-r--r--source4/ntvfs/cifs/vfs_cifs.c2
-rw-r--r--source4/ntvfs/common/notify.c4
-rw-r--r--source4/ntvfs/ipc/ipc_rap.c11
-rw-r--r--source4/ntvfs/ipc/rap_server.c3
-rw-r--r--source4/ntvfs/ipc/vfs_ipc.c2
-rw-r--r--source4/ntvfs/posix/vfs_posix.c2
-rw-r--r--source4/ntvfs/sysdep/sys_lease.c2
-rw-r--r--source4/ntvfs/sysdep/sys_notify.c2
-rw-r--r--source4/param/share.c3
-rw-r--r--source4/param/share.h5
-rw-r--r--source4/param/share_classic.c1
-rw-r--r--source4/param/share_ldb.c6
-rw-r--r--source4/param/tests/share.c4
-rw-r--r--source4/rpc_server/common/server_info.c4
-rw-r--r--source4/rpc_server/drsuapi/dcesrv_drsuapi.c2
-rw-r--r--source4/rpc_server/lsa/lsa_init.c2
-rw-r--r--source4/rpc_server/lsa/lsa_lookup.c15
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c29
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c4
-rw-r--r--source4/rpc_server/samr/samr_password.c6
-rw-r--r--source4/rpc_server/service_rpc.c2
-rw-r--r--source4/rpc_server/spoolss/dcesrv_spoolss.c2
-rw-r--r--source4/rpc_server/srvsvc/dcesrv_srvsvc.c20
-rw-r--r--source4/rpc_server/srvsvc/srvsvc_ntvfs.c2
-rw-r--r--source4/rpc_server/winreg/rpc_winreg.c2
-rw-r--r--source4/scripting/ejs/ejsnet/net_ctx.c2
-rw-r--r--source4/scripting/ejs/smbcalls_auth.c4
-rw-r--r--source4/scripting/ejs/smbcalls_ldb.c2
-rw-r--r--source4/scripting/ejs/smbcalls_nbt.c2
-rw-r--r--source4/scripting/ejs/smbcalls_reg.c2
-rw-r--r--source4/scripting/ejs/smbcalls_rpc.c4
-rw-r--r--source4/smb_server/smb/sesssetup.c5
-rw-r--r--source4/smb_server/smb_server.c3
-rw-r--r--source4/torture/config.mk33
-rw-r--r--source4/torture/ldap/cldapbench.c2
-rw-r--r--source4/torture/ldap/schema.c2
-rw-r--r--source4/torture/ldap/uptodatevector.c2
-rw-r--r--source4/torture/libnet/domain.c4
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c4
-rw-r--r--source4/torture/local/dbspeed.c2
-rw-r--r--source4/torture/nbt/dgram.c6
-rw-r--r--source4/torture/raw/lockbench.c9
-rw-r--r--source4/torture/raw/offline.c13
-rw-r--r--source4/torture/raw/open.c10
-rw-r--r--source4/torture/raw/openbench.c9
-rw-r--r--source4/torture/raw/oplock.c3
-rw-r--r--source4/torture/rpc/async_bind.c7
-rw-r--r--source4/torture/rpc/schannel.c6
-rw-r--r--source4/torture/smb2/scan.c4
-rw-r--r--source4/torture/smb2/util.c2
-rw-r--r--source4/torture/smbtorture.c2
-rw-r--r--source4/torture/ui.c3
-rw-r--r--source4/utils/net/net.c1
-rw-r--r--source4/winbind/idmap.c3
-rw-r--r--source4/winbind/idmap.h2
-rw-r--r--source4/winbind/wb_init_domain.c2
-rw-r--r--source4/winbind/wb_samba3_cmd.c2
-rw-r--r--source4/winbind/wb_server.c2
-rw-r--r--source4/wrepl_server/wrepl_server.c7
122 files changed, 491 insertions, 365 deletions
diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c
index 4b467cee75..731e489ba0 100644
--- a/source4/auth/auth_sam.c
+++ b/source4/auth/auth_sam.c
@@ -289,7 +289,7 @@ static NTSTATUS authsam_check_password_internals(struct auth_method_context *ctx
return NT_STATUS_NO_MEMORY;
}
- sam_ctx = samdb_connect(tmp_ctx, ctx->auth_ctx->lp_ctx, system_session(mem_ctx, ctx->auth_ctx->lp_ctx));
+ sam_ctx = samdb_connect(tmp_ctx, ctx->auth_ctx->event_ctx, ctx->auth_ctx->lp_ctx, system_session(mem_ctx, ctx->auth_ctx->lp_ctx));
if (sam_ctx == NULL) {
talloc_free(tmp_ctx);
return NT_STATUS_INVALID_SYSTEM_SERVICE;
diff --git a/source4/auth/auth_simple.c b/source4/auth/auth_simple.c
index 50be02a353..e7039c3657 100644
--- a/source4/auth/auth_simple.c
+++ b/source4/auth/auth_simple.c
@@ -90,7 +90,7 @@ _PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx,
}
if (session_info) {
- nt_status = auth_generate_session_info(tmp_ctx, lp_ctx, server_info, session_info);
+ nt_status = auth_generate_session_info(tmp_ctx, ev, lp_ctx, server_info, session_info);
if (NT_STATUS_IS_OK(nt_status)) {
talloc_steal(mem_ctx, *session_info);
diff --git a/source4/auth/credentials/credentials.c b/source4/auth/credentials/credentials.c
index 89dddc9e05..bfed451689 100644
--- a/source4/auth/credentials/credentials.c
+++ b/source4/auth/credentials/credentials.c
@@ -65,7 +65,6 @@ _PUBLIC_ struct cli_credentials *cli_credentials_init(TALLOC_CTX *mem_ctx)
cred->tries = 3;
cred->callback_running = false;
- cred->ev = NULL;
cli_credentials_set_kerberos_state(cred, CRED_AUTO_USE_KERBEROS);
cli_credentials_set_gensec_features(cred, 0);
@@ -675,7 +674,7 @@ _PUBLIC_ void cli_credentials_guess(struct cli_credentials *cred,
}
if (cli_credentials_get_kerberos_state(cred) != CRED_DONT_USE_KERBEROS) {
- cli_credentials_set_ccache(cred, lp_ctx, NULL, CRED_GUESS_FILE);
+ cli_credentials_set_ccache(cred, event_context_find(cred), lp_ctx, NULL, CRED_GUESS_FILE);
}
}
@@ -775,22 +774,3 @@ _PUBLIC_ bool cli_credentials_wrong_password(struct cli_credentials *cred)
return (cred->tries > 0);
}
-
-/*
- set the common event context for this set of credentials
- */
-_PUBLIC_ void cli_credentials_set_event_context(struct cli_credentials *cred, struct event_context *ev)
-{
- cred->ev = ev;
-}
-
-/*
- set the common event context for this set of credentials
- */
-_PUBLIC_ struct event_context *cli_credentials_get_event_context(struct cli_credentials *cred)
-{
- if (cred->ev == NULL) {
- cred->ev = event_context_find(cred);
- }
- return cred->ev;
-}
diff --git a/source4/auth/credentials/credentials.h b/source4/auth/credentials/credentials.h
index afcb300638..2514b5b1ce 100644
--- a/source4/auth/credentials/credentials.h
+++ b/source4/auth/credentials/credentials.h
@@ -26,6 +26,7 @@
#include "librpc/gen_ndr/misc.h"
struct ccache_container;
+struct event_context;
/* In order of priority */
enum credentials_obtained {
@@ -121,9 +122,6 @@ struct cli_credentials {
/* Whether any callback is currently running */
bool callback_running;
-
- /* an event context for anyone wanting to use the credentials */
- struct event_context *ev;
};
struct ldb_context;
@@ -152,12 +150,15 @@ NTSTATUS cli_credentials_get_ntlm_response(struct cli_credentials *cred, TALLOC_
const char *cli_credentials_get_realm(struct cli_credentials *cred);
const char *cli_credentials_get_username(struct cli_credentials *cred);
int cli_credentials_get_krb5_context(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct smb_krb5_context **smb_krb5_context);
int cli_credentials_get_ccache(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct ccache_container **ccc);
int cli_credentials_get_keytab(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct keytab_container **_ktc);
const char *cli_credentials_get_domain(struct cli_credentials *cred);
@@ -168,15 +169,15 @@ void cli_credentials_set_conf(struct cli_credentials *cred,
struct loadparm_context *lp_ctx);
const char *cli_credentials_get_principal(struct cli_credentials *cred, TALLOC_CTX *mem_ctx);
int cli_credentials_get_server_gss_creds(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct gssapi_creds_container **_gcc);
int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct gssapi_creds_container **_gcc);
-void cli_credentials_set_event_context(struct cli_credentials *cred, struct event_context *ev);
void cli_credentials_set_kerberos_state(struct cli_credentials *creds,
enum credentials_use_kerberos use_kerberos);
-struct event_context *cli_credentials_get_event_context(struct cli_credentials *cred);
bool cli_credentials_set_domain(struct cli_credentials *cred,
const char *val,
enum credentials_obtained obtained);
@@ -199,6 +200,7 @@ void cli_credentials_set_netlogon_creds(struct cli_credentials *cred,
NTSTATUS cli_credentials_set_krb5_context(struct cli_credentials *cred,
struct smb_krb5_context *smb_krb5_context);
NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *serviceprincipal);
NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cred,
@@ -220,14 +222,17 @@ bool cli_credentials_set_nt_hash(struct cli_credentials *cred,
const struct samr_Password *nt_hash,
enum credentials_obtained obtained);
int cli_credentials_set_keytab_name(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *keytab_name,
enum credentials_obtained obtained);
int cli_credentials_update_keytab(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx);
void cli_credentials_set_gensec_features(struct cli_credentials *creds, uint32_t gensec_features);
uint32_t cli_credentials_get_gensec_features(struct cli_credentials *creds);
int cli_credentials_set_ccache(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *name,
enum credentials_obtained obtained);
@@ -239,6 +244,7 @@ void cli_credentials_invalidate_ccache(struct cli_credentials *cred,
void cli_credentials_set_salt_principal(struct cli_credentials *cred, const char *principal);
enum credentials_use_kerberos cli_credentials_get_kerberos_state(struct cli_credentials *creds);
NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct ldb_context *ldb,
const char *base,
diff --git a/source4/auth/credentials/credentials_files.c b/source4/auth/credentials/credentials_files.c
index 1bbdf8a5ad..ab76ea2cde 100644
--- a/source4/auth/credentials/credentials_files.c
+++ b/source4/auth/credentials/credentials_files.c
@@ -30,6 +30,7 @@
#include "auth/credentials/credentials.h"
#include "auth/credentials/credentials_krb5.h"
#include "param/param.h"
+#include "lib/events/events.h"
/**
* Read a file descriptor, and parse it for a password (eg from a file or stdin)
@@ -169,6 +170,7 @@ _PUBLIC_ bool cli_credentials_parse_file(struct cli_credentials *cred, const cha
* @retval NTSTATUS error detailing any failure
*/
_PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct ldb_context *ldb,
const char *base,
@@ -305,13 +307,13 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
* (chewing CPU time) from the password */
keytab = ldb_msg_find_attr_as_string(msgs[0], "krb5Keytab", NULL);
if (keytab) {
- cli_credentials_set_keytab_name(cred, lp_ctx, keytab, CRED_SPECIFIED);
+ cli_credentials_set_keytab_name(cred, event_ctx, lp_ctx, keytab, CRED_SPECIFIED);
} else {
keytab = ldb_msg_find_attr_as_string(msgs[0], "privateKeytab", NULL);
if (keytab) {
keytab = talloc_asprintf(mem_ctx, "FILE:%s", private_path(mem_ctx, lp_ctx, keytab));
if (keytab) {
- cli_credentials_set_keytab_name(cred, lp_ctx, keytab, CRED_SPECIFIED);
+ cli_credentials_set_keytab_name(cred, event_ctx, lp_ctx, keytab, CRED_SPECIFIED);
}
}
}
@@ -336,7 +338,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cr
cred->machine_account_pending = false;
filter = talloc_asprintf(cred, SECRETS_PRIMARY_DOMAIN_FILTER,
cli_credentials_get_domain(cred));
- return cli_credentials_set_secrets(cred, lp_ctx, NULL,
+ return cli_credentials_set_secrets(cred, event_context_find(cred), lp_ctx, NULL,
SECRETS_PRIMARY_DOMAIN_DN,
filter);
}
@@ -348,6 +350,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cr
* @retval NTSTATUS error detailing any failure
*/
NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx)
{
char *filter;
@@ -358,7 +361,7 @@ NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred,
filter = talloc_asprintf(cred, SECRETS_KRBTGT_SEARCH,
cli_credentials_get_realm(cred),
cli_credentials_get_domain(cred));
- return cli_credentials_set_secrets(cred, lp_ctx, NULL,
+ return cli_credentials_set_secrets(cred, event_ctx, lp_ctx, NULL,
SECRETS_PRINCIPALS_DN,
filter);
}
@@ -370,6 +373,7 @@ NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred,
* @retval NTSTATUS error detailing any failure
*/
_PUBLIC_ NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *serviceprincipal)
{
@@ -382,7 +386,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *c
cli_credentials_get_realm(cred),
cli_credentials_get_domain(cred),
serviceprincipal);
- return cli_credentials_set_secrets(cred, lp_ctx, NULL,
+ return cli_credentials_set_secrets(cred, event_ctx, lp_ctx, NULL,
SECRETS_PRINCIPALS_DN, filter);
}
diff --git a/source4/auth/credentials/credentials_krb5.c b/source4/auth/credentials/credentials_krb5.c
index cd9285b09d..3bc1764448 100644
--- a/source4/auth/credentials/credentials_krb5.c
+++ b/source4/auth/credentials/credentials_krb5.c
@@ -30,6 +30,7 @@
#include "param/param.h"
_PUBLIC_ int cli_credentials_get_krb5_context(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct smb_krb5_context **smb_krb5_context)
{
@@ -39,8 +40,7 @@ _PUBLIC_ int cli_credentials_get_krb5_context(struct cli_credentials *cred,
return 0;
}
- ret = smb_krb5_init_context(cred, cli_credentials_get_event_context(cred),
- lp_ctx, &cred->smb_krb5_context);
+ ret = smb_krb5_init_context(cred, event_ctx, lp_ctx, &cred->smb_krb5_context);
if (ret) {
cred->smb_krb5_context = NULL;
return ret;
@@ -128,6 +128,7 @@ static int free_dccache(struct ccache_container *ccc) {
}
_PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *name,
enum credentials_obtained obtained)
@@ -144,7 +145,7 @@ _PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred,
return ENOMEM;
}
- ret = cli_credentials_get_krb5_context(cred, lp_ctx,
+ ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx,
&ccc->smb_krb5_context);
if (ret) {
talloc_free(ccc);
@@ -203,6 +204,7 @@ _PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred,
static int cli_credentials_new_ccache(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct ccache_container **_ccc)
{
@@ -221,7 +223,7 @@ static int cli_credentials_new_ccache(struct cli_credentials *cred,
return ENOMEM;
}
- ret = cli_credentials_get_krb5_context(cred, lp_ctx,
+ ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx,
&ccc->smb_krb5_context);
if (ret) {
talloc_free(ccc);
@@ -253,6 +255,7 @@ static int cli_credentials_new_ccache(struct cli_credentials *cred,
}
_PUBLIC_ int cli_credentials_get_ccache(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct ccache_container **ccc)
{
@@ -271,7 +274,7 @@ _PUBLIC_ int cli_credentials_get_ccache(struct cli_credentials *cred,
return EINVAL;
}
- ret = cli_credentials_new_ccache(cred, lp_ctx, ccc);
+ ret = cli_credentials_new_ccache(cred, event_ctx, lp_ctx, ccc);
if (ret) {
return ret;
}
@@ -348,6 +351,7 @@ static int free_gssapi_creds(struct gssapi_creds_container *gcc)
}
_PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct gssapi_creds_container **_gcc)
{
@@ -360,7 +364,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
*_gcc = cred->client_gss_creds;
return 0;
}
- ret = cli_credentials_get_ccache(cred, lp_ctx,
+ ret = cli_credentials_get_ccache(cred, event_ctx, lp_ctx,
&ccache);
if (ret) {
DEBUG(1, ("Failed to get CCACHE for GSSAPI client: %s\n", error_message(ret)));
@@ -402,6 +406,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
*/
int cli_credentials_set_client_gss_creds(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
gss_cred_id_t gssapi_cred,
enum credentials_obtained obtained)
@@ -419,7 +424,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
return ENOMEM;
}
- ret = cli_credentials_new_ccache(cred, lp_ctx, &ccc);
+ ret = cli_credentials_new_ccache(cred, event_ctx, lp_ctx, &ccc);
if (ret != 0) {
return ret;
}
@@ -456,6 +461,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
* it will be generated from the password.
*/
_PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct keytab_container **_ktc)
{
@@ -475,7 +481,7 @@ _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred,
return EINVAL;
}
- ret = cli_credentials_get_krb5_context(cred, lp_ctx,
+ ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx,
&smb_krb5_context);
if (ret) {
return ret;
@@ -510,6 +516,7 @@ _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred,
* FILE:/etc/krb5.keytab), open it and attach it */
_PUBLIC_ int cli_credentials_set_keytab_name(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *keytab_name,
enum credentials_obtained obtained)
@@ -523,7 +530,7 @@ _PUBLIC_ int cli_credentials_set_keytab_name(struct cli_credentials *cred,
return 0;
}
- ret = cli_credentials_get_krb5_context(cred, lp_ctx, &smb_krb5_context);
+ ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context);
if (ret) {
return ret;
}
@@ -549,6 +556,7 @@ _PUBLIC_ int cli_credentials_set_keytab_name(struct cli_credentials *cred,
}
_PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx)
{
krb5_error_code ret;
@@ -562,7 +570,7 @@ _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred,
return ENOMEM;
}
- ret = cli_credentials_get_krb5_context(cred, lp_ctx, &smb_krb5_context);
+ ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context);
if (ret) {
talloc_free(mem_ctx);
return ret;
@@ -570,7 +578,7 @@ _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred,
enctype_strings = cli_credentials_get_enctype_strings(cred);
- ret = cli_credentials_get_keytab(cred, lp_ctx, &ktc);
+ ret = cli_credentials_get_keytab(cred, event_ctx, lp_ctx, &ktc);
if (ret != 0) {
talloc_free(mem_ctx);
return ret;
@@ -585,6 +593,7 @@ _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred,
/* Get server gss credentials (in gsskrb5, this means the keytab) */
_PUBLIC_ int cli_credentials_get_server_gss_creds(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct gssapi_creds_container **_gcc)
{
@@ -603,12 +612,12 @@ _PUBLIC_ int cli_credentials_get_server_gss_creds(struct cli_credentials *cred,
return 0;
}
- ret = cli_credentials_get_krb5_context(cred, lp_ctx, &smb_krb5_context);
+ ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context);
if (ret) {
return ret;
}
- ret = cli_credentials_get_keytab(cred, lp_ctx, &ktc);
+ ret = cli_credentials_get_keytab(cred, event_ctx, lp_ctx, &ktc);
if (ret) {
DEBUG(1, ("Failed to get keytab for GSSAPI server: %s\n", error_message(ret)));
return ret;
diff --git a/source4/auth/credentials/credentials_krb5.h b/source4/auth/credentials/credentials_krb5.h
index aaa7d7f0da..f672b0ad9a 100644
--- a/source4/auth/credentials/credentials_krb5.h
+++ b/source4/auth/credentials/credentials_krb5.h
@@ -32,6 +32,7 @@ struct gssapi_creds_container {
/* Manually prototyped here to avoid needing gss headers in most callers */
int cli_credentials_set_client_gss_creds(struct cli_credentials *cred,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
gss_cred_id_t gssapi_cred,
enum credentials_obtained obtained);
diff --git a/source4/auth/gensec/gensec_gssapi.c b/source4/auth/gensec/gensec_gssapi.c
index e7dcb4ea68..cc0d40469e 100644
--- a/source4/auth/gensec/gensec_gssapi.c
+++ b/source4/auth/gensec/gensec_gssapi.c
@@ -273,7 +273,9 @@ static NTSTATUS gensec_gssapi_server_start(struct gensec_security *gensec_securi
DEBUG(3, ("No machine account credentials specified\n"));
return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
} else {
- ret = cli_credentials_get_server_gss_creds(machine_account, gensec_security->lp_ctx, &gcc);
+ ret = cli_credentials_get_server_gss_creds(machine_account,
+ gensec_security->event_ctx,
+ gensec_security->lp_ctx, &gcc);
if (ret) {
DEBUG(1, ("Aquiring acceptor credentials failed: %s\n",
error_message(ret)));
@@ -359,7 +361,9 @@ static NTSTATUS gensec_gssapi_client_start(struct gensec_security *gensec_securi
return NT_STATUS_INVALID_PARAMETER;
}
- ret = cli_credentials_get_client_gss_creds(creds, gensec_security->lp_ctx, &gcc);
+ ret = cli_credentials_get_client_gss_creds(creds,
+ gensec_security->event_ctx,
+ gensec_security->lp_ctx, &gcc);
switch (ret) {
case 0:
break;
@@ -1323,7 +1327,7 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi
} else if (!lp_parm_bool(gensec_security->lp_ctx, NULL, "gensec", "require_pac", false)) {
DEBUG(1, ("Unable to find PAC, resorting to local user lookup: %s\n",
gssapi_error_string(mem_ctx, maj_stat, min_stat, gensec_gssapi_state->gss_oid)));
- nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->lp_ctx, principal_string,
+ nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, principal_string,
&server_info);
if (!NT_STATUS_IS_OK(nt_status)) {
@@ -1338,7 +1342,7 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi
}
/* references the server_info into the session_info */
- nt_status = auth_generate_session_info(mem_ctx, gensec_security->lp_ctx, server_info, &session_info);
+ nt_status = auth_generate_session_info(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, server_info, &session_info);
if (!NT_STATUS_IS_OK(nt_status)) {
talloc_free(mem_ctx);
return nt_status;
@@ -1361,12 +1365,12 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi
return NT_STATUS_NO_MEMORY;
}
- cli_credentials_set_event_context(session_info->credentials, gensec_security->event_ctx);
cli_credentials_set_conf(session_info->credentials, gensec_security->lp_ctx);
/* Just so we don't segfault trying to get at a username */
cli_credentials_set_anonymous(session_info->credentials);
ret = cli_credentials_set_client_gss_creds(session_info->credentials,
+ gensec_security->event_ctx,
gensec_security->lp_ctx,
gensec_gssapi_state->delegated_cred_handle,
CRED_SPECIFIED);
diff --git a/source4/auth/gensec/gensec_krb5.c b/source4/auth/gensec/gensec_krb5.c
index ae601b19c2..47df2ccfcc 100644
--- a/source4/auth/gensec/gensec_krb5.c
+++ b/source4/auth/gensec/gensec_krb5.c
@@ -118,7 +118,9 @@ static NTSTATUS gensec_krb5_start(struct gensec_security *gensec_security)
talloc_set_destructor(gensec_krb5_state, gensec_krb5_destroy);
- if (cli_credentials_get_krb5_context(creds, gensec_security->lp_ctx, &gensec_krb5_state->smb_krb5_context)) {
+ if (cli_credentials_get_krb5_context(creds,
+ gensec_security->event_ctx,
+ gensec_security->lp_ctx, &gensec_krb5_state->smb_krb5_context)) {
talloc_free(gensec_krb5_state);
return NT_STATUS_INTERNAL_ERROR;
}
@@ -248,7 +250,9 @@ static NTSTATUS gensec_krb5_client_start(struct gensec_security *gensec_security
principal = gensec_get_target_principal(gensec_security);
- ret = cli_credentials_get_ccache(gensec_get_credentials(gensec_security), gensec_security->lp_ctx, &ccache_container);
+ ret = cli_credentials_get_ccache(gensec_get_credentials(gensec_security),
+ gensec_security->event_ctx,
+ gensec_security->lp_ctx, &ccache_container);
switch (ret) {
case 0:
break;
@@ -446,7 +450,9 @@ static NTSTATUS gensec_krb5_update(struct gensec_security *gensec_security,
}
/* Grab the keytab, however generated */
- ret = cli_credentials_get_keytab(gensec_get_credentials(gensec_security), gensec_security->lp_ctx, &keytab);
+ ret = cli_credentials_get_keytab(gensec_get_credentials(gensec_security),
+ gensec_security->event_ctx,
+ gensec_security->lp_ctx, &keytab);
if (ret) {
return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
}
@@ -597,7 +603,7 @@ static NTSTATUS gensec_krb5_session_info(struct gensec_security *gensec_security
DEBUG(5, ("krb5_ticket_get_authorization_data_type failed to find PAC: %s\n",
smb_get_krb5_error_message(context,
ret, mem_ctx)));
- nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->lp_ctx, principal_string,
+ nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, principal_string,
&server_info);
krb5_free_principal(context, client_principal);
free(principal_string);
@@ -645,7 +651,7 @@ static NTSTATUS gensec_krb5_session_info(struct gensec_security *gensec_security
}
/* references the server_info into the session_info */
- nt_status = auth_generate_session_info(mem_ctx, gensec_security->lp_ctx, server_info, &session_info);
+ nt_status = auth_generate_session_info(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, server_info, &session_info);
if (!NT_STATUS_IS_OK(nt_status)) {
talloc_free(mem_ctx);
diff --git a/source4/auth/gensec/schannel.c b/source4/auth/gensec/schannel.c
index b3117ee9b2..f21202b86f 100644
--- a/source4/auth/gensec/schannel.c
+++ b/source4/auth/gensec/schannel.c
@@ -125,7 +125,8 @@ static NTSTATUS schannel_update(struct gensec_security *gensec_security, TALLOC_
}
/* pull the session key for this client */
- status = schannel_fetch_session_key(out_mem_ctx, gensec_security->lp_ctx, workstation,
+ status = schannel_fetch_session_key(out_mem_ctx, gensec_security->event_ctx,
+ gensec_security->lp_ctx, workstation,
domain, &creds);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("Could not find session key for attempted schannel connection from %s: %s\n",
@@ -189,7 +190,7 @@ static NTSTATUS schannel_session_info(struct gensec_security *gensec_security,
struct auth_session_info **_session_info)
{
struct schannel_state *state = talloc_get_type(gensec_security->private_data, struct schannel_state);
- return auth_anonymous_session_info(state, gensec_security->lp_ctx, _session_info);
+ return auth_anonymous_session_info(state, gensec_security->event_ctx, gensec_security->lp_ctx, _session_info);
}
static NTSTATUS schannel_start(struct gensec_security *gensec_security)
diff --git a/source4/auth/gensec/schannel_state.c b/source4/auth/gensec/schannel_state.c
index 0c7c509954..0f7c4ca11d 100644
--- a/source4/auth/gensec/schannel_state.c
+++ b/source4/auth/gensec/schannel_state.c
@@ -32,7 +32,8 @@
/**
connect to the schannel ldb
*/
-struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
+struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx)
{
char *path;
struct ldb_context *ldb;
@@ -49,7 +50,7 @@ struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_con
existed = file_exist(path);
- ldb = ldb_wrap_connect(mem_ctx, lp_ctx, path,
+ ldb = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, path,
system_session(mem_ctx, lp_ctx),
NULL, LDB_FLG_NOSYNC, NULL);
talloc_free(path);
@@ -137,6 +138,7 @@ NTSTATUS schannel_store_session_key_ldb(TALLOC_CTX *mem_ctx,
}
NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct creds_CredentialState *creds)
{
@@ -144,7 +146,7 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
NTSTATUS nt_status;
int ret;
- ldb = schannel_db_connect(mem_ctx, lp_ctx);
+ ldb = schannel_db_connect(mem_ctx, ev_ctx, lp_ctx);
if (!ldb) {
return NT_STATUS_ACCESS_DENIED;
}
@@ -268,6 +270,7 @@ NTSTATUS schannel_fetch_session_key_ldb(TALLOC_CTX *mem_ctx,
}
NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
const char *computer_name,
const char *domain,
@@ -276,7 +279,7 @@ NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
NTSTATUS nt_status;
struct ldb_context *ldb;
- ldb = schannel_db_connect(mem_ctx, lp_ctx);
+ ldb = schannel_db_connect(mem_ctx, ev_ctx, lp_ctx);
if (!ldb) {
return NT_STATUS_ACCESS_DENIED;
}
diff --git a/source4/auth/ntlmssp/ntlmssp_server.c b/source4/auth/ntlmssp/ntlmssp_server.c
index 12802b7e79..d8ef2a20b8 100644
--- a/source4/auth/ntlmssp/ntlmssp_server.c
+++ b/source4/auth/ntlmssp/ntlmssp_server.c
@@ -725,7 +725,7 @@ NTSTATUS gensec_ntlmssp_session_info(struct gensec_security *gensec_security,
NTSTATUS nt_status;
struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data;
- nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_security->lp_ctx, gensec_ntlmssp_state->server_info, session_info);
+ nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_security->event_ctx, gensec_security->lp_ctx, gensec_ntlmssp_state->server_info, session_info);
NT_STATUS_NOT_OK_RETURN(nt_status);
(*session_info)->session_key = data_blob_talloc(*session_info,
diff --git a/source4/auth/sam.c b/source4/auth/sam.c
index ed44754993..a2090afcdc 100644
--- a/source4/auth/sam.c
+++ b/source4/auth/sam.c
@@ -428,6 +428,7 @@ NTSTATUS sam_get_results_principal(struct ldb_context *sam_ctx,
/* Used in the gensec_gssapi and gensec_krb5 server-side code, where the PAC isn't available */
NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *principal,
struct auth_serversupplied_info **server_info)
@@ -445,7 +446,7 @@ NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
- sam_ctx = samdb_connect(tmp_ctx, lp_ctx, system_session(tmp_ctx, lp_ctx));
+ sam_ctx = samdb_connect(tmp_ctx, event_ctx, lp_ctx, system_session(tmp_ctx, lp_ctx));
if (sam_ctx == NULL) {
talloc_free(tmp_ctx);
return NT_STATUS_INVALID_SYSTEM_SERVICE;
diff --git a/source4/auth/session.c b/source4/auth/session.c
index 112eac95d8..8f5e8d6c56 100644
--- a/source4/auth/session.c
+++ b/source4/auth/session.c
@@ -31,11 +31,12 @@
#include "auth/session_proto.h"
_PUBLIC_ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx)
{
NTSTATUS nt_status;
struct auth_session_info *session_info = NULL;
- nt_status = auth_anonymous_session_info(mem_ctx, lp_ctx, &session_info);
+ nt_status = auth_anonymous_session_info(mem_ctx, event_ctx, lp_ctx, &session_info);
if (!NT_STATUS_IS_OK(nt_status)) {
return NULL;
}
@@ -43,6 +44,7 @@ _PUBLIC_ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx,
}
_PUBLIC_ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info **_session_info)
{
@@ -60,7 +62,7 @@ _PUBLIC_ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx,
}
/* references the server_info into the session_info */
- nt_status = auth_generate_session_info(parent_ctx, lp_ctx, server_info, &session_info);
+ nt_status = auth_generate_session_info(parent_ctx, event_ctx, lp_ctx, server_info, &session_info);
talloc_free(mem_ctx);
NT_STATUS_NOT_OK_RETURN(nt_status);
@@ -151,6 +153,7 @@ _PUBLIC_ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx,
}
_PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct auth_serversupplied_info *server_info,
struct auth_session_info **_session_info)
@@ -168,6 +171,7 @@ _PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
session_info->session_key = server_info->user_session_key;
nt_status = security_token_create(session_info,
+ event_ctx,
lp_ctx,
server_info->account_sid,
server_info->primary_group_sid,
diff --git a/source4/auth/session.h b/source4/auth/session.h
index 87fc47791a..9b5fba7f39 100644
--- a/source4/auth/session.h
+++ b/source4/auth/session.h
@@ -36,6 +36,7 @@ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx,
const char *netbios_name,
struct auth_serversupplied_info **_server_info) ;
NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct auth_serversupplied_info *server_info,
struct auth_session_info **_session_info) ;
@@ -46,10 +47,12 @@ NTSTATUS make_server_info_netlogon_validation(TALLOC_CTX *mem_ctx,
union netr_Validation *validation,
struct auth_serversupplied_info **_server_info);
NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info **_session_info);
struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx);
diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c
index 783e31d1ae..58e9e2d89b 100644
--- a/source4/cldap_server/cldap_server.c
+++ b/source4/cldap_server/cldap_server.c
@@ -187,7 +187,7 @@ static void cldapd_task_init(struct task_server *task)
}
cldapd->task = task;
- cldapd->samctx = samdb_connect(cldapd, task->lp_ctx, anonymous_session(cldapd, task->lp_ctx));
+ cldapd->samctx = samdb_connect(cldapd, task->event_ctx, task->lp_ctx, anonymous_session(cldapd, task->event_ctx, task->lp_ctx));
if (cldapd->samctx == NULL) {
task_server_terminate(task, "cldapd failed to open samdb");
return;
diff --git a/source4/client/client.c b/source4/client/client.c
index 775aa69d37..ef88913c4d 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -32,6 +32,7 @@
#include "includes.h"
#include "version.h"
#include "libcli/libcli.h"
+#include "lib/events/events.h"
#include "lib/cmdline/popt_common.h"
#include "librpc/gen_ndr/ndr_srvsvc_c.h"
#include "librpc/gen_ndr/ndr_lsa.h"
@@ -3044,7 +3045,7 @@ static bool do_connect(struct smbclient_context *ctx,
status = smbcli_full_connection(ctx, &ctx->cli, server, ports,
share, NULL, cred, resolve_ctx,
- cli_credentials_get_event_context(cred),
+ event_context_init(NULL),
options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Connection to \\\\%s\\%s failed - %s\n",
diff --git a/source4/dsdb/common/sidmap.c b/source4/dsdb/common/sidmap.c
index 2144d61dfc..20bba7a0d9 100644
--- a/source4/dsdb/common/sidmap.c
+++ b/source4/dsdb/common/sidmap.c
@@ -49,14 +49,15 @@ struct sidmap_context {
/*
open a sidmap context - use talloc_free to close
*/
-struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
+struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx)
{
struct sidmap_context *sidmap;
sidmap = talloc(mem_ctx, struct sidmap_context);
if (sidmap == NULL) {
return NULL;
}
- sidmap->samctx = samdb_connect(sidmap, lp_ctx, system_session(sidmap, lp_ctx));
+ sidmap->samctx = samdb_connect(sidmap, ev_ctx, lp_ctx, system_session(sidmap, lp_ctx));
if (sidmap->samctx == NULL) {
talloc_free(sidmap);
return NULL;
diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c
index 3375059e99..e485c50a47 100644
--- a/source4/dsdb/repl/drepl_service.c
+++ b/source4/dsdb/repl/drepl_service.c
@@ -51,7 +51,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, lp_ctx, service->system_session_info);
+ service->samdb = samdb_connect(service, service->task->event_ctx, lp_ctx, service->system_session_info);
if (!service->samdb) {
return WERR_DS_SERVICE_UNAVAILABLE;
}
diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c
index b9333e451b..da10cbb057 100644
--- a/source4/dsdb/samdb/cracknames.c
+++ b/source4/dsdb/samdb/cracknames.c
@@ -1197,6 +1197,7 @@ NTSTATUS crack_service_principal_name(struct ldb_context *sam_ctx,
}
NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
uint32_t format_offered,
const char *name,
@@ -1214,7 +1215,7 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
}
- ldb = samdb_connect(mem_ctx, lp_ctx, system_session(mem_ctx, lp_ctx));
+ ldb = samdb_connect(mem_ctx, ev_ctx, lp_ctx, system_session(mem_ctx, lp_ctx));
if (ldb == NULL) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@@ -1259,6 +1260,7 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx,
}
NTSTATUS crack_auto_name_to_nt4_name(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
const char *name,
const char **nt4_domain,
@@ -1283,5 +1285,5 @@ NTSTATUS crack_auto_name_to_nt4_name(TALLOC_CTX *mem_ctx,
format_offered = DRSUAPI_DS_NAME_FORMAT_CANONICAL;
}
- return crack_name_to_nt4_name(mem_ctx, lp_ctx, format_offered, name, nt4_domain, nt4_account);
+ return crack_name_to_nt4_name(mem_ctx, ev_ctx, lp_ctx, format_offered, name, nt4_domain, nt4_account);
}
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 3b67ca19d3..88590f306b 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -484,8 +484,7 @@ static int samldb_fill_group_object(struct ldb_module *module, const struct ldb_
return ret;
}
-static int samldb_fill_user_or_computer_object(struct ldb_module *module, const struct ldb_message *msg,
- struct ldb_message **ret_msg)
+static int samldb_fill_user_or_computer_object(struct ldb_module *module, const struct ldb_message *msg, struct ldb_message **ret_msg)
{
int ret;
char *name;
diff --git a/source4/dsdb/samdb/ldb_modules/update_keytab.c b/source4/dsdb/samdb/ldb_modules/update_keytab.c
index 54362dcfd4..b36c2c9b71 100644
--- a/source4/dsdb/samdb/ldb_modules/update_keytab.c
+++ b/source4/dsdb/samdb/ldb_modules/update_keytab.c
@@ -90,7 +90,7 @@ static int add_modified(struct ldb_module *module, struct ldb_dn *dn, bool delet
}
cli_credentials_set_conf(item->creds, ldb_get_opaque(module->ldb, "loadparm"));
- status = cli_credentials_set_secrets(item->creds, ldb_get_opaque(module->ldb, "loadparm"), module->ldb, NULL, filter);
+ status = cli_credentials_set_secrets(item->creds, ldb_get_opaque(module->ldb, "EventContext"), ldb_get_opaque(module->ldb, "loadparm"), module->ldb, NULL, filter);
talloc_free(filter);
if (NT_STATUS_IS_OK(status)) {
if (delete) {
@@ -158,7 +158,7 @@ static int update_kt_end_trans(struct ldb_module *module)
struct dn_list *p;
for (p=data->changed_dns; p; p = p->next) {
int kret;
- kret = cli_credentials_update_keytab(p->creds, ldb_get_opaque(module->ldb, "loadparm"));
+ kret = cli_credentials_update_keytab(p->creds, ldb_get_opaque(module->ldb, "EventContext"), ldb_get_opaque(module->ldb, "loadparm"));
if (kret != 0) {
talloc_free(data->changed_dns);
data->changed_dns = NULL;
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index a01e442587..4af7fb7963 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -71,11 +71,12 @@ char *samdb_relative_path(struct ldb_context *ldb,
return an opaque context pointer on success, or NULL on failure
*/
struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info *session_info)
{
struct ldb_context *ldb;
- ldb = ldb_wrap_connect(mem_ctx, lp_ctx,
+ ldb = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx,
lp_sam_url(lp_ctx), session_info,
NULL, 0, NULL);
if (!ldb) {
@@ -98,6 +99,8 @@ int samdb_copy_template(struct ldb_context *ldb,
struct ldb_context *templates_ldb;
char *templates_ldb_path;
struct ldb_dn *basedn;
+ struct event_context *event_ctx;
+ struct loadparm_context *lp_ctx;
templates_ldb = talloc_get_type(ldb_get_opaque(ldb, "templates_ldb"), struct ldb_context);
@@ -109,8 +112,11 @@ int samdb_copy_template(struct ldb_context *ldb,
*errstring = talloc_asprintf(msg, "samdb_copy_template: ERROR: Failed to contruct path for template db");
return LDB_ERR_OPERATIONS_ERROR;
}
+
+ event_ctx = (struct event_context *)ldb_get_opaque(ldb, "EventContext");
+ lp_ctx = (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm");
- templates_ldb = ldb_wrap_connect(ldb, (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm"),
+ templates_ldb = ldb_wrap_connect(ldb, event_ctx, lp_ctx,
templates_ldb_path, NULL,
NULL, 0, NULL);
talloc_free(templates_ldb_path);
@@ -184,6 +190,7 @@ int samdb_copy_template(struct ldb_context *ldb,
Create the SID list for this user.
****************************************************************************/
NTSTATUS security_token_create(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct dom_sid *user_sid,
struct dom_sid *group_sid,
@@ -242,7 +249,7 @@ NTSTATUS security_token_create(TALLOC_CTX *mem_ctx,
}
/* setup the privilege mask for this token */
- status = samdb_privilege_setup(lp_ctx, ptoken);
+ status = samdb_privilege_setup(ev_ctx, lp_ctx, ptoken);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(ptoken);
return status;
diff --git a/source4/dsdb/samdb/samdb.h b/source4/dsdb/samdb/samdb.h
index 5d8694d2d4..9e02ef76c6 100644
--- a/source4/dsdb/samdb/samdb.h
+++ b/source4/dsdb/samdb/samdb.h
@@ -27,6 +27,7 @@ struct dsdb_control_current_partition;
struct dsdb_extended_replicated_object;
struct dsdb_extended_replicated_objects;
struct loadparm_context;
+struct event_context;
#include "librpc/gen_ndr/security.h"
#include "lib/ldb/include/ldb.h"
diff --git a/source4/dsdb/samdb/samdb_privilege.c b/source4/dsdb/samdb/samdb_privilege.c
index 5c2de81816..688d1ef9de 100644
--- a/source4/dsdb/samdb/samdb_privilege.c
+++ b/source4/dsdb/samdb/samdb_privilege.c
@@ -73,7 +73,8 @@ static NTSTATUS samdb_privilege_setup_sid(void *samctx, TALLOC_CTX *mem_ctx,
setup the privilege mask for this security token based on our
local SAM
*/
-NTSTATUS samdb_privilege_setup(struct loadparm_context *lp_ctx, struct security_token *token)
+NTSTATUS samdb_privilege_setup(struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx, struct security_token *token)
{
void *samctx;
TALLOC_CTX *mem_ctx;
@@ -97,7 +98,7 @@ NTSTATUS samdb_privilege_setup(struct loadparm_context *lp_ctx, struct security_
}
mem_ctx = talloc_new(token);
- samctx = samdb_connect(mem_ctx, lp_ctx, system_session(mem_ctx, lp_ctx));
+ samctx = samdb_connect(mem_ctx, ev_ctx, lp_ctx, system_session(mem_ctx, lp_ctx));
if (samctx == NULL) {
talloc_free(mem_ctx);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
diff --git a/source4/kdc/hdb-ldb.c b/source4/kdc/hdb-ldb.c
index d983b77b40..9c7b1f6457 100644
--- a/source4/kdc/hdb-ldb.c
+++ b/source4/kdc/hdb-ldb.c
@@ -50,6 +50,7 @@
#include "librpc/gen_ndr/ndr_drsblobs.h"
#include "libcli/auth/libcli_auth.h"
#include "param/param.h"
+#include "events/events.h"
enum hdb_ldb_ent_type
{ HDB_LDB_ENT_TYPE_CLIENT, HDB_LDB_ENT_TYPE_SERVER,
@@ -1106,6 +1107,7 @@ static krb5_error_code LDB_destroy(krb5_context context, HDB *db)
* code */
NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
krb5_context context, struct HDB **db, const char *arg)
{
@@ -1137,7 +1139,7 @@ NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx,
CRED_DONT_USE_KERBEROS);
/* Setup the link to LDB */
- (*db)->hdb_db = samdb_connect(*db, lp_ctx, session_info);
+ (*db)->hdb_db = samdb_connect(*db, ev_ctx, lp_ctx, session_info);
if ((*db)->hdb_db == NULL) {
DEBUG(1, ("hdb_ldb_create: Cannot open samdb for KDC backend!"));
return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
@@ -1168,7 +1170,7 @@ krb5_error_code hdb_ldb_create(krb5_context context, struct HDB **db, const char
{
NTSTATUS nt_status;
/* The global kdc_mem_ctx and kdc_lp_ctx, Disgusting, ugly hack, but it means one less private hook */
- nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, kdc_lp_ctx,
+ nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, event_context_find(kdc_mem_ctx), kdc_lp_ctx,
context, db, arg);
if (NT_STATUS_IS_OK(nt_status)) {
diff --git a/source4/kdc/kdc.c b/source4/kdc/kdc.c
index 72b5bb14a9..84d9d45f57 100644
--- a/source4/kdc/kdc.c
+++ b/source4/kdc/kdc.c
@@ -624,7 +624,7 @@ static void kdc_task_init(struct task_server *task)
}
kdc->config->num_db = 1;
- status = kdc_hdb_ldb_create(kdc, task->lp_ctx,
+ status = kdc_hdb_ldb_create(kdc, task->event_ctx, task->lp_ctx,
kdc->smb_krb5_context->krb5_context,
&kdc->config->db[0], NULL);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c
index f468fea6c4..1d49a8a4bd 100644
--- a/source4/kdc/kpasswdd.c
+++ b/source4/kdc/kpasswdd.c
@@ -180,7 +180,7 @@ static bool kpasswdd_change_password(struct kdc_server *kdc,
struct samr_DomInfo1 *dominfo;
struct ldb_context *samdb;
- samdb = samdb_connect(mem_ctx, kdc->task->lp_ctx, system_session(mem_ctx, kdc->task->lp_ctx));
+ samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, kdc->task->lp_ctx, system_session(mem_ctx, kdc->task->lp_ctx));
if (!samdb) {
return kpasswdd_make_error_reply(kdc, mem_ctx,
KRB5_KPASSWD_HARDERROR,
@@ -310,7 +310,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc,
krb5_free_principal(context, principal);
- samdb = samdb_connect(mem_ctx, kdc->task->lp_ctx, session_info);
+ samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, kdc->task->lp_ctx, session_info);
if (!samdb) {
return kpasswdd_make_error_reply(kdc, mem_ctx,
KRB5_KPASSWD_HARDERROR,
@@ -474,7 +474,7 @@ bool kpasswdd_process(struct kdc_server *kdc,
* we already have, rather than a new context */
cli_credentials_set_krb5_context(server_credentials, kdc->smb_krb5_context);
cli_credentials_set_conf(server_credentials, kdc->task->lp_ctx);
- nt_status = cli_credentials_set_stored_principal(server_credentials, kdc->task->lp_ctx, "kadmin/changepw");
+ nt_status = cli_credentials_set_stored_principal(server_credentials, kdc->task->event_ctx, kdc->task->lp_ctx, "kadmin/changepw");
if (!NT_STATUS_IS_OK(nt_status)) {
ret = kpasswdd_make_unauth_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 9b43d7bd74..9047773529 100644
--- a/source4/ldap_server/ldap_backend.c
+++ b/source4/ldap_server/ldap_backend.c
@@ -27,6 +27,7 @@
#include "auth/credentials/credentials.h"
#include "auth/gensec/gensec.h"
#include "param/param.h"
+#include "smbd/service_stream.h"
#define VALID_DN_SYNTAX(dn,i) do {\
if (!(dn)) {\
@@ -56,6 +57,7 @@ static int map_ldb_error(struct ldb_context *ldb, int err, const char **errstrin
NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn)
{
conn->ldb = ldb_wrap_connect(conn,
+ conn->connection->event.ctx,
conn->lp_ctx,
lp_sam_url(conn->lp_ctx),
conn->session_info,
diff --git a/source4/ldap_server/ldap_bind.c b/source4/ldap_server/ldap_bind.c
index f2c974ae3f..f37ef31c0a 100644
--- a/source4/ldap_server/ldap_bind.c
+++ b/source4/ldap_server/ldap_bind.c
@@ -44,7 +44,7 @@ static NTSTATUS ldapsrv_BindSimple(struct ldapsrv_call *call)
DEBUG(10, ("BindSimple dn: %s\n",req->dn));
- status = crack_auto_name_to_nt4_name(call, call->conn->lp_ctx, req->dn, &nt4_domain, &nt4_account);
+ status = crack_auto_name_to_nt4_name(call, call->conn->connection->event.ctx, call->conn->lp_ctx, req->dn, &nt4_domain, &nt4_account);
if (NT_STATUS_IS_OK(status)) {
status = authenticate_username_pw(call,
call->conn->connection->event.ctx,
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index 11cb63e07b..197f84692c 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -409,7 +409,7 @@ static void ldapsrv_accept(struct stream_connection *c)
conn->server_credentials = server_credentials;
/* Connections start out anonymous */
- if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, conn->lp_ctx, &conn->session_info))) {
+ if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, c->event.ctx, conn->lp_ctx, &conn->session_info))) {
ldapsrv_terminate_connection(conn, "failed to setup anonymous session info");
return;
}
@@ -478,7 +478,8 @@ static NTSTATUS add_socket(struct event_context *event_context,
}
/* Load LDAP database */
- ldb = samdb_connect(ldap_service, lp_ctx, system_session(ldap_service, lp_ctx));
+ ldb = samdb_connect(ldap_service, ldap_service->task->event_ctx,
+ lp_ctx, system_session(ldap_service, lp_ctx));
if (!ldb) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
diff --git a/source4/lib/appweb/mpr/miniMpr.c b/source4/lib/appweb/mpr/miniMpr.c
index 52b23608aa..381815eb23 100644
--- a/source4/lib/appweb/mpr/miniMpr.c
+++ b/source4/lib/appweb/mpr/miniMpr.c
@@ -31,6 +31,7 @@
#include "miniMpr.h"
#include "param/param.h"
+#include "lib/events/events.h"
/************************************ Code ************************************/
#if !BLD_APPWEB
@@ -50,6 +51,11 @@ void *mprMemCtx(void)
return mpr_ctx;
}
+struct event_context *mprEventCtx(void)
+{
+ return event_context_find(mprMemCtx());
+}
+
/* return the loadparm context being used for all ejs variables */
struct loadparm_context *mprLpCtx(void)
{
diff --git a/source4/lib/appweb/mpr/miniMpr.h b/source4/lib/appweb/mpr/miniMpr.h
index 15ce30c8df..2b8ff0af6a 100644
--- a/source4/lib/appweb/mpr/miniMpr.h
+++ b/source4/lib/appweb/mpr/miniMpr.h
@@ -274,6 +274,8 @@ extern void mprSetCtx(void *ctx);
extern void *mprMemCtx(void);
struct loadparm_context;
extern struct loadparm_context *mprLpCtx(void);
+struct event_context;
+extern struct event_context *mprEventCtx(void);
/* This function needs to be provided by anyone using ejs */
void ejs_exception(const char *reason);
diff --git a/source4/lib/ldb_wrap.c b/source4/lib/ldb_wrap.c
index 71ba37b479..b71adcbca2 100644
--- a/source4/lib/ldb_wrap.c
+++ b/source4/lib/ldb_wrap.c
@@ -94,6 +94,7 @@ static int ldb_wrap_destructor(struct ldb_context *ldb)
TODO: We need an error_string parameter
*/
struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
struct loadparm_context *lp_ctx,
const char *url,
struct auth_session_info *session_info,
@@ -103,7 +104,6 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
{
struct ldb_context *ldb;
int ret;
- struct event_context *ev;
char *real_url = NULL;
size_t *startup_blocks;
@@ -115,10 +115,9 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
ldb_set_modules_dir(ldb,
talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(lp_ctx)));
- /* 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 */
- ev = event_context_find(ldb);
+ if (ev == NULL) {
+ ev = event_context_find(mem_ctx);
+ }
if (ldb_set_opaque(ldb, "EventContext", ev)) {
talloc_free(ldb);
diff --git a/source4/lib/ldb_wrap.h b/source4/lib/ldb_wrap.h
index d3ff04b880..e626b6ef8a 100644
--- a/source4/lib/ldb_wrap.h
+++ b/source4/lib/ldb_wrap.h
@@ -27,10 +27,12 @@ struct ldb_message;
struct ldb_dn;
struct cli_credentials;
struct loadparm_context;
+struct event_context;
char *wrap_casefold(void *context, void *mem_ctx, const char *s);
struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
+ struct event_context *ev,
struct loadparm_context *lp_ctx,
const char *url,
struct auth_session_info *session_info,
diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c
index 2a9b1a59ce..4a2309faee 100644
--- a/source4/lib/registry/hive.c
+++ b/source4/lib/registry/hive.c
@@ -28,6 +28,7 @@
_PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct hive_key **root)
{
@@ -57,7 +58,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
} else if (!strncmp(peek, "TDB file", 8)) {
close(fd);
return reg_open_ldb_file(parent_ctx, location, session_info,
- credentials, lp_ctx, root);
+ credentials, ev_ctx, lp_ctx, root);
}
return WERR_BADFILE;
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index a764ca6235..a8a9ed597e 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -357,6 +357,7 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct hive_key *h,
WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct hive_key **k)
{
@@ -367,7 +368,7 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
if (location == NULL)
return WERR_INVALID_PARAM;
- wrap = ldb_wrap_connect(parent_ctx, lp_ctx,
+ wrap = ldb_wrap_connect(parent_ctx, ev_ctx, lp_ctx,
location, session_info, credentials, 0, NULL);
if (wrap == NULL) {
diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h
index d4c4a89c20..9c0f66b6d6 100644
--- a/source4/lib/registry/registry.h
+++ b/source4/lib/registry/registry.h
@@ -149,10 +149,12 @@ struct hive_operations {
struct cli_credentials;
struct auth_session_info;
+struct event_context;
WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct hive_key **root);
WERROR hive_key_get_info(TALLOC_CTX *mem_ctx, const struct hive_key *key,
@@ -199,6 +201,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx,
WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct hive_key **k);
@@ -359,6 +362,7 @@ WERROR reg_open_local(TALLOC_CTX *mem_ctx,
WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
struct registry_context **ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials);
diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i
index 1b3c1c281a..5ffee4bb3d 100644
--- a/source4/lib/registry/registry.i
+++ b/source4/lib/registry/registry.i
@@ -26,6 +26,7 @@
#include "includes.h"
#include "registry.h"
#include "param/param.h"
+#include "events/events.h"
typedef struct registry_context reg;
typedef struct hive_key hive_key;
@@ -41,6 +42,7 @@ typedef struct hive_key hive_key;
%import "../../auth/credentials/credentials.i"
%import "../../libcli/util/errors.i"
%import "../../param/param.i"
+%import "../events/events.i"
/* Utility functions */
@@ -132,6 +134,7 @@ typedef struct registry_context {
WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct hive_key **root);
@@ -139,6 +142,7 @@ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct hive_key **k);
@@ -165,6 +169,7 @@ typedef struct hive_key {
WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
struct registry_context **ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials);
diff --git a/source4/lib/registry/registry.py b/source4/lib/registry/registry.py
index 9dab309f33..cb20d6039d 100644
--- a/source4/lib/registry/registry.py
+++ b/source4/lib/registry/registry.py
@@ -59,6 +59,7 @@ def _swig_setattr_nondynamic_method(set):
import credentials
import param
+import events
reg_get_predef_name = _registry.reg_get_predef_name
str_regtype = _registry.str_regtype
Registry = _registry.Registry
diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c
index 4879b2e144..d9b85ee937 100644
--- a/source4/lib/registry/registry_wrap.c
+++ b/source4/lib/registry/registry_wrap.c
@@ -2478,29 +2478,30 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
#define SWIGTYPE_p_auth_session_info swig_types[1]
#define SWIGTYPE_p_char swig_types[2]
#define SWIGTYPE_p_cli_credentials swig_types[3]
-#define SWIGTYPE_p_hive_key swig_types[4]
-#define SWIGTYPE_p_int swig_types[5]
-#define SWIGTYPE_p_loadparm_context swig_types[6]
-#define SWIGTYPE_p_loadparm_service swig_types[7]
-#define SWIGTYPE_p_long_long swig_types[8]
-#define SWIGTYPE_p_p_char swig_types[9]
-#define SWIGTYPE_p_p_hive_key swig_types[10]
-#define SWIGTYPE_p_p_registry_context swig_types[11]
-#define SWIGTYPE_p_p_registry_key swig_types[12]
-#define SWIGTYPE_p_param_context swig_types[13]
-#define SWIGTYPE_p_param_opt swig_types[14]
-#define SWIGTYPE_p_param_section swig_types[15]
-#define SWIGTYPE_p_reg_diff_callbacks swig_types[16]
-#define SWIGTYPE_p_registry_context swig_types[17]
-#define SWIGTYPE_p_registry_key swig_types[18]
-#define SWIGTYPE_p_short swig_types[19]
-#define SWIGTYPE_p_signed_char swig_types[20]
-#define SWIGTYPE_p_unsigned_char swig_types[21]
-#define SWIGTYPE_p_unsigned_int swig_types[22]
-#define SWIGTYPE_p_unsigned_long_long swig_types[23]
-#define SWIGTYPE_p_unsigned_short swig_types[24]
-static swig_type_info *swig_types[26];
-static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
+#define SWIGTYPE_p_event_context swig_types[4]
+#define SWIGTYPE_p_hive_key swig_types[5]
+#define SWIGTYPE_p_int swig_types[6]
+#define SWIGTYPE_p_loadparm_context swig_types[7]
+#define SWIGTYPE_p_loadparm_service swig_types[8]
+#define SWIGTYPE_p_long_long swig_types[9]
+#define SWIGTYPE_p_p_char swig_types[10]
+#define SWIGTYPE_p_p_hive_key swig_types[11]
+#define SWIGTYPE_p_p_registry_context swig_types[12]
+#define SWIGTYPE_p_p_registry_key swig_types[13]
+#define SWIGTYPE_p_param_context swig_types[14]
+#define SWIGTYPE_p_param_opt swig_types[15]
+#define SWIGTYPE_p_param_section swig_types[16]
+#define SWIGTYPE_p_reg_diff_callbacks swig_types[17]
+#define SWIGTYPE_p_registry_context swig_types[18]
+#define SWIGTYPE_p_registry_key swig_types[19]
+#define SWIGTYPE_p_short swig_types[20]
+#define SWIGTYPE_p_signed_char swig_types[21]
+#define SWIGTYPE_p_unsigned_char swig_types[22]
+#define SWIGTYPE_p_unsigned_int swig_types[23]
+#define SWIGTYPE_p_unsigned_long_long swig_types[24]
+#define SWIGTYPE_p_unsigned_short swig_types[25]
+static swig_type_info *swig_types[27];
+static swig_module_info swig_module = {swig_types, 26, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -2547,6 +2548,7 @@ static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
#include "includes.h"
#include "registry.h"
#include "param/param.h"
+#include "events/events.h"
typedef struct registry_context reg;
typedef struct hive_key hive_key;
@@ -3462,8 +3464,9 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
char *arg2 = (char *) 0 ;
struct auth_session_info *arg3 = (struct auth_session_info *) 0 ;
struct cli_credentials *arg4 = (struct cli_credentials *) 0 ;
- struct loadparm_context *arg5 = (struct loadparm_context *) 0 ;
- struct hive_key **arg6 = (struct hive_key **) 0 ;
+ struct event_context *arg5 = (struct event_context *) 0 ;
+ struct loadparm_context *arg6 = (struct loadparm_context *) 0 ;
+ struct hive_key **arg7 = (struct hive_key **) 0 ;
WERROR result;
int res2 ;
char *buf2 = 0 ;
@@ -3474,21 +3477,25 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
int res4 = 0 ;
void *argp5 = 0 ;
int res5 = 0 ;
- struct hive_key *tmp6 ;
+ void *argp6 = 0 ;
+ int res6 = 0 ;
+ struct hive_key *tmp7 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
+ PyObject * obj4 = 0 ;
char * kwnames[] = {
- (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL
+ (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "ev_ctx",(char *) "lp_ctx", NULL
};
arg3 = NULL;
arg4 = NULL;
- arg5 = loadparm_init(NULL);
+ arg5 = event_context_init(NULL);
+ arg6 = loadparm_init(NULL);
arg1 = NULL;
- arg6 = &tmp6;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:hive_key",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+ arg7 = &tmp7;
+ if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:hive_key",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "hive_key" "', argument " "2"" of type '" "char const *""'");
@@ -3509,13 +3516,20 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
arg4 = (struct cli_credentials *)(argp4);
}
if (obj3) {
- res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_loadparm_context, 0 | 0 );
+ res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 | 0 );
if (!SWIG_IsOK(res5)) {
- SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "hive_key" "', argument " "5"" of type '" "struct loadparm_context *""'");
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "hive_key" "', argument " "5"" of type '" "struct event_context *""'");
}
- arg5 = (struct loadparm_context *)(argp5);
+ arg5 = (struct event_context *)(argp5);
}
- result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
+ if (obj4) {
+ res6 = SWIG_ConvertPtr(obj4, &argp6,SWIGTYPE_p_loadparm_context, 0 | 0 );
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "hive_key" "', argument " "6"" of type '" "struct loadparm_context *""'");
+ }
+ arg6 = (struct loadparm_context *)(argp6);
+ }
+ result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
@@ -3524,7 +3538,7 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
resultobj = Py_None;
}
Py_XDECREF(resultobj);
- resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0);
+ resultobj = SWIG_NewPointerObj(*arg7, SWIGTYPE_p_hive_key, 0);
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
fail:
@@ -3539,8 +3553,9 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
char *arg2 = (char *) 0 ;
struct auth_session_info *arg3 = (struct auth_session_info *) 0 ;
struct cli_credentials *arg4 = (struct cli_credentials *) 0 ;
- struct loadparm_context *arg5 = (struct loadparm_context *) 0 ;
- struct hive_key **arg6 = (struct hive_key **) 0 ;
+ struct event_context *arg5 = (struct event_context *) 0 ;
+ struct loadparm_context *arg6 = (struct loadparm_context *) 0 ;
+ struct hive_key **arg7 = (struct hive_key **) 0 ;
WERROR result;
int res2 ;
char *buf2 = 0 ;
@@ -3551,21 +3566,25 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
int res4 = 0 ;
void *argp5 = 0 ;
int res5 = 0 ;
- struct hive_key *tmp6 ;
+ void *argp6 = 0 ;
+ int res6 = 0 ;
+ struct hive_key *tmp7 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
+ PyObject * obj4 = 0 ;
char * kwnames[] = {
- (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL
+ (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "ev_ctx",(char *) "lp_ctx", NULL
};
arg3 = NULL;
arg4 = NULL;
- arg5 = loadparm_init(NULL);
+ arg5 = event_context_init(NULL);
+ arg6 = loadparm_init(NULL);
arg1 = NULL;
- arg6 = &tmp6;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+ arg7 = &tmp7;
+ if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "open_ldb" "', argument " "2"" of type '" "char const *""'");
@@ -3586,13 +3605,20 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
arg4 = (struct cli_credentials *)(argp4);
}
if (obj3) {
- res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_loadparm_context, 0 | 0 );
+ res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 | 0 );
if (!SWIG_IsOK(res5)) {
- SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_ldb" "', argument " "5"" of type '" "struct loadparm_context *""'");
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_ldb" "', argument " "5"" of type '" "struct event_context *""'");
}
- arg5 = (struct loadparm_context *)(argp5);
+ arg5 = (struct event_context *)(argp5);
}
- result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
+ if (obj4) {
+ res6 = SWIG_ConvertPtr(obj4, &argp6,SWIGTYPE_p_loadparm_context, 0 | 0 );
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "open_ldb" "', argument " "6"" of type '" "struct loadparm_context *""'");
+ }
+ arg6 = (struct loadparm_context *)(argp6);
+ }
+ result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
@@ -3601,7 +3627,7 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
resultobj = Py_None;
}
Py_XDECREF(resultobj);
- resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0);
+ resultobj = SWIG_NewPointerObj(*arg7, SWIGTYPE_p_hive_key, 0);
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
fail:
@@ -3696,9 +3722,10 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject *
PyObject *resultobj = 0;
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
struct registry_context **arg2 = (struct registry_context **) 0 ;
- struct loadparm_context *arg3 = (struct loadparm_context *) 0 ;
- struct auth_session_info *arg4 = (struct auth_session_info *) 0 ;
- struct cli_credentials *arg5 = (struct cli_credentials *) 0 ;
+ struct event_context *arg3 = (struct event_context *) 0 ;
+ struct loadparm_context *arg4 = (struct loadparm_context *) 0 ;
+ struct auth_session_info *arg5 = (struct auth_session_info *) 0 ;
+ struct cli_credentials *arg6 = (struct cli_credentials *) 0 ;
WERROR result;
struct registry_context *tmp2 ;
void *argp3 = 0 ;
@@ -3707,41 +3734,52 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject *
int res4 = 0 ;
void *argp5 = 0 ;
int res5 = 0 ;
+ void *argp6 = 0 ;
+ int res6 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
char * kwnames[] = {
- (char *) "lp_ctx",(char *) "session_info",(char *) "credentials", NULL
+ (char *) "ev_ctx",(char *) "lp_ctx",(char *) "session_info",(char *) "credentials", NULL
};
- arg3 = loadparm_init(NULL);
- arg4 = NULL;
+ arg3 = event_context_init(NULL);
+ arg4 = loadparm_init(NULL);
arg5 = NULL;
+ arg6 = NULL;
arg1 = NULL;
arg2 = &tmp2;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:open_samba",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
+ if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOOO:open_samba",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
if (obj0) {
- res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_loadparm_context, 0 | 0 );
+ res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_event_context, 0 | 0 );
if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_samba" "', argument " "3"" of type '" "struct loadparm_context *""'");
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_samba" "', argument " "3"" of type '" "struct event_context *""'");
}
- arg3 = (struct loadparm_context *)(argp3);
+ arg3 = (struct event_context *)(argp3);
}
if (obj1) {
- res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_auth_session_info, 0 | 0 );
+ res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_loadparm_context, 0 | 0 );
if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "open_samba" "', argument " "4"" of type '" "struct auth_session_info *""'");
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "open_samba" "', argument " "4"" of type '" "struct loadparm_context *""'");
}
- arg4 = (struct auth_session_info *)(argp4);
+ arg4 = (struct loadparm_context *)(argp4);
}
if (obj2) {
- res5 = SWIG_ConvertPtr(obj2, &argp5,SWIGTYPE_p_cli_credentials, 0 | 0 );
+ res5 = SWIG_ConvertPtr(obj2, &argp5,SWIGTYPE_p_auth_session_info, 0 | 0 );
if (!SWIG_IsOK(res5)) {
- SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_samba" "', argument " "5"" of type '" "struct cli_credentials *""'");
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_samba" "', argument " "5"" of type '" "struct auth_session_info *""'");
+ }
+ arg5 = (struct auth_session_info *)(argp5);
+ }
+ if (obj3) {
+ res6 = SWIG_ConvertPtr(obj3, &argp6,SWIGTYPE_p_cli_credentials, 0 | 0 );
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "open_samba" "', argument " "6"" of type '" "struct cli_credentials *""'");
}
- arg5 = (struct cli_credentials *)(argp5);
+ arg6 = (struct cli_credentials *)(argp6);
}
- result = reg_open_samba(arg1,arg2,arg3,arg4,arg5);
+ result = reg_open_samba(arg1,arg2,arg3,arg4,arg5,arg6);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
@@ -3786,6 +3824,7 @@ static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0
static swig_type_info _swigt__p_auth_session_info = {"_p_auth_session_info", "struct auth_session_info *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *|cli_credentials *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_hive_key = {"_p_hive_key", "struct hive_key *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *|loadparm_context *", 0, 0, (void*)0, 0};
@@ -3813,6 +3852,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_auth_session_info,
&_swigt__p_char,
&_swigt__p_cli_credentials,
+ &_swigt__p_event_context,
&_swigt__p_hive_key,
&_swigt__p_int,
&_swigt__p_loadparm_context,
@@ -3840,6 +3880,7 @@ static swig_cast_info _swigc__p_TALLOC_CTX[] = { {&_swigt__p_TALLOC_CTX, 0, 0,
static swig_cast_info _swigc__p_auth_session_info[] = { {&_swigt__p_auth_session_info, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_cli_credentials[] = { {&_swigt__p_cli_credentials, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_event_context[] = { {&_swigt__p_event_context, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_hive_key[] = { {&_swigt__p_hive_key, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_loadparm_context[] = { {&_swigt__p_loadparm_context, 0, 0, 0},{0, 0, 0, 0}};
@@ -3867,6 +3908,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_auth_session_info,
_swigc__p_char,
_swigc__p_cli_credentials,
+ _swigc__p_event_context,
_swigc__p_hive_key,
_swigc__p_int,
_swigc__p_loadparm_context,
diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c
index 59693dde8e..84a8112f17 100644
--- a/source4/lib/registry/samba.c
+++ b/source4/lib/registry/samba.c
@@ -26,6 +26,7 @@
*/
static WERROR mount_samba_hive(struct registry_context *ctx,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info *auth_info,
struct cli_credentials *creds,
@@ -40,11 +41,11 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
lp_private_dir(lp_ctx),
name);
- error = reg_open_hive(ctx, location, auth_info, creds, lp_ctx, &hive);
+ error = reg_open_hive(ctx, location, auth_info, creds, event_ctx, lp_ctx, &hive);
if (W_ERROR_EQUAL(error, WERR_BADFILE))
error = reg_open_ldb_file(ctx, location, auth_info,
- creds, lp_ctx, &hive);
+ creds, event_ctx, lp_ctx, &hive);
if (!W_ERROR_IS_OK(error))
return error;
@@ -55,6 +56,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
_PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
struct registry_context **ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials)
@@ -66,18 +68,18 @@ _PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
return result;
}
- mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
+ mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials,
"hklm", HKEY_LOCAL_MACHINE);
- mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
+ mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials,
"hkcr", HKEY_CLASSES_ROOT);
/* FIXME: Should be mounted from NTUSER.DAT in the home directory of the
* current user */
- mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
+ mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials,
"hkcu", HKEY_CURRENT_USER);
- mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
+ mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials,
"hku", HKEY_USERS);
/* FIXME: Different hive backend for HKEY_CLASSES_ROOT: merged view of HKEY_LOCAL_MACHINE\Software\Classes
diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c
index a16736c761..83abdd793d 100644
--- a/source4/lib/registry/tests/hive.c
+++ b/source4/lib/registry/tests/hive.c
@@ -363,7 +363,7 @@ static bool hive_setup_ldb(struct torture_context *tctx, void **data)
rmdir(dirname);
- error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->lp_ctx, &key);
+ error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->ev, tctx->lp_ctx, &key);
if (!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Unable to initialize ldb hive\n");
return false;
diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c
index 33512a0c8c..ec7873a111 100644
--- a/source4/lib/registry/tests/registry.c
+++ b/source4/lib/registry/tests/registry.c
@@ -524,7 +524,7 @@ static bool setup_local_registry(struct torture_context *tctx, void **data)
torture_assert_ntstatus_ok(tctx, status, "Creating temp dir failed");
filename = talloc_asprintf(tctx, "%s/classes_root.ldb", tempdir);
- error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &hive_key);
+ error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &hive_key);
torture_assert_werr_ok(tctx, error, "Opening classes_root file failed");
error = reg_mount_hive(rctx, hive_key, HKEY_CLASSES_ROOT, NULL);
diff --git a/source4/lib/registry/tools/common.c b/source4/lib/registry/tools/common.c
index 52f3c6f551..3ea780de60 100644
--- a/source4/lib/registry/tools/common.c
+++ b/source4/lib/registry/tools/common.c
@@ -42,6 +42,7 @@ struct registry_context *reg_common_open_remote(const char *remote,
}
struct registry_key *reg_common_open_file(const char *path,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct cli_credentials *creds)
{
@@ -49,7 +50,7 @@ struct registry_key *reg_common_open_file(const char *path,
struct registry_context *h = NULL;
WERROR error;
- error = reg_open_hive(NULL, path, NULL, creds, lp_ctx, &hive_root);
+ error = reg_open_hive(NULL, path, NULL, creds, ev_ctx, lp_ctx, &hive_root);
if(!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Unable to open '%s': %s \n",
@@ -67,12 +68,14 @@ struct registry_key *reg_common_open_file(const char *path,
return reg_import_hive_key(h, hive_root, -1, NULL);
}
-struct registry_context *reg_common_open_local(struct cli_credentials *creds, struct loadparm_context *lp_ctx)
+struct registry_context *reg_common_open_local(struct cli_credentials *creds,
+ struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx)
{
WERROR error;
struct registry_context *h = NULL;
- error = reg_open_samba(NULL, &h, lp_ctx, NULL, creds);
+ error = reg_open_samba(NULL, &h, ev_ctx, lp_ctx, NULL, creds);
if(!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Unable to open local registry:%s \n",
diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c
index 69fcfc2493..9b49799bed 100644
--- a/source4/lib/registry/tools/regdiff.c
+++ b/source4/lib/registry/tools/regdiff.c
@@ -29,6 +29,7 @@
enum reg_backend { REG_UNKNOWN, REG_LOCAL, REG_REMOTE, REG_NULL };
static struct registry_context *open_backend(poptContext pc,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
enum reg_backend backend,
const char *remote_host)
@@ -41,7 +42,7 @@ static struct registry_context *open_backend(poptContext pc,
poptPrintUsage(pc, stderr, 0);
return NULL;
case REG_LOCAL:
- error = reg_open_samba(NULL, &ctx, lp_ctx, NULL, cmdline_credentials);
+ error = reg_open_samba(NULL, &ctx, ev_ctx, lp_ctx, NULL, cmdline_credentials);
break;
case REG_REMOTE:
error = reg_open_remote(&ctx, NULL, cmdline_credentials, lp_ctx,
@@ -82,6 +83,7 @@ int main(int argc, const char **argv)
};
TALLOC_CTX *ctx;
void *callback_data;
+ struct event_context *ev_ctx;
struct reg_diff_callbacks *callbacks;
ctx = talloc_init("regdiff");
@@ -116,11 +118,13 @@ int main(int argc, const char **argv)
}
- h1 = open_backend(pc, cmdline_lp_ctx, backend1, remote1);
+ ev_ctx = event_context_init(NULL);
+
+ h1 = open_backend(pc, ev_ctx, cmdline_lp_ctx, backend1, remote1);
if (h1 == NULL)
return 1;
- h2 = open_backend(pc, cmdline_lp_ctx, backend2, remote2);
+ h2 = open_backend(pc, ev_ctx, cmdline_lp_ctx, backend2, remote2);
if (h2 == NULL)
return 1;
diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c
index 98443e6456..9285459d85 100644
--- a/source4/lib/registry/tools/regpatch.c
+++ b/source4/lib/registry/tools/regpatch.c
@@ -24,6 +24,7 @@
#include "lib/cmdline/popt_common.h"
#include "lib/registry/tools/common.h"
#include "param/param.h"
+#include "events/events.h"
int main(int argc, char **argv)
{
@@ -33,6 +34,7 @@ int main(int argc, char **argv)
struct registry_context *h;
const char *file = NULL;
const char *remote = NULL;
+ struct event_context *ev;
struct poptOption long_options[] = {
POPT_AUTOHELP
{"remote", 'R', POPT_ARG_STRING, &remote, 0, "connect to specified remote server", NULL},
@@ -47,10 +49,12 @@ int main(int argc, char **argv)
while((opt = poptGetNextOpt(pc)) != -1) {
}
+ ev = event_context_init(NULL);
+
if (remote) {
h = reg_common_open_remote (remote, cmdline_lp_ctx, cmdline_credentials);
} else {
- h = reg_common_open_local (cmdline_credentials, cmdline_lp_ctx);
+ h = reg_common_open_local (cmdline_credentials, ev, cmdline_lp_ctx);
}
if (h == NULL)
diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c
index 58f64cb049..80eafcc4a2 100644
--- a/source4/lib/registry/tools/regshell.c
+++ b/source4/lib/registry/tools/regshell.c
@@ -498,6 +498,7 @@ int main(int argc, char **argv)
poptContext pc;
const char *remote = NULL;
struct regshell_context *ctx;
+ struct event_context *ev_ctx;
bool ret = true;
struct poptOption long_options[] = {
POPT_AUTOHELP
@@ -516,17 +517,19 @@ int main(int argc, char **argv)
ctx = talloc_zero(NULL, struct regshell_context);
+ ev_ctx = event_context_init(ctx);
+
if (remote != NULL) {
ctx->registry = reg_common_open_remote(remote, cmdline_lp_ctx,
cmdline_credentials);
} else if (file != NULL) {
- ctx->current = reg_common_open_file(file, cmdline_lp_ctx, cmdline_credentials);
+ ctx->current = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials);
if (ctx->current == NULL)
return 1;
ctx->registry = ctx->current->context;
ctx->path = talloc_strdup(ctx, "");
} else {
- ctx->registry = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx);
+ ctx->registry = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx);
}
if (ctx->registry == NULL)
diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c
index 424d3515e0..440399f764 100644
--- a/source4/lib/registry/tools/regtree.c
+++ b/source4/lib/registry/tools/regtree.c
@@ -109,6 +109,7 @@ int main(int argc, char **argv)
poptContext pc;
struct registry_context *h = NULL;
struct registry_key *start_key = NULL;
+ struct event_context *ev_ctx;
WERROR error;
bool fullpath = false, no_values = false;
struct poptOption long_options[] = {
@@ -128,12 +129,14 @@ int main(int argc, char **argv)
while((opt = poptGetNextOpt(pc)) != -1) {
}
+ ev_ctx = event_context_init(NULL);
+
if (remote != NULL) {
h = reg_common_open_remote(remote, cmdline_lp_ctx, cmdline_credentials);
} else if (file != NULL) {
- start_key = reg_common_open_file(file, cmdline_lp_ctx, cmdline_credentials);
+ start_key = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials);
} else {
- h = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx);
+ h = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx);
}
if (h == NULL && start_key == NULL)
diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c
index c4f9cabb11..e8a5329985 100644
--- a/source4/libnet/libnet_become_dc.c
+++ b/source4/libnet/libnet_become_dc.c
@@ -793,7 +793,7 @@ static NTSTATUS becomeDC_ldap_connect(struct libnet_BecomeDC_state *s,
url = talloc_asprintf(s, "ldap://%s/", s->source_dsa.dns_name);
NT_STATUS_HAVE_NO_MEMORY(url);
- ldap->ldb = ldb_wrap_connect(s, s->libnet->lp_ctx, url,
+ ldap->ldb = ldb_wrap_connect(s, s->libnet->event_ctx, s->libnet->lp_ctx, url,
NULL,
s->libnet->cred,
0, NULL);
diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c
index 4549cd6e93..b5b28df81d 100644
--- a/source4/libnet/libnet_join.c
+++ b/source4/libnet/libnet_join.c
@@ -230,7 +230,7 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J
return NT_STATUS_NO_MEMORY;
}
- remote_ldb = ldb_wrap_connect(tmp_ctx, ctx->lp_ctx,
+ remote_ldb = ldb_wrap_connect(tmp_ctx, ctx->event_ctx, ctx->lp_ctx,
remote_ldb_url,
NULL, ctx->cred, 0, NULL);
if (!remote_ldb) {
diff --git a/source4/libnet/libnet_samdump_keytab.c b/source4/libnet/libnet_samdump_keytab.c
index c25cb4d9c5..0c4d3e5c59 100644
--- a/source4/libnet/libnet_samdump_keytab.c
+++ b/source4/libnet/libnet_samdump_keytab.c
@@ -26,8 +26,10 @@
#include "auth/credentials/credentials.h"
#include "auth/credentials/credentials_krb5.h"
#include "param/param.h"
+#include "lib/events/events.h"
static NTSTATUS samdump_keytab_handle_user(TALLOC_CTX *mem_ctx,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *keytab_name,
struct netr_DELTA_ENUM *delta)
@@ -53,12 +55,12 @@ static NTSTATUS samdump_keytab_handle_user(TALLOC_CTX *mem_ctx,
* pass a value in here */
cli_credentials_set_kvno(credentials, 0);
cli_credentials_set_nt_hash(credentials, &user->ntpassword, CRED_SPECIFIED);
- ret = cli_credentials_set_keytab_name(credentials, lp_ctx, keytab_name, CRED_SPECIFIED);
+ ret = cli_credentials_set_keytab_name(credentials, event_ctx, lp_ctx, keytab_name, CRED_SPECIFIED);
if (ret) {
return NT_STATUS_UNSUCCESSFUL;
}
- ret = cli_credentials_update_keytab(credentials, lp_ctx);
+ ret = cli_credentials_update_keytab(credentials, event_ctx, lp_ctx);
if (ret) {
return NT_STATUS_UNSUCCESSFUL;
}
@@ -82,6 +84,7 @@ static NTSTATUS libnet_samdump_keytab_fn(TALLOC_CTX *mem_ctx,
/* not interested in builtin users */
if (database == SAM_DATABASE_DOMAIN) {
nt_status = samdump_keytab_handle_user(mem_ctx,
+ event_context_find(mem_ctx),
global_loadparm,
keytab_name,
delta);
diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c
index a60b05189b..85e5dea2d7 100644
--- a/source4/libnet/libnet_samsync_ldb.c
+++ b/source4/libnet/libnet_samsync_ldb.c
@@ -1194,6 +1194,7 @@ static NTSTATUS libnet_samsync_ldb_init(TALLOC_CTX *mem_ctx,
ldap_url = talloc_asprintf(state, "ldap://%s", server);
state->remote_ldb = ldb_wrap_connect(mem_ctx,
+ state->samsync_state->machine_net_ctx->event_ctx,
state->samsync_state->machine_net_ctx->lp_ctx,
ldap_url,
NULL, state->samsync_state->machine_net_ctx->cred,
@@ -1222,6 +1223,7 @@ NTSTATUS libnet_samsync_ldb(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, str
state->trusted_domains = NULL;
state->sam_ldb = ldb_wrap_connect(mem_ctx,
+ ctx->event_ctx,
ctx->lp_ctx,
lp_sam_url(ctx->lp_ctx),
r->in.session_info,
diff --git a/source4/libnet/libnet_unbecome_dc.c b/source4/libnet/libnet_unbecome_dc.c
index 5d346ac166..6f06585880 100644
--- a/source4/libnet/libnet_unbecome_dc.c
+++ b/source4/libnet/libnet_unbecome_dc.c
@@ -310,7 +310,7 @@ static NTSTATUS unbecomeDC_ldap_connect(struct libnet_UnbecomeDC_state *s)
url = talloc_asprintf(s, "ldap://%s/", s->source_dsa.dns_name);
NT_STATUS_HAVE_NO_MEMORY(url);
- s->ldap.ldb = ldb_wrap_connect(s, s->libnet->lp_ctx, url,
+ s->ldap.ldb = ldb_wrap_connect(s, s->libnet->event_ctx, s->libnet->lp_ctx, url,
NULL,
s->libnet->cred,
0, NULL);
diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c
index 1cc63a3fb0..56a8ebe034 100644
--- a/source4/libnet/libnet_vampire.c
+++ b/source4/libnet/libnet_vampire.c
@@ -70,6 +70,7 @@ struct vampire_state {
const char *targetdir;
struct loadparm_context *lp_ctx;
+ struct event_context *event_ctx;
};
static NTSTATUS vampire_prepare_db(void *private_data,
@@ -335,7 +336,7 @@ static NTSTATUS vampire_apply_schema(struct vampire_state *s,
s->schema = NULL;
DEBUG(0,("Reopen the SAM LDB with system credentials and a already stored schema\n"));
- s->ldb = samdb_connect(s, s->lp_ctx,
+ s->ldb = samdb_connect(s, s->event_ctx, s->lp_ctx,
system_session(s, s->lp_ctx));
if (!s->ldb) {
DEBUG(0,("Failed to reopen sam.ldb\n"));
@@ -569,7 +570,6 @@ NTSTATUS libnet_Vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
struct libnet_JoinDomain *join;
struct libnet_set_join_secrets *set_secrets;
struct libnet_BecomeDC b;
- struct libnet_UnbecomeDC u;
struct vampire_state *s;
struct ldb_message *msg;
int ldb_ret;
@@ -581,12 +581,13 @@ NTSTATUS libnet_Vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
r->out.error_string = NULL;
- s = talloc_zero(mem_ctx , struct vampire_state);
+ s = talloc_zero(mem_ctx, struct vampire_state);
if (!s) {
return NT_STATUS_NO_MEMORY;
}
s->lp_ctx = ctx->lp_ctx;
+ s->event_ctx = ctx->event_ctx;
join = talloc_zero(s, struct libnet_JoinDomain);
if (!join) {
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 469c83788c..71c6d5f2cc 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -209,32 +209,20 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
struct epm_map_binding_state *s;
struct composite_context *pipe_connect_req;
struct cli_credentials *anon_creds;
- struct event_context *new_ev = NULL;
NTSTATUS status;
struct dcerpc_binding *epmapper_binding;
int i;
- /* Try to find event context in memory context in case passed
- * event_context (argument) was NULL. If there's none, just
- * create a new one.
- */
if (ev == NULL) {
- ev = event_context_find(mem_ctx);
- if (ev == NULL) {
- new_ev = event_context_init(mem_ctx);
- if (new_ev == NULL) return NULL;
- ev = new_ev;
- }
+ return NULL;
}
/* composite context allocation and setup */
c = composite_create(mem_ctx, ev);
if (c == NULL) {
- talloc_free(new_ev);
return NULL;
}
- talloc_steal(c, new_ev);
s = talloc_zero(c, struct epm_map_binding_state);
if (composite_nomem(s, c)) return c;
@@ -245,7 +233,6 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
/* anonymous credentials for rpc connection used to get endpoint mapping */
anon_creds = cli_credentials_init(mem_ctx);
- cli_credentials_set_event_context(anon_creds, ev);
cli_credentials_set_anonymous(anon_creds);
/*
diff --git a/source4/nbt_server/dgram/netlogon.c b/source4/nbt_server/dgram/netlogon.c
index 46bfaa9381..7fae6bc1f6 100644
--- a/source4/nbt_server/dgram/netlogon.c
+++ b/source4/nbt_server/dgram/netlogon.c
@@ -54,7 +54,7 @@ static void nbtd_netlogon_getdc(struct dgram_mailslot_handler *dgmslot,
return;
}
- samctx = samdb_connect(packet, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->lp_ctx));
+ samctx = samdb_connect(packet, iface->nbtsrv->task->event_ctx, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->event_ctx, iface->nbtsrv->task->lp_ctx));
if (samctx == NULL) {
DEBUG(2,("Unable to open sam in getdc reply\n"));
return;
@@ -125,7 +125,7 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot,
return;
}
- samctx = samdb_connect(packet, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->lp_ctx));
+ samctx = samdb_connect(packet, iface->nbtsrv->task->event_ctx, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->event_ctx, iface->nbtsrv->task->lp_ctx));
if (samctx == NULL) {
DEBUG(2,("Unable to open sam in getdc reply\n"));
return;
diff --git a/source4/nbt_server/nbt_server.c b/source4/nbt_server/nbt_server.c
index 2ac1fb4ef3..832bbe0103 100644
--- a/source4/nbt_server/nbt_server.c
+++ b/source4/nbt_server/nbt_server.c
@@ -66,7 +66,7 @@ static void nbtd_task_init(struct task_server *task)
return;
}
- nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->lp_ctx, anonymous_session(nbtsrv, task->lp_ctx));
+ nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->event_ctx, task->lp_ctx, anonymous_session(nbtsrv, task->event_ctx, task->lp_ctx));
if (nbtsrv->sam_ctx == NULL) {
task_server_terminate(task, "nbtd failed to open samdb");
return;
diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c
index 7de5bba468..c84b01f2b2 100644
--- a/source4/nbt_server/wins/winsdb.c
+++ b/source4/nbt_server/wins/winsdb.c
@@ -945,7 +945,8 @@ failed:
return NBT_RCODE_SVR;
}
-static bool winsdb_check_or_add_module_list(struct loadparm_context *lp_ctx, struct winsdb_handle *h)
+static bool winsdb_check_or_add_module_list(struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx, struct winsdb_handle *h)
{
int trans;
int ret;
@@ -992,7 +993,7 @@ static bool winsdb_check_or_add_module_list(struct loadparm_context *lp_ctx, str
flags |= LDB_FLG_NOSYNC;
}
- h->ldb = ldb_wrap_connect(h, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)),
+ h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)),
NULL, NULL, flags, NULL);
if (!h->ldb) goto failed;
@@ -1010,7 +1011,9 @@ failed:
return false;
}
-struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
+struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx,
const char *owner,
enum winsdb_handle_caller caller)
{
@@ -1026,7 +1029,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_contex
flags |= LDB_FLG_NOSYNC;
}
- h->ldb = ldb_wrap_connect(h, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)),
+ h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)),
NULL, NULL, flags, NULL);
if (!h->ldb) goto failed;
@@ -1037,7 +1040,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_contex
if (!h->local_owner) goto failed;
/* make sure the module list is available and used */
- ret = winsdb_check_or_add_module_list(lp_ctx, h);
+ ret = winsdb_check_or_add_module_list(ev_ctx, lp_ctx, h);
if (!ret) goto failed;
ldb_err = ldb_set_opaque(h->ldb, "winsdb_handle", h);
diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c
index f116c45898..f8901ce09d 100644
--- a/source4/nbt_server/wins/winsserver.c
+++ b/source4/nbt_server/wins/winsserver.c
@@ -985,7 +985,8 @@ NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv)
owner = iface_n_ip(ifaces, 0);
}
- nbtsrv->winssrv->wins_db = winsdb_connect(nbtsrv->winssrv, nbtsrv->task->lp_ctx,
+ nbtsrv->winssrv->wins_db = winsdb_connect(nbtsrv->winssrv, nbtsrv->task->event_ctx,
+ nbtsrv->task->lp_ctx,
owner, WINSDB_HANDLE_CALLER_NBTD);
if (!nbtsrv->winssrv->wins_db) {
return NT_STATUS_INTERNAL_DB_ERROR;
diff --git a/source4/ntptr/ntptr.h b/source4/ntptr/ntptr.h
index 3e95c3c5e1..7138a2fdfb 100644
--- a/source4/ntptr/ntptr.h
+++ b/source4/ntptr/ntptr.h
@@ -220,6 +220,7 @@ struct ntptr_ops {
struct ntptr_context {
const struct ntptr_ops *ops;
void *private_data;
+ struct event_context *ev_ctx;
struct loadparm_context *lp_ctx;
};
diff --git a/source4/ntptr/ntptr_base.c b/source4/ntptr/ntptr_base.c
index 0000337cb0..1165631b18 100644
--- a/source4/ntptr/ntptr_base.c
+++ b/source4/ntptr/ntptr_base.c
@@ -120,7 +120,8 @@ const struct ntptr_critical_sizes *ntptr_interface_version(void)
/*
create a ntptr_context with a specified NTPTR backend
*/
-NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
+NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx,
const char *providor, struct ntptr_context **_ntptr)
{
NTSTATUS status;
@@ -134,6 +135,7 @@ NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx
NT_STATUS_HAVE_NO_MEMORY(ntptr);
ntptr->private_data = NULL;
ntptr->ops = ntptr_backend_byname(providor);
+ ntptr->ev_ctx = ev_ctx;
ntptr->lp_ctx = lp_ctx;
if (!ntptr->ops) {
diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
index 47f3c0ddf0..3573fac3ea 100644
--- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
+++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c
@@ -42,9 +42,9 @@
connect to the SPOOLSS database
return a ldb_context pointer on success, or NULL on failure
*/
-static struct ldb_context *sptr_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
+static struct ldb_context *sptr_db_connect(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx, struct loadparm_context *lp_ctx)
{
- return ldb_wrap_connect(mem_ctx, lp_ctx, lp_spoolss_url(lp_ctx), system_session(mem_ctx, lp_ctx),
+ return ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, lp_spoolss_url(lp_ctx), system_session(mem_ctx, lp_ctx),
NULL, 0, NULL);
}
@@ -87,7 +87,7 @@ static int sptr_db_search(struct ldb_context *ldb,
static NTSTATUS sptr_init_context(struct ntptr_context *ntptr)
{
- struct ldb_context *sptr_db = sptr_db_connect(ntptr, ntptr->lp_ctx);
+ struct ldb_context *sptr_db = sptr_db_connect(ntptr, ntptr->ev_ctx, ntptr->lp_ctx);
NT_STATUS_HAVE_NO_MEMORY(sptr_db);
ntptr->private_data = sptr_db;
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index 2feb1a0efe..2b61268733 100644
--- a/source4/ntvfs/cifs/vfs_cifs.c
+++ b/source4/ntvfs/cifs/vfs_cifs.c
@@ -171,7 +171,6 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
if (!credentials) {
return NT_STATUS_NO_MEMORY;
}
- cli_credentials_set_event_context(credentials, ntvfs->ctx->event_ctx);
cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx);
cli_credentials_set_username(credentials, user, CRED_SPECIFIED);
if (domain) {
@@ -181,7 +180,6 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
} else if (machine_account) {
DEBUG(5, ("CIFS backend: Using machine account\n"));
credentials = cli_credentials_init(private);
- cli_credentials_set_event_context(credentials, ntvfs->ctx->event_ctx);
cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx);
if (domain) {
cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c
index 23aa3fb668..9055d6ece3 100644
--- a/source4/ntvfs/common/notify.c
+++ b/source4/ntvfs/common/notify.c
@@ -93,6 +93,10 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
return NULL;
}
+ if (ev == NULL) {
+ return NULL;
+ }
+
notify = talloc(mem_ctx, struct notify_context);
if (notify == NULL) {
return NULL;
diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c
index faf48705c4..4969f1a791 100644
--- a/source4/ntvfs/ipc/ipc_rap.c
+++ b/source4/ntvfs/ipc/ipc_rap.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "libcli/raw/interfaces.h"
#include "libcli/rap/rap.h"
+#include "events/events.h"
#include "ntvfs/ipc/proto.h"
#include "librpc/ndr/libndr.h"
#include "param/param.h"
@@ -100,11 +101,14 @@ struct rap_call {
struct ndr_pull *ndr_pull_param;
struct ndr_pull *ndr_pull_data;
+
+ struct event_context *event_ctx;
};
#define RAPNDR_FLAGS (LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct smb_trans2 *trans)
{
@@ -118,6 +122,7 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx,
ZERO_STRUCTP(call);
call->lp_ctx = talloc_reference(call, lp_ctx);
+ call->event_ctx = ev_ctx;
call->mem_ctx = mem_ctx;
@@ -271,7 +276,7 @@ static NTSTATUS _rap_netshareenum(struct rap_call *call)
break;
}
- result = rap_netshareenum(call, call->lp_ctx, &r);
+ result = rap_netshareenum(call, call->event_ctx, call->lp_ctx, &r);
if (!NT_STATUS_IS_OK(result))
return result;
@@ -430,7 +435,7 @@ static const struct
{NULL, -1, api_Unsupported}
};
-NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
+NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, struct loadparm_context *lp_ctx,
struct smb_trans2 *trans)
{
int i;
@@ -440,7 +445,7 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
struct ndr_push *final_param;
struct ndr_push *final_data;
- call = new_rap_srv_call(mem_ctx, lp_ctx, trans);
+ call = new_rap_srv_call(mem_ctx, event_ctx, lp_ctx, trans);
if (call == NULL)
return NT_STATUS_NO_MEMORY;
diff --git a/source4/ntvfs/ipc/rap_server.c b/source4/ntvfs/ipc/rap_server.c
index 633f0bf36e..d9fb7e21b2 100644
--- a/source4/ntvfs/ipc/rap_server.c
+++ b/source4/ntvfs/ipc/rap_server.c
@@ -29,6 +29,7 @@
* idea. */
NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct rap_NetShareEnum *r)
{
@@ -42,7 +43,7 @@ NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx,
r->out.available = 0;
r->out.info = NULL;
- nterr = share_get_context_by_name(mem_ctx, lp_share_backend(lp_ctx), lp_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(lp_ctx), event_ctx, lp_ctx, &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return nterr;
}
diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c
index 92f0eadae1..ea7b54ae6a 100644
--- a/source4/ntvfs/ipc/vfs_ipc.c
+++ b/source4/ntvfs/ipc/vfs_ipc.c
@@ -805,7 +805,7 @@ static NTSTATUS ipc_trans(struct ntvfs_module_context *ntvfs,
NTSTATUS status;
if (strequal(trans->in.trans_name, "\\PIPE\\LANMAN"))
- return ipc_rap_call(req, ntvfs->ctx->lp_ctx, trans);
+ return ipc_rap_call(req, ntvfs->ctx->event_ctx, ntvfs->ctx->lp_ctx, trans);
if (trans->in.setup_count != 2) {
return NT_STATUS_INVALID_PARAMETER;
diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c
index ebc2d88e70..14b5210fd0 100644
--- a/source4/ntvfs/posix/vfs_posix.c
+++ b/source4/ntvfs/posix/vfs_posix.c
@@ -219,7 +219,7 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs,
pvfs->ntvfs->ctx->server_id,
pvfs->ntvfs->ctx->msg_ctx,
pvfs->ntvfs->ctx->lp_ctx,
- event_context_find(pvfs),
+ pvfs->ntvfs->ctx->event_ctx,
pvfs->ntvfs->ctx->config);
pvfs->wbc_ctx = wbc_init(pvfs,
diff --git a/source4/ntvfs/sysdep/sys_lease.c b/source4/ntvfs/sysdep/sys_lease.c
index b8a165aa51..e6b11c450a 100644
--- a/source4/ntvfs/sysdep/sys_lease.c
+++ b/source4/ntvfs/sysdep/sys_lease.c
@@ -55,7 +55,7 @@ _PUBLIC_ struct sys_lease_context *sys_lease_context_create(struct share_config
}
if (ev == NULL) {
- ev = event_context_find(mem_ctx);
+ return NULL;
}
ctx = talloc_zero(mem_ctx, struct sys_lease_context);
diff --git a/source4/ntvfs/sysdep/sys_notify.c b/source4/ntvfs/sysdep/sys_notify.c
index eb5cc3793f..22b72c4d63 100644
--- a/source4/ntvfs/sysdep/sys_notify.c
+++ b/source4/ntvfs/sysdep/sys_notify.c
@@ -52,7 +52,7 @@ _PUBLIC_ struct sys_notify_context *sys_notify_context_create(struct share_confi
}
if (ev == NULL) {
- ev = event_context_find(mem_ctx);
+ return NULL;
}
ctx = talloc_zero(mem_ctx, struct sys_notify_context);
diff --git a/source4/param/share.c b/source4/param/share.c
index 51134d8970..f8ee468054 100644
--- a/source4/param/share.c
+++ b/source4/param/share.c
@@ -127,6 +127,7 @@ NTSTATUS share_register(const struct share_ops *ops)
}
NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct share_context **ctx)
{
@@ -138,7 +139,7 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name
return NT_STATUS_INTERNAL_ERROR;
}
- return ops->init(mem_ctx, ops, lp_ctx, ctx);
+ return ops->init(mem_ctx, ops, event_ctx, lp_ctx, ctx);
}
/*
diff --git a/source4/param/share.h b/source4/param/share.h
index 9f9cbdce5b..2a85fd4fbb 100644
--- a/source4/param/share.h
+++ b/source4/param/share.h
@@ -47,9 +47,12 @@ struct share_info {
void *value;
};
+struct event_context;
+
struct share_ops {
const char *name;
- NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct loadparm_context *lp_ctx,
+ NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx,
struct share_context **);
const char *(*string_option)(struct share_config *, const char *, const char *);
int (*int_option)(struct share_config *, const char *, int);
diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c
index c3adc4473c..bac1aac2d7 100644
--- a/source4/param/share_classic.c
+++ b/source4/param/share_classic.c
@@ -25,6 +25,7 @@
static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx,
const struct share_ops *ops,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct share_context **ctx)
{
diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c
index fb40f1e9bf..eba1665cc9 100644
--- a/source4/param/share_ldb.c
+++ b/source4/param/share_ldb.c
@@ -27,7 +27,9 @@
#include "param/share.h"
#include "param/param.h"
-static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, struct loadparm_context *lp_ctx,
+static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops,
+ struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx,
struct share_context **ctx)
{
struct ldb_context *sdb;
@@ -38,7 +40,7 @@ static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, stru
return NT_STATUS_NO_MEMORY;
}
- sdb = ldb_wrap_connect(*ctx, lp_ctx,
+ sdb = ldb_wrap_connect(*ctx, ev_ctx, lp_ctx,
private_path(*ctx, lp_ctx, "share.ldb"),
system_session(*ctx, lp_ctx),
NULL, 0, NULL);
diff --git a/source4/param/tests/share.c b/source4/param/tests/share.c
index 6d03b4e049..c64b5c607a 100644
--- a/source4/param/tests/share.c
+++ b/source4/param/tests/share.c
@@ -182,12 +182,12 @@ static void tcase_add_share_tests(struct torture_tcase *tcase)
static bool setup_ldb(struct torture_context *tctx, void **data)
{
- return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "ldb", tctx->lp_ctx, (struct share_context **)data));
+ return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "ldb", tctx->ev, tctx->lp_ctx, (struct share_context **)data));
}
static bool setup_classic(struct torture_context *tctx, void **data)
{
- return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "classic", tctx->lp_ctx, (struct share_context **)data));
+ return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "classic", tctx->ev, tctx->lp_ctx, (struct share_context **)data));
}
static bool teardown(struct torture_context *tctx, void *data)
diff --git a/source4/rpc_server/common/server_info.c b/source4/rpc_server/common/server_info.c
index 646879ad0d..da034e85ea 100644
--- a/source4/rpc_server/common/server_info.c
+++ b/source4/rpc_server/common/server_info.c
@@ -82,7 +82,7 @@ uint32_t dcesrv_common_get_version_build(TALLOC_CTX *mem_ctx, struct loadparm_co
}
/* This hardcoded value should go into a ldb database! */
-uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
+uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, struct dcesrv_context *dce_ctx)
{
int default_server_announce = 0;
default_server_announce |= SV_TYPE_WORKSTATION;
@@ -118,7 +118,7 @@ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dcesrv_contex
break;
}
/* open main ldb */
- samctx = samdb_connect(tmp_ctx, dce_ctx->lp_ctx, anonymous_session(tmp_ctx, dce_ctx->lp_ctx));
+ samctx = samdb_connect(tmp_ctx, event_ctx, dce_ctx->lp_ctx, anonymous_session(tmp_ctx, event_ctx, dce_ctx->lp_ctx));
if (samctx == NULL) {
DEBUG(2,("Unable to open samdb in determining server announce flags\n"));
} else {
diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
index a97b93a051..e0a222e767 100644
--- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
+++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
@@ -58,7 +58,7 @@ static WERROR dcesrv_drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_C
/*
* connect to the samdb
*/
- b_state->sam_ctx = samdb_connect(b_state, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
+ b_state->sam_ctx = samdb_connect(b_state, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
if (!b_state->sam_ctx) {
return WERR_FOOBAR;
}
diff --git a/source4/rpc_server/lsa/lsa_init.c b/source4/rpc_server/lsa/lsa_init.c
index 4dcd606435..0dc21fd9c5 100644
--- a/source4/rpc_server/lsa/lsa_init.c
+++ b/source4/rpc_server/lsa/lsa_init.c
@@ -50,7 +50,7 @@ NTSTATUS dcesrv_lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
}
/* make sure the sam database is accessible */
- state->sam_ldb = samdb_connect(state, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
+ state->sam_ldb = samdb_connect(state, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
if (state->sam_ldb == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
diff --git a/source4/rpc_server/lsa/lsa_lookup.c b/source4/rpc_server/lsa/lsa_lookup.c
index c6b9e3bd40..30bceb8139 100644
--- a/source4/rpc_server/lsa/lsa_lookup.c
+++ b/source4/rpc_server/lsa/lsa_lookup.c
@@ -195,7 +195,8 @@ static NTSTATUS lookup_well_known_sids(TALLOC_CTX *mem_ctx,
/*
lookup a SID for 1 name
*/
-static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx,
+static NTSTATUS dcesrv_lsa_lookup_name(struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx,
struct lsa_policy_state *state, TALLOC_CTX *mem_ctx,
const char *name, const char **authority_name,
struct dom_sid **sid, enum lsa_SidType *rtype)
@@ -218,7 +219,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx,
}
username = p + 1;
} else if (strchr_m(name, '@')) {
- status = crack_name_to_nt4_name(mem_ctx, lp_ctx, DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, name, &domain, &username);
+ status = crack_name_to_nt4_name(mem_ctx, ev_ctx, lp_ctx, DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, name, &domain, &username);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("Failed to crack name %s into an NT4 name: %s\n", name, nt_errstr(status)));
return status;
@@ -265,7 +266,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx,
if (!name) {
return NT_STATUS_NO_MEMORY;
}
- status = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
+ status = dcesrv_lsa_lookup_name(ev_ctx, lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
if (NT_STATUS_IS_OK(status)) {
return status;
}
@@ -275,7 +276,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx,
if (!name) {
return NT_STATUS_NO_MEMORY;
}
- status = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
+ status = dcesrv_lsa_lookup_name(ev_ctx, lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
if (NT_STATUS_IS_OK(status)) {
return status;
}
@@ -285,7 +286,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx,
if (!name) {
return NT_STATUS_NO_MEMORY;
}
- status = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
+ status = dcesrv_lsa_lookup_name(ev_ctx, lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
if (NT_STATUS_IS_OK(status)) {
return status;
}
@@ -721,7 +722,7 @@ NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call,
r->out.sids->sids[i].sid_index = 0xFFFFFFFF;
r->out.sids->sids[i].unknown = 0;
- status2 = dcesrv_lsa_lookup_name(lp_ctx, policy_state, mem_ctx, name, &authority_name, &sid, &rtype);
+ status2 = dcesrv_lsa_lookup_name(dce_call->event_ctx, lp_ctx, policy_state, mem_ctx, name, &authority_name, &sid, &rtype);
if (!NT_STATUS_IS_OK(status2) || sid->num_auths == 0) {
continue;
}
@@ -854,7 +855,7 @@ NTSTATUS dcesrv_lsa_LookupNames2(struct dcesrv_call_state *dce_call,
r->out.sids->sids[i].sid_index = 0xFFFFFFFF;
r->out.sids->sids[i].unknown = 0;
- status2 = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name,
+ status2 = dcesrv_lsa_lookup_name(dce_call->event_ctx, lp_ctx, state, mem_ctx, name,
&authority_name, &sid, &rtype);
if (!NT_STATUS_IS_OK(status2)) {
continue;
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 37e6351864..d9ae92c0fa 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -93,7 +93,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca
return NT_STATUS_ACCESS_DENIED;
}
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx,
+ sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
@@ -176,7 +176,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca
/* remember this session key state */
- nt_status = schannel_store_session_key(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, creds);
+ nt_status = schannel_store_session_key(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, creds);
return nt_status;
}
@@ -236,7 +236,8 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate2(struct dcesrv_call_state *dce_ca
the caller needs some of that information.
*/
-static NTSTATUS dcesrv_netr_creds_server_step_check(struct loadparm_context *lp_ctx,
+static NTSTATUS dcesrv_netr_creds_server_step_check(struct event_context *event_ctx,
+ struct loadparm_context *lp_ctx,
const char *computer_name,
TALLOC_CTX *mem_ctx,
struct netr_Authenticator *received_authenticator,
@@ -248,7 +249,7 @@ static NTSTATUS dcesrv_netr_creds_server_step_check(struct loadparm_context *lp_
struct ldb_context *ldb;
int ret;
- ldb = schannel_db_connect(mem_ctx, lp_ctx);
+ ldb = schannel_db_connect(mem_ctx, event_ctx, lp_ctx);
if (!ldb) {
return NT_STATUS_ACCESS_DENIED;
}
@@ -300,13 +301,13 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet(struct dcesrv_call_state *dce_call
struct ldb_context *sam_ctx;
NTSTATUS nt_status;
- nt_status = dcesrv_netr_creds_server_step_check(dce_call->conn->dce_ctx->lp_ctx,
+ nt_status = dcesrv_netr_creds_server_step_check(dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
r->in.computer_name, mem_ctx,
&r->in.credential, &r->out.return_authenticator,
&creds);
NT_STATUS_NOT_OK_RETURN(nt_status);
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
+ sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -339,13 +340,13 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet2(struct dcesrv_call_state *dce_cal
struct samr_CryptPassword password_buf;
- nt_status = dcesrv_netr_creds_server_step_check(dce_call->conn->dce_ctx->lp_ctx,
+ nt_status = dcesrv_netr_creds_server_step_check(dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
r->in.computer_name, mem_ctx,
&r->in.credential, &r->out.return_authenticator,
&creds);
NT_STATUS_NOT_OK_RETURN(nt_status);
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
+ sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -561,7 +562,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogonEx(struct dcesrv_call_state *dce_call,
{
NTSTATUS nt_status;
struct creds_CredentialState *creds;
- nt_status = schannel_fetch_session_key(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, r->in.computer_name, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx), &creds);
+ nt_status = schannel_fetch_session_key(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, r->in.computer_name, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx), &creds);
if (!NT_STATUS_IS_OK(nt_status)) {
return nt_status;
}
@@ -589,7 +590,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogonWithFlags(struct dcesrv_call_state *dce
return_authenticator = talloc(mem_ctx, struct netr_Authenticator);
NT_STATUS_HAVE_NO_MEMORY(return_authenticator);
- nt_status = dcesrv_netr_creds_server_step_check(dce_call->conn->dce_ctx->lp_ctx,
+ nt_status = dcesrv_netr_creds_server_step_check(dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
r->in.computer_name, mem_ctx,
r->in.credential, return_authenticator,
&creds);
@@ -891,14 +892,14 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
const char *local_domain;
- status = dcesrv_netr_creds_server_step_check(dce_call->conn->dce_ctx->lp_ctx,
+ status = dcesrv_netr_creds_server_step_check(dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
r->in.computer_name, mem_ctx,
r->in.credential,
r->out.return_authenticator,
NULL);
NT_STATUS_NOT_OK_RETURN(status);
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
+ sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -1003,7 +1004,7 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA
ZERO_STRUCT(r->out);
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
+ sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
if (sam_ctx == NULL) {
return WERR_DS_SERVICE_UNAVAILABLE;
}
@@ -1165,7 +1166,7 @@ static WERROR dcesrv_netr_DsrEnumerateDomainTrusts(struct dcesrv_call_state *dce
ZERO_STRUCT(r->out);
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
+ sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
if (sam_ctx == NULL) {
return WERR_GENERAL_FAILURE;
}
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 0aa4d65d8c..8ee77a6a30 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -156,7 +156,7 @@ static NTSTATUS dcesrv_samr_Connect(struct dcesrv_call_state *dce_call, TALLOC_C
}
/* make sure the sam database is accessible */
- c_state->sam_ctx = samdb_connect(c_state, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
+ c_state->sam_ctx = samdb_connect(c_state, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
if (c_state->sam_ctx == NULL) {
talloc_free(c_state);
return NT_STATUS_INVALID_SYSTEM_SERVICE;
@@ -4135,7 +4135,7 @@ static NTSTATUS dcesrv_samr_GetDomPwInfo(struct dcesrv_call_state *dce_call, TAL
ZERO_STRUCT(r->out.info);
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
+ sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c
index ec91b8eada..b78a9ceaa7 100644
--- a/source4/rpc_server/samr/samr_password.c
+++ b/source4/rpc_server/samr/samr_password.c
@@ -66,7 +66,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser(struct dcesrv_call_state *dce_call,
}
/* To change a password we need to open as system */
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
+ sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -205,7 +205,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call,
}
/* To change a password we need to open as system */
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
+ sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
@@ -343,7 +343,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
}
/* To change a password we need to open as system */
- sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
+ sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
if (sam_ctx == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c
index e81b8cd0aa..27f3fe41c2 100644
--- a/source4/rpc_server/service_rpc.c
+++ b/source4/rpc_server/service_rpc.c
@@ -107,7 +107,7 @@ static void dcesrv_sock_accept(struct stream_connection *srv_conn)
struct dcesrv_connection *dcesrv_conn = NULL;
struct auth_session_info *session_info = NULL;
- status = auth_anonymous_session_info(srv_conn, dcesrv_sock->dcesrv_ctx->lp_ctx, &session_info);
+ status = auth_anonymous_session_info(srv_conn, srv_conn->event.ctx, dcesrv_sock->dcesrv_ctx->lp_ctx, &session_info);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("dcesrv_sock_accept: auth_anonymous_session_info failed: %s\n",
nt_errstr(status)));
diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c
index 7c701ec50a..46270727a4 100644
--- a/source4/rpc_server/spoolss/dcesrv_spoolss.c
+++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c
@@ -216,7 +216,7 @@ static NTSTATUS dcerpc_spoolss_bind(struct dcesrv_call_state *dce_call, const st
NTSTATUS status;
struct ntptr_context *ntptr;
- status = ntptr_init_context(dce_call->context, dce_call->conn->dce_ctx->lp_ctx,
+ status = ntptr_init_context(dce_call->context, dce_call->conn->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
lp_ntptr_providor(dce_call->conn->dce_ctx->lp_ctx), &ntptr);
NT_STATUS_NOT_OK_RETURN(status);
diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
index 23e40d9976..8dc42bf43b 100644
--- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
+++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
@@ -445,7 +445,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
int count = 8;
int i;
- nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -543,7 +543,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
int count = 10;
int i;
- nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -735,7 +735,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call,
/* TODO: - paging of results
*/
- nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -984,7 +984,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call,
return WERR_INVALID_PARAM;
}
- nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -1238,7 +1238,7 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call,
return WERR_INVALID_PARAM;
}
- nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -1415,7 +1415,7 @@ static WERROR dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TA
}
all_string_sub(device, "\\", "/", 0);
- nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -1499,7 +1499,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA
info101->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx);
info101->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx);
- info101->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx);
+ info101->server_type = dcesrv_common_get_server_type(mem_ctx, dce_call->event_ctx, dce_ctx);
info101->comment = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx));
W_ERROR_HAVE_NO_MEMORY(info101->comment);
@@ -1519,7 +1519,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA
info102->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx);
info102->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx);
- info102->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx);
+ info102->server_type = dcesrv_common_get_server_type(mem_ctx, dce_call->event_ctx, dce_ctx);
info102->comment = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx));
W_ERROR_HAVE_NO_MEMORY(info102->comment);
@@ -1829,7 +1829,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL
/* TODO: - paging of results
*/
- nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -2292,7 +2292,7 @@ static WERROR dcesrv_srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALL
NTSTATUS nterr;
struct share_context *sctx;
- nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
diff --git a/source4/rpc_server/srvsvc/srvsvc_ntvfs.c b/source4/rpc_server/srvsvc/srvsvc_ntvfs.c
index 43fb24c0c3..f1cb35bdd8 100644
--- a/source4/rpc_server/srvsvc/srvsvc_ntvfs.c
+++ b/source4/rpc_server/srvsvc/srvsvc_ntvfs.c
@@ -62,7 +62,7 @@ NTSTATUS srvsvc_create_ntvfs_context(struct dcesrv_call_state *dce_call,
struct share_config *scfg;
const char *sharetype;
- status = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+ status = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c
index 9993dc14c1..22c60c354c 100644
--- a/source4/rpc_server/winreg/rpc_winreg.c
+++ b/source4/rpc_server/winreg/rpc_winreg.c
@@ -37,7 +37,7 @@ static NTSTATUS dcerpc_winreg_bind(struct dcesrv_call_state *dce_call,
WERROR err;
err = reg_open_samba(dce_call->context,
- &ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info,
+ &ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info,
NULL);
if (!W_ERROR_IS_OK(err)) {
diff --git a/source4/scripting/ejs/ejsnet/net_ctx.c b/source4/scripting/ejs/ejsnet/net_ctx.c
index 99be1c4ef8..cbe163552e 100644
--- a/source4/scripting/ejs/ejsnet/net_ctx.c
+++ b/source4/scripting/ejs/ejsnet/net_ctx.c
@@ -50,7 +50,7 @@ static int ejs_net_context(MprVarHandle eid, int argc, struct MprVar **argv)
ejsSetErrorMsg(eid, "talloc_new() failed");
return -1;
}
- ev = event_context_find(event_mem_ctx);
+ ev = mprEventCtx();
ctx = libnet_context_init(ev, mprLpCtx());
/* IF we generated a new event context, it will be under here,
diff --git a/source4/scripting/ejs/smbcalls_auth.c b/source4/scripting/ejs/smbcalls_auth.c
index 908a009159..b67bb7ed5b 100644
--- a/source4/scripting/ejs/smbcalls_auth.c
+++ b/source4/scripting/ejs/smbcalls_auth.c
@@ -55,7 +55,7 @@ static int ejs_doauth(MprVarHandle eid,
msg = c->msg_ctx;
} else {
/* Hope we can find the event context somewhere up there... */
- ev = event_context_find(tmp_ctx);
+ ev = mprEventCtx();
msg = messaging_client_init(tmp_ctx, lp_messaging_path(tmp_ctx, mprLpCtx()),
lp_iconv_convenience(mprLpCtx()), ev);
}
@@ -109,7 +109,7 @@ static int ejs_doauth(MprVarHandle eid,
goto done;
}
- nt_status = auth_generate_session_info(tmp_ctx, mprLpCtx(), server_info, &session_info);
+ nt_status = auth_generate_session_info(tmp_ctx, mprEventCtx(), mprLpCtx(), server_info, &session_info);
if (!NT_STATUS_IS_OK(nt_status)) {
mprSetPropertyValue(auth, "report", mprString("Session Info generation failed"));
mprSetPropertyValue(auth, "result", mprCreateBoolVar(false));
diff --git a/source4/scripting/ejs/smbcalls_ldb.c b/source4/scripting/ejs/smbcalls_ldb.c
index f47920b9bb..4a157945af 100644
--- a/source4/scripting/ejs/smbcalls_ldb.c
+++ b/source4/scripting/ejs/smbcalls_ldb.c
@@ -453,7 +453,7 @@ static int ejs_ldbConnect(MprVarHandle eid, int argc, char **argv)
dbfile = argv[0];
- ldb = ldb_wrap_connect(mprMemCtx(), mprLpCtx(), dbfile,
+ ldb = ldb_wrap_connect(mprMemCtx(), mprEventCtx(), mprLpCtx(), dbfile,
session_info, creds,
0, (const char **)(argv+1));
if (ldb == NULL) {
diff --git a/source4/scripting/ejs/smbcalls_nbt.c b/source4/scripting/ejs/smbcalls_nbt.c
index 67a85414ca..8c555bf821 100644
--- a/source4/scripting/ejs/smbcalls_nbt.c
+++ b/source4/scripting/ejs/smbcalls_nbt.c
@@ -70,7 +70,7 @@ static int ejs_resolve_name(MprVarHandle eid, int argc, struct MprVar **argv)
result = 0;
- nt_status = resolve_name(lp_resolve_context(mprLpCtx()), &name, tmp_ctx, &reply_addr, event_context_find(tmp_ctx));
+ nt_status = resolve_name(lp_resolve_context(mprLpCtx()), &name, tmp_ctx, &reply_addr, mprEventCtx());
if (NT_STATUS_IS_OK(nt_status)) {
mprSetPropertyValue(argv[0], "value", mprString(reply_addr));
diff --git a/source4/scripting/ejs/smbcalls_reg.c b/source4/scripting/ejs/smbcalls_reg.c
index e20d91ad2e..ed8653d3a7 100644
--- a/source4/scripting/ejs/smbcalls_reg.c
+++ b/source4/scripting/ejs/smbcalls_reg.c
@@ -70,7 +70,7 @@ static int ejs_reg_open(MprVarHandle eid, int argc, struct MprVar **argv)
struct registry_context *rctx;
WERROR error;
- error = reg_open_samba(mprMemCtx(), &rctx, mprLpCtx(), NULL, NULL);
+ error = reg_open_samba(mprMemCtx(), &rctx, mprEventCtx(), mprLpCtx(), NULL, NULL);
SMB_ASSERT(W_ERROR_IS_OK(error));
mprSetPtrChild(reg, "registry", rctx);
diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c
index d1e49b4348..94774d708b 100644
--- a/source4/scripting/ejs/smbcalls_rpc.c
+++ b/source4/scripting/ejs/smbcalls_rpc.c
@@ -73,7 +73,7 @@ static int ejs_irpc_connect(MprVarHandle eid, int argc, char **argv)
p->server_name = argv[0];
- ev = event_context_find(p);
+ ev = mprEventCtx();
/* create a messaging context, looping as we have no way to
allocate temporary server ids automatically */
@@ -158,7 +158,7 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv)
cli_credentials_set_anonymous(creds);
}
- ev = event_context_find(mprMemCtx());
+ ev = mprEventCtx();
status = dcerpc_pipe_connect(this, &p, binding, iface, creds, ev,
mprLpCtx());
diff --git a/source4/smb_server/smb/sesssetup.c b/source4/smb_server/smb/sesssetup.c
index de2141b808..2c4068bda5 100644
--- a/source4/smb_server/smb/sesssetup.c
+++ b/source4/smb_server/smb/sesssetup.c
@@ -70,7 +70,7 @@ static void sesssetup_old_send(struct auth_check_password_request *areq,
if (!NT_STATUS_IS_OK(status)) goto failed;
/* This references server_info into session_info */
- status = auth_generate_session_info(req, req->smb_conn->lp_ctx,
+ status = auth_generate_session_info(req, req->smb_conn->connection->event.ctx, req->smb_conn->lp_ctx,
server_info, &session_info);
if (!NT_STATUS_IS_OK(status)) goto failed;
@@ -166,7 +166,8 @@ static void sesssetup_nt1_send(struct auth_check_password_request *areq,
if (!NT_STATUS_IS_OK(status)) goto failed;
/* This references server_info into session_info */
- status = auth_generate_session_info(req, req->smb_conn->lp_ctx,
+ status = auth_generate_session_info(req, req->smb_conn->connection->event.ctx,
+ req->smb_conn->lp_ctx,
server_info, &session_info);
if (!NT_STATUS_IS_OK(status)) goto failed;
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index 4f8e628f74..367557dbb7 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -157,6 +157,7 @@ static void smbsrv_accept(struct stream_connection *conn)
smbsrv_management_init(smb_conn);
if (!NT_STATUS_IS_OK(share_get_context_by_name(smb_conn, lp_share_backend(smb_conn->lp_ctx),
+ smb_conn->connection->event.ctx,
smb_conn->lp_ctx, &(smb_conn->share_context)))) {
smbsrv_terminate_connection(smb_conn, "share_init failed!");
return;
@@ -206,7 +207,7 @@ static void smbsrv_preopen_ldb(struct task_server *task)
/* yes, this looks strange. It is a hack to preload the
schema. I'd like to share most of the ldb context with the
child too. That will come later */
- talloc_free(samdb_connect(task, task->lp_ctx, NULL));
+ talloc_free(samdb_connect(task, task->event_ctx, task->lp_ctx, NULL));
}
/*
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index 6e1bacf199..c2ec7c573a 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -313,28 +313,31 @@ locktest_OBJ_FILES = torture/locktest.o
MANPAGES += torture/man/locktest.1
-COV_TARGET = test
+ifeq ($(MAKECMDGOALS),gcov)
+GCOV?=1
+endif
+
+ifeq ($(MAKECMDGOALS),lcov)
+GCOV?=1
+endif
-COV_VARS = \
- CFLAGS="$(CFLAGS) --coverage" \
- LDFLAGS="$(LDFLAGS) --coverage"
+ifeq ($(MAKECMDGOALS),testcov-html)
+GCOV?=1
+endif
-test_cov:
- -$(MAKE) $(COV_TARGET) $(COV_VARS)
+ifdef GCOV
+CFLAGS += --coverage
+LDFLAGS += --coverage
+endif
+
+COV_TARGET = test
-gcov: test_cov
+gcov: test
for I in $(sort $(dir $(ALL_OBJS))); \
do $(GCOV) -p -o $$I $$I/*.c; \
done
-lcov-split:
- rm -f samba.info
- @$(MAKE) $(COV_TARGET) $(COV_VARS) \
- TEST_OPTIONS="--analyse-cmd=\"lcov --base-directory `pwd` --directory . --capture --output-file samba.info -t\""
- -rm heimdal/lib/*/{lex,parse}.{gcda,gcno}
- genhtml -o coverage samba.info
-
-lcov: test_cov
+lcov: test
-rm heimdal/lib/*/{lex,parse}.{gcda,gcno}
lcov --base-directory `pwd` --directory . --capture --output-file samba.info
genhtml -o coverage samba.info
diff --git a/source4/torture/ldap/cldapbench.c b/source4/torture/ldap/cldapbench.c
index 83e505e164..51586ac733 100644
--- a/source4/torture/ldap/cldapbench.c
+++ b/source4/torture/ldap/cldapbench.c
@@ -116,7 +116,7 @@ bool torture_bench_cldap(struct torture_context *torture)
make_nbt_name_server(&name, torture_setting_string(torture, "host", NULL));
/* do an initial name resolution to find its IP */
- status = resolve_name(lp_resolve_context(torture->lp_ctx), &name, torture, &address, event_context_find(torture));
+ status = resolve_name(lp_resolve_context(torture->lp_ctx), &name, torture, &address, torture->ev);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to resolve %s - %s\n",
name.name, nt_errstr(status));
diff --git a/source4/torture/ldap/schema.c b/source4/torture/ldap/schema.c
index 4cfce11eb5..8437e7f79d 100644
--- a/source4/torture/ldap/schema.c
+++ b/source4/torture/ldap/schema.c
@@ -376,7 +376,7 @@ bool torture_ldap_schema(struct torture_context *torture)
url = talloc_asprintf(torture, "ldap://%s/", host);
- ldb = ldb_wrap_connect(torture, torture->lp_ctx, url,
+ ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, url,
NULL,
cmdline_credentials,
0, NULL);
diff --git a/source4/torture/ldap/uptodatevector.c b/source4/torture/ldap/uptodatevector.c
index cec330b2f6..87b7e09e13 100644
--- a/source4/torture/ldap/uptodatevector.c
+++ b/source4/torture/ldap/uptodatevector.c
@@ -162,7 +162,7 @@ bool torture_ldap_uptodatevector(struct torture_context *torture)
url = talloc_asprintf(torture, "ldap://%s/", host);
if (!url) goto failed;
- ldb = ldb_wrap_connect(torture, torture->lp_ctx, url,
+ ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, url,
NULL,
cmdline_credentials,
0, NULL);
diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c
index ff1fbcab78..ab7846e5e1 100644
--- a/source4/torture/libnet/domain.c
+++ b/source4/torture/libnet/domain.c
@@ -74,7 +74,6 @@ bool torture_domainopen(struct torture_context *torture)
{
NTSTATUS status;
struct libnet_context *net_ctx;
- struct event_context *evt_ctx;
TALLOC_CTX *mem_ctx;
bool ret = true;
struct policy_handle h;
@@ -82,8 +81,7 @@ bool torture_domainopen(struct torture_context *torture)
mem_ctx = talloc_init("test_domain_open");
- evt_ctx = event_context_find(torture);
- net_ctx = libnet_context_init(evt_ctx, torture->lp_ctx);
+ net_ctx = libnet_context_init(torture->ev, torture->lp_ctx);
status = torture_rpc_connection(torture,
&net_ctx->samr.pipe,
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index 4d57a84582..bc92b4ebc2 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -322,7 +322,7 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
sam_ldb_path = talloc_asprintf(s, "%s/%s", s->targetdir, "private/sam.ldb");
DEBUG(0,("Reopen the SAM LDB with system credentials and a already stored schema: %s\n", sam_ldb_path));
- s->ldb = ldb_wrap_connect(s, s->tctx->lp_ctx, sam_ldb_path,
+ s->ldb = ldb_wrap_connect(s, s->tctx->ev, s->tctx->lp_ctx, sam_ldb_path,
system_session(s, s->tctx->lp_ctx),
NULL, 0, NULL);
if (!s->ldb) {
@@ -654,7 +654,7 @@ bool torture_net_become_dc(struct torture_context *torture)
sam_ldb_path = talloc_asprintf(s, "%s/%s", s->targetdir, "private/sam.ldb");
DEBUG(0,("Reopen the SAM LDB with system credentials and all replicated data: %s\n", sam_ldb_path));
- s->ldb = ldb_wrap_connect(s, s->lp_ctx, sam_ldb_path,
+ s->ldb = ldb_wrap_connect(s, s->tctx->ev, s->lp_ctx, sam_ldb_path,
system_session(s, s->lp_ctx),
NULL, 0, NULL);
if (!s->ldb) {
diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c
index 34083cd204..bf88c00e35 100644
--- a/source4/torture/local/dbspeed.c
+++ b/source4/torture/local/dbspeed.c
@@ -176,7 +176,7 @@ static bool test_ldb_speed(struct torture_context *torture, const void *_data)
torture_comment(torture, "Testing ldb speed for sidmap\n");
- ldb = ldb_wrap_connect(tmp_ctx, torture->lp_ctx, "tdb://test.ldb",
+ ldb = ldb_wrap_connect(tmp_ctx, torture->ev, torture->lp_ctx, "tdb://test.ldb",
NULL, NULL, LDB_FLG_NOSYNC, NULL);
if (!ldb) {
unlink("./test.ldb");
diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c
index e1680877e8..a4c8be888c 100644
--- a/source4/torture/nbt/dgram.c
+++ b/source4/torture/nbt/dgram.c
@@ -87,7 +87,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
+ resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
@@ -170,7 +170,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
+ resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
@@ -283,7 +283,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
- resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
+ resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
talloc_asprintf(tctx, "Failed to resolve %s", name.name));
load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c
index 86030c538a..21541d003b 100644
--- a/source4/torture/raw/lockbench.c
+++ b/source4/torture/raw/lockbench.c
@@ -316,7 +316,6 @@ bool torture_bench_lock(struct torture_context *torture)
int i;
int timelimit = torture_setting_int(torture, "timelimit", 10);
struct timeval tv;
- struct event_context *ev = event_context_find(mem_ctx);
struct benchlock_state *state;
int total = 0, minops=0;
struct smbcli_state *cli;
@@ -333,8 +332,8 @@ bool torture_bench_lock(struct torture_context *torture)
state[i].tctx = torture;
state[i].mem_ctx = talloc_new(state);
state[i].client_num = i;
- state[i].ev = ev;
- if (!torture_open_connection_ev(&cli, i, torture, ev)) {
+ state[i].ev = torture->ev;
+ if (!torture_open_connection_ev(&cli, i, torture, torture->ev)) {
return false;
}
talloc_steal(mem_ctx, state);
@@ -375,12 +374,12 @@ bool torture_bench_lock(struct torture_context *torture)
tv = timeval_current();
if (progress) {
- event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state);
+ event_add_timed(torture->ev, state, timeval_current_ofs(1, 0), report_rate, state);
}
printf("Running for %d seconds\n", timelimit);
while (timeval_elapsed(&tv) < timelimit) {
- event_loop_once(ev);
+ event_loop_once(torture->ev);
if (lock_failed) {
DEBUG(0,("locking failed\n"));
diff --git a/source4/torture/raw/offline.c b/source4/torture/raw/offline.c
index 1340692faa..9c66c3be9c 100644
--- a/source4/torture/raw/offline.c
+++ b/source4/torture/raw/offline.c
@@ -389,7 +389,6 @@ bool torture_test_offline(struct torture_context *torture)
int i;
int timelimit = torture_setting_int(torture, "timelimit", 10);
struct timeval tv;
- struct event_context *ev = event_context_find(mem_ctx);
struct offline_state *state;
struct smbcli_state *cli;
bool progress;
@@ -404,8 +403,8 @@ bool torture_test_offline(struct torture_context *torture)
for (i=0;i<nconnections;i++) {
state[i].tctx = torture;
state[i].mem_ctx = talloc_new(state);
- state[i].ev = ev;
- if (!torture_open_connection_ev(&cli, i, torture, ev)) {
+ state[i].ev = torture->ev;
+ if (!torture_open_connection_ev(&cli, i, torture, torture->ev)) {
return false;
}
state[i].tree = cli->tree;
@@ -418,7 +417,7 @@ bool torture_test_offline(struct torture_context *torture)
for (i=nconnections;i<numstates;i++) {
state[i].tctx = torture;
state[i].mem_ctx = talloc_new(state);
- state[i].ev = ev;
+ state[i].ev = torture->ev;
state[i].tree = state[i % nconnections].tree;
state[i].client = i;
}
@@ -468,12 +467,12 @@ bool torture_test_offline(struct torture_context *torture)
tv = timeval_current();
if (progress) {
- event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state);
+ event_add_timed(torture->ev, state, timeval_current_ofs(1, 0), report_rate, state);
}
printf("Running for %d seconds\n", timelimit);
while (timeval_elapsed(&tv) < timelimit) {
- event_loop_once(ev);
+ event_loop_once(torture->ev);
if (test_failed) {
DEBUG(0,("test failed\n"));
@@ -487,7 +486,7 @@ bool torture_test_offline(struct torture_context *torture)
while (state[i].loadfile ||
state[i].savefile ||
state[i].req) {
- event_loop_once(ev);
+ event_loop_once(torture->ev);
}
}
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index d28a8bd14e..c6ba0d2571 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -1350,21 +1350,19 @@ static bool test_raw_open_multi(struct torture_context *tctx)
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, "share", NULL);
int i, num_files = 3;
- struct event_context *ev;
int num_ok = 0;
int num_collision = 0;
- ev = cli_credentials_get_event_context(cmdline_credentials);
clients = talloc_array(mem_ctx, struct smbcli_state *, num_files);
requests = talloc_array(mem_ctx, struct smbcli_request *, num_files);
ios = talloc_array(mem_ctx, union smb_open, num_files);
- if ((ev == NULL) || (clients == NULL) || (requests == NULL) ||
+ if ((tctx->ev == NULL) || (clients == NULL) || (requests == NULL) ||
(ios == NULL)) {
DEBUG(0, ("talloc failed\n"));
return false;
}
- if (!torture_open_connection_share(mem_ctx, &cli, tctx, host, share, ev)) {
+ if (!torture_open_connection_share(mem_ctx, &cli, tctx, host, share, tctx->ev)) {
return false;
}
@@ -1372,7 +1370,7 @@ static bool test_raw_open_multi(struct torture_context *tctx)
for (i=0; i<num_files; i++) {
if (!torture_open_connection_share(mem_ctx, &(clients[i]),
- tctx, host, share, ev)) {
+ tctx, host, share, tctx->ev)) {
DEBUG(0, ("Could not open %d'th connection\n", i));
return false;
}
@@ -1441,7 +1439,7 @@ static bool test_raw_open_multi(struct torture_context *tctx)
break;
}
- if (event_loop_once(ev) != 0) {
+ if (event_loop_once(tctx->ev) != 0) {
DEBUG(0, ("event_loop_once failed\n"));
return false;
}
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index a5b1434a47..26b862c33f 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -369,7 +369,6 @@ bool torture_bench_open(struct torture_context *torture)
int i;
int timelimit = torture_setting_int(torture, "timelimit", 10);
struct timeval tv;
- struct event_context *ev = event_context_find(mem_ctx);
struct benchopen_state *state;
int total = 0;
int total_retries = 0;
@@ -387,8 +386,8 @@ bool torture_bench_open(struct torture_context *torture)
state[i].tctx = torture;
state[i].mem_ctx = talloc_new(state);
state[i].client_num = i;
- state[i].ev = ev;
- if (!torture_open_connection_ev(&state[i].cli, i, torture, ev)) {
+ state[i].ev = torture->ev;
+ if (!torture_open_connection_ev(&state[i].cli, i, torture, torture->ev)) {
return false;
}
talloc_steal(mem_ctx, state);
@@ -428,13 +427,13 @@ bool torture_bench_open(struct torture_context *torture)
tv = timeval_current();
if (progress) {
- report_te = event_add_timed(ev, state, timeval_current_ofs(1, 0),
+ report_te = event_add_timed(torture->ev, state, timeval_current_ofs(1, 0),
report_rate, state);
}
printf("Running for %d seconds\n", timelimit);
while (timeval_elapsed(&tv) < timelimit) {
- event_loop_once(ev);
+ event_loop_once(torture->ev);
if (open_failed) {
DEBUG(0,("open failed\n"));
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index 1927a0f027..fd8d292980 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -2841,13 +2841,12 @@ bool torture_bench_oplock(struct torture_context *torture)
int timelimit = torture_setting_int(torture, "timelimit", 10);
union smb_open io;
struct timeval tv;
- struct event_context *ev = event_context_find(mem_ctx);
cli = talloc_array(mem_ctx, struct smbcli_state *, torture_nprocs);
torture_comment(torture, "Opening %d connections\n", torture_nprocs);
for (i=0;i<torture_nprocs;i++) {
- if (!torture_open_connection_ev(&cli[i], i, torture, ev)) {
+ if (!torture_open_connection_ev(&cli[i], i, torture, torture->ev)) {
return false;
}
talloc_steal(mem_ctx, cli[i]);
diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c
index 1ca3c62df0..0ebbef1ce6 100644
--- a/source4/torture/rpc/async_bind.c
+++ b/source4/torture/rpc/async_bind.c
@@ -39,7 +39,6 @@ bool torture_async_bind(struct torture_context *torture)
{
NTSTATUS status;
TALLOC_CTX *mem_ctx;
- struct event_context *evt_ctx;
int i;
const char *binding_string;
struct cli_credentials *creds;
@@ -70,15 +69,11 @@ bool torture_async_bind(struct torture_context *torture)
/* credentials */
creds = cmdline_credentials;
- /* event context */
- evt_ctx = cli_credentials_get_event_context(creds);
- if (evt_ctx == NULL) return false;
-
/* send bind requests */
for (i = 0; i < torture_numasync; i++) {
table[i] = &ndr_table_lsarpc;
bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, binding_string,
- table[i], creds, evt_ctx, torture->lp_ctx);
+ table[i], creds, torture->ev, torture->lp_ctx);
}
/* recv bind requests */
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index 19b871f9c0..46605e53e6 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -270,7 +270,7 @@ static bool test_schannel(struct torture_context *tctx,
* the second */
/* Swap the binding details from SAMR to NETLOGON */
- status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL, tctx->lp_ctx);
+ status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, tctx->ev, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "epm map");
status = dcerpc_secondary_connection(p, &p_netlogon,
@@ -296,7 +296,7 @@ static bool test_schannel(struct torture_context *tctx,
"Failed to process schannel secured NETLOGON EX ops");
/* Swap the binding details from SAMR to LSARPC */
- status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, NULL, tctx->lp_ctx);
+ status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, tctx->ev, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "epm map");
status = dcerpc_secondary_connection(p, &p_lsa,
@@ -337,7 +337,7 @@ static bool test_schannel(struct torture_context *tctx,
"Failed to process schannel secured SAMR ops (on fresh connection)");
/* Swap the binding details from SAMR to NETLOGON */
- status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL, tctx->lp_ctx);
+ status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, tctx->ev, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "epm");
status = dcerpc_secondary_connection(p_samr2, &p_netlogon2,
diff --git a/source4/torture/smb2/scan.c b/source4/torture/smb2/scan.c
index 0f4c9fefdf..889d343a49 100644
--- a/source4/torture/smb2/scan.c
+++ b/source4/torture/smb2/scan.c
@@ -207,7 +207,7 @@ bool torture_smb2_scan(struct torture_context *torture)
status = smb2_connect(mem_ctx, host, share,
lp_resolve_context(torture->lp_ctx),
credentials, &tree,
- event_context_find(mem_ctx));
+ torture->ev);
if (!NT_STATUS_IS_OK(status)) {
printf("Connection failed - %s\n", nt_errstr(status));
return false;
@@ -224,7 +224,7 @@ bool torture_smb2_scan(struct torture_context *torture)
status = smb2_connect(mem_ctx, host, share,
lp_resolve_context(torture->lp_ctx),
credentials, &tree,
- event_context_find(mem_ctx));
+ torture->ev);
if (!NT_STATUS_IS_OK(status)) {
printf("Connection failed - %s\n", nt_errstr(status));
return false;
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index f85b1c42ff..6ac3926c98 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -314,7 +314,7 @@ bool torture_smb2_connection(struct torture_context *tctx, struct smb2_tree **tr
status = smb2_connect(tctx, host, share,
lp_resolve_context(tctx->lp_ctx),
credentials, tree,
- event_context_find(tctx));
+ tctx->ev);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to SMB2 share \\\\%s\\%s - %s\n",
host, share, nt_errstr(status));
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index faae784e4b..01a55a67f6 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -675,7 +675,7 @@ int main(int argc,char *argv[])
exit(1);
}
- torture = torture_context_init(cli_credentials_get_event_context(cmdline_credentials), ui_ops);
+ torture = torture_context_init(event_context_init(NULL), ui_ops);
if (basedir != NULL) {
if (basedir[0] != '/') {
fprintf(stderr, "Please specify an absolute path to --basedir\n");
diff --git a/source4/torture/ui.c b/source4/torture/ui.c
index efa584ebea..abbd814747 100644
--- a/source4/torture/ui.c
+++ b/source4/torture/ui.c
@@ -578,6 +578,3 @@ struct torture_test *torture_tcase_add_simple_test(struct torture_tcase *tcase,
return test;
}
-
-
-
diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c
index ab81f07225..a87b266568 100644
--- a/source4/utils/net/net.c
+++ b/source4/utils/net/net.c
@@ -200,7 +200,6 @@ static int binary_net(int argc, const char **argv)
ctx->lp_ctx = cmdline_lp_ctx;
ctx->credentials = cmdline_credentials;
ctx->event_ctx = ev;
- cli_credentials_set_event_context(ctx->credentials, ev);
rc = net_run_function(ctx, argc_new-1, argv_new+1, net_functable, net_usage);
diff --git a/source4/winbind/idmap.c b/source4/winbind/idmap.c
index 0c729825db..333a86445a 100644
--- a/source4/winbind/idmap.c
+++ b/source4/winbind/idmap.c
@@ -158,6 +158,7 @@ static struct dom_sid *idmap_msg_get_dom_sid(TALLOC_CTX *mem_ctx,
* \return allocated idmap_context on success, NULL on error
*/
struct idmap_context *idmap_init(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx)
{
struct idmap_context *idmap_ctx;
@@ -169,7 +170,7 @@ struct idmap_context *idmap_init(TALLOC_CTX *mem_ctx,
idmap_ctx->lp_ctx = lp_ctx;
- idmap_ctx->ldb_ctx = ldb_wrap_connect(mem_ctx, lp_ctx,
+ idmap_ctx->ldb_ctx = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx,
lp_idmap_url(lp_ctx),
system_session(mem_ctx, lp_ctx),
NULL, 0, NULL);
diff --git a/source4/winbind/idmap.h b/source4/winbind/idmap.h
index 6eae92cc68..13dbe0b921 100644
--- a/source4/winbind/idmap.h
+++ b/source4/winbind/idmap.h
@@ -31,6 +31,8 @@ struct idmap_context {
struct dom_sid *unix_users_sid;
};
+struct event_context;
+
#include "winbind/idmap_proto.h"
#endif
diff --git a/source4/winbind/wb_init_domain.c b/source4/winbind/wb_init_domain.c
index fc35f11db6..c1325bfe09 100644
--- a/source4/winbind/wb_init_domain.c
+++ b/source4/winbind/wb_init_domain.c
@@ -151,8 +151,6 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx,
state->domain->libnet_ctx->cred = cli_credentials_init(state->domain);
if (state->domain->libnet_ctx->cred == NULL) goto failed;
- cli_credentials_set_event_context(state->domain->libnet_ctx->cred, service->task->event_ctx);
-
cli_credentials_set_conf(state->domain->libnet_ctx->cred, service->task->lp_ctx);
/* Connect the machine account to the credentials */
diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c
index 7f1520a3b3..f43947e79a 100644
--- a/source4/winbind/wb_samba3_cmd.c
+++ b/source4/winbind/wb_samba3_cmd.c
@@ -151,8 +151,6 @@ NTSTATUS wbsrv_samba3_check_machacc(struct wbsrv_samba3_call *s3call)
return NT_STATUS_NO_MEMORY;
}
- cli_credentials_set_event_context(creds, service->task->event_ctx);
-
cli_credentials_set_conf(creds, service->task->lp_ctx);
/* Connect the machine account to the credentials */
diff --git a/source4/winbind/wb_server.c b/source4/winbind/wb_server.c
index 99191f3c6c..f84dece11c 100644
--- a/source4/winbind/wb_server.c
+++ b/source4/winbind/wb_server.c
@@ -149,7 +149,7 @@ static void winbind_task_init(struct task_server *task)
return;
}
- service->idmap_ctx = idmap_init(service, task->lp_ctx);
+ service->idmap_ctx = idmap_init(service, task->event_ctx, task->lp_ctx);
if (service->idmap_ctx == NULL) {
task_server_terminate(task, "Failed to load idmap database");
return;
diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c
index e750d9355a..b703066986 100644
--- a/source4/wrepl_server/wrepl_server.c
+++ b/source4/wrepl_server/wrepl_server.c
@@ -35,9 +35,10 @@
#include "lib/socket/netif.h"
static struct ldb_context *wins_config_db_connect(TALLOC_CTX *mem_ctx,
+ struct event_context *ev_ctx,
struct loadparm_context *lp_ctx)
{
- return ldb_wrap_connect(mem_ctx, lp_ctx, private_path(mem_ctx,
+ return ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, private_path(mem_ctx,
lp_ctx, lp_wins_config_url(lp_ctx)),
system_session(mem_ctx, lp_ctx), NULL, 0, NULL);
}
@@ -83,12 +84,12 @@ static NTSTATUS wreplsrv_open_winsdb(struct wreplsrv_service *service,
owner = iface_n_ip(ifaces, 0);
}
- service->wins_db = winsdb_connect(service, lp_ctx, owner, WINSDB_HANDLE_CALLER_WREPL);
+ service->wins_db = winsdb_connect(service, service->task->event_ctx, lp_ctx, owner, WINSDB_HANDLE_CALLER_WREPL);
if (!service->wins_db) {
return NT_STATUS_INTERNAL_DB_ERROR;
}
- service->config.ldb = wins_config_db_connect(service, lp_ctx);
+ service->config.ldb = wins_config_db_connect(service, service->task->event_ctx, lp_ctx);
if (!service->config.ldb) {
return NT_STATUS_INTERNAL_DB_ERROR;
}