summaryrefslogtreecommitdiff
path: root/source4/lib/registry/tools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-09-23 11:15:46 -0700
committerAndrew Tridgell <tridge@samba.org>2008-09-23 11:15:46 -0700
commit66092ced5e1dc4d35923a3c90bcb3214a885b17d (patch)
treed40fd46e86244f1b45abda2a95c8fe84bfc88c3c /source4/lib/registry/tools
parent9cf29abee296ea2fcdf712687a6ce2cf9fd9d74c (diff)
parent353aaf26c5f71d9a94e799a1c1e37449211e7a87 (diff)
downloadsamba-66092ced5e1dc4d35923a3c90bcb3214a885b17d.tar.gz
samba-66092ced5e1dc4d35923a3c90bcb3214a885b17d.tar.bz2
samba-66092ced5e1dc4d35923a3c90bcb3214a885b17d.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source4/lib/registry/tools')
-rw-r--r--source4/lib/registry/tools/regdiff.c2
-rw-r--r--source4/lib/registry/tools/regshell.c28
-rw-r--r--source4/lib/registry/tools/regtree.c23
3 files changed, 23 insertions, 30 deletions
diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c
index 240c582340..fcf7c26237 100644
--- a/source4/lib/registry/tools/regdiff.c
+++ b/source4/lib/registry/tools/regdiff.c
@@ -46,7 +46,7 @@ static struct registry_context *open_backend(poptContext pc,
break;
case REG_REMOTE:
error = reg_open_remote(&ctx, NULL, cmdline_credentials, lp_ctx,
- remote_host, NULL);
+ remote_host, ev_ctx);
break;
case REG_NULL:
error = reg_open_local(NULL, &ctx);
diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c
index 98f7f02c38..5c308bfbda 100644
--- a/source4/lib/registry/tools/regshell.c
+++ b/source4/lib/registry/tools/regshell.c
@@ -207,8 +207,8 @@ static WERROR cmd_ls(struct regshell_context *ctx, int argc, char **argv)
{
int i;
WERROR error;
- uint32_t data_type;
- DATA_BLOB data;
+ uint32_t valuetype;
+ DATA_BLOB valuedata;
const char *name = NULL;
for (i = 0; W_ERROR_IS_OK(error = reg_key_get_subkey_by_index(ctx,
@@ -221,19 +221,15 @@ static WERROR cmd_ls(struct regshell_context *ctx, int argc, char **argv)
}
if (!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) {
- DEBUG(0, ("Error occured while browsing thru keys: %s\n",
- win_errstr(error)));
+ fprintf(stderr, "Error occured while browsing thru keys: %s\n",
+ win_errstr(error));
+ return error;
}
for (i = 0; W_ERROR_IS_OK(error = reg_key_get_value_by_index(ctx,
- ctx->current,
- i,
- &name,
- &data_type,
- &data)); i++) {
- printf("V \"%s\" %s %s\n", name, str_regtype(data_type),
- reg_val_data_string(ctx, lp_iconv_convenience(cmdline_lp_ctx), data_type, data));
- }
+ ctx->current, i, &name, &valuetype, &valuedata)); i++)
+ printf("V \"%s\" %s %s\n", name, str_regtype(valuetype),
+ reg_val_data_string(ctx, lp_iconv_convenience(cmdline_lp_ctx), valuetype, valuedata));
return WERR_OK;
}
@@ -250,7 +246,8 @@ static WERROR cmd_mkkey(struct regshell_context *ctx, int argc, char **argv)
error = reg_key_add_name(ctx, ctx->current, argv[1], 0, NULL, &tmp);
if (!W_ERROR_IS_OK(error)) {
- fprintf(stderr, "Error adding new subkey '%s'\n", argv[1]);
+ fprintf(stderr, "Error adding new subkey '%s': %s\n", argv[1],
+ win_errstr(error));
return error;
}
@@ -438,7 +435,7 @@ static char **reg_complete_key(const char *text, int start, int end)
len = strlen(text);
for(i = 0; j < MAX_COMPLETIONS-1; i++) {
status = reg_key_get_subkey_by_index(mem_ctx, base, i,
- &subkeyname, NULL, NULL);
+ &subkeyname, NULL, NULL);
if(W_ERROR_IS_OK(status)) {
if(!strncmp(text, subkeyname, len)) {
matches[j] = strdup(subkeyname);
@@ -536,7 +533,8 @@ int main(int argc, char **argv)
if (ctx->current == NULL) {
int i;
- for (i = 0; reg_predefined_keys[i].handle; i++) {
+ for (i = 0; (reg_predefined_keys[i].handle != 0) &&
+ (ctx->current == NULL); i++) {
WERROR err;
err = reg_get_predefined_key(ctx->registry,
reg_predefined_keys[i].handle,
diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c
index 19e4a010b4..6d55a3eb84 100644
--- a/source4/lib/registry/tools/regtree.c
+++ b/source4/lib/registry/tools/regtree.c
@@ -38,10 +38,9 @@ static void print_tree(int level, struct registry_key *p,
bool fullpath, bool novals)
{
struct registry_key *subkey;
- const char *valuename;
- const char *keyname;
- uint32_t value_type;
- DATA_BLOB value_data;
+ const char *valuename, *keyname;
+ uint32_t valuetype;
+ DATA_BLOB valuedata;
struct security_descriptor *sec_desc;
WERROR error;
int i;
@@ -73,18 +72,14 @@ static void print_tree(int level, struct registry_key *p,
if (!novals) {
mem_ctx = talloc_init("print_tree");
- for(i = 0; W_ERROR_IS_OK(error = reg_key_get_value_by_index(mem_ctx,
- p,
- i,
- &valuename,
- &value_type,
- &value_data)); i++) {
+ for(i = 0; W_ERROR_IS_OK(error = reg_key_get_value_by_index(
+ mem_ctx, p, i, &valuename, &valuetype, &valuedata));
+ i++) {
int j;
- char *desc;
for(j = 0; j < level+1; j++) putchar(' ');
- desc = reg_val_description(mem_ctx, lp_iconv_convenience(cmdline_lp_ctx), valuename,
- value_type, value_data);
- printf("%s\n", desc);
+ printf("%s\n", reg_val_description(mem_ctx,
+ lp_iconv_convenience(cmdline_lp_ctx), valuename,
+ valuetype, valuedata));
}
talloc_free(mem_ctx);