1 diff -Nur dsniff-2.3/configure dsniff-2.3.patched/configure
2 --- dsniff-2.3/configure 2005-06-11 18:13:59.000000000 +0200
3 +++ dsniff-2.3.patched/configure 2005-06-11 18:14:37.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 18:14:56.000000000 +0200
62 -#define DB_LIBRARY_COMPATIBILITY_API
79 xdr_rec(XDR *xdrs, struct rec *rec)
82 tm = localtime(&rec->time);
83 strftime(tstr, sizeof(tstr), "%x %X", tm);
85 srcp = libnet_host_lookup(rec->src, Opt_dns);
86 dstp = libnet_host_lookup(rec->dst, Opt_dns);
94 record_hash(struct rec *rec)
98 static u_char hash[16];
102 MD5Update(&ctx, rec->data.n_bytes, rec->data.n_len);
103 MD5Final(hash, &ctx);
106 - key.size = sizeof(hash);
108 + key.dsize = sizeof(hash);
115 record_save(struct rec *rec)
122 @@ -120,15 +114,15 @@
123 if (!xdr_rec(&xdrs, rec))
127 - data.size = xdr_getpos(&xdrs);
129 + data.dsize = xdr_getpos(&xdrs);
133 key = record_hash(rec);
135 - if (db->put(db, key, &data, R_NOOVERWRITE) == 0)
137 + if (gdbm_store(dbf, key, data, GDBM_INSERT) == 0)
142 @@ -136,18 +130,22 @@
147 + datum nextkey, key, content;
151 - while (db->seq(db, &key, &data, R_NEXT) == 0) {
152 + key = gdbm_firstkey(dbf);
154 + nextkey = gdbm_nextkey(dbf, key);
155 + content = gdbm_fetch(dbf, key);
156 memset(&rec, 0, sizeof(rec));
157 - xdrmem_create(&xdrs, data.data, data.size, XDR_DECODE);
159 + xdrmem_create(&xdrs, content.dptr, content.dsize, XDR_DECODE);
160 if (xdr_rec(&xdrs, &rec)) {
169 @@ -155,16 +153,23 @@
170 record_init(char *file)
174 + // needed for gdbm_open, which does not have the option to create
175 + // a database in memory
177 + char *record_file = "/tmp/.dsniff.db";
178 + file = record_file;
183 + flags = GDBM_READER;
187 - flags = O_RDWR|O_CREAT;
188 + flags = GDBM_WRCREAT;
189 mode = S_IRUSR|S_IWUSR;
191 - if ((db = dbopen(file, flags, mode, DB_BTREE, NULL)) == NULL)
193 + if ((dbf = gdbm_open(file, 1024, flags, mode, NULL)) == NULL)