X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/437d3489a8df7eae517289a221173459eb2d7be2..42136877538fe79297345f554d033a41dc081daa:/package/dsniff/patches/gdbm.patch?ds=inline diff --git a/package/dsniff/patches/gdbm.patch b/package/dsniff/patches/gdbm.patch index 2d9256aae..30190abc9 100644 --- a/package/dsniff/patches/gdbm.patch +++ b/package/dsniff/patches/gdbm.patch @@ -1,7 +1,16 @@ 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 @@ +--- 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 @@ -42,21 +51,9 @@ diff -Nur dsniff-2.3/configure dsniff-2.3.patched/configure 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 ++++ dsniff-2.3.patched/record.c 2005-06-11 18:14:56.000000000 +0200 @@ -13,12 +13,7 @@ #include #include @@ -80,7 +77,15 @@ diff -Nur dsniff-2.3/record.c dsniff-2.3.patched/record.c static int xdr_rec(XDR *xdrs, struct rec *rec) -@@ -86,10 +81,10 @@ +@@ -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); } @@ -93,7 +98,7 @@ diff -Nur dsniff-2.3/record.c dsniff-2.3.patched/record.c static u_char hash[16]; MD5_CTX ctx; -@@ -102,16 +97,16 @@ +@@ -102,16 +96,16 @@ MD5Update(&ctx, rec->data.n_bytes, rec->data.n_len); MD5Final(hash, &ctx); @@ -114,7 +119,7 @@ diff -Nur dsniff-2.3/record.c dsniff-2.3.patched/record.c XDR xdrs; u_char buf[2048]; -@@ -120,15 +115,15 @@ +@@ -120,15 +114,15 @@ if (!xdr_rec(&xdrs, rec)) return (0); @@ -134,35 +139,45 @@ diff -Nur dsniff-2.3/record.c dsniff-2.3.patched/record.c return (1); } -@@ -136,18 +131,22 @@ +@@ -136,18 +130,22 @@ void record_dump(void) { - DBT key, data; -+ datum nextkey, data; ++ datum nextkey, key, content; 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 ); ++ 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, data.dptr, data.dsize, XDR_DECODE); - +- ++ xdrmem_create(&xdrs, content.dptr, content.dsize, XDR_DECODE); if (xdr_rec(&xdrs, &rec)) { record_print(&rec); } xdr_destroy(&xdrs); -+ free(data.dptr); -+ data = nextkey; ++ free(key.dptr); ++ key = nextkey; } } -@@ -157,14 +156,14 @@ +@@ -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; @@ -174,11 +189,12 @@ diff -Nur dsniff-2.3/record.c dsniff-2.3.patched/record.c 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 @@ +@@ -203,6 +208,6 @@ void record_close(void) {