Specify event_context to ldb_wrap_connect explicitly.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 17 Apr 2008 10:23:44 +0000 (12:23 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 17 Apr 2008 10:23:44 +0000 (12:23 +0200)
(This used to be commit b4e1ae07a284c044704322446c94351c2decff91)

87 files changed:
source4/auth/auth_sam.c
source4/auth/auth_simple.c
source4/auth/gensec/gensec_gssapi.c
source4/auth/gensec/gensec_krb5.c
source4/auth/gensec/schannel.c
source4/auth/gensec/schannel_state.c
source4/auth/ntlmssp/ntlmssp_server.c
source4/auth/sam.c
source4/auth/session.c
source4/auth/session.h
source4/cldap_server/cldap_server.c
source4/dsdb/common/sidmap.c
source4/dsdb/repl/drepl_service.c
source4/dsdb/samdb/cracknames.c
source4/dsdb/samdb/ldb_modules/samldb.c
source4/dsdb/samdb/ldb_modules/update_keytab.c
source4/dsdb/samdb/samdb.c
source4/dsdb/samdb/samdb.h
source4/dsdb/samdb/samdb_privilege.c
source4/kdc/hdb-ldb.c
source4/kdc/kdc.c
source4/kdc/kpasswdd.c
source4/ldap_server/ldap_backend.c
source4/ldap_server/ldap_bind.c
source4/ldap_server/ldap_server.c
source4/lib/ldb_wrap.c
source4/lib/ldb_wrap.h
source4/lib/registry/hive.c
source4/lib/registry/ldb.c
source4/lib/registry/registry.h
source4/lib/registry/registry.i
source4/lib/registry/registry.py
source4/lib/registry/registry_wrap.c
source4/lib/registry/samba.c
source4/lib/registry/tests/hive.c
source4/lib/registry/tests/registry.c
source4/lib/registry/tools/common.c
source4/lib/registry/tools/regdiff.c
source4/lib/registry/tools/regpatch.c
source4/lib/registry/tools/regshell.c
source4/lib/registry/tools/regtree.c
source4/libnet/libnet_become_dc.c
source4/libnet/libnet_join.c
source4/libnet/libnet_samsync_ldb.c
source4/libnet/libnet_unbecome_dc.c
source4/libnet/libnet_vampire.c
source4/nbt_server/dgram/netlogon.c
source4/nbt_server/nbt_server.c
source4/nbt_server/wins/winsdb.c
source4/nbt_server/wins/winsserver.c
source4/ntptr/ntptr.h
source4/ntptr/ntptr_base.c
source4/ntptr/simple_ldb/ntptr_simple_ldb.c
source4/ntvfs/ipc/ipc_rap.c
source4/ntvfs/ipc/rap_server.c
source4/ntvfs/ipc/vfs_ipc.c
source4/param/share.c
source4/param/share.h
source4/param/share_classic.c
source4/param/share_ldb.c
source4/param/tests/share.c
source4/rpc_server/common/server_info.c
source4/rpc_server/drsuapi/dcesrv_drsuapi.c
source4/rpc_server/lsa/lsa_init.c
source4/rpc_server/lsa/lsa_lookup.c
source4/rpc_server/netlogon/dcerpc_netlogon.c
source4/rpc_server/samr/dcesrv_samr.c
source4/rpc_server/samr/samr_password.c
source4/rpc_server/service_rpc.c
source4/rpc_server/spoolss/dcesrv_spoolss.c
source4/rpc_server/srvsvc/dcesrv_srvsvc.c
source4/rpc_server/srvsvc/srvsvc_ntvfs.c
source4/rpc_server/winreg/rpc_winreg.c
source4/scripting/ejs/smbcalls_auth.c
source4/scripting/ejs/smbcalls_ldb.c
source4/scripting/ejs/smbcalls_reg.c
source4/smb_server/smb/sesssetup.c
source4/smb_server/smb_server.c
source4/torture/ldap/schema.c
source4/torture/ldap/uptodatevector.c
source4/torture/libnet/libnet_BecomeDC.c
source4/torture/local/dbspeed.c
source4/torture/ui.c
source4/winbind/idmap.c
source4/winbind/idmap.h
source4/winbind/wb_server.c
source4/wrepl_server/wrepl_server.c

index 4b467cee75bd2d3dbcbd3a433cd9f4fe6210ce27..731e489ba0fc470d851ecd49c052a777ad92cd88 100644 (file)
@@ -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;
index 50be02a35334e86c549ca254d41e92cf49e22a7b..e7039c36575fb529e3ede16318eb017636438f6c 100644 (file)
@@ -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);
index cbee557d5a65bf2ef07f164509a9442149882234..cc0d40469e529099113c12233fdc52f1cc04d1de 100644 (file)
@@ -1327,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)) {
@@ -1342,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;
index 8abc0f8583e8244b16c6c236cce636224d0b227d..47df2ccfcc27835b920b6751dfc389bd9081ef5e 100644 (file)
@@ -603,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);
@@ -651,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);
index b3117ee9b2e00d0b86a27c31a424bce8cbaad1ee..f21202b86f5486e46a94898adf518d73ba90ae2d 100644 (file)
@@ -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)
index 0c7c509954f6a03b1c108927c629264e4c3b5c13..0f7c4ca11d7f9c75b283e901dc65a73c59721d17 100644 (file)
@@ -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;
        }
