From 411a2782aaa756b3a8f3988763ac592cff1257b3 Mon Sep 17 00:00:00 2001 From: Francesco Colista Date: Mon, 8 Jul 2013 11:33:58 +0000 Subject: main/arpwatch: added several patches for improving options and security --- main/arpwatch/18_all_arpwatch-2.1a15-nofork.patch | 94 +++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 main/arpwatch/18_all_arpwatch-2.1a15-nofork.patch (limited to 'main/arpwatch/18_all_arpwatch-2.1a15-nofork.patch') diff --git a/main/arpwatch/18_all_arpwatch-2.1a15-nofork.patch b/main/arpwatch/18_all_arpwatch-2.1a15-nofork.patch new file mode 100644 index 0000000000..83447f794f --- /dev/null +++ b/main/arpwatch/18_all_arpwatch-2.1a15-nofork.patch @@ -0,0 +1,94 @@ +Origianl idea comes from Matthias Andree. + +diff -Naru arpwatch-2.1a15.orig/arpwatch.8 arpwatch-2.1a15/arpwatch.8 +--- arpwatch-2.1a15.orig/arpwatch.8 2006-09-24 09:34:36.000000000 +0400 ++++ arpwatch-2.1a15/arpwatch.8 2006-09-24 10:06:24.000000000 +0400 +@@ -27,7 +27,12 @@ + .na + .B arpwatch + [ +-.B -dN ++.B -d ++] ++.br ++.ti +9 ++[ ++.B -F + ] + .br + .ti +9 +@@ -50,6 +55,11 @@ + .br + .ti +9 + [ ++.B -N ++] ++.br ++.ti +9 ++[ + .B -r + .I file + ] +@@ -115,6 +125,14 @@ + .IR stderr . + .LP + The ++.B -F ++flag is used to prevent ++.I arpwatch ++from forking. This is allows to run ++.I arpwatch ++from daemon tools. ++.LP ++The + .B -f + flag is used to set the ethernet/ip address database filename. + The default is +diff -Naru arpwatch-2.1a15.orig/arpwatch.c arpwatch-2.1a15/arpwatch.c +--- arpwatch-2.1a15.orig/arpwatch.c 2006-09-24 09:34:36.000000000 +0400 ++++ arpwatch-2.1a15/arpwatch.c 2006-09-24 10:10:17.000000000 +0400 +@@ -179,10 +179,12 @@ + struct bpf_program code; + char errbuf[PCAP_ERRBUF_SIZE]; + char* username = NULL; ++ int nofork = 0; + int restart = 0; + int restarting_loop = 0; + char options[] = + "d" ++ "F" + "f:" + "i:" + "n:" +@@ -229,6 +231,10 @@ + #endif + break; + ++ case 'F': ++ ++nofork; ++ break; ++ + case 'f': + arpfile = optarg; + break; +@@ -319,12 +325,14 @@ + + /* Drop into the background if not debugging */ + if (!debug) { +- pid = fork(); +- if (pid < 0) { +- syslog(LOG_ERR, "main fork(): %m"); +- exit(1); +- } else if (pid != 0) +- exit(0); ++ if (!nofork) { ++ pid = fork(); ++ if (pid < 0) { ++ syslog(LOG_ERR, "main fork(): %m"); ++ exit(1); ++ } else if (pid != 0) ++ exit(0); ++ } + (void)close(fileno(stdin)); + (void)close(fileno(stdout)); + (void)close(fileno(stderr)); -- cgit v1.2.3