From 1e8e048bf01447148ffa89ec237e2f9f58ff0ab6 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 18 Apr 2017 10:21:50 -0700 Subject: [PATCH] lib: param: Remove lpcfg_register_defaults_hook(). Completely unused functionality. Gets rid of another talloc_autofree_context(). Updated WHATSNEW to make this clear. Signed-off-by: Jeremy Allison Reviewed-by: Alexander Bokovoy --- WHATSNEW.txt | 10 ++++++++++ lib/param/loadparm.c | 32 -------------------------------- lib/param/param.h | 16 ---------------- 3 files changed, 10 insertions(+), 48 deletions(-) diff --git a/WHATSNEW.txt b/WHATSNEW.txt index c276ce28697..5e6d15947c9 100644 --- a/WHATSNEW.txt +++ b/WHATSNEW.txt @@ -50,6 +50,16 @@ smb.conf changes map untrusted to domain Deprecated strict sync Default changed yes +Removal of lpcfg_register_defaults_hook() +----------------------------------------- + +The undocumented and unsupported function lpcfg_register_defaults_hook() +that was used by external projects to call into Samba and modify +smb.conf default parameter settings has been removed. If your project +was using this call please raise the issue on +samba-technical@lists.samba.org in order to design a supported +way of obtaining the same functionality. + KNOWN ISSUES ============ diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index d7287ab6cd6..c8a8b6d95c4 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -2551,23 +2551,6 @@ static int lpcfg_destructor(struct loadparm_context *lp_ctx) return 0; } -struct defaults_hook_data { - const char *name; - lpcfg_defaults_hook hook; - struct defaults_hook_data *prev, *next; -} *defaults_hooks = NULL; - - -bool lpcfg_register_defaults_hook(const char *name, lpcfg_defaults_hook hook) -{ - struct defaults_hook_data *hook_data = talloc(talloc_autofree_context(), - struct defaults_hook_data); - hook_data->name = talloc_strdup(hook_data, name); - hook_data->hook = hook; - DLIST_ADD(defaults_hooks, hook_data); - return false; -} - /** * Initialise the global parameter structure. * @@ -2580,7 +2563,6 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) struct loadparm_context *lp_ctx; struct parmlist_entry *parm; char *logfile; - struct defaults_hook_data *defaults_hook; lp_ctx = talloc_zero(mem_ctx, struct loadparm_context); if (lp_ctx == NULL) @@ -3004,20 +2986,6 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) "rpc server dynamic port range", "49152-65535"); - /* Allow modules to adjust defaults */ - for (defaults_hook = defaults_hooks; defaults_hook; - defaults_hook = defaults_hook->next) { - bool ret; - - ret = defaults_hook->hook(lp_ctx); - if (!ret) { - DEBUG(1, ("Defaults hook %s failed to run.", - defaults_hook->name)); - talloc_free(lp_ctx); - return NULL; - } - } - for (i = 0; parm_table[i].label; i++) { if (!(lp_ctx->flags[i] & FLAG_CMDLINE)) { lp_ctx->flags[i] |= FLAG_DEFAULT; diff --git a/lib/param/param.h b/lib/param/param.h index a6dbafa42f9..589b8906db5 100644 --- a/lib/param/param.h +++ b/lib/param/param.h @@ -47,8 +47,6 @@ struct gensec_settings; struct bitmap; struct file_lists; -typedef bool (*lpcfg_defaults_hook) (struct loadparm_context *); - #ifdef CONFIG_H_IS_FROM_SAMBA #include "lib/param/param_proto.h" #include "lib/param/param_functions.h" @@ -216,20 +214,6 @@ const char *lpcfg_socket_options(struct loadparm_context *); struct dcerpc_server_info *lpcfg_dcerpc_server_info(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx); struct gensec_settings *lpcfg_gensec_settings(TALLOC_CTX *, struct loadparm_context *); -/* Hooks to override defaults. - * - * Every time a loadparm context is initialized, the hooks are - * called on it, once Samba itself has set defaults. - * - * This allows modules to tweak defaults (before any smb.conf file or registry - * is loaded). Usually they would do this by calling lpcfg_do_global_parameter - * or lpcfg_do_service_parameter. - * - * A good use case for this is OpenChange, which by default enables its - * DCE/RPC services when it is installed. - * */ -bool lpcfg_register_defaults_hook(const char *name, lpcfg_defaults_hook hook); - /* The following definitions come from param/util.c */ -- 2.34.1