From 86486fcc9826663f7bf03fe4ceb354818415d089 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 25 Dec 2007 02:31:41 +0100 Subject: [PATCH] Simplify libnet_smbconf_delshare(). Remove talloc context parameter. Remove d_printf error message. Michael (This used to be commit 870d35c04889603843bae989fb9c01396b4c6ed1) --- source3/libnet/libnet_conf.c | 11 ++++------- source3/utils/net_conf.c | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index ad02930ce4b..4c5a0829d6a 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -246,24 +246,21 @@ done: /** * delete a service from configuration */ -WERROR libnet_smbconf_delshare(TALLOC_CTX *ctx, const char *keyname) +WERROR libnet_smbconf_delshare(const char *servicename) { WERROR werr = WERR_OK; struct registry_key *key = NULL; + TALLOC_CTX *ctx = talloc_stackframe(); werr = libnet_smbconf_open_basepath(ctx, REG_KEY_WRITE, &key); if (!W_ERROR_IS_OK(werr)) { goto done; } - werr = reg_deletekey_recursive(key, key, keyname); - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error deleting registry key %s\\%s: %s\n", - KEY_SMBCONF, keyname, dos_errstr(werr)); - } + werr = reg_deletekey_recursive(key, key, servicename); done: - TALLOC_FREE(key); + TALLOC_FREE(ctx); return werr; } diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index e1b4fe1dfa4..38c14d779f1 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -317,7 +317,7 @@ static int import_process_service(TALLOC_CTX *ctx, d_printf("[%s]\n", servicename); } else { if (libnet_smbconf_key_exists(servicename)) { - werr = libnet_smbconf_delshare(tmp_ctx, servicename); + werr = libnet_smbconf_delshare(servicename); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -799,7 +799,7 @@ int net_conf_delshare(int argc, const char **argv) } sharename = argv[0]; - if (W_ERROR_IS_OK(libnet_smbconf_delshare(NULL, sharename))) { + if (W_ERROR_IS_OK(libnet_smbconf_delshare(sharename))) { ret = 0; } done: