1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Dropped the default vdr user

This commit is contained in:
Klaus Schmidinger 2006-01-13 16:16:32 +01:00
parent 317b15f5a0
commit b11dcb15de
6 changed files with 29 additions and 17 deletions

View File

@ -4155,3 +4155,8 @@ Video Disk Recorder Revision History
- Making the "Menu" key behave consistently has not been well received by several - Making the "Menu" key behave consistently has not been well received by several
users, so the new option "Setup/OSD/Menu button closes" can be used to get the users, so the new option "Setup/OSD/Menu button closes" can be used to get the
old behavior back (which also is the default value of this option). old behavior back (which also is the default value of this option).
- Dropped the default vdr user. The program now always runs under the user id
it was started from, unless the '-u' option is given and it was started from
the 'root' user. If you want to have a default vdr user, you can activate and
adjust the "VDR_USER = vdr" line in your Make.config file (from the original
patch by Ludwig Nussel).

View File

@ -136,10 +136,10 @@ Setting the system time:
------------------------ ------------------------
If you want VDR to set the system time according to the data received If you want VDR to set the system time according to the data received
from the transponder, you need to start VDR as user 'root'. VDR will from the transponder, you need to start VDR as user 'root'. For security
then only keep the capability to set the system time, and set its reasons you should then use the '-u' option to define a lesser privileged
user id to a lesser privileged one ('vdr' by default, can be set user id under which VDR should actually run. It will then only keep the
to a different value with the '-u' option). capability to set the system time, and set its user id to the given one.
You also need to enable the "EPG/Set system time" option in VDR's You also need to enable the "EPG/Set system time" option in VDR's
Setup menu, and select a transponder from which you want to receive Setup menu, and select a transponder from which you want to receive
the time in "Use time from transponder". Make sure you select a transponder the time in "Use time from transponder". Make sure you select a transponder

View File

@ -6,7 +6,7 @@
# See the main source file 'vdr.c' for copyright information and # See the main source file 'vdr.c' for copyright information and
# how to reach the author. # how to reach the author.
# #
# $Id: Make.config.template 1.6 2005/09/02 14:24:31 kls Exp $ # $Id: Make.config.template 1.7 2006/01/13 16:06:11 kls Exp $
### The C compiler and options: ### The C compiler and options:
@ -30,3 +30,6 @@ VIDEODIR = /video
LIRC_DEVICE = /dev/lircd LIRC_DEVICE = /dev/lircd
RCU_DEVICE = /dev/ttyS1 RCU_DEVICE = /dev/ttyS1
## Define if you want vdr to not run as root
#VDR_USER = vdr

View File

@ -4,7 +4,7 @@
# See the main source file 'vdr.c' for copyright information and # See the main source file 'vdr.c' for copyright information and
# how to reach the author. # how to reach the author.
# #
# $Id: Makefile 1.82 2006/01/08 16:12:26 kls Exp $ # $Id: Makefile 1.83 2006/01/13 16:04:56 kls Exp $
.DELETE_ON_ERROR: .DELETE_ON_ERROR:
@ -77,6 +77,9 @@ endif
ifdef REMOTE ifdef REMOTE
DEFINES += -DREMOTE_$(REMOTE) DEFINES += -DREMOTE_$(REMOTE)
endif endif
ifdef VDR_USER
DEFINES += -DVDR_USER=\"$(VDR_USER)\"
endif
LIRC_DEVICE ?= /dev/lircd LIRC_DEVICE ?= /dev/lircd
RCU_DEVICE ?= /dev/ttyS1 RCU_DEVICE ?= /dev/ttyS1

6
vdr.1
View File

@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the .\" License as specified in the file COPYING that comes with the
.\" vdr distribution. .\" vdr distribution.
.\" .\"
.\" $Id: vdr.1 1.20 2006/01/08 11:51:36 kls Exp $ .\" $Id: vdr.1 1.21 2006/01/13 16:01:19 kls Exp $
.\" .\"
.TH vdr 1 "08 Jan 2006" "1.3.38" "Video Disk Recorder" .TH vdr 1 "08 Jan 2006" "1.3.38" "Video Disk Recorder"
.SH NAME .SH NAME
@ -132,8 +132,8 @@ Set the controlling terminal.
Run as user \fIuser\fR in case vdr was started as user 'root'. Run as user \fIuser\fR in case vdr was started as user 'root'.
Starting vdr as 'root' is necessary if the system time shall Starting vdr as 'root' is necessary if the system time shall
be set from the transponder data, but for security reasons be set from the transponder data, but for security reasons
during normal operation vdr switches to a lesser privileged vdr can switch to a lesser privileged user id during normal
user id. By default the user 'vdr' is used. operation.
.TP .TP
.BI \-v\ dir ,\ \-\-video= dir .BI \-v\ dir ,\ \-\-video= dir
Use \fIdir\fR as video directory. Use \fIdir\fR as video directory.

