diff options
author | Luke Leighton <lkcl@samba.org> | 2000-02-04 04:59:31 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 2000-02-04 04:59:31 +0000 |
commit | 49d7f0afbc1c5425d53019e234d54ddf205c8e9a (patch) | |
tree | 43d8357f41553776790830223ff831cb29e7a55a /source/libsmb/unexpected.c | |
parent | 176c405d2702a4245561ff56c8eac3c754a0dea3 (diff) | |
download | samba-49d7f0afbc1c5425d53019e234d54ddf205c8e9a.tar.gz samba-49d7f0afbc1c5425d53019e234d54ddf205c8e9a.tar.xz samba-49d7f0afbc1c5425d53019e234d54ddf205c8e9a.zip |
1) added void* state argument to tdb_traverse. guess what! there were
two places i found where it was appropriate to _use_ that third argument,
in locking.c and brlock.c! there was a static traverse_function and
i removed the static variable, typecast it to a void*, passed it to
tdb_traverse and re-cast it back to the traverse_function inside the
tdb_traverse function. this makes the use of tdb_traverse() reentrant,
which is never going to happen, i know, i just don't like to see
statics lying about when there's no need for them.
as i had to do in samba-tng, all uses of tdb_traverse modified to take
the new void* state argument.
2) disabled rpcclient: referring people to use SAMBA_TNG rpcclient.
i don't know how the other samba team members would react if i deleted
rpcclient from cvs main. damn, that code's so old, it's unreal.
20 rpcclient commands, instead of about 70 in SAMBA_TNG.
Diffstat (limited to 'source/libsmb/unexpected.c')
-rw-r--r-- | source/libsmb/unexpected.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/libsmb/unexpected.c b/source/libsmb/unexpected.c index b210fb2504d..6c5dd611a9c 100644 --- a/source/libsmb/unexpected.c +++ b/source/libsmb/unexpected.c @@ -24,7 +24,7 @@ extern int DEBUGLEVEL; -static TDB_CONTEXT *tdb; +static TDB_CONTEXT *tdbd = NULL; /* the key type used in the unexpeceted packet database */ struct unexpected_key { @@ -48,11 +48,11 @@ void unexpected_packet(struct packet_struct *p) char buf[1024]; int len=0; - if (!tdb) { - tdb = tdb_open(lock_path("unexpected.tdb"), 1, + if (!tdbd) { + tdbd = tdb_open(lock_path("unexpected.tdb"), 1, TDB_CLEAR_IF_FIRST, O_RDWR | O_CREAT, 0644); - if (!tdb) { + if (!tdbd) { DEBUG(0,("Failed to open unexpected.tdb\n")); return; } @@ -71,7 +71,7 @@ void unexpected_packet(struct packet_struct *p) dbuf.dptr = buf; dbuf.dsize = len; - tdb_store(tdb, kbuf, dbuf, TDB_REPLACE); + tdb_store(tdbd, kbuf, dbuf, TDB_REPLACE); } @@ -80,7 +80,7 @@ static time_t lastt; /**************************************************************************** delete the record if it is too old **************************************************************************/ -static int traverse_fn(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf) +static int traverse_fn(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state) { struct unexpected_key key; @@ -99,14 +99,14 @@ delete all old unexpected packets **************************************************************************/ void clear_unexpected(time_t t) { - if (!tdb) return; + if (!tdbd) return; if ((lastt != 0) && (t < lastt + NMBD_UNEXPECTED_TIMEOUT)) return; lastt = t; - tdb_traverse(tdb, traverse_fn); + tdb_traverse(tdbd, traverse_fn, NULL); } @@ -118,7 +118,7 @@ static char *match_name; /**************************************************************************** tdb traversal fn to find a matching 137 packet **************************************************************************/ -static int traverse_match(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf) +static int traverse_match(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state) { struct unexpected_key key; struct packet_struct *p; @@ -159,7 +159,7 @@ struct packet_struct *receive_unexpected(enum packet_type packet_type, int id, match_type = packet_type; match_name = mailslot_name; - tdb_traverse(tdb2, traverse_match); + tdb_traverse(tdb2, traverse_match, NULL); tdb_close(tdb2); |