summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-12-08 16:37:40 +0100
committerMichael Adam <obnox@samba.org>2011-12-15 16:00:46 +0100
commit77dca703504044412872b7e9ad4d2c9c1971ba32 (patch)
tree3590101bf44b384ee381ce335d12983d38bdf468
parentdaa365493e3fd7b7a664628e48438e7938fa4628 (diff)
downloadsamba-77dca703504044412872b7e9ad4d2c9c1971ba32.tar.gz
samba-77dca703504044412872b7e9ad4d2c9c1971ba32.tar.bz2
samba-77dca703504044412872b7e9ad4d2c9c1971ba32.zip
s3-dbwrap: Rewrite dbwrap_fallback_parse_record based on dbwrap_fetch_locked
This is in preparation to remove the db_context->fetch function pointer Signed-off-by: Michael Adam <obnox@samba.org>
-rw-r--r--source3/lib/dbwrap/dbwrap.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source3/lib/dbwrap/dbwrap.c b/source3/lib/dbwrap/dbwrap.c
index 8ad6c946e9..0635d76b2c 100644
--- a/source3/lib/dbwrap/dbwrap.c
+++ b/source3/lib/dbwrap/dbwrap.c
@@ -65,14 +65,23 @@ static NTSTATUS dbwrap_fallback_parse_record(struct db_context *db, TDB_DATA key
void *private_data),
void *private_data)
{
+ struct db_record *rec;
TDB_DATA data;
- NTSTATUS status;
- status = dbwrap_fetch(db, talloc_tos(), key, &data);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ rec = dbwrap_fetch_locked(db, talloc_tos(), key);
+ if (rec == NULL) {
+ return NT_STATUS_NOT_FOUND;
+ }
+ data = dbwrap_record_get_value(rec);
+
+ data.dptr = talloc_memdup(talloc_tos(), data.dptr, data.dsize);
+ TALLOC_FREE(rec);
+ if (data.dptr == NULL) {
+ return NT_STATUS_NO_MEMORY;
}
+
parser(key, data, private_data);
+
TALLOC_FREE(data.dptr);
return NT_STATUS_OK;
}