1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

s3:net registry check: handle missing version info

Signed-off-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Gregor Beck 2011-10-24 14:29:45 +02:00 committed by Michael Adam
parent c1d83b0ff2
commit bba62cdb0c

View File

@ -917,6 +917,36 @@ done:
return NT_STATUS_IS_OK(status);
}
static bool
dbwrap_store_uint32_verbose(struct db_context *db, const char *key, uint32_t nval)
{
uint32_t oval;
NTSTATUS status;
status = dbwrap_fetch_uint32(db, key, &oval);
if (NT_STATUS_IS_OK(status)) {
if (nval == oval) {
goto done;
}
printf("store %s:\n overwrite: %d\n with: %d\n", key,
(int)oval, (int)nval);
} else if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
printf("store %s:\n write: %d\n", key, (int)nval);
} else {
printf ("store %s:\n failed to fetch old value: %s\n", key,
nt_errstr(status));
goto done;
}
status = dbwrap_store_uint32(db, key, nval);
if (!NT_STATUS_IS_OK(status)) {
printf ("store %s failed: %s\n", key, nt_errstr(status));
}
done:
return NT_STATUS_IS_OK(status);
}
static int cmp_keynames(char **p1, char **p2)
{
@ -1200,6 +1230,12 @@ static bool check_ctx_fix_inplace(struct check_ctx *ctx) {
DEBUG(0, ("delete traverse failed: %s\n", nt_errstr(status)));
return false;
}
if (!dbwrap_store_uint32_verbose(ctx->odb, "INFO/version", ctx->version)) {
DEBUG(0, ("storing version failed: %s\n", nt_errstr(status)));
return false;
}
return true;
}