summaryrefslogtreecommitdiffstats
path: root/package/dsniff/patches/gdbm.patch
diff options
context:
space:
mode:
Diffstat (limited to 'package/dsniff/patches/gdbm.patch')
-rw-r--r--package/dsniff/patches/gdbm.patch188
1 files changed, 188 insertions, 0 deletions
diff --git a/package/dsniff/patches/gdbm.patch b/package/dsniff/patches/gdbm.patch
new file mode 100644
index 000000000..2d9256aae
--- /dev/null
+++ b/package/dsniff/patches/gdbm.patch
@@ -0,0 +1,188 @@
+diff -Nur dsniff-2.3/configure dsniff-2.3.patched/configure
+--- dsniff-2.3/configure 2005-06-09 15:21:49.000000000 +0200
++++ dsniff-2.3.patched/configure 2005-06-09 15:26:41.000000000 +0200
+@@ -3051,7 +3051,40 @@
+
+ fi
+
++echo $ac_n "checking for libgdbm""... $ac_c" 1>&6
++echo "configure:3059: checking for libgdbm" >&5
++# Check whether --with-gdbm or --without-gdbm was given.
++if test "${with_gdbm+set}" = set; then
++ withval="$with_gdbm"
++ case "$withval" in
++ yes|no)
++ echo "$ac_t""no" 1>&6
++ ;;
++ *)
++ echo "$ac_t""$withval" 1>&6
++ if test -f $withval/include/gdbm.h -a -f $withval/lib/libgdbm.a; then
++ owd=`pwd`
++ if cd $withval; then withval=`pwd`; cd $owd; fi
++ DBINC="-I$withval/include"
++ DBLIB="-L$withval/lib -lgdbm"
++ else
++ { echo "configure: error: gdbm.h or libgdbm.a not found in $withval" 1>&2; exit 1; }
++ fi
++ ;;
++ esac
++else
++ if test -f ${prefix}/include/gdbm.h; then
++ LNETINC="-I${prefix}/include"
++ LNETLIB="-L${prefix}/lib -lgdbm"
++ elif test -f /usr/include/gdbm.h; then
++ LNETLIB="-lgdbm"
++ else
++ echo "$ac_t""no" 1>&6
++ { echo "configure: error: libgdbm not found" 1>&2; exit 1; }
++ fi
++ echo "$ac_t""yes" 1>&6
+
++fi
+
+
+ echo $ac_n "checking for libnet""... $ac_c" 1>&6
+diff -Nur dsniff-2.3/configure dsniff-2.3.patched/configure
+--- dsniff-2.3/configure 2005-06-09 15:17:11.000000000 +0200
++++ dsniff-2.3.patched/configure 2005-06-09 14:47:24.000000000 +0200
+@@ -16,6 +16,8 @@
+ ac_help="$ac_help
+ --with-db=DIR use Berkeley DB (with --enable-compat185) in DIR"
+ ac_help="$ac_help
++ --with-gdbm=DIR use GNU DBM in DIR"
++ac_help="$ac_help
+ --with-libpcap=DIR use libpcap in DIR"
+ ac_help="$ac_help
+ --with-libnet=DIR use libnet in DIR"
+diff -Nur dsniff-2.3/record.c dsniff-2.3.patched/record.c
+--- dsniff-2.3/record.c 2000-11-14 16:51:02.000000000 +0100
++++ dsniff-2.3.patched/record.c 2005-06-09 15:16:50.000000000 +0200
+@@ -13,12 +13,7 @@
+ #include <stdio.h>
+ #include <time.h>
+ #include <md5.h>
+-#ifdef HAVE_DB_185_H
+-#define DB_LIBRARY_COMPATIBILITY_API
+-#include <db_185.h>
+-#elif HAVE_DB_H
+-#include <db.h>
+-#endif
++#include <gdbm.h>
+ #include <libnet.h>
+ #include "options.h"
+ #include "record.h"
+@@ -34,7 +29,7 @@
+ struct netobj data;
+ };
+
+-static DB *db;
++GDBM_FILE dbf;
+
+ static int
+ xdr_rec(XDR *xdrs, struct rec *rec)
+@@ -86,10 +81,10 @@
+ fflush(stdout);
+ }
+
+-static DBT *
++static datum
+ record_hash(struct rec *rec)
+ {
+- static DBT key;
++ static datum key;
+ static u_char hash[16];
+ MD5_CTX ctx;
+
+@@ -102,16 +97,16 @@
+ MD5Update(&ctx, rec->data.n_bytes, rec->data.n_len);
+ MD5Final(hash, &ctx);
+
+- key.data = hash;
+- key.size = sizeof(hash);
++ key.dptr = hash;
++ key.dsize = sizeof(hash);
+
+- return (&key);
++ return (key);
+ }
+
+ static int
+ record_save(struct rec *rec)
+ {
+- DBT *key, data;
++ datum key, data;
+ XDR xdrs;
+ u_char buf[2048];
+
+@@ -120,15 +115,15 @@
+ if (!xdr_rec(&xdrs, rec))
+ return (0);
+
+- data.data = buf;
+- data.size = xdr_getpos(&xdrs);
++ data.dptr = buf;
++ data.dsize = xdr_getpos(&xdrs);
+
+ xdr_destroy(&xdrs);
+
+ key = record_hash(rec);
+
+- if (db->put(db, key, &data, R_NOOVERWRITE) == 0)
+- db->sync(db, 0);
++ if (gdbm_store(dbf, key, data, GDBM_INSERT) == 0)
++ gdbm_sync(dbf);
+
+ return (1);
+ }
+@@ -136,18 +131,22 @@
+ void
+ record_dump(void)
+ {
+- DBT key, data;
++ datum nextkey, data;
+ XDR xdrs;
+ struct rec rec;
+
+- while (db->seq(db, &key, &data, R_NEXT) == 0) {
++ data = gdbm_firstkey ( dbf );
++ while (data.dptr) {
++ nextkey = gdbm_nextkey ( dbf, data );
+ memset(&rec, 0, sizeof(rec));
+- xdrmem_create(&xdrs, data.data, data.size, XDR_DECODE);
++ xdrmem_create(&xdrs, data.dptr, data.dsize, XDR_DECODE);
+
+ if (xdr_rec(&xdrs, &rec)) {
+ record_print(&rec);
+ }
+ xdr_destroy(&xdrs);
++ free(data.dptr);
++ data = nextkey;
+ }
+ }
+
+@@ -157,14 +156,14 @@
+ int flags, mode;
+
+ if (Opt_read) {
+- flags = O_RDONLY;
++ flags = GDBM_READER;
+ mode = 0;
+ }
+ else {
+- flags = O_RDWR|O_CREAT;
++ flags = GDBM_WRCREAT;
+ mode = S_IRUSR|S_IWUSR;
+ }
+- if ((db = dbopen(file, flags, mode, DB_BTREE, NULL)) == NULL)
++ if ((dbf = gdbm_open(file, 1024, flags, mode, NULL)) == NULL)
+ return (0);
+
+ return (1);
+@@ -203,6 +202,6 @@
+ void
+ record_close(void)
+ {
+- db->close(db);
++ gdbm_close(dbf);
+ }
+