vdr/vdr/debian/patches 05_set_system_time_as_user.dpatch 07_not_as_root.dpatch
Thomas Schmidt
pkg-vdr-dvb-changes@lists.alioth.debian.org
Mon, 31 Jan 2005 22:57:40 +0000
Update of /cvsroot/pkg-vdr-dvb/vdr/vdr/debian/patches
In directory haydn:/tmp/cvs-serv24886/vdr/vdr/debian/patches
Modified Files:
05_set_system_time_as_user.dpatch 07_not_as_root.dpatch
Log Message:
* only try to change capabilities/user when vdr is called by root
Index: 05_set_system_time_as_user.dpatch
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdr/debian/patches/05_set_system_time_as_user.dpatch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- 05_set_system_time_as_user.dpatch 16 Jan 2005 19:39:47 -0000 1.2
+++ 05_set_system_time_as_user.dpatch 31 Jan 2005 22:57:37 -0000 1.3
@@ -7,9 +7,9 @@
## DP: <ludwig.nussel@gmx.de>
@DPATCH@
-diff -urNad vdr-1.2.6/Makefile /tmp/dpep.Olbr86/vdr-1.2.6/Makefile
---- vdr-1.2.6/Makefile 2005-01-16 17:45:11.000000000 +0100
-+++ /tmp/dpep.Olbr86/vdr-1.2.6/Makefile 2005-01-16 17:45:11.000000000 +0100
+diff -urNad vdr-1.2.6/Makefile /tmp/dpep.OwcM4r/vdr-1.2.6/Makefile
+--- vdr-1.2.6/Makefile 2005-01-31 22:48:08.000000000 +0100
++++ /tmp/dpep.OwcM4r/vdr-1.2.6/Makefile 2005-01-31 22:48:09.000000000 +0100
@@ -87,7 +87,7 @@
# The main program:
@@ -19,9 +19,9 @@
# The font files:
-diff -urNad vdr-1.2.6/vdr.c /tmp/dpep.Olbr86/vdr-1.2.6/vdr.c
---- vdr-1.2.6/vdr.c 2005-01-16 17:45:11.000000000 +0100
-+++ /tmp/dpep.Olbr86/vdr-1.2.6/vdr.c 2005-01-16 17:45:11.000000000 +0100
+diff -urNad vdr-1.2.6/vdr.c /tmp/dpep.OwcM4r/vdr-1.2.6/vdr.c
+--- vdr-1.2.6/vdr.c 2005-01-31 22:48:08.000000000 +0100
++++ /tmp/dpep.OwcM4r/vdr-1.2.6/vdr.c 2005-01-31 23:03:08.000000000 +0100
@@ -31,6 +31,10 @@
#include <stdlib.h>
#include <termios.h>
@@ -174,20 +174,24 @@
"\n",
cSIProcessor::GetEpgDataFileName() ? cSIProcessor::GetEpgDataFileName() : "'-'",
DEFAULTPLUGINDIR,
-@@ -290,6 +394,17 @@
+@@ -290,6 +394,21 @@
return 0;
}
-+ if(username && set_keepcaps() != 0)
-+ return 2;
++ // Only try to change capabilities/user when vdr is called by
++ // root
++ if (!getuid () || !getgid () || !geteuid () || !getegid ()) {
++ if(username && set_keepcaps() != 0)
++ return 2;
+
-+ if (su(username, groupname) != 0)
-+ return 2;
++ if (su(username, groupname) != 0)
++ return 2;
+
-+ if(username && set_nokeepcaps() != 0)
-+ return 2;
++ if(username && set_nokeepcaps() != 0)
++ return 2;
+
-+ set_cap_sys_time();
++ set_cap_sys_time();
++ }
+
// Log file:
Index: 07_not_as_root.dpatch
===================================================================
RCS file: /cvsroot/pkg-vdr-dvb/vdr/vdr/debian/patches/07_not_as_root.dpatch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- 07_not_as_root.dpatch 16 Jan 2005 20:41:05 -0000 1.2
+++ 07_not_as_root.dpatch 31 Jan 2005 22:57:37 -0000 1.3
@@ -6,9 +6,9 @@
## DP: 05_set_system_time_as_user.dpatch)
@DPATCH@
-diff -urNad vdr-1.2.6/vdr.c /tmp/dpep.KXhAyV/vdr-1.2.6/vdr.c
---- vdr-1.2.6/vdr.c 2005-01-16 21:24:13.000000000 +0100
-+++ /tmp/dpep.KXhAyV/vdr-1.2.6/vdr.c 2005-01-16 21:27:33.000000000 +0100
+diff -urNad vdr-1.2.6/vdr.c /tmp/dpep.YDJHqf/vdr-1.2.6/vdr.c
+--- vdr-1.2.6/vdr.c 2005-01-31 23:07:51.000000000 +0100
++++ /tmp/dpep.YDJHqf/vdr-1.2.6/vdr.c 2005-01-31 23:09:10.000000000 +0100
@@ -35,6 +35,7 @@
#include <grp.h>
#include <sys/capability.h>
@@ -68,7 +68,7 @@
+ fprintf (stderr, "%s: sorry, I refuse to run with root privileges\n", argv[0]);
+ return 0;
+ }
-+
- if(username && set_keepcaps() != 0)
- return 2;
-
++
+ // Only try to change capabilities/user when vdr is called by
+ // root
+ if (!getuid () || !getgid () || !geteuid () || !getegid ()) {