summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-03-13 20:02:16 +0100
committerVolker Lendecke <vl@samba.org>2010-03-13 20:20:37 +0100
commitb4826b9393244e46e855a65a65df67d9e6c1d81c (patch)
tree20dfe00ea7f8bc9997fdaa8f4e8c73aa1e367e82 /source3
parentcfc44d244152609e17a26db85bbbf827955958a7 (diff)
downloadsamba-b4826b9393244e46e855a65a65df67d9e6c1d81c.tar.gz
samba-b4826b9393244e46e855a65a65df67d9e6c1d81c.tar.bz2
samba-b4826b9393244e46e855a65a65df67d9e6c1d81c.zip
s3: Convert unexpected.tdb to use tdb_wrap_open
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/unexpected.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/source3/libsmb/unexpected.c b/source3/libsmb/unexpected.c
index d123e24aa8..1ac45ec84b 100644
--- a/source3/libsmb/unexpected.c
+++ b/source3/libsmb/unexpected.c
@@ -20,7 +20,7 @@
#include "includes.h"
-static TDB_CONTEXT *tdbd = NULL;
+static struct tdb_wrap *tdbd = NULL;
/* the key type used in the unexpected packet database */
struct unexpected_key {
@@ -45,9 +45,10 @@ void unexpected_packet(struct packet_struct *p)
uint32_t enc_ip;
if (!tdbd) {
- tdbd = tdb_open_log(lock_path("unexpected.tdb"), 0,
- TDB_CLEAR_IF_FIRST|TDB_DEFAULT,
- O_RDWR | O_CREAT, 0644);
+ tdbd = tdb_wrap_open(talloc_autofree_context(),
+ lock_path("unexpected.tdb"), 0,
+ TDB_CLEAR_IF_FIRST|TDB_DEFAULT,
+ O_RDWR | O_CREAT, 0644);
if (!tdbd) {
DEBUG(0,("Failed to open unexpected.tdb\n"));
return;
@@ -74,7 +75,7 @@ void unexpected_packet(struct packet_struct *p)
dbuf.dptr = (uint8_t *)buf;
dbuf.dsize = len;
- tdb_store(tdbd, kbuf, dbuf, TDB_REPLACE);
+ tdb_store(tdbd->tdb, kbuf, dbuf, TDB_REPLACE);
}
@@ -115,7 +116,7 @@ void clear_unexpected(time_t t)
lastt = t;
- tdb_traverse(tdbd, traverse_fn, NULL);
+ tdb_traverse(tdbd->tdb, traverse_fn, NULL);
}
struct receive_unexpected_state {
@@ -185,10 +186,11 @@ static int traverse_match(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf,
struct packet_struct *receive_unexpected(enum packet_type packet_type, int id,
const char *mailslot_name)
{
- TDB_CONTEXT *tdb2;
+ struct tdb_wrap *tdb2;
struct receive_unexpected_state state;
- tdb2 = tdb_open_log(lock_path("unexpected.tdb"), 0, 0, O_RDONLY, 0);
+ tdb2 = tdb_wrap_open(talloc_autofree_context(),
+ lock_path("unexpected.tdb"), 0, 0, O_RDONLY, 0);
if (!tdb2) return NULL;
state.matched_packet = NULL;
@@ -196,9 +198,9 @@ struct packet_struct *receive_unexpected(enum packet_type packet_type, int id,
state.match_type = packet_type;
state.match_name = mailslot_name;
- tdb_traverse(tdb2, traverse_match, &state);
+ tdb_traverse(tdb2->tdb, traverse_match, &state);
- tdb_close(tdb2);
+ TALLOC_FREE(tdb2);
return state.matched_packet;
}