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/libnet/libnet_join.c | |
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/libnet/libnet_join.c')
-rw-r--r-- | source3/libnet/libnet_join.c | 58 |
1 files changed, 41 insertions, 17 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 9b62286ecb..66b5461dc2 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -19,8 +19,7 @@ */ #include "includes.h" -#include "libnet/libnet_join.h" -#include "libnet/libnet_proto.h" +#include "libnet/libnet.h" /**************************************************************** ****************************************************************/ @@ -886,33 +885,48 @@ done: static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) { WERROR werr; + struct libnet_conf_ctx *ctx; + + werr = libnet_conf_open(r, &ctx); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE)) { - werr = libnet_conf_set_global_parameter("security", "user"); - W_ERROR_NOT_OK_RETURN(werr); + werr = libnet_conf_set_global_parameter(ctx, "security", "user"); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } - werr = libnet_conf_set_global_parameter("workgroup", + werr = libnet_conf_set_global_parameter(ctx, "workgroup", r->in.domain_name); - return werr; + goto done; } - werr = libnet_conf_set_global_parameter("security", "domain"); - W_ERROR_NOT_OK_RETURN(werr); + werr = libnet_conf_set_global_parameter(ctx, "security", "domain"); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } - werr = libnet_conf_set_global_parameter("workgroup", + werr = libnet_conf_set_global_parameter(ctx, "workgroup", r->out.netbios_domain_name); - W_ERROR_NOT_OK_RETURN(werr); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } if (r->out.domain_is_ad) { - werr = libnet_conf_set_global_parameter("security", "ads"); - W_ERROR_NOT_OK_RETURN(werr); + werr = libnet_conf_set_global_parameter(ctx, "security", "ads"); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } - werr = libnet_conf_set_global_parameter("realm", + werr = libnet_conf_set_global_parameter(ctx, "realm", r->out.dns_domain_name); - W_ERROR_NOT_OK_RETURN(werr); } +done: + libnet_conf_close(ctx); return werr; } @@ -922,15 +936,25 @@ static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) static WERROR do_unjoin_modify_vals_config(struct libnet_UnjoinCtx *r) { WERROR werr = WERR_OK; + struct libnet_conf_ctx *ctx; + + werr = libnet_conf_open(r, &ctx); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { - werr = libnet_conf_set_global_parameter("security", "user"); - W_ERROR_NOT_OK_RETURN(werr); + werr = libnet_conf_set_global_parameter(ctx, "security", "user"); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } } - libnet_conf_delete_parameter(GLOBAL_NAME, "realm"); + libnet_conf_delete_parameter(ctx, GLOBAL_NAME, "realm"); +done: + libnet_conf_close(ctx); return werr; } |