diff options
author | Gregor Beck <gbeck@sernet.de> | 2011-10-24 14:29:45 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-11-29 18:20:06 +0100 |
commit | bba62cdb0c5f3ae85a5eeaa9b747e04a2d392440 (patch) | |
tree | fe374dedb1a516a0faa90eab6bb87b09673fec91 /source3/utils | |
parent | c1d83b0ff2bd400161a21c99b34523164ebd6462 (diff) | |
download | samba-bba62cdb0c5f3ae85a5eeaa9b747e04a2d392440.tar.gz samba-bba62cdb0c5f3ae85a5eeaa9b747e04a2d392440.tar.bz2 samba-bba62cdb0c5f3ae85a5eeaa9b747e04a2d392440.zip |
s3:net registry check: handle missing version info
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_registry_check.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source3/utils/net_registry_check.c b/source3/utils/net_registry_check.c index 8e67edd7f1..2c278319f5 100644 --- a/source3/utils/net_registry_check.c +++ b/source3/utils/net_registry_check.c @@ -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; } |