gpm/gpm-1.20.6-capability.patch
2009-08-20 08:39:53 +00:00

49 lines
1.7 KiB
Diff

diff -urp gpm-1.20.6.orig/configure.ac gpm-1.20.6/configure.ac
--- gpm-1.20.6.orig/configure.ac 2009-08-15 13:39:33.000000000 -0400
+++ gpm-1.20.6/configure.ac 2009-08-15 13:51:14.000000000 -0400
@@ -129,6 +129,9 @@ No|no|N|n) SHARED_LIBS=-lc ;;
LIBS=$SAVELIBS ;;
esac
+# look for capabilities library
+LIBCAP_NG_PATH
+
GPMXTERM=
AC_SUBST(GPMXTERM)
AC_SUBST(abi_lev)
diff -urp gpm-1.20.6.orig/src/daemon/main.c gpm-1.20.6/src/daemon/main.c
--- gpm-1.20.6.orig/src/daemon/main.c 2009-08-15 13:39:33.000000000 -0400
+++ gpm-1.20.6/src/daemon/main.c 2009-08-15 13:47:39.000000000 -0400
@@ -26,9 +26,18 @@
#include "headers/daemon.h"
#include "headers/gpmInt.h"
+#ifdef HAVE_LIBCAP_NG
+#include <cap-ng.h>
+#endif
int main(int argc, char **argv)
{
+#ifdef HAVE_LIBCAP_NG
+ capng_clear(CAPNG_SELECT_BOTH);
+ capng_updatev(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED,
+ CAP_SYS_ADMIN, CAP_SYS_TTY_CONFIG, -1);
+ capng_apply(CAPNG_SELECT_BOTH);
+#endif
startup(argc,argv); /* setup configurations */
old_main(); /* LATER: exit(daemon()); */
return 0; /* if we didn't exit before, just give back success */
diff -urp gpm-1.20.6.orig/src/Makefile.in gpm-1.20.6/src/Makefile.in
--- gpm-1.20.6.orig/src/Makefile.in 2009-08-15 13:39:33.000000000 -0400
+++ gpm-1.20.6/src/Makefile.in 2009-08-15 13:49:45.000000000 -0400
@@ -82,7 +82,8 @@ prog/%: prog/%.o
all: gpm lib/libgpm.so.@abi_lev@ lib/libgpm.a $(PROG)
gpm: $(GOBJ)
- $(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $(GOBJ) @LIBS@ $(LIBS) -lm
+ $(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $(GOBJ) @LIBS@ $(LIBS) \
+ -lm $(CAPNG_LDADD)
# construct dependings of sourcefiles and link sourcefiles
$(DEPFILE) dep: prog/gpm-root.c