diff options
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/common/sidmap.c | 5 | ||||
-rw-r--r-- | source4/dsdb/config.mk | 18 | ||||
-rw-r--r-- | source4/dsdb/repl/drepl_service.c | 2 | ||||
-rw-r--r-- | source4/dsdb/samdb/cracknames.c | 6 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/config.mk | 62 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/samldb.c | 3 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/update_keytab.c | 4 | ||||
-rw-r--r-- | source4/dsdb/samdb/samdb.c | 20 | ||||
-rw-r--r-- | source4/dsdb/samdb/samdb.h | 2 | ||||
-rw-r--r-- | source4/dsdb/samdb/samdb_privilege.c | 5 |
10 files changed, 72 insertions, 55 deletions
diff --git a/source4/dsdb/common/sidmap.c b/source4/dsdb/common/sidmap.c index 2144d61dfc..20bba7a0d9 100644 --- a/source4/dsdb/common/sidmap.c +++ b/source4/dsdb/common/sidmap.c @@ -49,14 +49,15 @@ struct sidmap_context { /* open a sidmap context - use talloc_free to close */ -struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx) +struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx, + struct loadparm_context *lp_ctx) { struct sidmap_context *sidmap; sidmap = talloc(mem_ctx, struct sidmap_context); if (sidmap == NULL) { return NULL; } - sidmap->samctx = samdb_connect(sidmap, lp_ctx, system_session(sidmap, lp_ctx)); + sidmap->samctx = samdb_connect(sidmap, ev_ctx, lp_ctx, system_session(sidmap, lp_ctx)); if (sidmap->samctx == NULL) { talloc_free(sidmap); return NULL; diff --git a/source4/dsdb/config.mk b/source4/dsdb/config.mk index e334e4c6e3..7b700fda22 100644 --- a/source4/dsdb/config.mk +++ b/source4/dsdb/config.mk @@ -5,57 +5,57 @@ mkinclude samdb/ldb_modules/config.mk ################################################ # Start SUBSYSTEM SAMDB [SUBSYSTEM::SAMDB] -PRIVATE_PROTO_HEADER = samdb/samdb_proto.h PUBLIC_DEPENDENCIES = HEIMDAL_KRB5 PRIVATE_DEPENDENCIES = LIBNDR NDR_MISC NDR_DRSUAPI NDR_DRSBLOBS NSS_WRAPPER \ auth_system_session LDAP_ENCODE LIBCLI_AUTH LIBNDR \ SAMDB_SCHEMA LDB_WRAP SAMDB_COMMON -SAMDB_OBJ_FILES = $(addprefix dsdb/, \ +SAMDB_OBJ_FILES = $(addprefix $(dsdbsrcdir)/, \ samdb/samdb.o \ samdb/samdb_privilege.o \ samdb/cracknames.o \ repl/replicated_objects.o) +$(eval $(call proto_header_template,$(dsdbsrcdir)/samdb/samdb_proto.h,$(SAMDB_OBJ_FILES:.o=.c))) # PUBLIC_HEADERS += dsdb/samdb/samdb.h [SUBSYSTEM::SAMDB_COMMON] -PRIVATE_PROTO_HEADER = common/proto.h PRIVATE_DEPENDENCIES = LIBLDB -SAMDB_COMMON_OBJ_FILES = $(addprefix dsdb/common/, \ +SAMDB_COMMON_OBJ_FILES = $(addprefix $(dsdbsrcdir)/common/, \ sidmap.o \ flag_mapping.o \ util.o) +$(eval $(call proto_header_template,$(dsdbsrcdir)/common/proto.h,$(SAMDB_COMMON_OBJ_FILES:.o=.c))) [SUBSYSTEM::SAMDB_SCHEMA] -PRIVATE_PROTO_HEADER = schema/proto.h PRIVATE_DEPENDENCIES = SAMDB_COMMON NDR_DRSUAPI NDR_DRSBLOBS -SAMDB_SCHEMA_OBJ_FILES = $(addprefix dsdb/schema/, \ +SAMDB_SCHEMA_OBJ_FILES = $(addprefix $(dsdbsrcdir)/schema/, \ schema_init.o \ schema_syntax.o \ schema_constructed.o) +$(eval $(call proto_header_template,$(dsdbsrcdir)/schema/proto.h,$(SAMDB_SCHEMA_OBJ_FILES:.o=.c))) # PUBLIC_HEADERS += dsdb/schema/schema.h ####################### # Start SUBSYSTEM DREPL_SRV [MODULE::DREPL_SRV] INIT_FUNCTION = server_service_drepl_init -SUBSYSTEM = service -PRIVATE_PROTO_HEADER = repl/drepl_service_proto.h +SUBSYSTEM = smbd PRIVATE_DEPENDENCIES = \ SAMDB \ process_model # End SUBSYSTEM DREPL_SRV ####################### -DREPL_SRV_OBJ_FILES = $(addprefix dsdb/repl/, \ +DREPL_SRV_OBJ_FILES = $(addprefix $(dsdbsrcdir)/repl/, \ drepl_service.o \ drepl_periodic.o \ drepl_partitions.o \ drepl_out_pull.o \ drepl_out_helpers.o) +$(eval $(call proto_header_template,$(dsdbsrcdir)/repl/drepl_service_proto.h,$(DREPL_SRV_OBJ_FILES:.o=.c))) diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 3375059e99..e485c50a47 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -51,7 +51,7 @@ static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service, struct lo const struct GUID *ntds_guid; struct drsuapi_DsBindInfo28 *bind_info28; - service->samdb = samdb_connect(service, lp_ctx, service->system_session_info); + service->samdb = samdb_connect(service, service->task->event_ctx, lp_ctx, service->system_session_info); if (!service->samdb) { return WERR_DS_SERVICE_UNAVAILABLE; } diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c index b9333e451b..da10cbb057 100644 --- a/source4/dsdb/samdb/cracknames.c +++ b/source4/dsdb/samdb/cracknames.c @@ -1197,6 +1197,7 @@ NTSTATUS crack_service_principal_name(struct ldb_context *sam_ctx, } NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, uint32_t format_offered, const char *name, @@ -1214,7 +1215,7 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } - ldb = samdb_connect(mem_ctx, lp_ctx, system_session(mem_ctx, lp_ctx)); + ldb = samdb_connect(mem_ctx, ev_ctx, lp_ctx, system_session(mem_ctx, lp_ctx)); if (ldb == NULL) { return NT_STATUS_INTERNAL_DB_CORRUPTION; } @@ -1259,6 +1260,7 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx, } NTSTATUS crack_auto_name_to_nt4_name(TALLOC_CTX *mem_ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, const char *name, const char **nt4_domain, @@ -1283,5 +1285,5 @@ NTSTATUS crack_auto_name_to_nt4_name(TALLOC_CTX *mem_ctx, format_offered = DRSUAPI_DS_NAME_FORMAT_CANONICAL; } - return crack_name_to_nt4_name(mem_ctx, lp_ctx, format_offered, name, nt4_domain, nt4_account); + return crack_name_to_nt4_name(mem_ctx, ev_ctx, lp_ctx, format_offered, name, nt4_domain, nt4_account); } diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk index 414b449ba8..eae190a85f 100644 --- a/source4/dsdb/samdb/ldb_modules/config.mk +++ b/source4/dsdb/samdb/ldb_modules/config.mk @@ -4,7 +4,7 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR NDR_MISC -INIT_FUNCTION = objectguid_module_module_ops +INIT_FUNCTION = LDB_MODULE(objectguid) # End MODULE ldb_objectguid ################################################ @@ -17,7 +17,7 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC LIBNDR NDR_MISC NDR_DRSUAPI \ NDR_DRSBLOBS LIBNDR -INIT_FUNCTION = repl_meta_data_module_module_ops +INIT_FUNCTION = LDB_MODULE(repl_meta_data) # End MODULE ldb_repl_meta_data ################################################ @@ -30,7 +30,7 @@ ldb_repl_meta_data_OBJ_FILES = \ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC -INIT_FUNCTION = dsdb_cache_module_module_ops +INIT_FUNCTION = LDB_MODULE(dsdb_cache) # End MODULE ldb_dsdb_cache ################################################ @@ -43,7 +43,7 @@ ldb_dsdb_cache_OBJ_FILES = \ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC -INIT_FUNCTION = schema_fsmo_module_module_ops +INIT_FUNCTION = LDB_MODULE(schema_fsmo) # End MODULE ldb_schema_fsmo ################################################ @@ -56,7 +56,7 @@ ldb_schema_fsmo_OBJ_FILES = \ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC -INIT_FUNCTION = naming_fsmo_module_module_ops +INIT_FUNCTION = LDB_MODULE(naming_fsmo) # End MODULE ldb_naming_fsmo ################################################ @@ -69,7 +69,7 @@ ldb_naming_fsmo_OBJ_FILES = \ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC -INIT_FUNCTION = pdc_fsmo_module_module_ops +INIT_FUNCTION = LDB_MODULE(pdc_fsmo) # End MODULE ldb_pdc_fsmo ################################################ @@ -82,7 +82,7 @@ ldb_pdc_fsmo_OBJ_FILES = \ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LDAP_ENCODE NDR_MISC SAMDB -INIT_FUNCTION = samldb_module_module_ops +INIT_FUNCTION = LDB_MODULE(samldb) # # End MODULE ldb_samldb ################################################ @@ -95,10 +95,9 @@ ldb_samldb_OBJ_FILES = \ [MODULE::ldb_samba3sam] SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY -INIT_FUNCTION = &ldb_samba3sam_module_module_ops -PRIVATE_DEPENDENCIES = LIBTALLOC ldb_map SMBPASSWD NSS_WRAPPER LIBSECURITY \ +INIT_FUNCTION = LDB_MODULE(samba3sam) +PRIVATE_DEPENDENCIES = LIBTALLOC SMBPASSWD NSS_WRAPPER LIBSECURITY \ NDR_SECURITY -# # End MODULE ldb_samldb ################################################ @@ -110,11 +109,10 @@ ldb_samba3sam_OBJ_FILES = \ [MODULE::ldb_simple_ldap_map] SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY -INIT_FUNCTION = &ldb_simple_ldap_map_module_module_ops -PRIVATE_DEPENDENCIES = LIBTALLOC ldb_map LIBNDR NDR_MISC +INIT_FUNCTION = LDB_MODULE(simple_ldap_map) +PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR NDR_MISC ENABLE = YES ALIASES = entryuuid nsuniqueid -# # End MODULE ldb_entryuuid ################################################ @@ -125,7 +123,7 @@ ldb_simple_ldap_map_OBJ_FILES = \ # # Start MODULE ldb_proxy # [MODULE::ldb_proxy] # SUBSYSTEM = LIBLDB -# INIT_FUNCTION = proxy_module_module_ops +# INIT_FUNCTION = LDB_MODULE(proxy) # OBJ_FILES = \ # proxy.o # @@ -139,7 +137,7 @@ ldb_simple_ldap_map_OBJ_FILES = \ SUBSYSTEM = LIBLDB PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB OUTPUT_TYPE = SHARED_LIBRARY -INIT_FUNCTION = rootdse_module_module_ops +INIT_FUNCTION = LDB_MODULE(rootdse) # End MODULE ldb_rootdse ################################################ @@ -150,7 +148,7 @@ ldb_rootdse_OBJ_FILES = dsdb/samdb/ldb_modules/rootdse.o [MODULE::ldb_password_hash] SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY -INIT_FUNCTION = password_hash_module_module_ops +INIT_FUNCTION = LDB_MODULE(password_hash) PRIVATE_DEPENDENCIES = HEIMDAL_HDB_KEYS LIBTALLOC HEIMDAL_KRB5 LDAP_ENCODE \ LIBCLI_AUTH NDR_DRSBLOBS KERBEROS SAMDB # End MODULE ldb_password_hash @@ -164,7 +162,7 @@ ldb_password_hash_OBJ_FILES = dsdb/samdb/ldb_modules/password_hash.o PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR SAMDB OUTPUT_TYPE = SHARED_LIBRARY SUBSYSTEM = LIBLDB -INIT_FUNCTION = local_password_module_module_ops +INIT_FUNCTION = LDB_MODULE(local_password) # End MODULE ldb_local_password ################################################ @@ -176,7 +174,7 @@ ldb_local_password_OBJ_FILES = dsdb/samdb/ldb_modules/local_password.o PRIVATE_DEPENDENCIES = LIBTALLOC LIBSECURITY SAMDB OUTPUT_TYPE = SHARED_LIBRARY SUBSYSTEM = LIBLDB -INIT_FUNCTION = &ldb_kludge_acl_module_ops +INIT_FUNCTION = LDB_MODULE(kludge_acl) # End MODULE ldb_kludge_acl ################################################ @@ -189,7 +187,7 @@ ldb_kludge_acl_OBJ_FILES = dsdb/samdb/ldb_modules/kludge_acl.o SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR LIBSECURITY SAMDB -INIT_FUNCTION = &ldb_extended_dn_module_ops +INIT_FUNCTION = LDB_MODULE(extended_dn) # End MODULE ldb_extended_dn ################################################ @@ -201,7 +199,7 @@ ldb_extended_dn_OBJ_FILES = dsdb/samdb/ldb_modules/extended_dn.o SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC -INIT_FUNCTION = &ldb_show_deleted_module_ops +INIT_FUNCTION = LDB_MODULE(show_deleted) # End MODULE ldb_show_deleted ################################################ @@ -213,7 +211,7 @@ ldb_show_deleted_OBJ_FILES = dsdb/samdb/ldb_modules/show_deleted.o SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB -INIT_FUNCTION = &ldb_partition_module_ops +INIT_FUNCTION = LDB_MODULE(partition) # End MODULE ldb_partition ################################################ @@ -225,7 +223,7 @@ ldb_partition_OBJ_FILES = dsdb/samdb/ldb_modules/partition.o SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBLDB -INIT_FUNCTION = &ldb_schema_module_ops +INIT_FUNCTION = LDB_MODULE(schema) # End MODULE ldb_schema ################################################ @@ -238,7 +236,7 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC CREDENTIALS #Also depends on credentials, but that would loop -INIT_FUNCTION = &ldb_update_kt_module_ops +INIT_FUNCTION = LDB_MODULE(update_kt) # End MODULE ldb_update_kt ################################################ @@ -247,7 +245,7 @@ ldb_update_keytab_OBJ_FILES = dsdb/samdb/ldb_modules/update_keytab.o ################################################ # Start MODULE ldb_objectclass [MODULE::ldb_objectclass] -INIT_FUNCTION = &ldb_objectclass_module_ops +INIT_FUNCTION = LDB_MODULE(objectclass) OUTPUT_TYPE = SHARED_LIBRARY CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC LIBSECURITY NDR_SECURITY SAMDB @@ -260,7 +258,7 @@ ldb_objectclass_OBJ_FILES = dsdb/samdb/ldb_modules/objectclass.o ################################################ # Start MODULE ldb_subtree_rename [MODULE::ldb_subtree_rename] -INIT_FUNCTION = &ldb_subtree_rename_module_ops +INIT_FUNCTION = LDB_MODULE(subtree_rename) CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB @@ -272,7 +270,7 @@ ldb_subtree_rename_OBJ_FILES = dsdb/samdb/ldb_modules/subtree_rename.o ################################################ # Start MODULE ldb_subtree_rename [MODULE::ldb_subtree_delete] -INIT_FUNCTION = &ldb_subtree_delete_module_ops +INIT_FUNCTION = LDB_MODULE(subtree_delete) CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB @@ -284,7 +282,7 @@ ldb_subtree_delete_OBJ_FILES = dsdb/samdb/ldb_modules/subtree_delete.o ################################################ # Start MODULE ldb_linked_attributes [MODULE::ldb_linked_attributes] -INIT_FUNCTION = &ldb_linked_attributes_module_ops +INIT_FUNCTION = LDB_MODULE(linked_attributes) CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB @@ -297,7 +295,7 @@ ldb_linked_attributes_OBJ_FILES = dsdb/samdb/ldb_modules/linked_attributes.o ################################################ # Start MODULE ldb_ranged_results [MODULE::ldb_ranged_results] -INIT_FUNCTION = &ldb_ranged_results_module_ops +INIT_FUNCTION = LDB_MODULE(ranged_results) CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB @@ -309,7 +307,7 @@ ldb_ranged_results_OBJ_FILES = dsdb/samdb/ldb_modules/ranged_results.o ################################################ # Start MODULE ldb_anr [MODULE::ldb_anr] -INIT_FUNCTION = &ldb_anr_module_ops +INIT_FUNCTION = LDB_MODULE(anr) CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB @@ -322,7 +320,7 @@ ldb_anr_OBJ_FILES = dsdb/samdb/ldb_modules/anr.o ################################################ # Start MODULE ldb_normalise [MODULE::ldb_normalise] -INIT_FUNCTION = &ldb_normalise_module_ops +INIT_FUNCTION = LDB_MODULE(normalise) CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB @@ -335,10 +333,10 @@ ldb_normalise_OBJ_FILES = dsdb/samdb/ldb_modules/normalise.o ################################################ # Start MODULE ldb_instancetype [MODULE::ldb_instancetype] -INIT_FUNCTION = &ldb_instancetype_module_ops +INIT_FUNCTION = LDB_MODULE(instancetype) CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY -PRIVATE_DEPENDENCIES = LIBTALLOC +PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB SUBSYSTEM = LIBLDB # End MODULE ldb_instancetype ################################################ diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 3b67ca19d3..88590f306b 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -484,8 +484,7 @@ static int samldb_fill_group_object(struct ldb_module *module, const struct ldb_ return ret; } -static int samldb_fill_user_or_computer_object(struct ldb_module *module, const struct ldb_message *msg, - struct ldb_message **ret_msg) +static int samldb_fill_user_or_computer_object(struct ldb_module *module, const struct ldb_message *msg, struct ldb_message **ret_msg) { int ret; char *name; diff --git a/source4/dsdb/samdb/ldb_modules/update_keytab.c b/source4/dsdb/samdb/ldb_modules/update_keytab.c index 54362dcfd4..b36c2c9b71 100644 --- a/source4/dsdb/samdb/ldb_modules/update_keytab.c +++ b/source4/dsdb/samdb/ldb_modules/update_keytab.c @@ -90,7 +90,7 @@ static int add_modified(struct ldb_module *module, struct ldb_dn *dn, bool delet } cli_credentials_set_conf(item->creds, ldb_get_opaque(module->ldb, "loadparm")); - status = cli_credentials_set_secrets(item->creds, ldb_get_opaque(module->ldb, "loadparm"), module->ldb, NULL, filter); + status = cli_credentials_set_secrets(item->creds, ldb_get_opaque(module->ldb, "EventContext"), ldb_get_opaque(module->ldb, "loadparm"), module->ldb, NULL, filter); talloc_free(filter); if (NT_STATUS_IS_OK(status)) { if (delete) { @@ -158,7 +158,7 @@ static int update_kt_end_trans(struct ldb_module *module) struct dn_list *p; for (p=data->changed_dns; p; p = p->next) { int kret; - kret = cli_credentials_update_keytab(p->creds, ldb_get_opaque(module->ldb, "loadparm")); + kret = cli_credentials_update_keytab(p->creds, ldb_get_opaque(module->ldb, "EventContext"), ldb_get_opaque(module->ldb, "loadparm")); if (kret != 0) { talloc_free(data->changed_dns); data->changed_dns = NULL; diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index a01e442587..9154f5382b 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -37,6 +37,7 @@ #include "dsdb/samdb/samdb.h" #include "dsdb/common/flags.h" #include "param/param.h" +#include "lib/events/events.h" char *samdb_relative_path(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, @@ -71,11 +72,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 +100,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 +113,17 @@ 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"); + + /* FIXME: need to remove this wehn we finally pass the event + * context around in ldb */ + if (event_ctx == NULL) { + event_ctx = event_context_init(templates_ldb); + } - 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 +197,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 +256,7 @@ NTSTATUS security_token_create(TALLOC_CTX *mem_ctx, } /* setup the privilege mask for this token */ - status = samdb_privilege_setup(lp_ctx, ptoken); + status = samdb_privilege_setup(ev_ctx, lp_ctx, ptoken); if (!NT_STATUS_IS_OK(status)) { talloc_free(ptoken); return status; diff --git a/source4/dsdb/samdb/samdb.h b/source4/dsdb/samdb/samdb.h index 5d8694d2d4..8370857aba 100644 --- a/source4/dsdb/samdb/samdb.h +++ b/source4/dsdb/samdb/samdb.h @@ -27,6 +27,7 @@ struct dsdb_control_current_partition; struct dsdb_extended_replicated_object; struct dsdb_extended_replicated_objects; struct loadparm_context; +struct event_context; #include "librpc/gen_ndr/security.h" #include "lib/ldb/include/ldb.h" @@ -36,6 +37,7 @@ struct loadparm_context; #include "dsdb/schema/schema.h" #include "dsdb/samdb/samdb_proto.h" #include "dsdb/common/proto.h" +#include "dsdb/common/flags.h" #define DSDB_CONTROL_CURRENT_PARTITION_OID "1.3.6.1.4.1.7165.4.3.2" struct dsdb_control_current_partition { diff --git a/source4/dsdb/samdb/samdb_privilege.c b/source4/dsdb/samdb/samdb_privilege.c index 5c2de81816..688d1ef9de 100644 --- a/source4/dsdb/samdb/samdb_privilege.c +++ b/source4/dsdb/samdb/samdb_privilege.c @@ -73,7 +73,8 @@ static NTSTATUS samdb_privilege_setup_sid(void *samctx, TALLOC_CTX *mem_ctx, setup the privilege mask for this security token based on our local SAM */ -NTSTATUS samdb_privilege_setup(struct loadparm_context *lp_ctx, struct security_token *token) +NTSTATUS samdb_privilege_setup(struct event_context *ev_ctx, + struct loadparm_context *lp_ctx, struct security_token *token) { void *samctx; TALLOC_CTX *mem_ctx; @@ -97,7 +98,7 @@ NTSTATUS samdb_privilege_setup(struct loadparm_context *lp_ctx, struct security_ } mem_ctx = talloc_new(token); - samctx = samdb_connect(mem_ctx, lp_ctx, system_session(mem_ctx, lp_ctx)); + samctx = samdb_connect(mem_ctx, ev_ctx, lp_ctx, system_session(mem_ctx, lp_ctx)); if (samctx == NULL) { talloc_free(mem_ctx); return NT_STATUS_INTERNAL_DB_CORRUPTION; |