mirror of
https://github.com/samba-team/samba.git
synced 2025-07-30 19:42:05 +03:00
s3-param: Rename loadparm_s3_context -> loadparm_s3_helpers
This helps clarify the role of this structure and wrapper function. The purpose here is to provide helper functions to the lib/param loadparm_context that point back at the s3 lp_ functions. This allows a struct loadparm_context to be passed to any point in the code, and always refer to the correct loadparm system. If this has not been set, the variables loaded in the lib/param code will be returned. As requested by Michael Adam. Andrew Bartlett Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Jun 27 17:11:16 CEST 2012 on sn-devel-104
This commit is contained in:
@ -1362,7 +1362,7 @@ struct loadparm_context {
|
||||
bool refuse_free;
|
||||
bool global; /* Is this the global context, which may set
|
||||
* global variables such as debug level etc? */
|
||||
const struct loadparm_s3_context *s3_fns;
|
||||
const struct loadparm_s3_helpers *s3_fns;
|
||||
};
|
||||
|
||||
|
||||
@ -3469,7 +3469,7 @@ struct loadparm_context *loadparm_init_global(bool load_default)
|
||||
* Initialise the global parameter structure.
|
||||
*/
|
||||
struct loadparm_context *loadparm_init_s3(TALLOC_CTX *mem_ctx,
|
||||
const struct loadparm_s3_context *s3_fns)
|
||||
const struct loadparm_s3_helpers *s3_fns)
|
||||
{
|
||||
struct loadparm_context *loadparm_context = talloc_zero(mem_ctx, struct loadparm_context);
|
||||
if (!loadparm_context) {
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef _PARAM_H /* _PARAM_H */
|
||||
#define _PARAM_H
|
||||
|
||||
struct loadparm_s3_context;
|
||||
struct loadparm_s3_helpers;
|
||||
|
||||
struct parmlist_entry;
|
||||
|
||||
|
@ -83,7 +83,7 @@ sub print_header($$)
|
||||
$file->("#ifndef $header_name\n");
|
||||
$file->("#define $header_name\n\n");
|
||||
$file->("/* This file was automatically generated by mks3param.pl. DO NOT EDIT */\n\n");
|
||||
$file->("struct loadparm_s3_context\n");
|
||||
$file->("struct loadparm_s3_helpers\n");
|
||||
$file->("{\n");
|
||||
$file->("\tconst char * (*get_parametric)(struct loadparm_service *, const char *type, const char *option);\n");
|
||||
$file->("\tstruct parm_struct * (*get_parm_struct)(const char *param_name);\n");
|
||||
|
@ -239,7 +239,7 @@ NTSTATUS auth_generic_prepare(TALLOC_CTX *mem_ctx,
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
lp_ctx = loadparm_init_s3(tmp_ctx, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(tmp_ctx, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(10, ("loadparm_init_s3 failed\n"));
|
||||
TALLOC_FREE(tmp_ctx);
|
||||
|
@ -44,7 +44,7 @@ static NTSTATUS check_samba4_security(const struct auth_context *auth_context,
|
||||
struct auth4_context *auth4_context;
|
||||
struct loadparm_context *lp_ctx;
|
||||
|
||||
lp_ctx = loadparm_init_s3(frame, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(frame, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(10, ("loadparm_init_s3 failed\n"));
|
||||
talloc_free(frame);
|
||||
@ -109,7 +109,7 @@ static NTSTATUS prepare_gensec(TALLOC_CTX *mem_ctx,
|
||||
struct cli_credentials *server_credentials;
|
||||
struct server_id *server_id;
|
||||
|
||||
lp_ctx = loadparm_init_s3(frame, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(frame, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(1, ("loadparm_init_s3 failed\n"));
|
||||
TALLOC_FREE(frame);
|
||||
@ -192,7 +192,7 @@ static NTSTATUS make_auth4_context_s4(TALLOC_CTX *mem_ctx,
|
||||
struct imessaging_context *msg_ctx;
|
||||
struct server_id *server_id;
|
||||
|
||||
lp_ctx = loadparm_init_s3(frame, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(frame, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(1, ("loadparm_init_s3 failed\n"));
|
||||
TALLOC_FREE(frame);
|
||||
|
@ -1504,7 +1504,7 @@ void _lp_set_server_role(int server_role);
|
||||
|
||||
/* The following definitions come from param/loadparm_ctx.c */
|
||||
|
||||
const struct loadparm_s3_context *loadparm_s3_context(void);
|
||||
const struct loadparm_s3_helpers *loadparm_s3_helpers(void);
|
||||
|
||||
/* The following definitions come from param/loadparm_server_role.c */
|
||||
|
||||
|
@ -1583,7 +1583,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lp_ctx = loadparm_init_s3(db_path, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(db_path, loadparm_s3_helpers());
|
||||
|
||||
db_ctdb->wtdb = tdb_wrap_open(db_ctdb, db_path, hash_size, tdb_flags,
|
||||
O_RDWR, 0, lp_ctx);
|
||||
|
@ -118,7 +118,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
|
||||
#endif
|
||||
|
||||
if (result == NULL) {
|
||||
struct loadparm_context *lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_context());
|
||||
struct loadparm_context *lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_helpers());
|
||||
result = dbwrap_local_open(mem_ctx, lp_ctx, name, hash_size,
|
||||
tdb_flags, open_flags, mode,
|
||||
lock_order);
|
||||
|
@ -104,7 +104,7 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx,
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
lp_ctx = loadparm_init_s3(result, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(result, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(0, ("loadparm_init_s3 failed\n"));
|
||||
return NT_STATUS_INTERNAL_ERROR;
|
||||
@ -158,7 +158,7 @@ bool messaging_tdb_parent_init(TALLOC_CTX *mem_ctx)
|
||||
struct tdb_wrap *db;
|
||||
struct loadparm_context *lp_ctx;
|
||||
|
||||
lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(0, ("loadparm_init_s3 failed\n"));
|
||||
return false;
|
||||
|
@ -54,7 +54,7 @@ struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lp_ctx = loadparm_init_s3(result, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(result, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(0, ("loadparm_init_s3 failed\n"));
|
||||
talloc_free(result);
|
||||
|
@ -44,7 +44,7 @@ bool serverid_parent_init(TALLOC_CTX *mem_ctx)
|
||||
struct tdb_wrap *db;
|
||||
struct loadparm_context *lp_ctx;
|
||||
|
||||
lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(0, ("loadparm_init_s3 failed\n"));
|
||||
return false;
|
||||
|
@ -238,7 +238,7 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
auth_context->generate_session_info_pac = kerberos_fetch_pac;
|
||||
|
||||
lp_ctx = loadparm_init_s3(tmp_ctx, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(tmp_ctx, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
status = NT_STATUS_INVALID_SERVER_STATE;
|
||||
DEBUG(10, ("loadparm_init_s3 failed\n"));
|
||||
|
@ -62,7 +62,7 @@ NTSTATUS auth_generic_client_prepare(TALLOC_CTX *mem_ctx, struct auth_generic_st
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
lp_ctx = loadparm_init_s3(ans, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(ans, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(10, ("loadparm_init_s3 failed\n"));
|
||||
TALLOC_FREE(ans);
|
||||
|
@ -66,7 +66,7 @@ static int dfs_samba4_connect(struct vfs_handle_struct *handle,
|
||||
return -1;
|
||||
}
|
||||
|
||||
data->lp_ctx = loadparm_init_s3(data, loadparm_s3_context());
|
||||
data->lp_ctx = loadparm_init_s3(data, loadparm_s3_helpers());
|
||||
if (data->lp_ctx == NULL) {
|
||||
DEBUG(0, ("loadparm_init_s3 failed\n"));
|
||||
SMB_VFS_NEXT_DISCONNECT(handle);
|
||||
|
@ -248,7 +248,7 @@ static bool posix_eadb_init(int snum, struct tdb_wrap **p_db)
|
||||
return false;
|
||||
}
|
||||
|
||||
lp_ctx = loadparm_init_s3(NULL, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers());
|
||||
|
||||
become_root();
|
||||
db = tdb_wrap_open(NULL, eadb, 50000,
|
||||
|
@ -60,7 +60,7 @@ static bool lp_load_for_s4_ctx(const char *filename)
|
||||
* All of the s4 loadparm functions should be here eventually, once
|
||||
* they are implemented in the s3 loadparm, have the same format (enum
|
||||
* values in particular) and defaults. */
|
||||
static const struct loadparm_s3_context s3_fns =
|
||||
static const struct loadparm_s3_helpers s3_fns =
|
||||
{
|
||||
.get_parametric = lp_parm_const_string_service,
|
||||
.get_parm_struct = lp_get_parameter,
|
||||
@ -117,7 +117,7 @@ static const struct loadparm_s3_context s3_fns =
|
||||
.passwordserver = lp_passwordserver
|
||||
};
|
||||
|
||||
const struct loadparm_s3_context *loadparm_s3_context(void)
|
||||
const struct loadparm_s3_helpers *loadparm_s3_helpers(void)
|
||||
{
|
||||
return &s3_fns;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ void initparam(void);
|
||||
static PyObject *py_get_context(PyObject *self)
|
||||
{
|
||||
PyObject *py_loadparm;
|
||||
const struct loadparm_s3_context *s3_context;
|
||||
const struct loadparm_s3_helpers *s3_context;
|
||||
const struct loadparm_context *s4_context;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
|
||||
@ -40,7 +40,7 @@ static PyObject *py_get_context(PyObject *self)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s3_context = loadparm_s3_context();
|
||||
s3_context = loadparm_s3_helpers();
|
||||
|
||||
s4_context = loadparm_init_s3(mem_ctx, s3_context);
|
||||
if (s4_context == NULL) {
|
||||
|
@ -2283,7 +2283,7 @@ static NTSTATUS pdb_init_samba4(struct pdb_methods **pdb_method,
|
||||
goto nomem;
|
||||
}
|
||||
|
||||
state->lp_ctx = loadparm_init_s3(state, loadparm_s3_context());
|
||||
state->lp_ctx = loadparm_init_s3(state, loadparm_s3_helpers());
|
||||
if (state->lp_ctx == NULL) {
|
||||
DEBUG(0, ("loadparm_init_s3 failed\n"));
|
||||
goto nomem;
|
||||
|
@ -1001,7 +1001,7 @@ NTSTATUS _netr_ServerAuthenticate3(struct pipes_struct *p,
|
||||
goto out;
|
||||
}
|
||||
|
||||
lp_ctx = loadparm_init_s3(p->mem_ctx, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(p->mem_ctx, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(10, ("loadparm_init_s3 failed\n"));
|
||||
status = NT_STATUS_INTERNAL_ERROR;
|
||||
@ -1106,7 +1106,7 @@ static NTSTATUS netr_creds_server_step_check(struct pipes_struct *p,
|
||||
}
|
||||
}
|
||||
|
||||
lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(0, ("loadparm_init_s3 failed\n"));
|
||||
return NT_STATUS_INTERNAL_ERROR;
|
||||
@ -1782,7 +1782,7 @@ NTSTATUS _netr_LogonSamLogonEx(struct pipes_struct *p,
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
lp_ctx = loadparm_init_s3(p->mem_ctx, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(p->mem_ctx, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(0, ("loadparm_init_s3 failed\n"));
|
||||
return NT_STATUS_INTERNAL_ERROR;
|
||||
@ -2335,7 +2335,7 @@ NTSTATUS _netr_GetForestTrustInformation(struct pipes_struct *p,
|
||||
|
||||
/* TODO: check server name */
|
||||
|
||||
lp_ctx = loadparm_init_s3(p->mem_ctx, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(p->mem_ctx, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(0, ("loadparm_init_s3 failed\n"));
|
||||
return NT_STATUS_INTERNAL_ERROR;
|
||||
@ -2441,7 +2441,7 @@ NTSTATUS _netr_ServerGetTrustInfo(struct pipes_struct *p,
|
||||
DATA_BLOB session_key;
|
||||
struct loadparm_context *lp_ctx;
|
||||
|
||||
lp_ctx = loadparm_init_s3(p->mem_ctx, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(p->mem_ctx, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
DEBUG(0, ("loadparm_init_s3 failed\n"));
|
||||
return NT_STATUS_INTERNAL_ERROR;
|
||||
|
@ -447,7 +447,7 @@ static bool pipe_schannel_auth_bind(struct pipes_struct *p,
|
||||
return false;
|
||||
}
|
||||
|
||||
lp_ctx = loadparm_init_s3(p, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(p, loadparm_s3_helpers());
|
||||
if (!lp_ctx) {
|
||||
DEBUG(0,("pipe_schannel_auth_bind: loadparm_init_s3() failed!\n"));
|
||||
return false;
|
||||
|
@ -133,7 +133,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx,
|
||||
notify->msg = msg;
|
||||
notify->list = NULL;
|
||||
|
||||
lp_ctx = loadparm_init_s3(notify, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(notify, loadparm_s3_helpers());
|
||||
notify->db_notify = db_open_tdb(
|
||||
notify, lp_ctx, lock_path("notify.tdb"),
|
||||
0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
|
||||
|
@ -1365,7 +1365,7 @@ extern void build_options(bool screen);
|
||||
}
|
||||
|
||||
if (lp_server_role() == ROLE_DOMAIN_BDC || lp_server_role() == ROLE_DOMAIN_PDC) {
|
||||
struct loadparm_context *lp_ctx = loadparm_init_s3(NULL, loadparm_s3_context());
|
||||
struct loadparm_context *lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers());
|
||||
if (!open_schannel_session_store(NULL, lp_ctx)) {
|
||||
DEBUG(0,("ERROR: Samba cannot open schannel store for secured NETLOGON operations.\n"));
|
||||
exit(1);
|
||||
|
@ -2900,7 +2900,7 @@ enum {
|
||||
opt_workstation = "";
|
||||
}
|
||||
|
||||
lp_ctx = loadparm_init_s3(NULL, loadparm_s3_context());
|
||||
lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers());
|
||||
if (lp_ctx == NULL) {
|
||||
x_fprintf(x_stderr, "loadparm_init_s3() failed!\n");
|
||||
exit(1);
|
||||
|
Reference in New Issue
Block a user