summaryrefslogtreecommitdiff
path: root/source3/lib/dbwrap
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/dbwrap')
-rw-r--r--source3/lib/dbwrap/dbwrap.h4
-rw-r--r--source3/lib/dbwrap/dbwrap_util.c14
2 files changed, 11 insertions, 7 deletions
diff --git a/source3/lib/dbwrap/dbwrap.h b/source3/lib/dbwrap/dbwrap.h
index a549c84d8e..423791660c 100644
--- a/source3/lib/dbwrap/dbwrap.h
+++ b/source3/lib/dbwrap/dbwrap.h
@@ -73,8 +73,8 @@ NTSTATUS dbwrap_fetch_bystring(struct db_context *db, TALLOC_CTX *mem_ctx,
NTSTATUS dbwrap_fetch_int32(struct db_context *db, const char *keystr,
int32_t *result);
int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v);
-bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
- uint32_t *val);
+NTSTATUS dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
+ uint32_t *val);
int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
uint32_t *oldval, uint32_t change_val);
diff --git a/source3/lib/dbwrap/dbwrap_util.c b/source3/lib/dbwrap/dbwrap_util.c
index 5c3940e97b..bd29460f49 100644
--- a/source3/lib/dbwrap/dbwrap_util.c
+++ b/source3/lib/dbwrap/dbwrap_util.c
@@ -72,25 +72,29 @@ int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v)
return NT_STATUS_IS_OK(status) ? 0 : -1;
}
-bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
- uint32_t *val)
+NTSTATUS dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
+ uint32_t *val)
{
TDB_DATA dbuf;
NTSTATUS status;
+ if (val == NULL) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
status = dbwrap_fetch_bystring(db, NULL, keystr, &dbuf);
if (!NT_STATUS_IS_OK(status)) {
- return false;
+ return status;
}
if ((dbuf.dptr == NULL) || (dbuf.dsize != sizeof(uint32_t))) {
TALLOC_FREE(dbuf.dptr);
- return false;
+ return NT_STATUS_NOT_FOUND;
}
*val = IVAL(dbuf.dptr, 0);
TALLOC_FREE(dbuf.dptr);
- return true;
+ return NT_STATUS_OK;
}
int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v)