1 Index: dsniff-2.4/configure
2 ===================================================================
3 --- dsniff-2.4.orig/configure 2010-11-03 23:42:49.466000001 +0100
4 +++ dsniff-2.4/configure 2010-11-03 23:42:52.921000006 +0100
7 --with-db=DIR use Berkeley DB (with --enable-compat185) in DIR"
9 + --with-gdbm=DIR use GNU DBM in DIR"
11 --with-libpcap=DIR use libpcap in DIR"
13 --with-libnet=DIR use libnet in DIR"
14 @@ -3059,7 +3061,40 @@
18 +echo $ac_n "checking for libgdbm""... $ac_c" 1>&6
19 +echo "configure:3059: checking for libgdbm" >&5
20 +# Check whether --with-gdbm or --without-gdbm was given.
21 +if test "${with_gdbm+set}" = set; then
22 + withval="$with_gdbm"
25 + echo "$ac_t""no" 1>&6
28 + echo "$ac_t""$withval" 1>&6
29 + if test -f $withval/include/gdbm.h -a -f $withval/lib/libgdbm.a; then
31 + if cd $withval; then withval=`pwd`; cd $owd; fi
32 + DBINC="-I$withval/include"
33 + DBLIB="-L$withval/lib -lgdbm"
35 + { echo "configure: error: gdbm.h or libgdbm.a not found in $withval" 1>&2; exit 1; }
40 + if test -f ${prefix}/include/gdbm.h; then
41 + LNETINC="-I${prefix}/include"
42 + LNETLIB="-L${prefix}/lib -lgdbm"
43 + elif test -f /usr/include/gdbm.h; then
46 + echo "$ac_t""no" 1>&6
47 + { echo "configure: error: libgdbm not found" 1>&2; exit 1; }
49 + echo "$ac_t""yes" 1>&6
54 echo $ac_n "checking for libnet""... $ac_c" 1>&6
55 Index: dsniff-2.4/record.c
56 ===================================================================
57 --- dsniff-2.4.orig/record.c 2010-11-03 23:42:49.471000001 +0100
58 +++ dsniff-2.4/record.c 2010-11-03 23:42:52.922000005 +0100
64 -#define DB_LIBRARY_COMPATIBILITY_API
81 xdr_rec(XDR *xdrs, struct rec *rec)
84 tm = localtime(&rec->time);
85 strftime(tstr, sizeof(tstr), "%x %X", tm);
87 srcp = libnet_host_lookup(rec->src, Opt_dns);
88 dstp = libnet_host_lookup(rec->dst, Opt_dns);
96 record_hash(struct rec *rec)
100 static u_char hash[16];
104 MD5Update(&ctx, rec->data.n_bytes, rec->data.n_len);
105 MD5Final(hash, &ctx);
108 - key.size = sizeof(hash);
110 + key.dsize = sizeof(hash);
117 record_save(struct rec *rec)
124 @@ -123,15 +117,15 @@
125 if (!xdr_rec(&xdrs, rec))
129 - data.size = xdr_getpos(&xdrs);
131 + data.dsize = xdr_getpos(&xdrs);
135 key = record_hash(rec);
137 - if (db->put(db, key, &data, R_NOOVERWRITE) == 0)
139 + if (gdbm_store(dbf, key, data, GDBM_INSERT) == 0)
144 @@ -139,18 +133,22 @@
149 + datum nextkey, key, content;
153 - while (db->seq(db, &key, &data, R_NEXT) == 0) {
154 + key = gdbm_firstkey(dbf);
156 + nextkey = gdbm_nextkey(dbf, key);
157 + content = gdbm_fetch(dbf, key);
158 memset(&rec, 0, sizeof(rec));
159 - xdrmem_create(&xdrs, data.data, data.size, XDR_DECODE);
161 + xdrmem_create(&xdrs, content.dptr, content.dsize, XDR_DECODE);
162 if (xdr_rec(&xdrs, &rec)) {
171 @@ -158,16 +156,23 @@
172 record_init(char *file)
176 + // needed for gdbm_open, which does not have the option to create
177 + // a database in memory
179 + char *record_file = "/tmp/.dsniff.db";
180 + file = record_file;
185 + flags = GDBM_READER;
189 - flags = O_RDWR|O_CREAT;
190 + flags = GDBM_WRCREAT;
191 mode = S_IRUSR|S_IWUSR;
193 - if ((db = dbopen(file, flags, mode, DB_BTREE, NULL)) == NULL)
195 + if ((dbf = gdbm_open(file, 1024, flags, mode, NULL)) == NULL)