From: Gregor Beck Date: Tue, 25 Oct 2011 07:33:05 +0000 (+0200) Subject: s3:dbwrap: let dbwrap_fetch_uint32 distinguish between "not found" and "wrong format" X-Git-Tag: talloc-2.0.8~246 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fe74b777d2beb6d033b68c271d9c869789cc4ac5;p=thirdparty%2Fsamba.git s3:dbwrap: let dbwrap_fetch_uint32 distinguish between "not found" and "wrong format" Signed-off-by: Stefan Metzmacher --- diff --git a/lib/dbwrap/dbwrap_util.c b/lib/dbwrap/dbwrap_util.c index 119c7e11374..d0a34cc9068 100644 --- a/lib/dbwrap/dbwrap_util.c +++ b/lib/dbwrap/dbwrap_util.c @@ -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);