summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-04-09 12:31:05 +0200
committerMichael Adam <obnox@samba.org>2008-04-09 23:52:34 +0200
commit2547baebc48ecb215668183d2552d83ecd4564f3 (patch)
treef2e1b01cd0ac98c7561168a5ad8e4d0d007abf30
parentd3dcaac176212a20c2bb71a08b4ac39ea2689047 (diff)
downloadsamba-2547baebc48ecb215668183d2552d83ecd4564f3.tar.gz
samba-2547baebc48ecb215668183d2552d83ecd4564f3.tar.bz2
samba-2547baebc48ecb215668183d2552d83ecd4564f3.zip
net registry: add a getvalue subcommand that prints a single given value.
usage: "net registry getvalue <keyname> <valuename>" Michael (This used to be commit 77f049943e133986dc47d25fff2415def1cec32f)
-rw-r--r--source3/utils/net_registry.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c
index c7cc5af493..6af8236092 100644
--- a/source3/utils/net_registry.c
+++ b/source3/utils/net_registry.c
@@ -260,6 +260,42 @@ done:
return ret;
}
+static int net_registry_getvalue(int argc, const char **argv)
+{
+ WERROR werr;
+ int ret = -1;
+ struct registry_key *key = NULL;
+ struct registry_value *value = NULL;
+ TALLOC_CTX *ctx = talloc_stackframe();
+
+ if (argc != 2) {
+ d_fprintf(stderr, "usage: net rpc registry getvalue <key> "
+ "<valuename>\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", dos_errstr(werr));
+ goto done;
+ }
+
+ werr = reg_queryvalue(ctx, key, argv[1], &value);
+ if (!W_ERROR_IS_OK(werr)) {
+ d_fprintf(stderr, "reg_queryvalue failed: %s\n",
+ dos_errstr(werr));
+ goto done;
+ }
+
+ print_registry_value(value);
+
+ ret = 0;
+
+done:
+ TALLOC_FREE(ctx);
+ return ret;
+}
+
static int net_registry_setvalue(int argc, const char **argv)
{
WERROR werr;
@@ -415,6 +451,11 @@ int net_registry(int argc, const char **argv)
"Delete a registry key"
},
{
+ "getvalue",
+ net_registry_getvalue,
+ "Print a registry value",
+ },
+ {
"setvalue",
net_registry_setvalue,
"Set a new registry value"