summaryrefslogtreecommitdiff
path: root/package/dsniff/patches/patch-record_c
diff options
context:
space:
mode:
Diffstat (limited to 'package/dsniff/patches/patch-record_c')
-rw-r--r--package/dsniff/patches/patch-record_c155
1 files changed, 0 insertions, 155 deletions
diff --git a/package/dsniff/patches/patch-record_c b/package/dsniff/patches/patch-record_c
deleted file mode 100644
index df9583d9a..000000000
--- a/package/dsniff/patches/patch-record_c
+++ /dev/null
@@ -1,155 +0,0 @@
-$Id$
---- dsniff-2.4.orig/record.c 2001-03-15 09:33:04.000000000 +0100
-+++ dsniff-2.4/record.c 2009-12-11 12:49:32.000000000 +0100
-@@ -15,12 +15,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"
-@@ -37,7 +32,7 @@ struct rec {
- struct netobj data;
- };
-
--static DB *db;
-+GDBM_FILE dbf;
-
- static int
- xdr_rec(XDR *xdrs, struct rec *rec)
-@@ -64,9 +59,8 @@ record_print(struct rec *rec)
-
- 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);
-+ srcp = libnet_addr2name4(rec->src, Opt_dns);
-+ dstp = libnet_addr2name4(rec->dst, Opt_dns);
-
- if ((pr = getprotobynumber(rec->proto)) == NULL)
- protop = "unknown";
-@@ -89,10 +83,10 @@ record_print(struct rec *rec)
- 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;
-
-@@ -105,16 +99,16 @@ record_hash(struct rec *rec)
- 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];
-
-@@ -123,15 +117,15 @@ record_save(struct rec *rec)
- 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);
- }
-@@ -139,18 +133,22 @@ record_save(struct rec *rec)
- 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;
- }
- }
-
-@@ -158,16 +156,23 @@ int
- 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);
-@@ -206,6 +211,6 @@ record(in_addr_t src, in_addr_t dst, int
- void
- record_close(void)
- {
-- db->close(db);
-+ gdbm_close(dbf);
- }
-