summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net_registry.c104
1 files changed, 41 insertions, 63 deletions
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c
index bb7c67f1f1..62d34184b0 100644
--- a/source3/utils/net_registry.c
+++ b/source3/utils/net_registry.c
@@ -122,69 +122,6 @@ done:
return werr;
}
-/*
- *
- * the main "net registry" function implementations
- *
- */
-
-static int net_registry_enumerate(struct net_context *c, int argc,
- const char **argv)
-{
- WERROR werr;
- struct registry_key *key = NULL;
- TALLOC_CTX *ctx = talloc_stackframe();
- char *subkey_name;
- NTTIME modtime;
- uint32_t count;
- char *valname = NULL;
- struct registry_value *valvalue = NULL;
- int ret = -1;
-
- if (argc != 1 || c->display_usage) {
- d_printf("%s\n%s",
- _("Usage:"),
- _("net registry enumerate <path>\n"));
- d_printf("%s\n%s",
- _("Example:"),
- _("net registry enumerate 'HKLM\\Software\\Samba'\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;
- }
-
- for (count = 0;
- werr = reg_enumkey(ctx, key, count, &subkey_name, &modtime),
- W_ERROR_IS_OK(werr);
- count++)
- {
- print_registry_key(subkey_name, &modtime);
- }
- if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
- goto done;
- }
-
- for (count = 0;
- werr = reg_enumvalue(ctx, key, count, &valname, &valvalue),
- W_ERROR_IS_OK(werr);
- count++)
- {
- print_registry_value_with_name(valname, valvalue);
- }
- if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) {
- goto done;
- }
-
- ret = 0;
-done:
- TALLOC_FREE(ctx);
- return ret;
-}
-
static WERROR registry_enumkey(struct registry_key* parent, const char* keyname, bool recursive)
{
WERROR werr;
@@ -249,6 +186,47 @@ done:
return werr;
}
+
+
+/*
+ *
+ * the main "net registry" function implementations
+ *
+ */
+static int net_registry_enumerate(struct net_context *c, int argc,
+ const char **argv)
+{
+ WERROR werr;
+ struct registry_key *key = NULL;
+ char* name = NULL;
+ TALLOC_CTX *ctx = talloc_stackframe();
+ int ret = -1;
+
+ if (argc != 1 || c->display_usage) {
+ d_printf("%s\n%s",
+ _("Usage:"),
+ _("net registry enumerate <path>\n"));
+ d_printf("%s\n%s",
+ _("Example:"),
+ _("net registry enumerate 'HKLM\\Software\\Samba'\n"));
+ goto done;
+ }
+
+ werr = open_hive(ctx, argv[0], REG_KEY_READ, &key, &name);
+ if (!W_ERROR_IS_OK(werr)) {
+ d_fprintf(stderr, _("open_key failed: %s\n"), win_errstr(werr));
+ goto done;
+ }
+
+ werr = registry_enumkey(key, name, c->opt_reboot);
+ if (W_ERROR_IS_OK(werr)) {
+ ret = 0;
+ }
+done:
+ TALLOC_FREE(ctx);
+ return ret;
+}
+
static int net_registry_enumerate_recursive(struct net_context *c, int argc,
const char **argv)
{