diff options
author | Michael Adam <obnox@samba.org> | 2007-12-23 15:07:20 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2007-12-24 00:18:35 +0100 |
commit | 8f163d5c5ae48a3ff1974e936b9316781eceff8a (patch) | |
tree | f467b48f72c2d3f034abf7d5a50b7fb6e0a9ccfc /source3/utils | |
parent | 4e53afccb1470b8d889f7300ad77a497f38ed418 (diff) | |
download | samba-8f163d5c5ae48a3ff1974e936b9316781eceff8a.tar.gz samba-8f163d5c5ae48a3ff1974e936b9316781eceff8a.tar.bz2 samba-8f163d5c5ae48a3ff1974e936b9316781eceff8a.zip |
Move logic of net_conf_getparm() to libnet_conf.c.
Michael
(This used to be commit d3a20c4d5a8109334cd3ed665ba60cfcc4425059)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_conf.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 673d373177..f3f2321643 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -869,7 +869,6 @@ static int net_conf_getparm(int argc, const char **argv) { int ret = -1; WERROR werr = WERR_OK; - struct registry_key *key = NULL; char *service = NULL; char *param = NULL; struct registry_value *value = NULL; @@ -884,21 +883,20 @@ static int net_conf_getparm(int argc, const char **argv) service = strdup_lower(argv[0]); param = strdup_lower(argv[1]); - if (!libnet_smbconf_key_exists(ctx, service)) { + werr = libnet_smbconf_getparm(ctx, service, param, &value); + + if (W_ERROR_EQUAL(werr, WERR_NO_SUCH_SERVICE)) { d_fprintf(stderr, - "ERROR: given service '%s' does not exist.\n", + "Error: given service '%s' does not exist.\n", service); goto done; - } - - werr = libnet_smbconf_open_path(ctx, service, REG_KEY_READ, &key); - if (!W_ERROR_IS_OK(werr)) { + } else if (W_ERROR_EQUAL(werr, WERR_INVALID_PARAM)) { + d_fprintf(stderr, + "Error: given parameter '%s' is not set.\n", + param); goto done; - } - - werr = reg_queryvalue(ctx, key, param, &value); - if (!W_ERROR_IS_OK(werr)) { - d_fprintf(stderr, "Error querying value '%s': %s.\n", + } else if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "Error getting value '%s': %s.\n", param, dos_errstr(werr)); goto done; } |