summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-09-22 06:27:49 +0200
committerMichael Adam <obnox@samba.org>2010-09-22 06:30:01 +0200
commitcb5c86e5027fd7bca73e855bcf433846a7c680f3 (patch)
tree299e16599553c5e8db2caaea56f66616d30ac871
parent7a25d13742fe190e2b8b97f62d7db85db4e816e9 (diff)
downloadsamba-cb5c86e5027fd7bca73e855bcf433846a7c680f3.tar.gz
samba-cb5c86e5027fd7bca73e855bcf433846a7c680f3.tar.bz2
samba-cb5c86e5027fd7bca73e855bcf433846a7c680f3.zip
s3:net: add subcommand net registry deletekey_recursive
to delete a key including subkeys
-rw-r--r--source3/utils/net_registry.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c
index 6021fa08e1..7ea68f1126 100644
--- a/source3/utils/net_registry.c
+++ b/source3/utils/net_registry.c
@@ -240,8 +240,9 @@ done:
return ret;
}
-static int net_registry_deletekey(struct net_context *c, int argc,
- const char **argv)
+static int net_registry_deletekey_internal(struct net_context *c, int argc,
+ const char **argv,
+ bool recursive)
{
WERROR werr;
char *subkeyname;
@@ -271,7 +272,11 @@ static int net_registry_deletekey(struct net_context *c, int argc,
goto done;
}
- werr = reg_deletekey(hivekey, subkeyname);
+ if (recursive) {
+ werr = reg_deletekey_recursive(hivekey, subkeyname);
+ } else {
+ werr = reg_deletekey(hivekey, subkeyname);
+ }
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "reg_deletekey %s: %s\n", _("failed"),
win_errstr(werr));
@@ -285,6 +290,18 @@ done:
return ret;
}
+static int net_registry_deletekey(struct net_context *c, int argc,
+ const char **argv)
+{
+ return net_registry_deletekey_internal(c, argc, argv, false);
+}
+
+static int net_registry_deletekey_recursive(struct net_context *c, int argc,
+ const char **argv)
+{
+ return net_registry_deletekey_internal(c, argc, argv, true);
+}
+
static int net_registry_getvalue_internal(struct net_context *c, int argc,
const char **argv, bool raw)
{
@@ -1124,6 +1141,14 @@ int net_registry(struct net_context *c, int argc, const char **argv)
" Delete a registry key")
},
{
+ "deletekey_recursive",
+ net_registry_deletekey_recursive,
+ NET_TRANSPORT_LOCAL,
+ N_("Delete a registry key with subkeys"),
+ N_("net registry deletekey_recursive\n"
+ " Delete a registry key with subkeys")
+ },
+ {
"getvalue",
net_registry_getvalue,
NET_TRANSPORT_LOCAL,