diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
commit | 6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch) | |
tree | 850c71039563c16a5d563c47e7ba2ab645baf198 /source3/lib/dbwrap.c | |
parent | 6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff) | |
parent | 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff) | |
download | samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.bz2 samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip |
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
Diffstat (limited to 'source3/lib/dbwrap.c')
-rw-r--r-- | source3/lib/dbwrap.c | 61 |
1 files changed, 1 insertions, 60 deletions
diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index 4e7346c2c4..83fc40efac 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -21,6 +21,7 @@ #include "includes.h" #include "dbwrap.h" +#include "util_tdb.h" #ifdef CLUSTER_SUPPORT #include "ctdb_private.h" #endif @@ -156,63 +157,3 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, return result; } - -NTSTATUS dbwrap_delete(struct db_context *db, TDB_DATA key) -{ - struct db_record *rec; - NTSTATUS status; - - rec = db->fetch_locked(db, talloc_tos(), key); - if (rec == NULL) { - return NT_STATUS_NO_MEMORY; - } - status = rec->delete_rec(rec); - TALLOC_FREE(rec); - return status; -} - -NTSTATUS dbwrap_store(struct db_context *db, TDB_DATA key, - TDB_DATA data, int flags) -{ - struct db_record *rec; - NTSTATUS status; - - rec = db->fetch_locked(db, talloc_tos(), key); - if (rec == NULL) { - return NT_STATUS_NO_MEMORY; - } - - status = rec->store(rec, data, flags); - TALLOC_FREE(rec); - return status; -} - -TDB_DATA dbwrap_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, - TDB_DATA key) -{ - TDB_DATA result; - - if (db->fetch(db, mem_ctx, key, &result) == -1) { - return make_tdb_data(NULL, 0); - } - - return result; -} - -NTSTATUS dbwrap_delete_bystring(struct db_context *db, const char *key) -{ - return dbwrap_delete(db, string_term_tdb_data(key)); -} - -NTSTATUS dbwrap_store_bystring(struct db_context *db, const char *key, - TDB_DATA data, int flags) -{ - return dbwrap_store(db, string_term_tdb_data(key), data, flags); -} - -TDB_DATA dbwrap_fetch_bystring(struct db_context *db, TALLOC_CTX *mem_ctx, - const char *key) -{ - return dbwrap_fetch(db, mem_ctx, string_term_tdb_data(key)); -} - |