diff options
-rw-r--r-- | main/fprobe/APKBUILD | 23 | ||||
-rw-r--r-- | main/fprobe/fprobe-1.1-pidfile-sanity.patch | 48 | ||||
-rw-r--r-- | main/fprobe/fprobe-1.1-setgroups.patch | 19 |
3 files changed, 86 insertions, 4 deletions
diff --git a/main/fprobe/APKBUILD b/main/fprobe/APKBUILD index f7311e98e..f5db4ea82 100644 --- a/main/fprobe/APKBUILD +++ b/main/fprobe/APKBUILD @@ -1,19 +1,32 @@ -# Contributor: Carlo Landmeter <clandmeter@gmail.com> +# Contributor: Leonardo Arena <rnalrd@gmail.com> # Maintainer: Carlo Landmeter <clandmeter@gmail.com> pkgname=fprobe pkgver=1.1 -pkgrel=3 +pkgrel=4 pkgdesc="libpcap-based tool that collect network traffic" url="http://fprobe.sourceforge.net/" license="GPL" depends= makedepends="libpcap-dev" +install="" subpackages="$pkgname-doc" source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2 -$pkgname.initd -$pkgname.confd" + fprobe-1.1-pidfile-sanity.patch + fprobe-1.1-setgroups.patch + $pkgname.initd + $pkgname.confd" _builddir="$srcdir"/$pkgname-$pkgver + +prepare() { + cd $_builddir + for i in ../*.patch + do + msg "Applying $i" + patch -p1 < ../$i || exit 1 + done +} + build() { cd "$_builddir" ./configure --prefix=/usr \ @@ -32,5 +45,7 @@ package() { } md5sums="65850d0470078269b33eee58cba77ac2 fprobe-1.1.tar.bz2 +265c9d9c434df46fc224a1ce7051e27a fprobe-1.1-pidfile-sanity.patch +ba8632d883fb49e83ea16db67c50a69b fprobe-1.1-setgroups.patch 41810a73503624de2c27809e34ed80b4 fprobe.initd ba9c9327456e4db897b60481705df282 fprobe.confd" diff --git a/main/fprobe/fprobe-1.1-pidfile-sanity.patch b/main/fprobe/fprobe-1.1-pidfile-sanity.patch new file mode 100644 index 000000000..e7c10bd98 --- /dev/null +++ b/main/fprobe/fprobe-1.1-pidfile-sanity.patch @@ -0,0 +1,48 @@ +If we are using the chroot() option or the setuid options, we must create the +pidfile before doing the chroot OR the setreuid. It's actually best for +start-stop-daemon if we create the pidfile from the master side of the fork() +before it exits, since most of the startup checks happen after the chroot() +unfortunetly. + +Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> + +diff -Nuar fprobe-1.1.orig/src/fprobe.c fprobe-1.1/src/fprobe.c +--- fprobe-1.1.orig/src/fprobe.c 2005-01-30 08:43:35.000000000 +0000 ++++ fprobe-1.1/src/fprobe.c 2008-03-16 20:51:24.000000000 +0000 +@@ -1379,7 +1379,8 @@ + + my_log_open(ident, verbosity, log_dest); + if (!(log_dest & 2)) { +- switch (fork()) { ++ pid_t childpid = fork(); ++ switch (childpid) { + case -1: + fprintf(stderr, "fork(): %s", strerror(errno)); + exit(1); +@@ -1392,6 +1393,12 @@ + break; + + default: ++ if (!(pidfile = fopen(pidfilepath, "w"))) ++ my_log(LOG_ERR, "Can't create pid file. fopen(): %s", strerror(errno)); ++ else { ++ fprintf(pidfile, "%ld\n", (long) childpid); ++ fclose(pidfile); ++ } + exit(0); + } + } else { +@@ -1548,13 +1555,6 @@ + } + } + +- if (!(pidfile = fopen(pidfilepath, "w"))) +- my_log(LOG_ERR, "Can't create pid file. fopen(): %s", strerror(errno)); +- else { +- fprintf(pidfile, "%ld\n", (long) pid); +- fclose(pidfile); +- } +- + my_log(LOG_INFO, "pid: %d", pid); + my_log(LOG_INFO, "interface: %s, datalink: %s (%d)", + dev, dlt[link_type_idx].descr, link_type); diff --git a/main/fprobe/fprobe-1.1-setgroups.patch b/main/fprobe/fprobe-1.1-setgroups.patch new file mode 100644 index 000000000..969681243 --- /dev/null +++ b/main/fprobe/fprobe-1.1-setgroups.patch @@ -0,0 +1,19 @@ +This seems to fail after the chroot(), so just squelch the exit for now. + +Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> + +diff -Nuar fprobe-1.1/src/fprobe.c fprobe-1.1.new/src/fprobe.c +--- fprobe-1.1/src/fprobe.c 2008-03-17 00:06:43.000000000 +0000 ++++ fprobe-1.1.new/src/fprobe.c 2008-03-17 00:07:30.000000000 +0000 +@@ -1541,10 +1541,10 @@ + } + + if (pw) { + if (setgroups(0, NULL) < 0) { + my_log(LOG_CRIT, "setgroups: %s", strerror(errno)); +- exit(1); ++ //exit(1); + } + if (setregid(pw->pw_gid, pw->pw_gid)) { + my_log(LOG_CRIT, "setregid(%u): %s", pw->pw_gid, strerror(errno)); + exit(1); |