summaryrefslogtreecommitdiffstats
path: root/net-analyzer/netams/files
diff options
context:
space:
mode:
Diffstat (limited to 'net-analyzer/netams/files')
-rw-r--r--net-analyzer/netams/files/netams-3.4.5-ds-compile.patch24
-rw-r--r--net-analyzer/netams/files/netams-ds-compile.patch24
-rw-r--r--net-analyzer/netams/files/netams-ds-portrange.patch96
-rw-r--r--net-analyzer/netams/files/netams.init32
-rw-r--r--net-analyzer/netams/files/netams33.init25
5 files changed, 201 insertions, 0 deletions
diff --git a/net-analyzer/netams/files/netams-3.4.5-ds-compile.patch b/net-analyzer/netams/files/netams-3.4.5-ds-compile.patch
new file mode 100644
index 0000000..46c4de7
--- /dev/null
+++ b/net-analyzer/netams/files/netams-3.4.5-ds-compile.patch
@@ -0,0 +1,24 @@
+diff -dPNur netams-3.4.5-orig/configure.sh netams-3.4.5/configure.sh
+--- netams-3.4.5-orig/configure.sh 2009-09-06 16:44:54.000000000 +0000
++++ netams-3.4.5/configure.sh 2014-10-14 01:11:43.000000000 +0000
+@@ -259,7 +259,7 @@
+ echo "GLib 2.0 found disabling OpenSSL"
+ echo " [ $v1 $v2 $v3 ]"
+ echo "DEFINE += -DWIPE_OPENSSL -I$v2 -I$v3" >> $makefile
+- echo "LIB += -lglib-2.0 -L$v1" >> $makefile
++ echo "LIB += -lcrypt -lglib-2.0 -L$v1" >> $makefile
+ else
+ echo "LibC - enabling OpenSSL"
+ echo "LIB += -lcrypt" >> $makefile
+diff -dPNur netams-3.4.5-orig/src/config.h netams-3.4.5/src/config.h
+--- netams-3.4.5-orig/src/config.h 2009-08-01 09:23:55.000000000 +0000
++++ netams-3.4.5/src/config.h 2014-10-14 01:10:09.000000000 +0000
+@@ -49,7 +49,7 @@
+ #ifndef WIPE_OPENSSL
+ #include <openssl/lhash.h>
+ #else
+-#include <glib/ghash.h>
++#include <glib.h>
+ #endif
+
+ #define __FAVOR_BSD 1 //this is dirty hack -D_BSD_SOURCE should work but do not
diff --git a/net-analyzer/netams/files/netams-ds-compile.patch b/net-analyzer/netams/files/netams-ds-compile.patch
new file mode 100644
index 0000000..550bf81
--- /dev/null
+++ b/net-analyzer/netams/files/netams-ds-compile.patch
@@ -0,0 +1,24 @@
+diff -dPNur netams-3.3.3a/src/connections.c netams-3.3.3a-new/src/connections.c
+--- netams-3.3.3a/src/connections.c 2005-11-20 02:31:02.000000000 +0400
++++ netams-3.3.3a-new/src/connections.c 2006-04-10 03:37:34.000000000 +0500
+@@ -92,7 +92,7 @@
+ }
+
+ #ifdef LINUX
+-ssize_t conn_write(void *conn, const char *buf, unsigned i) {
++ssize_t conn_write(void *conn, const char *buf, size_t i) {
+ #else
+ int conn_write(void *conn, const char *buf, int i) {
+ #endif
+diff -dPNur netams-3.3.3a/src/connections.h netams-3.3.3a-new/src/connections.h
+--- netams-3.3.3a/src/connections.h 2005-03-02 14:39:30.000000000 +0400
++++ netams-3.3.3a-new/src/connections.h 2006-04-10 03:38:25.000000000 +0500
+@@ -13,7 +13,7 @@
+ #define CONN_FD_VIRT -1
+
+ #ifdef LINUX
+-ssize_t conn_write(void *conn, const char *buf, unsigned i);
++ssize_t conn_write(void *conn, const char *buf, size_t i);
+ #else
+ int conn_write(void *conn, const char *buf, int i);
+ #endif
diff --git a/net-analyzer/netams/files/netams-ds-portrange.patch b/net-analyzer/netams/files/netams-ds-portrange.patch
new file mode 100644
index 0000000..6154960
--- /dev/null
+++ b/net-analyzer/netams/files/netams-ds-portrange.patch
@@ -0,0 +1,96 @@
+diff -dPNur netams-3.2.3/src/policy.c netams-3.2.3-ranges/src/policy.c
+--- netams-3.2.3/src/policy.c 2005-02-24 11:58:13.000000000 +0100
++++ netams-3.2.3-ranges/src/policy.c 2005-07-25 23:52:32.000000000 +0200
+@@ -32,6 +32,8 @@
+ target.num_ports=0;
+ for (u_char i=0; i<PC_MAX_PORTS; i++)
+ target.src_ports[i]=target.dst_ports[i]=0;
++ for (u_char i=0; i<PC_MAX_PORTS; i++)
++ target.max_ports[i]=0;
+
+ target.num_addrs=0;
+ for (u_char i=0; i<PC_MAX_ADDRS; i++)
+@@ -171,6 +173,8 @@
+ target.check_type|=PC_IP_PORTS;
+ u_char j=0;
+ u_short ports;
++ u_short max_port;
++ char *maxptr;
+ char *ptr;
+
+ while (tgt[j+*i+1]!=empty && j<PC_MAX_PORTS) {
+@@ -179,9 +183,19 @@
+ else
+ ptr=tgt[j+*i+1];
+
++
++ maxptr = strchr(ptr,':');
++ if (!maxptr) maxptr = strchr(ptr,'-');
++
+ ports=strtol(ptr, NULL, 10);
+
+ if (!ports) break;
++
++ if (maxptr) {
++ max_port = strtol(maxptr+1, NULL, 10);
++ if (ports>max_port) max_port = 0;
++ } else max_port = 0;
++ target.max_ports[j] = htons(max_port);
+
+ switch (tgt[j+*i+1][0]) {
+ case 's':
+@@ -358,11 +372,26 @@
+ if(target.num_ports) sprintf(buf+strlen(buf), "ports ");
+ for (u_char i=0; i<target.num_ports; i++) {
+ if (target.src_ports[i]==target.dst_ports[i])
++ {
++ if (target.max_ports[i])
++ sprintf(buf+strlen(buf), "%u:%u ", ntohs(target.src_ports[i]), ntohs(target.max_ports[i]));
++ else
+ sprintf(buf+strlen(buf), "%u ", ntohs(target.src_ports[i]));
++ }
+ else if (target.src_ports[i])
++ {
++ if (target.max_ports[i])
++ sprintf(buf+strlen(buf), "s%u:%u ", ntohs(target.src_ports[i]), ntohs(target.max_ports[i]));
++ else
+ sprintf(buf+strlen(buf), "s%u ", ntohs(target.src_ports[i]));
++ }
+ else if (target.dst_ports[i])
++ {
++ if (target.max_ports[i])
++ sprintf(buf+strlen(buf), "d%u:%u ", ntohs(target.dst_ports[i]),ntohs(target.max_ports[i]));
++ else
+ sprintf(buf+strlen(buf), "d%u ", ntohs(target.dst_ports[i]));
++ }
+ }
+ }
+ if (target.check_type&PC_UNIT) {
+@@ -436,6 +465,15 @@
+ res=1;
+ break;
+ }
++
++ if (target.max_ports[i]) {
++ if (((target.src_ports[i])&&(ntohs(flow->srcport)>ntohs(target.src_ports[i]))&&(ntohs(flow->srcport)<=ntohs(target.max_ports[i])))||
++ ((target.dst_ports[i])&&(ntohs(flow->dstport)>ntohs(target.dst_ports[i]))&&(ntohs(flow->dstport)<=ntohs(target.max_ports[i])))) {
++ res=1;
++ break;
++ }
++ }
++
+ }
+ if(!res) return 0;
+ }
+diff -dPNur netams-3.2.3/src/policy.h netams-3.2.3-ranges/src/policy.h
+--- netams-3.2.3/src/policy.h 2005-01-17 15:13:21.000000000 +0100
++++ netams-3.2.3-ranges/src/policy.h 2005-07-25 23:30:40.000000000 +0200
+@@ -86,6 +86,8 @@
+ u_char num_ports;
+ u_short src_ports[PC_MAX_PORTS];
+ u_short dst_ports[PC_MAX_PORTS];
++
++ u_short max_ports[PC_MAX_PORTS];
+
+ //PC_IP_TOS
+ u_char ip_tos;
diff --git a/net-analyzer/netams/files/netams.init b/net-analyzer/netams/files/netams.init
new file mode 100644
index 0000000..c5aca06
--- /dev/null
+++ b/net-analyzer/netams/files/netams.init
@@ -0,0 +1,32 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header:
+
+depend() {
+ need net mysql
+}
+
+
+daemondir=/usr/local/sbin
+path_to_etc=/etc/
+
+
+start() {
+ ebegin "Starting netams"
+ /bin/mkdir -p /var/run/netams
+ if [ -x $daemondir/netams ]; then
+ if [ -f $path_to_etc/netams.cfg ]; then
+ $daemondir/netams -lf $path_to_etc/netams.cfg >/dev/null
+ eend $?
+ else
+ eend 1
+ fi
+ else
+ eend 1
+ fi
+}
+
+stop() {
+ killall ${KILL_OPTS} netams
+}
diff --git a/net-analyzer/netams/files/netams33.init b/net-analyzer/netams/files/netams33.init
new file mode 100644
index 0000000..a4b56ad
--- /dev/null
+++ b/net-analyzer/netams/files/netams33.init
@@ -0,0 +1,25 @@
+#!/sbin/runscript
+# $Id: netams-gentoo.sh,v 1.1 2005/06/07 20:20:37 anton Exp $
+# this is Linux Gentoo version
+
+start() {
+ ebegin "Starting NeTAMS"
+ if [ -f /etc/netams.cfg ]; then
+ start-stop-daemon --start --quiet --background \
+ --pid /var/run/netams.pid \
+ --exec /usr/sbin/netams -- -f /etc/netams.cfg -l
+ fi
+ eend $? "Failed to start NeTAMS"
+}
+
+stop() {
+ ebegin "Stopping netams"
+ start-stop-daemon --stop --quiet --pid /var/run/netams.pid --exec /usr/sbin/netams
+ eend $? "Failed to stop NeTAMS"
+}
+
+restart() {
+ svc_stop
+ sleep 3
+ svc_start
+}