s3:dbwrap: let dbwrap_fetch_uint32 distinguish between "not found" and "wrong format"
authorGregor Beck <gbeck@sernet.de>
Tue, 25 Oct 2011 07:33:05 +0000 (09:33 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Sep 2012 14:26:38 +0000 (16:26 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
lib/dbwrap/dbwrap_util.c

index 119c7e1137433c5bec751a54633e457039e041b1..d0a34cc9068e31adbc5bb1858f1dc09e03e5c630 100644 (file)
@@ -112,10 +112,13 @@ NTSTATUS dbwrap_fetch_uint32_bystring(struct db_context *db,
                return status;
        }
 
-       if ((dbuf.dptr == NULL) || (dbuf.dsize != sizeof(uint32_t))) {
-               TALLOC_FREE(dbuf.dptr);
+       if ((dbuf.dptr == NULL) || (dbuf.dsize == 0)) {
                return NT_STATUS_NOT_FOUND;
        }
+       if (dbuf.dsize != sizeof(uint32_t)) {
+               TALLOC_FREE(dbuf.dptr);
+               return NT_STATUS_UNSUCCESSFUL;
+       }
 
        *val = IVAL(dbuf.dptr, 0);
        TALLOC_FREE(dbuf.dptr);