17
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.cadsoft.de/vdr * The project's page is at http://www.cadsoft.de/vdr
* *
* $Id: vdr.c 1.235 2006/01/13 15:33:54 kls Exp $ * $Id: vdr.c 1.236 2006/01/13 16:16:32 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -157,14 +157,13 @@ int main(int argc, char *argv[])
// Command line options: // Command line options:
#define DEFAULTVDRUSER "vdr"
#define DEFAULTSVDRPPORT 2001 #define DEFAULTSVDRPPORT 2001
#define DEFAULTWATCHDOG 0 // seconds #define DEFAULTWATCHDOG 0 // seconds
#define DEFAULTPLUGINDIR PLUGINDIR #define DEFAULTPLUGINDIR PLUGINDIR
#define DEFAULTEPGDATAFILENAME "epg.data" #define DEFAULTEPGDATAFILENAME "epg.data"
bool StartedAsRoot = false; bool StartedAsRoot = false;
const char *VdrUser = DEFAULTVDRUSER; const char *VdrUser = NULL;
int SVDRPport = DEFAULTSVDRPPORT; int SVDRPport = DEFAULTSVDRPPORT;
const char *AudioCommand = NULL; const char *AudioCommand = NULL;
const char *ConfigDirectory = NULL; const char *ConfigDirectory = NULL;
@ -192,6 +191,9 @@ int main(int argc, char *argv[])
#if defined(VFAT) #if defined(VFAT)
VfatFileSystem = true; VfatFileSystem = true;
#endif #endif
#if defined(VDR_USER)
VdrUser = VDR_USER;
#endif
cPluginManager PluginManager(DEFAULTPLUGINDIR); cPluginManager PluginManager(DEFAULTPLUGINDIR);
int ExitCode = 0; int ExitCode = 0;
@ -337,7 +339,7 @@ int main(int argc, char *argv[])
// Set user id in case we were started as root: // Set user id in case we were started as root:
if (getuid() == 0) { if (VdrUser && getuid() == 0) {
StartedAsRoot = true; StartedAsRoot = true;
if (strcmp(VdrUser, "root")) { if (strcmp(VdrUser, "root")) {
if (!SetKeepCaps(true)) if (!SetKeepCaps(true))
@ -394,8 +396,8 @@ int main(int argc, char *argv[])
" -r CMD, --record=CMD call CMD before and after a recording\n" " -r CMD, --record=CMD call CMD before and after a recording\n"
" -s CMD, --shutdown=CMD call CMD to shutdown the computer\n" " -s CMD, --shutdown=CMD call CMD to shutdown the computer\n"
" -t TTY, --terminal=TTY controlling tty\n" " -t TTY, --terminal=TTY controlling tty\n"
" -u USER, --user=USER run as user USER (default: %s); only applicable\n" " -u USER, --user=USER run as user USER; only applicable if started as\n"
" if started as root\n" " root\n"
" -v DIR, --video=DIR use DIR as video directory (default: %s)\n" " -v DIR, --video=DIR use DIR as video directory (default: %s)\n"
" -V, --version print version information and exit\n" " -V, --version print version information and exit\n"
" --vfat encode special characters in recording names to\n" " --vfat encode special characters in recording names to\n"
@ -408,7 +410,6 @@ int main(int argc, char *argv[])
LIRC_DEVICE, LIRC_DEVICE,
DEFAULTSVDRPPORT, DEFAULTSVDRPPORT,
RCU_DEVICE, RCU_DEVICE,
DEFAULTVDRUSER,
VideoDirectory, VideoDirectory,
DEFAULTWATCHDOG DEFAULTWATCHDOG
); );
@ -473,7 +474,7 @@ int main(int argc, char *argv[])
} }
isyslog("VDR version %s started", VDRVERSION); isyslog("VDR version %s started", VDRVERSION);
if (StartedAsRoot) if (StartedAsRoot && VdrUser)
isyslog("switched to user '%s'", VdrUser); isyslog("switched to user '%s'", VdrUser);
if (DaemonMode) if (DaemonMode)
dsyslog("running as daemon (tid=%d)", cThread::ThreadId()); dsyslog("running as daemon (tid=%d)", cThread::ThreadId());