index 12802b7e79c0d9b90e4130006676a377ed79032a..d8ef2a20b828f63fe224fd132343e8c13d1865bd 100644 (file)
@@ -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, 
index ed44754993b36e9fedf1130d1d2012b10b6a8208..a2090afcdc53372ee1e1e559b2b668ccaa4506a0 100644 (file)
@@ -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;
index 112eac95d84aec38c4a60c526a7cff1058f8846a..8f5e8d6c5612685b7c04512cd733efad4b0d2025 100644 (file)
 #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,
index 87fc47791a9e446dd7569e3f2bfd4eef007886ca..9b5fba7f39b14693340fef88e4268b91c4464b5f 100644 (file)
@@ -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);
 
 
index 783e31d1ae622267ba55ed65a59f891d8157fb49..58e9e2d89b53af56db9002fac2d322e749af27e5 100644 (file)
@@ -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;
index 2144d61dfcab0ec26486ef5c000b008a4c13ed4f..20bba7a0d93aa413955509da1537e58eca08261f 100644 (file)
@@ -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;
index 3375059e99e00e58976f4a0af4e59105ad4dcd63..e485c50a473d5e94f0199adc37bbeceb4c492508 100644 (file)
@@ -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;
        }
index b9333e451bade34a437f63b53f749673cb0977d0..da10cbb0577fda7032ceab332e6bdbd02567605f 100644 (file)
@@ -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);
 }
index 3b67ca19d35b2c55434770ebba90cfa07a0feb60..88590f306beddbf2a6712f5ca49202f727b2af39 100644 (file)
@@ -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;
index 3096ce8dd92aad303385d1e2087a8ed976248c7f..b36c2c9b71443f20ef0454b9142c79df7f0b69da 100644 (file)
@@ -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, "event_ctx"), 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, "event_ctx"), 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;
index a01e4425878a4e134c75b6b6f55f6d9fb5fb8eb7..4af7fb796388423f6a3fecfc164966a543541f63 100644 (file)
@@ -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;
index 5d8694d2d499fbc839a790f2ebd2b0fe4b4296d2..9e02ef76c6271e6a9649aef8099ae107b2c23162 100644 (file)
@@ -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"
index 5c2de81816c97b26e8a92328a37badd1eebe4da6..688d1ef9de3da4586d3337f2fbee4573a85c7c48 100644 (file)
@@ -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;
index d983b77b40dc01efaa1610b01457faa4ed9da994..9c7b1f6457a85dbec24008f67de1bfb435220d6f 100644 (file)
@@ -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)) {
index 72b5bb14a93c531b266d67a105def35e45632119..84d9d45f5768310705877707a41dbf33f3d578d8 100644 (file)
@@ -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)) {
index 3635676d17745afbf6598956790adef691a04492..1d49a8a4bd23d726fe56754cd6fd6cd3fbfe63b1 100644 (file)
@@ -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,
index 9b43d7bd742ca757cc76089d1ab5c214b2bb60fe..9047773529906a5a55a138e3d3a8c3095b90a303 100644 (file)
@@ -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,
index f2c974ae3f76eab52f89f82a409e772e8dabc88e..f37ef31c0adb15057e77e75bfca0a449072e5384 100644 (file)
@@ -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,
index 11cb63e07bf2f3d753b11c9cfb576f345cb5f349..197f84692c14bb82cdce6cdba01acc61b3dc7110 100644 (file)
@@ -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;
        }
index 71ba37b4797300cc5f1d3bae133699f4087b9faf..b71adcbca27dbb7cc0ecc25f04ae3b1174ec4f0f 100644 (file)
@@ -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);
index d3ff04b8808b0cd7eb8907043e50ab7197341e1d..e626b6ef8aa7d0797e59e4117553ed5a0a219365 100644 (file)
@@ -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,
index 2a9b1a59ceff6d91cfaf679b16d7c94f7a03abc0..4a2309faeee00fb3fd67cde30d824c1b03220112 100644 (file)
@@ -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;
index a764ca6235322885b4d4049f4a0cfb2d66f41d72..a8a9ed597e47db51bdea97cc208aec5b62255055 100644 (file)
@@ -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) {
index d4c4a89c2097e9152d958955c21bef13bcaa7384..9c0f66b6d6ea9db922fa184b91e52aad2c9cb7b7 100644 (file)
@@ -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);
index 1b3c1c281a824421e4dfda0b21adc266a4a3641f..5ffee4bb3dab341537d5bdf388eb6f1915ed3135 100644 (file)
@@ -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);
index 9dab309f33ffc25e6b9d2b374e950a1e0a832f44..cb20d6039ddded2a6069b8c29afa82d696c142d1 100644 (file)
@@ -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
index 4879b2e144d3bc03f6a5064a19491636f4c765d5..d9b85ee9375ae89c3ca8a92d382c07636f05cef9 100644 (file)
@@ -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,
index 59693dde8e60ea8c75df87f2dcf13e2eaf895383..84a8112f17952c45233203fd061e35c3bb2a0a9c 100644 (file)
@@ -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
index a16736c761dec4b6415eca49875bd4937369b70e..83abdd793d668ae97575134f03d473e49db9d21e 100644 (file)
@@ -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;
index 33512a0c8c472400e6947a07ab6b5028011184fd..ec7873a111bb048929e150b12f169154baff248d 100644 (file)
@@ -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);
index 52f3c6f551e239ba6538fd586ee2eb93887383d2..3ea780de60ae22f15702de95d7e9838601461eb6 100644 (file)
@@ -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",
index 69fcfc2493142fc375c604bf0d206a382d945df6..9b49799bed90f7b7003cd492d8711d868c61ea75 100644 (file)
@@ -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;
 
index 98443e64566593ccb1001c9f26fbebc98e6436d8..9285459d8501db55b3fecbbaeb1525e5a1567ee7 100644 (file)
@@ -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)
index 58f64cb049b2f292d64ac81e0aa9f586800db6c0..80eafcc4a29a69edfed366c5293b53f0cbc77956 100644 (file)
@@ -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)
index 424d3515e0cd2d5f0315977a2f234014887b738c..440399f7645470f8e761a63904a6e13816c6cf6f 100644 (file)
@@ -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)
index c4f9cabb1166411c0284a3a119c7c7e9fc78b9c4..e8a5329985aa8f8fb5acbd02213debde12e22c4c 100644 (file)
@@ -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);
index 4549cd6e9349c05096c890d18011fa1873f35f1f..b5b28df81d128385822c2f195e68d9e7d9a8c0c2 100644 (file)
@@ -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) {
index a60b05189b0bcff5f5c3d6ce900219ecb2f370ec..85e5dea2d72cac6215c8086474df1ba89214c443 100644 (file)
@@ -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,
index 5d346ac166fdd0c0df20c31f3fe049f8e81be822..6f065858804dbf4e23ca7fdb6b497812e53d5224 100644 (file)
@@ -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);
index 1cc63a3fb0cbe8404c92be131d0db2985675252d..56a8ebe034c386467feacfb176678a711f619c58 100644 (file)
@@ -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) {
index 46bfaa9381fbc2f6be3e5d423f45d84392ee195a..7fae6bc1f6c67d8db04e82b9c62a0f01a1b5697c 100644 (file)
@@ -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;
index 2ac1fb4ef3fb2cc766b7507269d1998261e56185..832bbe0103924f30797face6553fee1f6125146c 100644 (file)
@@ -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;
index 7de5bba468d30289ac426440c8e071dd33c86299..c84b01f2b20571d667162ab27383e5243881f45a 100644 (file)
@@ -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);
index f116c458981723e391d6d4d78068e75d1d06afa9..f8901ce09d2943bcb3b3747a56d30f2f0184b5a1 100644 (file)
@@ -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;
index 3e95c3c5e1c0cca0e6a52eac8ea55d389e38303a..7138a2fdfba81a0a5912dd62b4ad76021e6a6a75 100644 (file)
@@ -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;
 };
 
index 0000337cb0f22d9d7f5a6de35b424c5b8105cf80..1165631b182a203058c74fc72151765d627ac859 100644 (file)
@@ -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) {
index 47f3c0ddf0e326c9143537c2c847996ce64abacc..3573fac3eadcfbd94b272cc2346260bddd34f72d 100644 (file)
@@ -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;
index faf48705c466cc27630c809fe755de68e33939f5..4969f1a79100f766ef2763be439ee1da45a151dd 100644 (file)
@@ -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;
index 633f0bf36e3abb7d27a14db55da2fa2bd0204712..d9fb7e21b23fef2567fe97551cb7b5d188a7247c 100644 (file)
@@ -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;
        }
