s3:net registry check: adapt to new semantic of dbwrap_fetch with rbt
authorGregor Beck <gbeck@sernet.de>
Thu, 3 Nov 2011 13:57:52 +0000 (14:57 +0100)
committerMichael Adam <obnox@samba.org>
Tue, 29 Nov 2011 18:53:30 +0000 (19:53 +0100)
Signed-off-by: Michael Adam <obnox@samba.org>
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Tue Nov 29 19:53:30 CET 2011 on sn-devel-104

source3/utils/net_registry_check.c

index c51a2f02b96b1410a79b90d0e06b36bedf730575..ce7032ab64963b94a753638920eba172b9ebe0bc 100644 (file)
@@ -264,22 +264,19 @@ static struct regkey*
 check_ctx_lookup_key(struct check_ctx *ctx, const char *path) {
        struct regkey *ret = NULL;
        NTSTATUS status;
-       TDB_DATA val;
+       TDB_DATA val = tdb_null;
 
        if ( path == NULL) {
                return ctx->root;
        }
 
        status = dbwrap_fetch(ctx->reg, ctx, string_term_tdb_data(path), &val);
-       if (!NT_STATUS_IS_OK(status)) {
-               return NULL;
-       }
-       if (val.dptr != NULL) {
+       if (NT_STATUS_IS_OK(status)) {
                if (ctx->opt.verbose) {
                        printf("Open: %s\n", path);
                }
                ret = *(struct regkey**)val.dptr;
-       } else {
+       } else if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
                /* not yet existing, create */
                char *pp;
                if (ctx->opt.verbose) {
@@ -304,6 +301,9 @@ check_ctx_lookup_key(struct check_ctx *ctx, const char *path) {
 
                dbwrap_store(ctx->reg, string_term_tdb_data(path),
                             make_tdb_data((void*)&ret, sizeof(ret)), 0);
+       } else {
+               DEBUG(0, ("lookup key: failed to fetch %s: %s\n", path,
+                         nt_errstr(status)));
        }
 done:
        talloc_free(val.dptr);