move old kamikaze out of trunk - will put buildroot-ng in there as soon as all the...
[openwrt/openwrt.git] / openwrt / package / dsniff / patches / gdbm.patch
diff --git a/openwrt/package/dsniff/patches/gdbm.patch b/openwrt/package/dsniff/patches/gdbm.patch
deleted file mode 100644 (file)
index 30190ab..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-diff -Nur dsniff-2.3/configure dsniff-2.3.patched/configure
---- dsniff-2.3/configure       2005-06-11 18:13:59.000000000 +0200
-+++ dsniff-2.3.patched/configure       2005-06-11 18:14:37.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"
-@@ -3051,7 +3053,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/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-11 18:14:56.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)
-@@ -61,7 +56,6 @@
-       
-       tm = localtime(&rec->time);
-       strftime(tstr, sizeof(tstr), "%x %X", tm);
--      
-       srcp = libnet_host_lookup(rec->src, Opt_dns);
-       dstp = libnet_host_lookup(rec->dst, Opt_dns);
-@@ -86,10 +80,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 +96,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 +114,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 +130,22 @@
- void
- record_dump(void)
- {
--      DBT key, data;
-+      datum nextkey, key, content;
-       XDR xdrs;
-       struct rec rec;
-       
--      while (db->seq(db, &key, &data, R_NEXT) == 0) { 
-+      key = gdbm_firstkey(dbf);
-+      while (key.dptr) {      
-+              nextkey = gdbm_nextkey(dbf, key);
-+              content = gdbm_fetch(dbf, key);
-               memset(&rec, 0, sizeof(rec));
--              xdrmem_create(&xdrs, data.data, data.size, XDR_DECODE);
--              
-+              xdrmem_create(&xdrs, content.dptr, content.dsize, XDR_DECODE);
-               if (xdr_rec(&xdrs, &rec)) {
-                       record_print(&rec);
-               }
-               xdr_destroy(&xdrs);
-+              free(key.dptr);
-+              key = nextkey;
-       }
- }
-@@ -155,16 +153,23 @@
- record_init(char *file)
- {
-       int flags, mode;
--      
-+      // needed for gdbm_open, which does not have the option to create
-+      // a database in memory
-+      if(file == NULL) {
-+              char *record_file = "/tmp/.dsniff.db";
-+              file = record_file;
-+      }
-+
-       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 +208,6 @@
- void
- record_close(void)
- {
--      db->close(db);
-+      gdbm_close(dbf);
- }