Search
j0ke.net Open Build Service
>
Projects
>
home:netmax
:
tools
>
mtr
> mtr-0.87-capabilities.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File mtr-0.87-capabilities.patch of Package mtr
diff -rau mtr-0.87/configure.ac mtr-0.87.patched/configure.ac --- mtr-0.87/configure.ac 2016-08-03 07:26:53.000000000 +0200 +++ mtr-0.87.patched/configure.ac 2016-12-08 16:44:12.567466576 +0100 @@ -20,6 +20,10 @@ AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h cursesX.h sys/types.h fcntl.h) AC_CHECK_HEADERS(socket.h sys/socket.h sys/xti.h arpa/nameser_compat.h) +AC_CHECK_LIB(cap, cap_init, + AC_DEFINE(HAVE_CAPABILITIES, 1, capability support) + LIBS="$LIBS -lcap", AC_MSG_WARN(No capability support available.)) + AC_SEARCH_LIBS(initscr, [ncurses curses cursesX], , AC_MSG_WARN(Building without curses display support) AC_DEFINE(NO_CURSES, 1, [Define if you don't have the curses libraries available.]) Only in mtr-0.87.patched: configure.ac.orig Only in mtr-0.87.patched: configure.ac.rej diff -rau mtr-0.87/mtr.c mtr-0.87.patched/mtr.c --- mtr-0.87/mtr.c 2016-08-01 15:15:17.000000000 +0200 +++ mtr-0.87.patched/mtr.c 2016-12-08 16:43:33.906800557 +0100 @@ -46,6 +46,9 @@ #include "asn.h" #include "version.h" +#ifdef HAVE_CAPABILITIES +#include <sys/capability.h> +#endif #ifdef ENABLE_IPV6 #define DEFAULT_AF AF_UNSPEC @@ -605,6 +608,18 @@ exit( EXIT_FAILURE ); } + /* ported from ping */ +#ifdef HAVE_CAPABILITIES + { + cap_t caps = cap_init(); + if (cap_set_proc(caps) < 0) { + fprintf (stderr, "mtr: Unable to drop capabilities.\n"); + exit(1); + } + cap_free(caps); + } +#endif + /* Now drop to user permissions */ if (setgid(getgid()) || setuid(getuid())) { fprintf (stderr, "mtr: Unable to drop permissions.\n");