From f8c39cbb7b3e4df3c07735575bc5f31717b22f66 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 29 Dec 2007 03:38:13 +0100 Subject: Move functionality of net_conf_showshare() to libnet_conf.c The functionality is moved to a new function libnet_smbconf_getshare(). This returns the parameters of the given share as two lists: the list of parameter names and the list of matching (formatted) parameter values. The retrieval and formatting is done in a new internal helper function libnet_smbconf_reg_get_values() that is to become the replacement for list_values() from net_conf.c once functionality of net_conf_list() has been moved to libnet_conf, too. Michael (This used to be commit 198232bd525cfac933b4885e6b330ebf4ac2c8ae) --- source3/utils/net_conf.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 8140941da2..9a7c8c9097 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -525,7 +525,12 @@ static int net_conf_showshare(int argc, const char **argv) int ret = -1; WERROR werr = WERR_OK; struct registry_key *key = NULL; + char *sharename = NULL; TALLOC_CTX *ctx; + uint32_t num_params; + uint32_t count; + char **param_names; + char **param_values; ctx = talloc_init("showshare"); @@ -534,15 +539,21 @@ static int net_conf_showshare(int argc, const char **argv) goto done; } - werr = libnet_smbconf_reg_open_path(ctx, argv[0], REG_KEY_READ, &key); + sharename = argv[0]; + + werr = libnet_smbconf_getshare(ctx, sharename, &num_params, + ¶m_names, ¶m_values); if (!W_ERROR_IS_OK(werr)) { + d_printf("error getting share parameters: %s\n", + dos_errstr(werr)); goto done; } - d_printf("[%s]\n", argv[0]); + d_printf("[%s]\n", sharename); - if (!W_ERROR_IS_OK(list_values(ctx, key))) { - goto done; + for (count = 0; count <= num_params; count++) { + d_printf("\t%s = %s\n", param_names[count], + param_values[count]); } ret = 0; -- cgit