mirror of
https://github.com/samba-team/samba.git
synced 2025-12-05 12:23:50 +03:00
Introduce a libnet_conf context created by libnet_conf_open().
The libnet_conf_ctx stores the information necessary to interoperate with the configuration. It is created by calling libnet_conf_open() and destroyed by calling libnet_conf_close(). The context is passed to all the libnet_conf functions. It currently stores the token to access the registry. Later, it could store more data, e.g. the server to connect to, credentials, and so on. For support of other backends than registry or support of remote configuration, only the open function will have to be changed. In net_conf, the calls to the actual net_conf functions is wrapped into a function that calls libnet_conf_open()/_close(). Thus an individual variant of net_conf_runfunction2() and functable2 is used to cope with functions being called by the wrapper with the additional libnet_conf_ctx argument. Michael
This commit is contained in:
@@ -149,6 +149,10 @@ static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx,
|
||||
uint8_t *buffer,
|
||||
uint32_t *parm_error)
|
||||
{
|
||||
WERROR werr;
|
||||
struct libnet_conf_ctx *conf_ctx;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
|
||||
struct srvsvc_NetSrvInfo1005 *info1005;
|
||||
|
||||
if (!buffer) {
|
||||
@@ -167,8 +171,20 @@ static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx,
|
||||
return WERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return libnet_conf_set_global_parameter("server string",
|
||||
mem_ctx = talloc_stackframe();
|
||||
werr = libnet_conf_open(mem_ctx, &conf_ctx);
|
||||
if (!W_ERROR_IS_OK(werr)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
werr = libnet_conf_set_global_parameter(conf_ctx,
|
||||
"server string",
|
||||
info1005->comment);
|
||||
|
||||
done:
|
||||
libnet_conf_close(conf_ctx);
|
||||
TALLOC_FREE(mem_ctx);
|
||||
return werr;
|
||||
}
|
||||
|
||||
static WERROR NetServerSetInfoLocal(struct libnetapi_ctx *ctx,
|
||||
|
||||
Reference in New Issue
Block a user