diff options
author | Michael Adam <obnox@samba.org> | 2008-01-11 18:55:20 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-01-11 18:55:26 +0100 |
commit | 83aed537c16f632599484f60c5ccebc3ab713801 (patch) | |
tree | 74a1e32739ea32312ebcc48774b74ee83f24d260 /source/libnet | |
parent | 88874a501d0c086f796e4838af8c9399d3cccc1f (diff) | |
download | samba-83aed537c16f632599484f60c5ccebc3ab713801.tar.gz samba-83aed537c16f632599484f60c5ccebc3ab713801.tar.xz samba-83aed537c16f632599484f60c5ccebc3ab713801.zip |
Fix panic in "net conf": Fix logic in error condition.
Michael
Diffstat (limited to 'source/libnet')
-rw-r--r-- | source/libnet/libnet_conf.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/source/libnet/libnet_conf.c b/source/libnet/libnet_conf.c index d0ef6eb0e6b..dcb80d96eaa 100644 --- a/source/libnet/libnet_conf.c +++ b/source/libnet/libnet_conf.c @@ -110,7 +110,7 @@ static WERROR libnet_conf_reg_open_path(TALLOC_CTX *mem_ctx, } werr = ntstatus_to_werror(registry_create_admin_token(tmp_ctx, &token)); - if (W_ERROR_IS_OK(werr)) { + if (!W_ERROR_IS_OK(werr)) { DEBUG(1, ("Error creating admin token\n")); goto done; } @@ -421,6 +421,48 @@ done: **********************************************************************/ /** + * Open the configuration. + * + * Upon success, this creates and returns the conf context + * that should be passed around in subsequent calls to the other + * libnet_conf functions. + */ +WERROR libnet_conf_open(TALLOC_CTX *mem_ctx, struct libnet_conf_ctx **conf_ctx) +{ + WERROR werr = WERR_OK; + struct libnet_conf_ctx *ctx; + + if (conf_ctx == NULL) { + return WERR_INVALID_PARAM; + } + + ctx = talloc_zero(mem_ctx, struct libnet_conf_ctx); + if (ctx == NULL) { + return WERR_NOMEM; + } + + talloc_set_destructor(ctx, libnet_conf_destrox_ctx); + + ctx->token = registry_create_admin_token(tmp_ctx); + if (ctx->token == NULL) { + DEBUG(1, ("Error creating admin token\n")); + /* what is the appropriate error code here? */ + werr = WERR_CAN_NOT_COMPLETE; + goto done; + } + + +} + +/** + * Close the configuration. + */ +WERROR libnet_conf_close(struct libnet_conf_ctx *ctx) +{ + regdb_close(); +} + +/** * Drop the whole configuration (restarting empty). */ WERROR libnet_conf_drop(void) |