Skip to content

Commit

Permalink
lib: param: Remove lpcfg_register_defaults_hook().
Browse files Browse the repository at this point in the history
Completely unused functionality. Gets rid of another
talloc_autofree_context(). Updated WHATSNEW to make
this clear.

Signed-off-by: Jeremy Allison <[email protected]>
Reviewed-by: Alexander Bokovoy <[email protected]>
  • Loading branch information
jrasamba committed Apr 18, 2017
1 parent 4fe2b24 commit 1e8e048
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 48 deletions.
10 changes: 10 additions & 0 deletions WHATSNEW.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
[email protected] in order to design a supported
way of obtaining the same functionality.

KNOWN ISSUES
============

Expand Down
32 changes: 0 additions & 32 deletions lib/param/loadparm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 0 additions & 16 deletions lib/param/param.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 */


Expand Down

0 comments on commit 1e8e048

Please sign in to comment.