1 diff -Nur dsniff-2.3/configure dsniff-2.3.patched/configure
2 --- dsniff-2.3/configure 2005-06-11 16:38:47.000000000 +0200
3 +++ dsniff-2.3.patched/configure 2005-06-11 16:39:26.000000000 +0200
6 --with-db=DIR use Berkeley DB (with --enable-compat185) in DIR"
8 + --with-gdbm=DIR use GNU DBM in DIR"
10 --with-libpcap=DIR use libpcap in DIR"
12 --with-libnet=DIR use libnet in DIR"
13 @@ -3051,7 +3053,40 @@
17 +echo $ac_n "checking for libgdbm""... $ac_c" 1>&6
18 +echo "configure:3059: checking for libgdbm" >&5
19 +# Check whether --with-gdbm or --without-gdbm was given.
20 +if test "${with_gdbm+set}" = set; then
21 + withval="$with_gdbm"
24 + echo "$ac_t""no" 1>&6
27 + echo "$ac_t""$withval" 1>&6
28 + if test -f $withval/include/gdbm.h -a -f $withval/lib/libgdbm.a; then
30 + if cd $withval; then withval=`pwd`; cd $owd; fi
31 + DBINC="-I$withval/include"
32 + DBLIB="-L$withval/lib -lgdbm"
34 + { echo "configure: error: gdbm.h or libgdbm.a not found in $withval" 1>&2; exit 1; }
39 + if test -f ${prefix}/include/gdbm.h; then
40 + LNETINC="-I${prefix}/include"
41 + LNETLIB="-L${prefix}/lib -lgdbm"
42 + elif test -f /usr/include/gdbm.h; then
45 + echo "$ac_t""no" 1>&6
46 + { echo "configure: error: libgdbm not found" 1>&2; exit 1; }
48 + echo "$ac_t""yes" 1>&6
53 echo $ac_n "checking for libnet""... $ac_c" 1>&6
54 diff -Nur dsniff-2.3/record.c dsniff-2.3.patched/record.c
55 --- dsniff-2.3/record.c 2000-11-14 16:51:02.000000000 +0100
56 +++ dsniff-2.3.patched/record.c 2005-06-11 16:39:49.000000000 +0200
62 -#define DB_LIBRARY_COMPATIBILITY_API
79 xdr_rec(XDR *xdrs, struct rec *rec)
86 record_hash(struct rec *rec)
90 static u_char hash[16];
94 MD5Update(&ctx, rec->data.n_bytes, rec->data.n_len);
98 - key.size = sizeof(hash);
100 + key.dsize = sizeof(hash);
107 record_save(struct rec *rec)
114 @@ -120,15 +115,15 @@
115 if (!xdr_rec(&xdrs, rec))
119 - data.size = xdr_getpos(&xdrs);
121 + data.dsize = xdr_getpos(&xdrs);
125 key = record_hash(rec);
127 - if (db->put(db, key, &data, R_NOOVERWRITE) == 0)
129 + if (gdbm_store(dbf, key, data, GDBM_INSERT) == 0)
134 @@ -136,18 +131,22 @@
139 + datum nextkey, data;
143 - while (db->seq(db, &key, &data, R_NEXT) == 0) {
144 + data = gdbm_firstkey ( dbf );
145 + while (data.dptr) {
146 + nextkey = gdbm_nextkey ( dbf, data );
147 memset(&rec, 0, sizeof(rec));
148 - xdrmem_create(&xdrs, data.data, data.size, XDR_DECODE);
149 + xdrmem_create(&xdrs, data.dptr, data.dsize, XDR_DECODE);
151 if (xdr_rec(&xdrs, &rec)) {
160 @@ -155,16 +154,23 @@
161 record_init(char *file)
165 + // needed for gdbm_open, which does not have the option to create
166 + // a database in memory
168 + char *record_file = "/tmp/.dsniff.db";
169 + file = record_file;
174 + flags = GDBM_READER;
178 - flags = O_RDWR|O_CREAT;
179 + flags = GDBM_WRCREAT;
180 mode = S_IRUSR|S_IWUSR;
182 - if ((db = dbopen(file, flags, mode, DB_BTREE, NULL)) == NULL)
184 + if ((dbf = gdbm_open(file, 1024, flags, mode, NULL)) == NULL)