From fe74b777d2beb6d033b68c271d9c869789cc4ac5 Mon Sep 17 00:00:00 2001 From: Gregor Beck Date: Tue, 25 Oct 2011 09:33:05 +0200 Subject: s3:dbwrap: let dbwrap_fetch_uint32 distinguish between "not found" and "wrong format" Signed-off-by: Stefan Metzmacher --- lib/dbwrap/dbwrap_util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/dbwrap') diff --git a/lib/dbwrap/dbwrap_util.c b/lib/dbwrap/dbwrap_util.c index 119c7e1137..d0a34cc906 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); -- cgit