summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Gysin2015-09-30 23:02:02 +0300
committerChristoph Gysin2015-09-30 23:02:02 +0300
commitddd5a37161756fa8c3ebdddd3cf19634932e8b42 (patch)
treebddf02bd28ac4eed2a6b212b4d177f9179e6e0dc
downloadaur-ddd5a37161756fa8c3ebdddd3cf19634932e8b42.tar.gz
initial commit
-rw-r--r--.SRCINFO23
-rw-r--r--.gitignore3
-rw-r--r--CVE-2006-0048.patch18
-rw-r--r--PKGBUILD41
-rw-r--r--fix-build-with-gcc5.patch233
-rw-r--r--fix-double-free-error.patch40
-rw-r--r--fix-infinite-loop-on-powerpc.patch26
-rw-r--r--fix-man-invocation.patch22
8 files changed, 406 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..e4e8e41d0cbc
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,23 @@
+pkgbase = tcpick
+ pkgdesc = Tcp stream sniffer and connection tracker
+ pkgver = 0.2.1
+ pkgrel = 1
+ url = http://tcpick.sourceforge.net
+ arch = i686
+ arch = x86_64
+ license = GPL
+ source = http://prdownloads.sourceforge.net/tcpick/tcpick-0.2.1.tar.gz
+ source = CVE-2006-0048.patch
+ source = fix-build-with-gcc5.patch
+ source = fix-double-free-error.patch
+ source = fix-infinite-loop-on-powerpc.patch
+ source = fix-man-invocation.patch
+ md5sums = bb94f2f9ea81aeb645619fbe9b3b9a29
+ md5sums = 3efd250f8cb6a308dd07ae858562ccc3
+ md5sums = b6a7330a1a8b0b79a7d1db73712db0c2
+ md5sums = 391c336816f126ecbf7e6c219905340f
+ md5sums = 8c468789fb553f7d31ae48cfc260409d
+ md5sums = 3a2107306148df3d792aa796b04a3309
+
+pkgname = tcpick
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..b63977a0ed66
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+src/
+pkg/
+*.tar.*
diff --git a/CVE-2006-0048.patch b/CVE-2006-0048.patch
new file mode 100644
index 000000000000..4155a86805dc
--- /dev/null
+++ b/CVE-2006-0048.patch
@@ -0,0 +1,18 @@
+Description: Fix for CVE-2006-0048
+Author: Cédric Delfosse <cedric@debian.org>
+Origin: vendor
+Bug-Debian: http://bugs.debian.org/360571
+Last-Update: 2006-04-14
+
+--- a/src/write.c
++++ b/src/write.c
+@@ -244,6 +244,9 @@ out_flavour( enum FLAVOUR flavour,
+ if( flags.separator && ( out == stdout ) ) /* FIXME: sucks? */
+ color( c_SEPARATOR, stdout, SEPARATOR "\n" );
+
++ /* Temporary fix for CVE-2006-0048 */
++ if (buflen < 0) buflen = 0;
++
+ switch ( flavour ) {
+ case HEX_ASCII_DUMP:
+ out_xa( out, buf, buflen );
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..8c25538e7504
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,41 @@
+# Maintainer: Christoph Gysin <christoph.gysin@gmail.com>
+
+pkgname=tcpick
+pkgver=0.2.1
+pkgrel=1
+pkgdesc='Tcp stream sniffer and connection tracker'
+arch=('i686' 'x86_64')
+url='http://tcpick.sourceforge.net'
+license=('GPL')
+source=(http://prdownloads.sourceforge.net/tcpick/$pkgname-$pkgver.tar.gz
+ CVE-2006-0048.patch
+ fix-build-with-gcc5.patch
+ fix-double-free-error.patch
+ fix-infinite-loop-on-powerpc.patch
+ fix-man-invocation.patch)
+md5sums=('bb94f2f9ea81aeb645619fbe9b3b9a29'
+ '3efd250f8cb6a308dd07ae858562ccc3'
+ 'b6a7330a1a8b0b79a7d1db73712db0c2'
+ '391c336816f126ecbf7e6c219905340f'
+ '8c468789fb553f7d31ae48cfc260409d'
+ '3a2107306148df3d792aa796b04a3309')
+
+prepare() {
+ cd $srcdir/$pkgname-$pkgver
+ patch -Np1 -i ../CVE-2006-0048.patch
+ patch -Np1 -i ../fix-build-with-gcc5.patch
+ patch -Np1 -i ../fix-double-free-error.patch
+ patch -Np1 -i ../fix-infinite-loop-on-powerpc.patch
+ patch -Np1 -i ../fix-man-invocation.patch
+}
+
+build() {
+ cd $srcdir/$pkgname-$pkgver
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd $srcdir/$pkgname-$pkgver
+ make install DESTDIR=$pkgdir
+}
diff --git a/fix-build-with-gcc5.patch b/fix-build-with-gcc5.patch
new file mode 100644
index 000000000000..eefc56fe38eb
--- /dev/null
+++ b/fix-build-with-gcc5.patch
@@ -0,0 +1,233 @@
+Description: Fix build with GCC 5
+ GCC 5 is more picky with external references which are not properly
+ declared with forward references. Add all relevant functions to tcpick.h
+ to avoid this problem and fix the problems put into light by this change
+ (some invalid function calls).
+Author: Raphaël Hertzog <hertzog@debian.org>
+Bug-Debian: http://bugs.debian.org/778141
+Origin: vendor
+Last-Update: 2015-07-13
+
+--- a/src/tcpick.h
++++ b/src/tcpick.h
+@@ -10,10 +10,12 @@
+ */
+
+ #include "config.h"
++#define _GNU_SOURCE
+
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#include <ctype.h>
+
+ #ifdef HAVE_SIGNAL_H
+ # include <signal.h>
+@@ -114,3 +116,102 @@
+ #include "flags.h"
+ #include "lookup.h"
+ #include "timer.h"
++
++/* From args.c */
++void parse_args(int argc, char ** argv);
++
++/* From colors.c */
++void textcolor(FILE * out, int attr, int fg, int bg);
++void resetcolor(FILE * out);
++void color(int attr, int fg, FILE * out, char *fmt, ...);
++
++/* From datalink.c */
++char *datalink2str(int dl_id);
++int datalink2off(int dl_id);
++
++/* From display.c */
++char * status2str(enum STATUS status);
++int display_status( FILE * out, struct CONN * conn, enum STATUS status );
++int display_header( FILE * out );
++int out_h( FILE * out, u_char * buf, int buflen );
++int out_hn( FILE * out, u_char * buf, int buflen );
++int out_p( FILE * out, u_char * buf, int buflen );
++int out_xa (FILE * out, u_char * buf, int buflen);
++int out_x (FILE * out, u_char * buf, int buflen);
++
++/* From fragments.c */
++int
++addfr( struct FRAGMENT ** first,
++ int wlen,
++ u_int32_t data_off,
++ u_char * payload,
++ int payload_len );
++
++int
++flush_ack( struct HOST_DESC * desc,
++ struct CONN * conn_ptr,
++ int ack_num );
++
++/* From lookup_query.c */
++char * lookup_new(struct in_addr ia);
++char * lookup(struct in_addr ia);
++char * getportname(u_int16_t port);
++
++/* From lookup_tree.c */
++struct _l_node *_l_alloc(struct in_addr, char *);
++char *_l_get(struct in_addr);
++int _l_insert(struct _l_node * new);
++
++/* Form msg.c */
++void err(char *fmt, ...);
++void msg(int v, int attr, int fg, char *fmt, ...);
++void sorry(char * func, char * desc);
++
++/* From quit.c */
++void fault(char * func, char * desc);
++void suicide(char * func, char * fmt, ...);
++void print_statistics();
++void cleanup();
++void exit_signal(int sig_type);
++
++/* From tcpick.c */
++void signal_setup(int sig, void (*handler)( ));
++
++/* From time.c */
++char * time_ascii(char * ret);
++
++/* From timer.c */
++void set_timer();
++void check_expired();
++void sigalrm_callback(int sig_type);
++
++/* From tracker.c */
++int status_switch(struct CONN * prev, enum STATUS status);
++int newconn( struct CONN * prev_ring );
++int rmconn( struct CONN * prev_ring );
++int free_desc( struct HOST_DESC * desc, int freedescfilename );
++
++/* From verify.c */
++int
++verify();
++
++/* From write.c */
++char *
++avail_filename(struct CONN * conn_ptr,
++ enum PART side, char * ext);
++
++void
++open_file(struct CONN * conn_ptr,
++ struct HOST_DESC * desc);
++
++int
++flowflush(struct CONN * conn_ptr,
++ struct HOST_DESC * desc,
++ u_char * buf,
++ int buflen);
++
++int
++out_flavour(enum FLAVOUR flavour,
++ FILE * out,
++ u_char * buf,
++ int buflen);
+--- a/src/loop.c
++++ b/src/loop.c
+@@ -95,8 +95,7 @@ got_packet (u_char * useless,
+ #endif /* TCPICK_DEBUG */
+
+ if( flags.header > 0 )
+- display_header( stdout, ippacket, tcppacket,
+- payload_len );
++ display_header(stdout);
+
+ verify(); /* call the core to manage the packet */
+
+--- a/src/display.c
++++ b/src/display.c
+@@ -297,7 +297,7 @@ out_x (FILE * out, u_char * buf, int buf
+ color( c_NONPRINT, out, pos % 2 ? "%2.2x " : "%2.2x", *( buf + pos ) );
+ else
+ /* hex space fill */
+- fprintf(out, pos % 2 ? " " : " ", *( buf + pos ) );
++ fprintf(out, pos % 2 ? " " : " ");
+ pos++;
+ } while ( pos % 16 );
+
+--- a/src/tcpick.c
++++ b/src/tcpick.c
+@@ -50,10 +50,10 @@
+ #include "tcpick.h"
+ #include "globals.h"
+
+-char *errbuf[PCAP_ERRBUF_SIZE];
++char errbuf[PCAP_ERRBUF_SIZE];
+ struct bpf_program filter_compiled;
+ bpf_u_int32 netp; /* ip */
+-bpf_u_int32 maskp; /* subnet mask */
++bpf_u_int32 maskp = PCAP_NETMASK_UNKNOWN; /* subnet mask */
+ struct in_addr addr;
+ char *other_args = NULL;
+ pcap_t *descr;
+@@ -238,7 +238,7 @@ int main(int argc, char **argv)
+ &filter_compiled,
+ filter,
+ 0,
+- (int)net
++ maskp
+ ) == -1) )
+ err("error compiling filter \"%s\"",filter);
+
+--- a/src/time.c
++++ b/src/time.c
+@@ -42,7 +42,7 @@ char * time_ascii(char * ret)
+ tzp = (struct timezone * ) S_malloc( sizeof(struct timezone) );
+
+ memset(tp, 0, sizeof(struct timeval));
+- memset(tzp, 0, sizeof(struct timeval));
++ memset(tzp, 0, sizeof(struct timezone));
+
+ if(gettimeofday(tp, tzp)) {
+
+@@ -58,7 +58,7 @@ char * time_ascii(char * ret)
+ brokentime->tm_hour,
+ brokentime->tm_min,
+ brokentime->tm_sec,
+- tp->tv_usec
++ (int)tp->tv_usec
+ );
+ break;
+
+@@ -79,7 +79,7 @@ char * time_ascii(char * ret)
+ brokentime->tm_hour,
+ brokentime->tm_min,
+ brokentime->tm_sec,
+- tp->tv_usec
++ (int)tp->tv_usec
+ );
+ break;
+
+@@ -99,7 +99,7 @@ char * time_ascii(char * ret)
+ return ret;
+
+ retNULL:
+- sprintf(ret,"");
++ ret[0] = '\0';
+ return NULL;
+
+ }
+--- a/src/debug.c
++++ b/src/debug.c
+@@ -32,7 +32,7 @@ void
+ print_conn_chain (struct CONN * f)
+ {
+ while (f) {
+- printf ("%x->",f);
++ printf ("%p->",f);
+
+ if (f == f->next) {
+ printf ("inf\n");
+@@ -48,7 +48,7 @@ int
+ print_fragment_chain(struct FRAGMENT * f)
+ {
+ while (f) {
+- printf ("%x(%i,%i)->",f,f->off,f->len);
++ printf ("%p(%i,%i)->",f,f->off,f->len);
+
+ if (f == f->next) {
+ printf ("inf\n");
diff --git a/fix-double-free-error.patch b/fix-double-free-error.patch
new file mode 100644
index 000000000000..c5d934b42100
--- /dev/null
+++ b/fix-double-free-error.patch
@@ -0,0 +1,40 @@
+Description: Fix double-free error
+ tcpick try to free twice the pointer to the filename it uses to write
+ the data. This patches fixes that.
+Author: Cedric Delfosse <cedric@debian.org>
+Bug-Debian: http://bugs.debian.org/319864
+Last-Update: 2005-07-26
+Origin: vendor, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=319864#19
+
+--- a/src/tracker.c
++++ b/src/tracker.c
+@@ -99,8 +99,9 @@ int rmconn( struct CONN * prev_ring )
+ if( curr->next == NULL )
+ last_conn = prev_ring;
+
+- free_desc( &(curr->client) );
+- free_desc( &(curr->server) );
++ free_desc( &(curr->client), 1);
++ if (flags.writer.type == UNIQUE) free_desc( &(curr->server), 0);
++ else free_desc( &(curr->server), 1);
+ S_free( curr );
+
+ conn = first_conn;
+@@ -124,7 +125,7 @@ int rmconn( struct CONN * prev_ring )
+ count_opened--;
+ }
+
+-int free_desc( struct HOST_DESC * desc )
++int free_desc( struct HOST_DESC * desc, int freedescfilename )
+ /* frees the host descriptor and closes the file */
+ {
+ struct FRAGMENT * tmp;
+@@ -134,7 +135,7 @@ int free_desc( struct HOST_DESC * desc )
+ if (flags.writer.type == UNIQUE)
+ desc->oth->file = NULL;
+ }
+- if( desc->filename ) {
++ if( desc->filename && freedescfilename ) {
+ S_free( desc->filename );
+ desc->filename = NULL;
+ }
diff --git a/fix-infinite-loop-on-powerpc.patch b/fix-infinite-loop-on-powerpc.patch
new file mode 100644
index 000000000000..1efde8843b9e
--- /dev/null
+++ b/fix-infinite-loop-on-powerpc.patch
@@ -0,0 +1,26 @@
+Description: Fix infinite loop on powerpc
+ On the ppc C compiler, char is an unsigned data type. This means that
+ no variable of type char can ever compare equal to the int value -1. gcc
+ tries to warn you about this when you compile tcpick, by saying:
+ .
+ args.c:195: warning: comparison is always true due to limited range of
+ data type
+ .
+ tcpick therefore never makes it past the getopt loop. The following
+ patch fixes the problem.
+Author: Alan Curry <pacman@world.std.com>
+Origin: other, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=327327#5
+Bug-Debian: http://bugs.debian.org/327327
+Last-Update: 2005-09-09
+
+--- a/src/args.c
++++ b/src/args.c
+@@ -149,7 +149,7 @@ parse_display_rebuild ( char * s )
+ void
+ parse_args(int argc, char ** argv)
+ {
+- char opt;
++ int opt;
+
+ #ifdef HAVE_GETOPT_LONG
+ static struct option long_options[]=
diff --git a/fix-man-invocation.patch b/fix-man-invocation.patch
new file mode 100644
index 000000000000..411cfd89790f
--- /dev/null
+++ b/fix-man-invocation.patch
@@ -0,0 +1,22 @@
+Description: Fix man invocation
+ Upon startup, tcpick says:
+ .
+ important: `man 1 tcpick' explains all options available
+ .
+ but the man page is in section 8, not 1. This patch fixes that.
+Bug-Debian: http://bugs.debian.org/265067
+Origin: vendor
+Author: Cédric Delfosse <cedric@debian.org>
+Last-Update: 2004-08-18
+
+--- a/src/args.c
++++ b/src/args.c
+@@ -386,7 +386,7 @@ parse_args(int argc, char ** argv)
+ if(flags.versionandquit) {
+ color( c_USAGE, stdout, PACKAGE_STRING "\n"
+ " Author: " AUTHOR "\n"
+- " for other info try `man 1 tcpick', or `%s --help'\n\n"
++ " for other info try `man tcpick', or `%s --help'\n\n"
+ TERMS ,TCPICK_NAME);
+ exit( TCPICK_SUCCESS );
+ }