summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY1
-rw-r--r--vdr.14
-rw-r--r--vdr.c14
4 files changed, 11 insertions, 9 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 55a0766c..d22ba771 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -2842,6 +2842,7 @@ Derek Kelly <user.vdr@gmail.com>
for reporting a missing template for DVBDIR in Make.config.template
for suggesting to add ARGSDIR to the ONEDIR section of Make.config.template
for suggesting to change the naming of "binary skip mode" to "adaptive skip mode"
+ for suggesting to make the -u option also accept a numerical user id
Marcel Unbehaun <frostworks@gmx.de>
for adding cRecordingInfo::GetEvent()
diff --git a/HISTORY b/HISTORY
index 4eec9061..373e881f 100644
--- a/HISTORY
+++ b/HISTORY
@@ -8644,3 +8644,4 @@ Video Disk Recorder Revision History
this version of VDR, you can uncomment the line
//#define DEPRECATED_GETBITMAP
in osd.h as a quick workaround. In the long run the plugin will need to be adapted.
+- The -u option now also accepts a numerical user id (suggested by Derek Kelly).
diff --git a/vdr.1 b/vdr.1
index 3d908201..0ce3eed8 100644
--- a/vdr.1
+++ b/vdr.1
@@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the
.\" vdr distribution.
.\"
-.\" $Id: vdr.1 4.1 2015/04/18 14:25:07 kls Exp $
+.\" $Id: vdr.1 4.2 2015/04/19 12:39:13 kls Exp $
.\"
.TH vdr 1 "19 Feb 2015" "2.2" "Video Disk Recorder"
.SH NAME
@@ -206,7 +206,7 @@ Run as user \fIuser\fR in case vdr was started as user 'root'.
Starting vdr as 'root' is necessary if the system time shall
be set from the transponder data, but for security reasons
vdr can switch to a lesser privileged user id during normal
-operation.
+operation. \fIuser\fR can be a user name or a numerical id.
.TP
.BI \-\-updindex= rec
Update the index file for the given recording.
diff --git a/vdr.c b/vdr.c
index 0243a297..d8b2b1a5 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* The project's page is at http://www.tvdr.de
*
- * $Id: vdr.c 4.1 2015/04/18 14:22:47 kls Exp $
+ * $Id: vdr.c 4.2 2015/04/19 12:38:12 kls Exp $
*/
#include <getopt.h>
@@ -92,12 +92,12 @@
static int LastSignal = 0;
-static bool SetUser(const char *UserName, bool UserDump)
+static bool SetUser(const char *User, bool UserDump)
{
- if (UserName) {
- struct passwd *user = getpwnam(UserName);
+ if (User) {
+ struct passwd *user = isnumber(User) ? getpwuid(atoi(User)) : getpwnam(User);
if (!user) {
- fprintf(stderr, "vdr: unknown user: '%s'\n", UserName);
+ fprintf(stderr, "vdr: unknown user: '%s'\n", User);
return false;
}
if (setgid(user->pw_gid) < 0) {
@@ -509,7 +509,7 @@ int main(int argc, char *argv[])
if (VdrUser && geteuid() == 0) {
StartedAsRoot = true;
- if (strcmp(VdrUser, "root")) {
+ if (strcmp(VdrUser, "root") && strcmp(VdrUser, "0")) {
if (!SetKeepCaps(true))
return 2;
if (!SetUser(VdrUser, UserDump))
@@ -592,7 +592,7 @@ int main(int argc, char *argv[])
" (default: %s)\n"
" -t TTY, --terminal=TTY controlling tty\n"
" -u USER, --user=USER run as user USER; only applicable if started as\n"
- " root\n"
+ " root; USER can be a user name or a numerical id\n"
" --updindex=REC update index for recording REC and exit\n"
" --userdump allow coredumps if -u is given (debugging)\n"
" -v DIR, --video=DIR use DIR as video directory (default: %s)\n"