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
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;
};
* 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) {
#ifndef _PARAM_H /* _PARAM_H */
#define _PARAM_H
-struct loadparm_s3_context;
+struct loadparm_s3_helpers;
struct parmlist_entry;
$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");
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);
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);
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);
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);
/* 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 */
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);
#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);
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;
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;
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);
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;
}
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"));
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);
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);
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,
* 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,
.passwordserver = lp_passwordserver
};
-const struct loadparm_s3_context *loadparm_s3_context(void)
+const struct loadparm_s3_helpers *loadparm_s3_helpers(void)
{
return &s3_fns;
}
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;
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) {
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;
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;
}
}
- 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;
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;
/* 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;
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;
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;
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,
}
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);
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);