]> git.samba.org - bbaumbach/samba-autobuild/.git/commitdiff
s3:net registry check: adapt to new semantic of dbwrap_fetch
authorGregor Beck <gbeck@sernet.de>
Mon, 24 Oct 2011 08:25:29 +0000 (10:25 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 29 Nov 2011 17:20:06 +0000 (18:20 +0100)
Signed-off-by: Michael Adam <obnox@samba.org>
source3/utils/net_registry_check.c

index 2c278319f594ccd34bf6231d1aaafdb9908d8d45..c51a2f02b96b1410a79b90d0e06b36bedf730575 100644 (file)
@@ -893,18 +893,21 @@ dbwrap_store_verbose(struct db_context *db, const char *key, TDB_DATA nval)
        NTSTATUS status;
 
        status = dbwrap_fetch_bystring(db, mem_ctx, key, &oval);
-       if (!NT_STATUS_IS_OK(status)) {
-               printf ("store %s failed to fetch old value: %s\n", key,
-                       nt_errstr(status));
-               goto done;
-       }
+       if (NT_STATUS_IS_OK(status)) {
+               if (tdb_data_equal(nval, oval)) {
+                       goto done;
+               }
+               printf("store %s:\n  overwrite: %s\n  with:      %s\n", key,
+                      tdb_data_print(mem_ctx, oval),
+                      tdb_data_print(mem_ctx, nval));
 
-       if (!tdb_data_is_empty(oval) && !tdb_data_equal(nval, oval)) {
-               printf("store %s:\n"
-                      "  overwrite: %s\n"
-                      "  with:      %s\n",
-                      key, tdb_data_print(mem_ctx, oval),
+       } else if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
+               printf("store %s:\n  write: %s\n", key,
                       tdb_data_print(mem_ctx, nval));
+       } else {
+               printf ("store %s:\n  failed to fetch old value: %s\n", key,
+                       nt_errstr(status));
+               goto done;
        }
 
        status = dbwrap_store_bystring(db, key, nval, 0);