index 92f0eadae1de74379a97b70b11f3cf6030509bab..ea7b54ae6ac29a4228119df81d3db141b057bb7f 100644 (file)
@@ -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;
index 51134d897037c7e076529feccca86b0afce026ed..f8ee468054755c9eec637d2c21706f1e3cbf5103 100644 (file)
@@ -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);
 }
 
 /*
index 9f9cbdce5bed8ed447f37ffa68c9fa8bb6c97d0d..2a85fd4fbbffb94fed518f4540f17ddb9c237aa9 100644 (file)
@@ -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);
index c3adc4473c789d2a7dc68edae1c5a3cdd240c2a5..bac1aac2d78f33ca82312a53cb8599af31309ad6 100644 (file)
@@ -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)
 {
index fb40f1e9bfe8be040e3480ea91dd26eccebc1787..eba1665cc9f5654fe22f47e56bb95c005a83eaa7 100644 (file)
@@ -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);
index 6d03b4e0492459afb0e786cc418870979a52d0c5..c64b5c607a53ef13638cd974952dc84c1d814caf 100644 (file)
@@ -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)
index 646879ad0d5ddb9dbaa65698ab27da87dfa5d06e..da034e85ea5c53e69ed14335db99a53dc4f5fda0 100644 (file)
@@ -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 {
index a97b93a051a3bae29fb6931968f6843ca9091cf6..e0a222e7675be23856c24fa7c54bba80d47ae414 100644 (file)
@@ -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;
        }
index 4dcd6064353b1554423ca55f91feb3e3f332dc5c..0dc21fd9c502c2dcdf650b701ede05d31ec8f5d5 100644 (file)
@@ -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;
        }
index c6b9e3bd406c78eeca6147ab5da4418ae3feff7c..30bceb813903059fd9620ffb1f529fdd48127870 100644 (file)
@@ -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;
index 37e6351864093e818895bb788c04837791f28514..d9ae92c0fa7002c918de4c29bf8a53d49b4592f4 100644 (file)
@@ -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;
        }
index 0aa4d65d8c5ca22973bbed19bfce099b25157c6e..8ee77a6a30068342ed520be9ff5a4e5e854fce98 100644 (file)
@@ -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;
        }
index ec91b8eadaf5491ad060becc18c2fb8ecd1d6fac..b78a9ceaa7b46c6cb9583da831f3832f0ac38e2f 100644 (file)
@@ -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;
        }
index e81b8cd0aaec0a1f3c822764b33d30447da04ba7..27f3fe41c24d6d2b10a9410b5272200de042758f 100644 (file)
@@ -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)));
index 7c701ec50a0ec0109bd5ac525fc460fa5957accc..46270727a4e2797aa90c516e9db53f635b7c0cb3 100644 (file)
@@ -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);
 
index 23e40d997653b95b16665536954f0d3d167b11cd..8dc42bf43b68a9604c85aed00cab5a063b588c1d 100644 (file)
@@ -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);
        }
index 43fb24c0c36cc64d8574ffba42ed3ed3ccd2eeb3..f1cb35bdd8978339c3b5da7326d11263f30f90ce 100644 (file)
@@ -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;
        }
index 9993dc14c116630c4fb38faf3de3131cce7f0b09..22c60c354c5002b14a5469306212c5feb7f86360 100644 (file)
@@ -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)) {
index 8e464a50218d13912ac4c535ef5c6ad3f0938c2a..b67bb7ed5bde10163bdce0f9e4750a5627bf4fd5 100644 (file)
@@ -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));
index f47920b9bb5fd04d306c40ff88fc7ddcfd625f84..4a157945af5cdf9184792e3187addc87e05b2454 100644 (file)
@@ -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) {
index e20d91ad2eeef7b5dec0566a6f4f78b4cdcd7711..ed8653d3a7b3b46c3faefde2a8c7eb05bc2bb900 100644 (file)
@@ -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);
index de2141b8086d2595f42f9c8a8826939e3cf4837e..2c4068bda5f0da029e5fb0c34b7b237914215d99 100644 (file)
@@ -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;
 
index 4f8e628f7414762761c1e10b2cac04d8d4a50c7b..367557dbb7422ff75b556f827ff2a1380b064a2e 100644 (file)
@@ -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));
 }
 
 /*
index 4cfce11eb5b0cacff204075a7d86685766c69d11..8437e7f79db13af5652b04815df1e48fa7b8eae8 100644 (file)
@@ -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);
index cec330b2f6138b3ff9ad797642a5b73685ccc318..87b7e09e136276d2e13ef49ea5d2f20ba01bbfc8 100644 (file)
@@ -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);
index 4d57a84582874a8182a9097202b0d51dac827235..bc92b4ebc2e29edc6a924a8931690e3844e20cfc 100644 (file)
@@ -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) {
index 34083cd204fd3039886eed17a51a41021aa1595e..bf88c00e35885d32bbca6912616a86f81cd8e422 100644 (file)
@@ -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");
index efa584ebeaae2735fdc5d9f672c8fe35528d6521..abbd814747666fc11fc8ced46a02ab73d028b721 100644 (file)
@@ -578,6 +578,3 @@ struct torture_test *torture_tcase_add_simple_test(struct torture_tcase *tcase,
 
        return test;
 }
-
-
-
index 0c729825dbb8a7bada0b79b2ce702dbed4fe9d7b..333a86445a244037ad5340e6c7ad1966b5e6c4b6 100644 (file)
@@ -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);
index 6eae92cc68c4ed0f7221ace5ecce031c0e7bc1f9..13dbe0b921455a3e8448e66443d4ac32b37c7632 100644 (file)
@@ -31,6 +31,8 @@ struct idmap_context {
        struct dom_sid *unix_users_sid;
 };
 
+struct event_context;
+
 #include "winbind/idmap_proto.h"
 
 #endif
index 99191f3c6ce6a957398ec1ec3b0b397d33b1457f..f84dece11c0feb3190950f630949c94f80ede9d4 100644 (file)
@@ -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;
index e750d9355aeb3f5d6a78b70afcc4103e2bd9d394..b7030669869af7561d64bed1db8e6b73601b3b8d 100644 (file)
 #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;
        }