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

The -u option now also accepts a numerical user id

This commit is contained in:
Klaus Schmidinger 2015-04-19 12:50:26 +02:00
parent 5499d5ae84
commit d14adc1e68
4 changed files with 11 additions and 9 deletions

View File

@ -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()

View File

@ -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).

4
vdr.1
View File

@ -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.

14
vdr.c
View File

@ -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"