diff options
author | Volker Lendecke <vl@samba.org> | 2009-12-15 20:17:01 +0100 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2010-11-02 15:42:22 +0000 |
commit | 0e95fca747826209edfde79d18b106c69e51cd6b (patch) | |
tree | 5e973c9e66df934754d0d07da07c1675cf2c1b36 /source3 | |
parent | 18e3b223c77b8257966879f5238994642881d147 (diff) | |
download | samba-0e95fca747826209edfde79d18b106c69e51cd6b.tar.gz samba-0e95fca747826209edfde79d18b106c69e51cd6b.tar.bz2 samba-0e95fca747826209edfde79d18b106c69e51cd6b.zip |
s3: Add "net registry getvaluesraw"
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue Nov 2 15:42:22 UTC 2010 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/net_registry.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c index 7ea68f1126..163d059ae0 100644 --- a/source3/utils/net_registry.c +++ b/source3/utils/net_registry.c @@ -352,6 +352,49 @@ static int net_registry_getvalueraw(struct net_context *c, int argc, return net_registry_getvalue_internal(c, argc, argv, true); } +static int net_registry_getvaluesraw(struct net_context *c, int argc, + const char **argv) +{ + WERROR werr; + int ret = -1; + struct registry_key *key = NULL; + TALLOC_CTX *ctx = talloc_stackframe(); + uint32_t idx; + + if (argc != 1 || c->display_usage) { + d_fprintf(stderr, "usage: net rpc registry getvaluesraw " + "<key>\n"); + goto done; + } + + werr = open_key(ctx, argv[0], REG_KEY_READ, &key); + if (!W_ERROR_IS_OK(werr)) { + d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr)); + goto done; + } + + idx = 0; + while (true) { + struct registry_value *val; + + werr = reg_enumvalue(talloc_tos(), key, idx, NULL, &val); + + if (W_ERROR_EQUAL(werr, WERR_NO_MORE_ITEMS)) { + ret = 0; + break; + } + if (!W_ERROR_IS_OK(werr)) { + break; + } + print_registry_value(val, true); + TALLOC_FREE(val); + idx += 1; + } +done: + TALLOC_FREE(ctx); + return ret; +} + static int net_registry_setvalue(struct net_context *c, int argc, const char **argv) { @@ -1165,6 +1208,14 @@ int net_registry(struct net_context *c, int argc, const char **argv) " Print a registry value (raw format)") }, { + "getvaluesraw", + net_registry_getvaluesraw, + NET_TRANSPORT_LOCAL, + "Print all values of a key in raw format", + "net registry getvaluesraw <key>\n" + " Print a registry value (raw format)" + }, + { "setvalue", net_registry_setvalue, NET_TRANSPORT_LOCAL, |