aboutsummaryrefslogtreecommitdiffstats
path: root/main/arpwatch/18_all_arpwatch-2.1a15-nofork.patch
diff options
context:
space:
mode:
authorFrancesco Colista <francesco.colista@gmail.com>2013-07-08 11:33:58 +0000
committerFrancesco Colista <francesco.colista@gmail.com>2013-07-08 11:34:11 +0000
commit411a2782aaa756b3a8f3988763ac592cff1257b3 (patch)
treef3506a151a9b2e71ed9417f298e40f11e8d66418 /main/arpwatch/18_all_arpwatch-2.1a15-nofork.patch
parent0852cf7df3027cc1addd921d31c0b032983196e0 (diff)
downloadaports-411a2782aaa756b3a8f3988763ac592cff1257b3.tar.bz2
aports-411a2782aaa756b3a8f3988763ac592cff1257b3.tar.xz
main/arpwatch: added several patches for improving options and security
Diffstat (limited to 'main/arpwatch/18_all_arpwatch-2.1a15-nofork.patch')
-rw-r--r--main/arpwatch/18_all_arpwatch-2.1a15-nofork.patch94
1 files changed, 94 insertions, 0 deletions
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));