summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-12-29 22:09:51 +0100
committerMichael Adam <obnox@samba.org>2007-12-30 00:32:41 +0100
commit9c1449594458ad6f019f48072bba2b1c831b628b (patch)
tree0bd2dde259776fbf1bf0a387b881ef86df2a3c29 /source3
parentfe47e2e85585c1f7f9455747f1ef5d4c20501960 (diff)
downloadsamba-9c1449594458ad6f019f48072bba2b1c831b628b.tar.gz
samba-9c1449594458ad6f019f48072bba2b1c831b628b.tar.bz2
samba-9c1449594458ad6f019f48072bba2b1c831b628b.zip
Use libnet_smbconf_get_config() in net_conf_list().
This leaves only output logic in net_conf_list(). Michael (This used to be commit 95d9981d59fe69ee1ed98f21475bd1ba72930c1b)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net_conf.c64
1 files changed, 19 insertions, 45 deletions
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index 8957408bd6..ed9ed389e4 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -301,10 +301,12 @@ static int net_conf_list(int argc, const char **argv)
WERROR werr = WERR_OK;
int ret = -1;
TALLOC_CTX *ctx;
- struct registry_key *base_key = NULL;
- struct registry_key *sub_key = NULL;
- uint32 idx_key = 0;
- char *subkey_name = NULL;
+ uint32_t num_shares;
+ char **share_names;
+ uint32_t *num_params;
+ char ***param_names;
+ char ***param_values;
+ uint32_t share_count, param_count;
ctx = talloc_init("list");
@@ -313,54 +315,26 @@ static int net_conf_list(int argc, const char **argv)
goto done;
}
- werr = libnet_smbconf_reg_open_basepath(ctx, REG_KEY_READ, &base_key);
+ werr = libnet_smbconf_get_config(ctx, &num_shares, &share_names,
+ &num_params, &param_names,
+ &param_values);
if (!W_ERROR_IS_OK(werr)) {
+ d_fprintf(stderr, "Error getting config: %s\n",
+ dos_errstr(werr));
goto done;
}
- if (libnet_smbconf_key_exists(GLOBAL_NAME)) {
- werr = reg_openkey(ctx, base_key, GLOBAL_NAME,
- REG_KEY_READ, &sub_key);
- if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "Error opening subkey '%s' : %s\n",
- subkey_name, dos_errstr(werr));
- goto done;
- }
- d_printf("[%s]\n", GLOBAL_NAME);
- if (!W_ERROR_IS_OK(list_values(ctx, sub_key))) {
- goto done;
- }
- d_printf("\n");
- }
-
- for (idx_key = 0;
- W_ERROR_IS_OK(werr = reg_enumkey(ctx, base_key, idx_key,
- &subkey_name, NULL));
- idx_key++)
- {
- if (strequal(subkey_name, GLOBAL_NAME)) {
- continue;
- }
- d_printf("[%s]\n", subkey_name);
-
- werr = reg_openkey(ctx, base_key, subkey_name,
- REG_KEY_READ, &sub_key);
- if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr,
- "Error opening subkey '%s': %s\n",
- subkey_name, dos_errstr(werr));
- goto done;
- }
- if (!W_ERROR_IS_OK(list_values(ctx, sub_key))) {
- goto done;
+ for (share_count = 0; share_count < num_shares; share_count++) {
+ d_printf("[%s]\n", share_names[share_count]);
+ for (param_count = 0; param_count < num_params[share_count];
+ param_count++)
+ {
+ d_printf("\t%s = %s\n",
+ param_names[share_count][param_count],
+ param_values[share_count][param_count]);
}
d_printf("\n");
}
- if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
- d_fprintf(stderr, "Error enumerating subkeys: %s\n",
- dos_errstr(werr));
- goto done;
- }
ret = 0;