aboutsummaryrefslogtreecommitdiff
path: root/net/netsed
diff options
context:
space:
mode:
authorKevin Lo <kevlo@FreeBSD.org>2002-08-23 07:38:41 +0000
committerKevin Lo <kevlo@FreeBSD.org>2002-08-23 07:38:41 +0000
commit38522658a4982ab1e0de4c1751f0e8173d0e7bc5 (patch)
treefbbaff4ed1bba735aed9d2bc217935e682c37a57 /net/netsed
parent9a10f238374b0165294c39ff511b993a8849c7a9 (diff)
downloadports-38522658a4982ab1e0de4c1751f0e8173d0e7bc5.tar.gz
ports-38522658a4982ab1e0de4c1751f0e8173d0e7bc5.zip
Fixed the zombie prevention.
PR: 41898 Submitted by: MAINTAINER
Notes
Notes: svn path=/head/; revision=64866
Diffstat (limited to 'net/netsed')
-rw-r--r--net/netsed/Makefile1
-rw-r--r--net/netsed/files/patch-netsed.c59
2 files changed, 55 insertions, 5 deletions
diff --git a/net/netsed/Makefile b/net/netsed/Makefile
index 6784593415c3..51bc3a166b84 100644
--- a/net/netsed/Makefile
+++ b/net/netsed/Makefile
@@ -7,6 +7,7 @@
PORTNAME= netsed
PORTVERSION= 0.01
+PORTREVISION= 1
CATEGORIES= net security
MASTER_SITES= http://dione.ids.pl/~lcamtuf/ \
http://lcamtuf.na.export.pl/
diff --git a/net/netsed/files/patch-netsed.c b/net/netsed/files/patch-netsed.c
index 88c7b6ba5c8d..cab0a91ebbdc 100644
--- a/net/netsed/files/patch-netsed.c
+++ b/net/netsed/files/patch-netsed.c
@@ -1,6 +1,31 @@
---- netsed.c.orig Tue Jan 9 11:30:40 2001
-+++ netsed.c Tue Jan 9 11:43:41 2001
-@@ -134,8 +134,10 @@
+--- netsed.c.orig Fri Jan 5 18:58:22 2001
++++ netsed.c Sun Aug 11 14:32:29 2002
+@@ -2,6 +2,7 @@
+ #include <unistd.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
++#include <sys/wait.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <fcntl.h>
+@@ -45,11 +46,11 @@
+ ERR("This will replace all occurences of pat1 with pat2 in matching packets.\n");
+ ERR("Additional parameter (count) can be used to expire rule after 'count'\n");
+ ERR("succesful substitutions. Eight-bit characters, including NULL and '/', can\n");
+- ERR("be passed using HTTP-alike hex escape sequences (eg. %%0a%%0d). Single '%%'\n");
+- ERR("can be reached by using '%%%%'. Examples:\n\n");
+- ERR(" 's/anrew/mike/1' - replace 'andrew' with 'mike' (once)\n");
+- ERR(" 's/anrew/mike' - replace all occurences of 'andrew' with 'mike'\n");
+- ERR(" 's/anrew/mike%%00' - replace 'andrew' with 'mike\\x00' (to keep orig. size)\n");
++ ERR("be passed using HTTP-alike hex escape sequences (eg. CRLF -> %%0a%%0d).\n");
++ ERR("Single '%%' can be reached by using '%%%%'. Examples:\n\n");
++ ERR(" 's/andrew/mike/1' - replace 'andrew' with 'mike' (once)\n");
++ ERR(" 's/andrew/mike' - replace all occurences of 'andrew' with 'mike'\n");
++ ERR(" 's/andrew/mike%%00' - replace 'andrew' with 'mike\\x00' (to keep orig. size)\n");
+ ERR(" 's/%%%%/%%2f/20' - replace '%%' with '/' in first 20 packets\n\n");
+ ERR("Rules are not working on cross-packet boundaries and are evaluated from\n");
+ ERR("first to last not expired rule.\n");
+@@ -134,8 +135,10 @@
void bind_and_listen(int tcp,int port) {
@@ -11,7 +36,7 @@
fcntl(lsock,F_SETFL,O_NONBLOCK);
laddr.sin_family = PF_INET;
laddr.sin_port = htons (port);
-@@ -186,7 +188,6 @@
+@@ -186,7 +189,6 @@
rd=read(s1,buf,sizeof(buf));
if (rd<0 && errno!=EAGAIN) return 0; // s1 not connected
if (rd>0) {
@@ -19,7 +44,7 @@
printf("[+] Caught server -> client packet.\n");
rd=sed_the_buffer(rd);
if (write(s2,b2,rd)<=0) return 0; // not able to send
-@@ -195,7 +196,6 @@
+@@ -195,7 +197,6 @@
rd=read(s2,buf,sizeof(buf));
if (rd<0 && errno!=EAGAIN) return 0; // s2 not connected
if (rd>0) {
@@ -27,3 +52,27 @@
printf("[+] Caught client -> server packet.\n");
rd=sed_the_buffer(rd);
if (write(s1,b2,rd)<=0) return 0; // not able to send
+@@ -204,6 +205,14 @@
+ return 1;
+ }
+
++void sig_chld(int signo)
++{
++ pid_t pid;
++ int stat;
++ while ( (pid = waitpid(-1, &stat, WNOHANG)) > 0)
++ printf("child %d terminated\n", pid);
++ return;
++}
+
+ int main(int argc,char* argv[]) {
+ int i;
+@@ -242,7 +251,7 @@
+ if (fixedhost && fixedport) printf("[+] Using fixed forwarding to %s:%s.\n",argv[3],argv[4]);
+ else printf("[+] Using dynamic (transparent proxy) forwarding.\n");
+ signal(SIGPIPE,SIG_IGN);
+- signal(SIGCHLD,SIG_IGN);
++ signal(SIGCHLD,sig_chld);
+
+ // Am I bad coder?;>
+