2870e043fe
- chroot to /var/empty, - support pppoe, - autoconf surgery (functional rather than pretty) to use a version of pcre from the century of the fruitbat, - fix license marker, regen plist reads good to jasper@
39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
$OpenBSD: patch-ngrep_c,v 1.3 2009/03/30 21:19:02 sthen Exp $
|
|
--- ngrep.c.orig Tue Nov 28 13:38:43 2006
|
|
+++ ngrep.c Thu Mar 26 22:31:23 2009
|
|
@@ -92,7 +92,7 @@
|
|
#endif
|
|
|
|
#if USE_PCRE
|
|
-#include "pcre-5.0/pcre.h"
|
|
+#include "pcre.h"
|
|
#else
|
|
#include "regex-0.12/regex.h"
|
|
#endif
|
|
@@ -549,6 +549,10 @@ int main(int argc, char **argv) {
|
|
link_offset = PPPHDR_SIZE;
|
|
break;
|
|
|
|
+ case DLT_PPP_ETHER:
|
|
+ link_offset = PPPOEHDR_SIZE;
|
|
+ break;
|
|
+
|
|
#if HAVE_DLT_LOOP
|
|
case DLT_LOOP:
|
|
#endif
|
|
@@ -1197,6 +1201,14 @@ void drop_privs(void) {
|
|
perror("attempt to drop privileges failed");
|
|
clean_exit(-1);
|
|
}
|
|
+ if (chroot("/var/empty") == -1) {
|
|
+ perror("attempt to drop privileges failed: chroot failed");
|
|
+ clean_exit(-1);
|
|
+ }
|
|
+ if (chdir("/") == -1) {
|
|
+ perror("attempt to drop privileges failed: chdir failed");
|
|
+ clean_exit(-1);
|
|
+ }
|
|
|
|
if (((getgid() != newgid) && (setgid(newgid) == -1)) ||
|
|
((getegid() != newgid) && (setegid(newgid) == -1)) ||
|