The branch, master has been updated via 306783d lib: modules: Change XXX_init interface from XXX_init(void) to XXX_init(TALLOC_CTX *) from 9342b3e pyrpc: Fix segfault in ClientConnection
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 306783d6f5d577a0b8bd31d659d8c802f22f0333 Author: Jeremy Allison <j...@samba.org> Date: Thu Apr 20 12:24:43 2017 -0700 lib: modules: Change XXX_init interface from XXX_init(void) to XXX_init(TALLOC_CTX *) Not currently used - no logic changes inside. This will make it possible to pass down a long-lived talloc context from the loading function for modules to use instead of having them internally all use talloc_autofree_context() which is a hidden global. Updated all known module interface numbers, and added a WHATSNEW. Signed-off-by: Jeremy Allison <j...@samba.org> Signed-off-by: Ralph Böhme <s...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Sat Apr 22 01:17:00 CEST 2017 on sn-devel-144 ----------------------------------------------------------------------- Summary of changes: WHATSNEW.txt | 19 +++++++++++++++++++ auth/gensec/external.c | 4 ++-- auth/gensec/gensec.h | 3 ++- auth/gensec/gensec_start.c | 6 +++--- auth/gensec/ncalrpc.c | 4 ++-- auth/gensec/schannel.c | 4 ++-- auth/gensec/spnego.c | 4 ++-- auth/ntlmssp/ntlmssp.c | 2 +- auth/ntlmssp/ntlmssp.h | 2 +- buildtools/wafsamba/samba_patterns.py | 3 +++ docs-xml/Samba3-Developers-Guide/modules.xml | 14 ++++++++++++-- examples/VFS/shadow_copy_test.c | 2 +- examples/VFS/skel_opaque.c | 2 +- examples/VFS/skel_transparent.c | 2 +- examples/auth/auth_skel.c | 4 ++-- examples/pdb/test.c | 2 +- file_server/file_server.c | 4 ++-- lib/util/modules.c | 6 +++--- lib/util/samba_modules.h | 6 +++--- libcli/echo/tests/echo.c | 4 ++-- pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm | 4 ++-- source3/auth/auth.c | 2 +- source3/auth/auth_builtin.c | 2 +- source3/auth/auth_domain.c | 2 +- source3/auth/auth_sam.c | 2 +- source3/auth/auth_samba4.c | 4 ++-- source3/auth/auth_script.c | 4 ++-- source3/auth/auth_unix.c | 2 +- source3/auth/auth_winbind.c | 2 +- source3/auth/proto.h | 12 ++++++------ source3/include/auth.h | 3 ++- source3/include/idmap.h | 3 ++- source3/include/nss_info.h | 2 +- source3/include/passdb.h | 3 ++- source3/include/smb_perfcount.h | 3 ++- source3/include/vfs.h | 3 ++- source3/modules/perfcount_test.c | 2 +- source3/modules/vfs_acl_tdb.c | 2 +- source3/modules/vfs_acl_xattr.c | 2 +- source3/modules/vfs_afsacl.c | 4 ++-- source3/modules/vfs_aio_fork.c | 4 ++-- source3/modules/vfs_aio_linux.c | 2 +- source3/modules/vfs_aio_pthread.c | 4 ++-- source3/modules/vfs_aixacl.c | 4 ++-- source3/modules/vfs_aixacl2.c | 4 ++-- source3/modules/vfs_audit.c | 2 +- source3/modules/vfs_btrfs.c | 4 ++-- source3/modules/vfs_cacheprime.c | 4 ++-- source3/modules/vfs_cap.c | 4 ++-- source3/modules/vfs_catia.c | 2 +- source3/modules/vfs_ceph.c | 4 ++-- source3/modules/vfs_commit.c | 4 ++-- source3/modules/vfs_crossrename.c | 4 ++-- source3/modules/vfs_default.c | 4 ++-- source3/modules/vfs_default_quota.c | 4 ++-- source3/modules/vfs_dfs_samba4.c | 4 ++-- source3/modules/vfs_dirsort.c | 2 +- source3/modules/vfs_expand_msdfs.c | 4 ++-- source3/modules/vfs_extd_audit.c | 2 +- source3/modules/vfs_fake_acls.c | 4 ++-- source3/modules/vfs_fake_dfq.c | 2 +- source3/modules/vfs_fake_perms.c | 4 ++-- source3/modules/vfs_fileid.c | 4 ++-- source3/modules/vfs_fruit.c | 4 ++-- source3/modules/vfs_full_audit.c | 2 +- source3/modules/vfs_glusterfs.c | 4 ++-- source3/modules/vfs_gpfs.c | 4 ++-- source3/modules/vfs_hpuxacl.c | 2 +- source3/modules/vfs_linux_xfs_sgid.c | 4 ++-- source3/modules/vfs_media_harmony.c | 4 ++-- source3/modules/vfs_netatalk.c | 4 ++-- source3/modules/vfs_nfs4acl_xattr.c | 4 ++-- source3/modules/vfs_offline.c | 4 ++-- source3/modules/vfs_posix_eadb.c | 2 +- source3/modules/vfs_posixacl.c | 4 ++-- source3/modules/vfs_posixacl.h | 2 +- source3/modules/vfs_prealloc.c | 4 ++-- source3/modules/vfs_preopen.c | 4 ++-- source3/modules/vfs_readahead.c | 4 ++-- source3/modules/vfs_readonly.c | 4 ++-- source3/modules/vfs_recycle.c | 4 ++-- source3/modules/vfs_shadow_copy.c | 4 ++-- source3/modules/vfs_shadow_copy2.c | 4 ++-- source3/modules/vfs_shell_snap.c | 4 ++-- source3/modules/vfs_snapper.c | 4 ++-- source3/modules/vfs_solarisacl.c | 4 ++-- source3/modules/vfs_streams_depot.c | 4 ++-- source3/modules/vfs_streams_xattr.c | 4 ++-- source3/modules/vfs_syncops.c | 2 +- source3/modules/vfs_time_audit.c | 4 ++-- source3/modules/vfs_tru64acl.c | 4 ++-- source3/modules/vfs_tsmsm.c | 4 ++-- source3/modules/vfs_unityed_media.c | 4 ++-- source3/modules/vfs_vxfs.c | 4 ++-- source3/modules/vfs_worm.c | 4 ++-- source3/modules/vfs_xattr_tdb.c | 4 ++-- source3/modules/vfs_zfsacl.c | 4 ++-- source3/passdb/pdb_interface.c | 2 +- source3/passdb/pdb_ldap.c | 4 ++-- source3/passdb/pdb_ldap.h | 2 +- source3/passdb/pdb_nds.c | 2 +- source3/passdb/pdb_nds.h | 2 +- source3/passdb/pdb_samba_dsdb.c | 4 ++-- source3/passdb/pdb_smbpasswd.c | 2 +- source3/passdb/pdb_smbpasswd.h | 2 +- source3/passdb/pdb_tdb.c | 2 +- source3/passdb/pdb_tdb.h | 2 +- source3/rpc_server/mdssvc/srv_mdssvc_nt.c | 2 +- source3/rpc_server/rpc_service_setup.c | 4 ++-- source3/smbd/vfs.c | 2 +- source3/winbindd/idmap.c | 2 +- source3/winbindd/idmap_ad.c | 4 ++-- source3/winbindd/idmap_ad_nss.c | 2 +- source3/winbindd/idmap_autorid.c | 2 +- source3/winbindd/idmap_hash/idmap_hash.c | 2 +- source3/winbindd/idmap_ldap.c | 4 ++-- source3/winbindd/idmap_nss.c | 2 +- source3/winbindd/idmap_passdb.c | 2 +- source3/winbindd/idmap_proto.h | 8 ++++---- source3/winbindd/idmap_rfc2307.c | 2 +- source3/winbindd/idmap_rid.c | 2 +- source3/winbindd/idmap_script.c | 2 +- source3/winbindd/idmap_tdb.c | 2 +- source3/winbindd/idmap_tdb2.c | 2 +- source3/winbindd/nss_info.c | 2 +- source3/winbindd/nss_info_template.c | 2 +- source3/wscript | 6 +++--- source4/auth/auth.h | 2 +- source4/auth/gensec/gensec_gssapi.c | 4 ++-- source4/auth/gensec/gensec_krb5.c | 4 ++-- source4/auth/ntlm/auth.c | 4 ++-- source4/auth/ntlm/auth_anonymous.c | 4 ++-- source4/auth/ntlm/auth_developer.c | 4 ++-- source4/auth/ntlm/auth_sam.c | 4 ++-- source4/auth/ntlm/auth_server_service.c | 2 +- source4/auth/ntlm/auth_unix.c | 4 ++-- source4/auth/ntlm/auth_winbind.c | 4 ++-- source4/cldap_server/cldap_server.c | 4 ++-- source4/dns_server/dns_server.c | 4 ++-- source4/dsdb/dns/dns_update.c | 4 ++-- source4/dsdb/kcc/kcc_service.c | 2 +- source4/dsdb/repl/drepl_service.c | 2 +- source4/echo_server/echo_server.c | 4 ++-- source4/kdc/kdc-heimdal.c | 4 ++-- source4/ldap_server/ldap_server.c | 2 +- source4/lib/com/classes/simple.c | 4 ++-- source4/lib/http/gensec/basic.c | 4 ++-- source4/lib/http/gensec/ntlm.c | 4 ++-- source4/nbt_server/nbt_server.c | 4 ++-- source4/ntp_signd/ntp_signd.c | 4 ++-- source4/ntvfs/cifs/vfs_cifs.c | 4 ++-- source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c | 2 +- source4/ntvfs/ipc/vfs_ipc.c | 2 +- source4/ntvfs/nbench/vfs_nbench.c | 4 ++-- source4/ntvfs/ntvfs_base.c | 6 +++--- source4/ntvfs/posix/pvfs_acl.c | 6 +++--- source4/ntvfs/posix/pvfs_acl_nfs4.c | 4 ++-- source4/ntvfs/posix/pvfs_acl_xattr.c | 4 ++-- source4/ntvfs/posix/vfs_posix.c | 2 +- source4/ntvfs/print/vfs_print.c | 4 ++-- source4/ntvfs/simple/vfs_simple.c | 2 +- source4/ntvfs/smb2/vfs_smb2.c | 4 ++-- source4/ntvfs/sysdep/inotify.c | 4 ++-- source4/ntvfs/sysdep/sys_lease.c | 4 ++-- source4/ntvfs/sysdep/sys_lease_linux.c | 4 ++-- source4/ntvfs/sysdep/sys_notify.c | 4 ++-- source4/ntvfs/unixuid/vfs_unixuid.c | 4 ++-- source4/param/share.c | 4 ++-- source4/param/share_classic.c | 4 ++-- source4/param/share_ldb.c | 4 ++-- source4/rpc_server/dcerpc_server.c | 6 +++--- source4/rpc_server/lsa/dcesrv_lsa.c | 6 +++--- source4/rpc_server/service_rpc.c | 4 ++-- source4/smb_server/service_smb.c | 2 +- source4/smbd/process_model.c | 6 +++--- source4/smbd/process_single.c | 4 ++-- source4/smbd/process_standard.c | 4 ++-- source4/smbd/server.c | 6 +++--- source4/torture/basic/base.c | 2 +- source4/torture/dfs/domaindfs.c | 2 +- source4/torture/dns/dlz_bind9.c | 4 ++-- source4/torture/dns/internal_dns.c | 4 ++-- source4/torture/drs/drs_init.c | 2 +- source4/torture/krb5/kdc-heimdal.c | 2 +- source4/torture/krb5/kdc-mit.c | 2 +- source4/torture/ldap/common.c | 2 +- source4/torture/libnet/libnet.c | 2 +- source4/torture/libnetapi/libnetapi.c | 2 +- source4/torture/libsmbclient/libsmbclient.c | 2 +- source4/torture/local/local.c | 2 +- source4/torture/nbench/nbench.c | 2 +- source4/torture/nbt/nbt.c | 2 +- source4/torture/ntp/ntp_signd.c | 2 +- source4/torture/rap/rap.c | 2 +- source4/torture/raw/raw.c | 2 +- source4/torture/rpc/rpc.c | 2 +- source4/torture/smb2/smb2.c | 2 +- source4/torture/smbtorture.c | 2 +- source4/torture/torture.c | 6 +++--- source4/torture/unix/unix.c | 2 +- source4/torture/vfs/vfs.c | 2 +- source4/torture/winbind/winbind.c | 2 +- source4/web_server/web_server.c | 4 ++-- source4/winbind/winbindd.c | 4 ++-- source4/wrepl_server/wrepl_server.c | 2 +- 205 files changed, 373 insertions(+), 335 deletions(-) Changeset truncated at 500 lines: diff --git a/WHATSNEW.txt b/WHATSNEW.txt index 5e6d159..d9324e7 100644 --- a/WHATSNEW.txt +++ b/WHATSNEW.txt @@ -60,6 +60,25 @@ was using this call please raise the issue on samba-techni...@lists.samba.org in order to design a supported way of obtaining the same functionality. +Change of loadable module interface +----------------------------------- + +The _init function of all loadable modules in Samba has changed +from: + +NTSTATUS _init(void); + +to: + +NTSTATUS _init(TALLOC_CTX *); + +This allows a program loading a module to pass in a long-lived +talloc context (which must be guaranteed to be alive for the +lifetime of the module). This allows modules to avoid use of +the talloc_autofree_context() (which is inherently thread-unsafe) +and still be valgrind-clean on exit. Modules that don't need to +free long-lived data on exist should use the NULL talloc context. + KNOWN ISSUES ============ diff --git a/auth/gensec/external.c b/auth/gensec/external.c index 9c17888..92295bc 100644 --- a/auth/gensec/external.c +++ b/auth/gensec/external.c @@ -32,7 +32,7 @@ * layer is already mutually authenticated. */ -NTSTATUS gensec_external_init(void); +NTSTATUS gensec_external_init(TALLOC_CTX *ctx); static NTSTATUS gensec_external_start(struct gensec_security *gensec_security) { @@ -111,7 +111,7 @@ static const struct gensec_security_ops gensec_external_ops = { }; -NTSTATUS gensec_external_init(void) +NTSTATUS gensec_external_init(TALLOC_CTX *ctx) { NTSTATUS ret; diff --git a/auth/gensec/gensec.h b/auth/gensec/gensec.h index 6764ee5..3924a7c 100644 --- a/auth/gensec/gensec.h +++ b/auth/gensec/gensec.h @@ -107,7 +107,8 @@ struct gensec_settings { struct gensec_security_ops; struct gensec_security_ops_wrapper; -#define GENSEC_INTERFACE_VERSION 0 +/* Change to 1, loadable modules now take a TALLOC_CTX * init() parameter. */ +#define GENSEC_INTERFACE_VERSION 1 /* this structure is used by backends to determine the size of some critical types */ struct gensec_critical_sizes; diff --git a/auth/gensec/gensec_start.c b/auth/gensec/gensec_start.c index 31a5559..83a86cf 100644 --- a/auth/gensec/gensec_start.c +++ b/auth/gensec/gensec_start.c @@ -956,7 +956,7 @@ bool gensec_setting_bool(struct gensec_settings *settings, const char *mechanism _PUBLIC_ NTSTATUS gensec_init(void) { static bool initialized = false; -#define _MODULE_PROTO(init) extern NTSTATUS init(void); +#define _MODULE_PROTO(init) extern NTSTATUS init(TALLOC_CTX *); #ifdef STATIC_gensec_MODULES STATIC_gensec_MODULES_PROTO; init_module_fn static_init[] = { STATIC_gensec_MODULES }; @@ -970,8 +970,8 @@ _PUBLIC_ NTSTATUS gensec_init(void) shared_init = load_samba_modules(NULL, "gensec"); - run_init_functions(static_init); - run_init_functions(shared_init); + run_init_functions(NULL, static_init); + run_init_functions(NULL, shared_init); talloc_free(shared_init); diff --git a/auth/gensec/ncalrpc.c b/auth/gensec/ncalrpc.c index e6f33f3..8916ef5 100644 --- a/auth/gensec/ncalrpc.c +++ b/auth/gensec/ncalrpc.c @@ -30,7 +30,7 @@ #include "lib/param/param.h" #include "tsocket.h" -_PUBLIC_ NTSTATUS gensec_ncalrpc_as_system_init(void); +_PUBLIC_ NTSTATUS gensec_ncalrpc_as_system_init(TALLOC_CTX *ctx); struct gensec_ncalrpc_state { enum { @@ -338,7 +338,7 @@ static const struct gensec_security_ops gensec_ncalrpc_security_ops = { .priority = GENSEC_EXTERNAL, }; -_PUBLIC_ NTSTATUS gensec_ncalrpc_as_system_init(void) +_PUBLIC_ NTSTATUS gensec_ncalrpc_as_system_init(TALLOC_CTX *ctx) { NTSTATUS status; diff --git a/auth/gensec/schannel.c b/auth/gensec/schannel.c index 1b99bb7..bf169d4 100644 --- a/auth/gensec/schannel.c +++ b/auth/gensec/schannel.c @@ -441,7 +441,7 @@ static NTSTATUS netsec_outgoing_packet(struct schannel_state *state, return NT_STATUS_OK; } -_PUBLIC_ NTSTATUS gensec_schannel_init(void); +_PUBLIC_ NTSTATUS gensec_schannel_init(TALLOC_CTX *ctx); static size_t schannel_sig_size(struct gensec_security *gensec_security, size_t data_size) { @@ -849,7 +849,7 @@ static const struct gensec_security_ops gensec_schannel_security_ops = { .priority = GENSEC_SCHANNEL }; -_PUBLIC_ NTSTATUS gensec_schannel_init(void) +_PUBLIC_ NTSTATUS gensec_schannel_init(TALLOC_CTX *ctx) { NTSTATUS ret; ret = gensec_register(&gensec_schannel_security_ops); diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c index 017181a..4b3edc6 100644 --- a/auth/gensec/spnego.c +++ b/auth/gensec/spnego.c @@ -34,7 +34,7 @@ #undef strcasecmp -_PUBLIC_ NTSTATUS gensec_spnego_init(void); +_PUBLIC_ NTSTATUS gensec_spnego_init(TALLOC_CTX *ctx); enum spnego_state_position { SPNEGO_SERVER_START, @@ -1694,7 +1694,7 @@ static const struct gensec_security_ops gensec_spnego_security_ops = { .priority = GENSEC_SPNEGO }; -_PUBLIC_ NTSTATUS gensec_spnego_init(void) +_PUBLIC_ NTSTATUS gensec_spnego_init(TALLOC_CTX *ctx) { NTSTATUS ret; ret = gensec_register(&gensec_spnego_security_ops); diff --git a/auth/ntlmssp/ntlmssp.c b/auth/ntlmssp/ntlmssp.c index 6f7c089..ec2f6d9 100644 --- a/auth/ntlmssp/ntlmssp.c +++ b/auth/ntlmssp/ntlmssp.c @@ -252,7 +252,7 @@ static const struct gensec_security_ops gensec_ntlmssp_resume_ccache_ops = { .priority = GENSEC_NTLMSSP }; -_PUBLIC_ NTSTATUS gensec_ntlmssp_init(void) +_PUBLIC_ NTSTATUS gensec_ntlmssp_init(TALLOC_CTX *ctx) { NTSTATUS ret; diff --git a/auth/ntlmssp/ntlmssp.h b/auth/ntlmssp/ntlmssp.h index 2412768..658d3fa 100644 --- a/auth/ntlmssp/ntlmssp.h +++ b/auth/ntlmssp/ntlmssp.h @@ -145,7 +145,7 @@ bool ntlmssp_blob_matches_magic(const DATA_BLOB *blob); /* The following definitions come from auth/ntlmssp/gensec_ntlmssp.c */ -NTSTATUS gensec_ntlmssp_init(void); +NTSTATUS gensec_ntlmssp_init(TALLOC_CTX *ctx); uint32_t gensec_ntlmssp_neg_flags(struct gensec_security *gensec_security); const char *gensec_ntlmssp_server_domain(struct gensec_security *gensec_security); diff --git a/buildtools/wafsamba/samba_patterns.py b/buildtools/wafsamba/samba_patterns.py index ceca2cc..0481520 100644 --- a/buildtools/wafsamba/samba_patterns.py +++ b/buildtools/wafsamba/samba_patterns.py @@ -178,6 +178,9 @@ def write_build_options(task): keys_header_other.append(key) else: keys_option_have.append(key) + elif key.startswith("static_init_"): + l = key.split("(") + keys_misc.append(l[0]) else: keys_misc.append(key) diff --git a/docs-xml/Samba3-Developers-Guide/modules.xml b/docs-xml/Samba3-Developers-Guide/modules.xml index a74c176..f0d19f1 100644 --- a/docs-xml/Samba3-Developers-Guide/modules.xml +++ b/docs-xml/Samba3-Developers-Guide/modules.xml @@ -101,7 +101,7 @@ The prototype for these functions is: </para> <para><programlisting> -NTSTATUS init_module(void); +NTSTATUS init_module(TALLOC_CTX *); </programlisting></para> <para>This function should call one or more @@ -111,7 +111,7 @@ NT_STATUS_UNSUCCESSFUL or a more useful nt error code on failure.</para> <para>For example, pdb_ldap_init() contains: </para> <para><programlisting> -NTSTATUS pdb_ldap_init(void) +NTSTATUS pdb_ldap_init(TALLOC_CTX *) { smb_register_passdb(PASSDB_INTERFACE_VERSION, "ldapsam", pdb_init_ldapsam); smb_register_passdb(PASSDB_INTERFACE_VERSION, "ldapsam_nua", pdb_init_ldapsam_nua); @@ -119,6 +119,16 @@ smb_register_passdb(PASSDB_INTERFACE_VERSION, "ldapsam_nua", pdb_init_ldapsam_nu } </programlisting></para> +<para> +The TALLOC_CTX pointer passed as a parameter must be a long-lived context, +that will stay around for as long as the program that loads the module +exists. It allows the caller to taloc_free any long lived data the +module choses to place on this context on program exit (giving a cleaner +valgrind trace). It should be used by modules in place of talloc_autofree_context(), +use of which makes programs thread-unsafe. Modules that don't care about +free on exist should use the NULL talloc context. +</para> + <sect2> <title>Static/Shared selection in configure.in</title> diff --git a/examples/VFS/shadow_copy_test.c b/examples/VFS/shadow_copy_test.c index 05d6e16..48bf9d5 100644 --- a/examples/VFS/shadow_copy_test.c +++ b/examples/VFS/shadow_copy_test.c @@ -84,7 +84,7 @@ static struct vfs_fn_pointers vfs_test_shadow_copy_fns = { }; static_decl_vfs; -NTSTATUS vfs_shadow_copy_test_init(void) +NTSTATUS vfs_shadow_copy_test_init(TALLOC_CTX *ctx) { return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "shadow_copy_test", diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 9479595..ffd951c 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -994,7 +994,7 @@ struct vfs_fn_pointers skel_opaque_fns = { }; static_decl_vfs; -NTSTATUS vfs_skel_opaque_init(void) +NTSTATUS vfs_skel_opaque_init(TALLOC_CTX *ctx) { return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque", &skel_opaque_fns); diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index f601312..afadbc1 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -1119,7 +1119,7 @@ struct vfs_fn_pointers skel_transparent_fns = { }; static_decl_vfs; -NTSTATUS vfs_skel_transparent_init(void) +NTSTATUS vfs_skel_transparent_init(TALLOC_CTX *ctx) { return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent", &skel_transparent_fns); diff --git a/examples/auth/auth_skel.c b/examples/auth/auth_skel.c index 3f3379f..6abd5ad 100644 --- a/examples/auth/auth_skel.c +++ b/examples/auth/auth_skel.c @@ -67,8 +67,8 @@ static NTSTATUS auth_init_skel(struct auth_context *auth_context, const char *pa return NT_STATUS_OK; } -NTSTATUS auth_skel_init(void); -NTSTATUS auth_skel_init(void) +NTSTATUS auth_skel_init(TALLOC_CTX *ctx); +NTSTATUS auth_skel_init(TALLOC_CTX *ctx) { return smb_register_auth(AUTH_INTERFACE_VERSION, "skel", auth_init_skel); } diff --git a/examples/pdb/test.c b/examples/pdb/test.c index 6d68d87..a5e7dac 100644 --- a/examples/pdb/test.c +++ b/examples/pdb/test.c @@ -108,7 +108,7 @@ static NTSTATUS testsam_init(struct pdb_methods **pdb_method, const char *locati } static_decl_pdb; -NTSTATUS pdb_test_init(void) +NTSTATUS pdb_test_init(TALLOC_CTX *ctx) { return smb_register_passdb(PASSDB_INTERFACE_VERSION, "testsam", testsam_init); diff --git a/file_server/file_server.c b/file_server/file_server.c index aab5f39..72d7de5 100644 --- a/file_server/file_server.c +++ b/file_server/file_server.c @@ -93,9 +93,9 @@ static void s3fs_task_init(struct task_server *task) } /* called at smbd startup - register ourselves as a server service */ -NTSTATUS server_service_s3fs_init(void); +NTSTATUS server_service_s3fs_init(TALLOC_CTX *); -NTSTATUS server_service_s3fs_init(void) +NTSTATUS server_service_s3fs_init(TALLOC_CTX *ctx) { return register_server_service("s3fs", s3fs_task_init); } diff --git a/lib/util/modules.c b/lib/util/modules.c index c7e9f64..c3c05f2 100644 --- a/lib/util/modules.c +++ b/lib/util/modules.c @@ -116,7 +116,7 @@ static init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path) * * @return true if all functions ran successfully, false otherwise */ -bool run_init_functions(init_module_fn *fns) +bool run_init_functions(TALLOC_CTX *ctx, init_module_fn *fns) { int i; bool ret = true; @@ -124,7 +124,7 @@ bool run_init_functions(init_module_fn *fns) if (fns == NULL) return true; - for (i = 0; fns[i]; i++) { ret &= (bool)NT_STATUS_IS_OK(fns[i]()); } + for (i = 0; fns[i]; i++) { ret &= (bool)NT_STATUS_IS_OK(fns[i](ctx)); } return ret; } @@ -195,7 +195,7 @@ static NTSTATUS do_smb_load_module(const char *subsystem, DEBUG(2, ("Module '%s' loaded\n", module_name)); - status = init(); + status = init(NULL); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("Module '%s' initialization failed: %s\n", module_name, get_friendly_nt_error_msg(status))); diff --git a/lib/util/samba_modules.h b/lib/util/samba_modules.h index 2f40811..1ae9c6e 100644 --- a/lib/util/samba_modules.h +++ b/lib/util/samba_modules.h @@ -22,9 +22,9 @@ #define _SAMBA_MODULES_H /* Module support */ -typedef NTSTATUS (*init_module_fn) (void); +typedef NTSTATUS (*init_module_fn) (TALLOC_CTX *ctx); -NTSTATUS samba_init_module(void); +NTSTATUS samba_init_module(TALLOC_CTX *ctx); /* this needs to be a string which is not in the C library. We previously used "init_module", but that meant that modules which @@ -44,7 +44,7 @@ init_module_fn load_module(const char *path, bool is_probe, void **handle); * * @return true if all functions ran successfully, false otherwise */ -bool run_init_functions(init_module_fn *fns); +bool run_init_functions(TALLOC_CTX *ctx, init_module_fn *fns); /** * Load the initialization functions from DSO files for a specific subsystem. diff --git a/libcli/echo/tests/echo.c b/libcli/echo/tests/echo.c index 6424c81..8e51504 100644 --- a/libcli/echo/tests/echo.c +++ b/libcli/echo/tests/echo.c @@ -26,7 +26,7 @@ #include "libcli/util/ntstatus.h" #include "libcli/echo/libecho.h" -NTSTATUS torture_libcli_echo_init(void); +NTSTATUS torture_libcli_echo_init(TALLOC_CTX *); /* Basic test function that sends an echo request and checks the reply */ static bool echo_udp_basic(struct torture_context *tctx, const char *address) @@ -81,7 +81,7 @@ static bool torture_echo_udp(struct torture_context *tctx) } /* Test suite that bundles all the libecho tests */ -NTSTATUS torture_libcli_echo_init(void) +NTSTATUS torture_libcli_echo_init(TALLOC_CTX *ctx) { struct torture_suite *suite; diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm index 88c7705..ad36f00 100644 --- a/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm +++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm @@ -259,7 +259,7 @@ static bool $name\__op_interface_by_name(struct dcesrv_interface *iface, const c return false; } -NTSTATUS dcerpc_server_$name\_init(void) +NTSTATUS dcerpc_server_$name\_init(TALLOC_CTX *ctx) { NTSTATUS ret; static const struct dcesrv_endpoint_server ep_server = { @@ -296,7 +296,7 @@ sub ParseInterface($) my($interface) = shift; my $count = 0; - $res .= "NTSTATUS dcerpc_server_$interface->{NAME}\_init(void);\n"; + $res .= "NTSTATUS dcerpc_server_$interface->{NAME}\_init(TALLOC_CTX *);\n"; $res .= "\n"; if (!defined $interface->{PROPERTIES}->{uuid}) { diff --git a/source3/auth/auth.c b/source3/auth/auth.c index ba6245d..54e9433 100644 --- a/source3/auth/auth.c +++ b/source3/auth/auth.c @@ -392,7 +392,7 @@ bool load_auth_module(struct auth_context *auth_context, /* Initialise static modules if not done so yet */ if(!initialised_static_modules) { - static_init_auth; + static_init_auth(NULL); initialised_static_modules = True; } diff --git a/source3/auth/auth_builtin.c b/source3/auth/auth_builtin.c index 7480799..0fa95d9 100644 --- a/source3/auth/auth_builtin.c +++ b/source3/auth/auth_builtin.c @@ -167,7 +167,7 @@ static NTSTATUS auth_init_name_to_ntstatus(struct auth_context *auth_context, co #endif /* DEVELOPER */ -NTSTATUS auth_builtin_init(void) +NTSTATUS auth_builtin_init(TALLOC_CTX *mem_ctx) { smb_register_auth(AUTH_INTERFACE_VERSION, "guest", auth_init_guest); #ifdef DEVELOPER diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c index b3ff518..40d717d 100644 --- a/source3/auth/auth_domain.c +++ b/source3/auth/auth_domain.c @@ -406,7 +406,7 @@ static NTSTATUS auth_init_trustdomain(struct auth_context *auth_context, const c return NT_STATUS_OK; } -NTSTATUS auth_domain_init(void) +NTSTATUS auth_domain_init(TALLOC_CTX *mem_ctx) { smb_register_auth(AUTH_INTERFACE_VERSION, "trustdomain", auth_init_trustdomain); smb_register_auth(AUTH_INTERFACE_VERSION, "ntdomain", auth_init_ntdomain); diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c index 634386f..4bcb792 100644 --- a/source3/auth/auth_sam.c +++ b/source3/auth/auth_sam.c @@ -188,7 +188,7 @@ static NTSTATUS auth_init_sam_netlogon3(struct auth_context *auth_context, return NT_STATUS_OK; } -NTSTATUS auth_sam_init(void) +NTSTATUS auth_sam_init(TALLOC_CTX *mem_ctx) { smb_register_auth(AUTH_INTERFACE_VERSION, "sam", auth_init_sam); smb_register_auth(AUTH_INTERFACE_VERSION, "sam_ignoredomain", auth_init_sam_ignoredomain); diff --git a/source3/auth/auth_samba4.c b/source3/auth/auth_samba4.c index 4c83c2a..46c8f9f 100644 --- a/source3/auth/auth_samba4.c +++ b/source3/auth/auth_samba4.c @@ -391,8 +391,8 @@ static NTSTATUS auth_init_samba4(struct auth_context *auth_context, return NT_STATUS_OK; } -NTSTATUS auth_samba4_init(void); -NTSTATUS auth_samba4_init(void) +NTSTATUS auth_samba4_init(TALLOC_CTX *mem_ctx); +NTSTATUS auth_samba4_init(TALLOC_CTX *mem_ctx) { smb_register_auth(AUTH_INTERFACE_VERSION, "samba4", auth_init_samba4); diff --git a/source3/auth/auth_script.c b/source3/auth/auth_script.c index dc8794b..fae55e9 100644 --- a/source3/auth/auth_script.c +++ b/source3/auth/auth_script.c @@ -180,8 +180,8 @@ static NTSTATUS auth_init_script(struct auth_context *auth_context, const char * return NT_STATUS_OK; } -NTSTATUS auth_script_init(void); -NTSTATUS auth_script_init(void) +NTSTATUS auth_script_init(TALLOC_CTX *); +NTSTATUS auth_script_init(TALLOC_CTX *ctx) { return smb_register_auth(AUTH_INTERFACE_VERSION, "script", auth_init_script); } -- Samba Shared Repository