From f415169064b21ab8e025f1f36cdcb3258d2de679 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 9 Jan 2006 16:54:35 +0100 Subject: [PATCH] Skipping all SetCaps() and SetUser() calls when it is started as 'root' and "-u root" is given --- HISTORY | 5 ++++- vdr.c | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/HISTORY b/HISTORY index 27a95ab1..150c7547 100644 --- a/HISTORY +++ b/HISTORY @@ -4135,7 +4135,7 @@ Video Disk Recorder Revision History Schneider). - Cleaned up some trailing white space. -2006-01-08: Version 1.3.39 +2006-01-09: Version 1.3.39 - The SVDRP command LSTT now accepts the new option 'id' to have the channels of the timers listed with their unique channel ids instead of their numbers @@ -4147,3 +4147,6 @@ Video Disk Recorder Revision History (thanks to Peter Bieringer). If you are using the PC keyboard as remote control input you may need to make VDR newly learn the keys by removing the remote.conf file. +- To avoid problems with access rights when VDR shall run as 'root' it now skips + all SetCaps() and SetUser() calls when it is started as 'root' and "-u root" + is given. diff --git a/vdr.c b/vdr.c index a476a25b..c8afec24 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/vdr * - * $Id: vdr.c 1.233 2006/01/08 11:49:03 kls Exp $ + * $Id: vdr.c 1.234 2006/01/09 16:44:15 kls Exp $ */ #include @@ -339,14 +339,16 @@ int main(int argc, char *argv[]) if (getuid() == 0) { StartedAsRoot = true; - if (!SetKeepCaps(true)) - return 2; - if (!SetUser(VdrUser)) - return 2; - if (!SetKeepCaps(false)) - return 2; - if (!SetCapSysTime()) - return 2; + if (strcmp(VdrUser, "root")) { + if (!SetKeepCaps(true)) + return 2; + if (!SetUser(VdrUser)) + return 2; + if (!SetKeepCaps(false)) + return 2; + if (!SetCapSysTime()) + return 2; + } } // Help and version info: