summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-05-23 12:12:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:53:53 -0500
commit4a137a7cf154955db5d1b1bb67017575a428d737 (patch)
tree5939daae5bd2883e11f3c07cd03f7a56dcc419a3 /source4/lib
parentf371d2454298b0e64978c04056da5635d7e72921 (diff)
downloadsamba-4a137a7cf154955db5d1b1bb67017575a428d737.tar.gz
samba-4a137a7cf154955db5d1b1bb67017575a428d737.tar.bz2
samba-4a137a7cf154955db5d1b1bb67017575a428d737.zip
r829: Implement 'hive' command
(This used to be commit 2a87981bd0a79f0d685441d690e2f810d6ed86d0)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/registry/common/reg_objects.c5
-rw-r--r--source4/lib/registry/tools/regshell.c16
2 files changed, 20 insertions, 1 deletions
diff --git a/source4/lib/registry/common/reg_objects.c b/source4/lib/registry/common/reg_objects.c
index 0109a1f8fe..168ee946e8 100644
--- a/source4/lib/registry/common/reg_objects.c
+++ b/source4/lib/registry/common/reg_objects.c
@@ -93,6 +93,11 @@ uint32 reg_val_type( REG_VAL *val )
/**********************************************************************
*********************************************************************/
+REG_HANDLE *reg_key_handle (REG_KEY *key)
+{
+ return key->handle;
+}
+
char *reg_key_name( REG_KEY *key )
{
return key->name;
diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c
index dbddaa5dcf..b843e91120 100644
--- a/source4/lib/registry/tools/regshell.c
+++ b/source4/lib/registry/tools/regshell.c
@@ -147,7 +147,21 @@ static REG_KEY *cmd_rmval(REG_KEY *cur, int argc, char **argv)
static REG_KEY *cmd_hive(REG_KEY *cur, int argc, char **argv)
{
- /* FIXME */
+ int i;
+ WERROR error = WERR_OK;
+ for(i = 0; W_ERROR_IS_OK(error); i++) {
+ REG_KEY *hive;
+ error = reg_get_hive(reg_key_handle(cur), i, &hive);
+ if(!W_ERROR_IS_OK(error)) break;
+
+ if(argc == 1) {
+ printf("%s\n", reg_key_name(hive));
+ } else if(!strcmp(reg_key_name(hive), argv[1])) {
+ return hive;
+ }
+ reg_key_free(hive);
+ }
+ return NULL;
}
static REG_KEY *cmd_exit(REG_KEY *cur, int argc, char **argv)