From f881d43837e77e5ed2d96aecb976720a5d2c237b Mon Sep 17 00:00:00 2001 From: Gregor Beck Date: Thu, 20 Oct 2011 17:38:06 +0200 Subject: s3:net registry check: fix a case where automatic and read only mode take the wrong action Signed-off-by: Michael Adam --- source3/utils/net_registry_check.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source3/utils/net_registry_check.c') 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) { -- cgit