mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
libsmbconf: add private_data section to smbconf_ctx.
This private data should be used by backends. The token for the registry backend is moved from the context to the private data section, since this is registry specific. Michael (This used to be commit a02163356bdd0c17a25a45e9904f8bd1e1c4bee4)
This commit is contained in:
parent
6f7cfeddd6
commit
be97af0edb
@ -54,9 +54,9 @@ struct smbconf_ops {
|
||||
};
|
||||
|
||||
struct smbconf_ctx {
|
||||
NT_USER_TOKEN *token;
|
||||
const char *path;
|
||||
struct smbconf_ops *ops;
|
||||
void *data; /* private data for use in backends */
|
||||
};
|
||||
|
||||
WERROR smbconf_add_string_to_array(TALLOC_CTX *mem_ctx,
|
||||
|
@ -20,6 +20,9 @@
|
||||
#include "includes.h"
|
||||
#include "smbconf_private.h"
|
||||
|
||||
struct reg_private_data {
|
||||
NT_USER_TOKEN *token;
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
@ -27,6 +30,11 @@
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
static struct reg_private_data *rpd(struct smbconf_ctx *ctx)
|
||||
{
|
||||
return (struct reg_private_data *)(ctx->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a registry key specified by "path"
|
||||
*/
|
||||
@ -44,7 +52,7 @@ static WERROR smbconf_reg_open_path(TALLOC_CTX *mem_ctx,
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (ctx->token == NULL) {
|
||||
if (rpd(ctx)->token == NULL) {
|
||||
DEBUG(1, ("Error: token missing from smbconf_ctx. "
|
||||
"was smbconf_init() called?\n"));
|
||||
werr = WERR_INVALID_PARAM;
|
||||
@ -57,7 +65,8 @@ static WERROR smbconf_reg_open_path(TALLOC_CTX *mem_ctx,
|
||||
goto done;
|
||||
}
|
||||
|
||||
werr = reg_open_path(mem_ctx, path, desired_access, ctx->token, key);
|
||||
werr = reg_open_path(mem_ctx, path, desired_access, rpd(ctx)->token,
|
||||
key);
|
||||
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
DEBUG(1, ("Error opening registry path '%s': %s\n",
|
||||
@ -385,17 +394,20 @@ static WERROR smbconf_reg_init(struct smbconf_ctx *ctx, const char *path)
|
||||
goto done;
|
||||
}
|
||||
|
||||
ctx->data = TALLOC_ZERO_P(ctx, struct reg_private_data);
|
||||
|
||||
werr = ntstatus_to_werror(registry_create_admin_token(ctx,
|
||||
&(rpd(ctx)->token)));
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
DEBUG(1, ("Error creating admin token\n"));
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!registry_init_smbconf()) {
|
||||
werr = WERR_REG_IO_FAILURE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
werr = ntstatus_to_werror(registry_create_admin_token(ctx,
|
||||
&(ctx->token)));
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
DEBUG(1, ("Error creating admin token\n"));
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
return werr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user