knock patch

Yesterday I had to get the knock program, for access to a more-secured external machine. The RPM was retrieved from here, a source RPM. I installed the RPM, then untarred it from ~/rpmbuild/SOURCES/knock-0.5.tar.gz. The next step was to run the usual “./configure”, “make”, “sudo make install”, but there were problems compiling, the first ones necessitating the installation of the libpcap-devel RPM. The second compilation error:

~/Programs/knock-0.5% make
gcc -g -O2 -g -Wall -pedantic -fno-exceptions -D_GNU_SOURCE -I. -o src/knockd.o -c src/knockd.c
src/knockd.c:134: error: ‘PATH_MAX’ undeclared here (not in a function)
src/knockd.c: In function ‘parseconfig’:
src/knockd.c:438: warning: unused variable ‘line’
src/knockd.c: In function ‘get_next_one_time_sequence’:
src/knockd.c:695: warning: unused variable ‘line’
src/knockd.c: In function ‘sniff’:
src/knockd.c:1386: warning: unused variable ‘parsed_stop_cmd’
src/knockd.c:1385: warning: unused variable ‘parsed_start_cmd’
make: *** [src/knockd.o] Error 1

required a change to src/list.h, to add the line: #include <limits.h>. Here is the patch file:

diff -ur knock-0.5/src/list.h knock-0.5-fixed/src/list.h
--- knock-0.5/src/list.h 2005-06-27 00:32:49.000000000 -0400
+++ knock-0.5-fixed/src/list.h 2010-06-24 12:52:50.644596951 -0400
@@ -21,6 +21,8 @@
#ifndef _PAC_LIST_H
#define _PAC_LIST_H

+#include <limits.h>
+
#define FREELIST(p) { list_free(p); p = NULL; }

/* your average linked list */