diff options
Diffstat (limited to 'net-analyzer/traceroute/files/traceroute-1.4a5-droproot.patch')
-rw-r--r-- | net-analyzer/traceroute/files/traceroute-1.4a5-droproot.patch | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/net-analyzer/traceroute/files/traceroute-1.4a5-droproot.patch b/net-analyzer/traceroute/files/traceroute-1.4a5-droproot.patch deleted file mode 100644 index 70267f498528..000000000000 --- a/net-analyzer/traceroute/files/traceroute-1.4a5-droproot.patch +++ /dev/null @@ -1,103 +0,0 @@ -Ripped from Fedora. - -* Tue Jul 18 2000 Jeff Johnson <jbj@redhat.com> -- drop root privileges even earlier (#13466). - ---- traceroute-1.4a12/traceroute.c -+++ traceroute-1.4a12/traceroute.c -@@ -383,6 +383,40 @@ - else - prog = argv[0]; - -+ cp = "icmp"; -+ if ((pe = getprotobyname(cp)) == NULL) { -+ Fprintf(stderr, "%s: unknown protocol %s\n", prog, cp); -+ exit(1); -+ } -+ -+ /* Insure the socket fds won't be 0, 1 or 2 */ -+ if (open(devnull, O_RDONLY) < 0 || -+ open(devnull, O_RDONLY) < 0 || -+ open(devnull, O_RDONLY) < 0) { -+ Fprintf(stderr, "%s: open \"%s\": %s\n", -+ prog, devnull, strerror(errno)); -+ exit(1); -+ } -+ if ((s = socket(AF_INET, SOCK_RAW, pe->p_proto)) < 0) { -+ Fprintf(stderr, "%s: icmp socket: %s\n", prog, strerror(errno)); -+ exit(1); -+ } -+ -+#ifndef __hpux -+ sndsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); -+#else -+ sndsock = socket(AF_INET, SOCK_RAW, -+ useicmp ? IPPROTO_ICMP : IPPROTO_UDP); -+#endif -+ -+ if (sndsock < 0) { -+ Fprintf(stderr, "%s: raw socket: %s\n", prog, strerror(errno)); -+ exit(1); -+ } -+ -+ /* Revert to non-privileged user after opening sockets */ -+ setuid(getuid()); -+ - opterr = 0; - while ((op = getopt(argc, argv, "dFInrvxf:g:i:m:p:q:s:t:w:z:")) != EOF) - switch (op) { -@@ -604,42 +638,6 @@ - outdata = (struct outdata *)(outudp + 1); - } - -- cp = "icmp"; -- if ((pe = getprotobyname(cp)) == NULL) { -- Fprintf(stderr, "%s: unknown protocol %s\n", prog, cp); -- exit(1); -- } -- -- /* Insure the socket fds won't be 0, 1 or 2 */ -- if (open(devnull, O_RDONLY) < 0 || -- open(devnull, O_RDONLY) < 0 || -- open(devnull, O_RDONLY) < 0) { -- Fprintf(stderr, "%s: open \"%s\": %s\n", -- prog, devnull, strerror(errno)); -- exit(1); -- } -- if ((s = socket(AF_INET, SOCK_RAW, pe->p_proto)) < 0) { -- Fprintf(stderr, "%s: icmp socket: %s\n", prog, strerror(errno)); -- exit(1); -- } -- if (options & SO_DEBUG) -- (void)setsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&on, -- sizeof(on)); -- if (options & SO_DONTROUTE) -- (void)setsockopt(s, SOL_SOCKET, SO_DONTROUTE, (char *)&on, -- sizeof(on)); -- --#ifndef __hpux -- sndsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); --#else -- sndsock = socket(AF_INET, SOCK_RAW, -- useicmp ? IPPROTO_ICMP : IPPROTO_UDP); --#endif -- if (sndsock < 0) { -- Fprintf(stderr, "%s: raw socket: %s\n", prog, strerror(errno)); -- exit(1); -- } -- - #if defined(IP_OPTIONS) && !defined(HAVE_RAW_OPTIONS) - if (lsrr > 0) { - u_char optlist[MAX_IPOPTLEN]; -@@ -672,6 +670,11 @@ - } - } - #endif -+ -+ if (options & SO_DEBUG) -+ (void)setsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&on, sizeof(on)); -+ if (options & SO_DONTROUTE) -+ (void)setsockopt(s, SOL_SOCKET, SO_DONTROUTE, (char *)&on, sizeof(on)); - - #ifdef SO_SNDBUF - if (setsockopt(sndsock, SOL_SOCKET, SO_SNDBUF, (char *)&packlen, |