diff options
author | Michael Adam <obnox@samba.org> | 2008-01-13 01:40:05 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-01-13 02:14:34 +0100 |
commit | 1ee6d3e1ee56554d83437a8c79cb169a26732154 (patch) | |
tree | f94b6473640b8ea1ada891460e99225a3b18980e /source3/lib/netapi | |
parent | 4add2fe36e0eb84a4e49f8e38c2a14023581eeca (diff) | |
download | samba-1ee6d3e1ee56554d83437a8c79cb169a26732154.tar.gz samba-1ee6d3e1ee56554d83437a8c79cb169a26732154.tar.bz2 samba-1ee6d3e1ee56554d83437a8c79cb169a26732154.zip |
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 used to be commit c2a9346faa26e79af5948197a1b322e545f0ed09)
Diffstat (limited to 'source3/lib/netapi')
-rw-r--r-- | source3/lib/netapi/serverinfo.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index 0e356e0ee7..67680ba55a 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -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, |