summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Beck <gbeck@sernet.de>2011-10-20 17:38:06 +0200
committerMichael Adam <obnox@samba.org>2011-10-26 02:44:03 +0200
commitf881d43837e77e5ed2d96aecb976720a5d2c237b (patch)
tree4003fc2225a2a5fd321ab67114572ab547314054
parent4fe5e091e13a450b67759725f41f3b748e235890 (diff)
downloadsamba-f881d43837e77e5ed2d96aecb976720a5d2c237b.tar.gz
samba-f881d43837e77e5ed2d96aecb976720a5d2c237b.tar.bz2
samba-f881d43837e77e5ed2d96aecb976720a5d2c237b.zip
s3:net registry check: fix a case where automatic and read only mode take the wrong action
Signed-off-by: Michael Adam <obnox@samba.org>
-rw-r--r--source3/utils/net_registry_check.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source3/utils/net_registry_check.c b/source3/utils/net_registry_check.c
index 0ae2c962d3..870a0edce2 100644
--- a/source3/utils/net_registry_check.c
+++ b/source3/utils/net_registry_check.c
@@ -336,7 +336,7 @@ static struct check_ctx* check_ctx_create(TALLOC_CTX *mem_ctx, const char *db,
}
}
- ctx->default_action = opt->automatic ? 'd' : 'r';
+ ctx->default_action = 'r';
return ctx;
fail:
talloc_free(ctx);
@@ -728,6 +728,7 @@ static int check_tdb_action(struct db_record *rec, void *check_ctx)
char *key;
bool invalid_path = false;
bool once_more;
+ bool first_iter = true;
if (!tdb_data_is_cstr(rec_key)) {
printf("Key is not zero terminated: \"%.*s\"\ntry to go on.\n",
@@ -791,9 +792,9 @@ static int check_tdb_action(struct db_record *rec, void *check_ctx)
if (invalid_path) {
int action;
if (ctx->opt.output == NULL) {
- action = 's';
+ action = first_iter ? 'r' : 's';
} else if (ctx->opt.automatic) {
- action = (ctx->default_action == 'r') ? 'd' : 'r';
+ action = first_iter ? 'r' : 'd';
} else if (ctx->auto_action != '\0') {
action = ctx->auto_action;
} else {
@@ -828,6 +829,7 @@ static int check_tdb_action(struct db_record *rec, void *check_ctx)
break;
}
}
+ first_iter = false;
} while (once_more);
if (invalid_path) {