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:
parent
5499d5ae84
commit
d14adc1e68
@ -2842,6 +2842,7 @@ Derek Kelly <user.vdr@gmail.com>
|
|||||||
for reporting a missing template for DVBDIR in Make.config.template
|
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 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 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>
|
Marcel Unbehaun <frostworks@gmx.de>
|
||||||
for adding cRecordingInfo::GetEvent()
|
for adding cRecordingInfo::GetEvent()
|
||||||
|
1
HISTORY
1
HISTORY
@ -8644,3 +8644,4 @@ Video Disk Recorder Revision History
|
|||||||
this version of VDR, you can uncomment the line
|
this version of VDR, you can uncomment the line
|
||||||
//#define DEPRECATED_GETBITMAP
|
//#define DEPRECATED_GETBITMAP
|
||||||
in osd.h as a quick workaround. In the long run the plugin will need to be adapted.
|
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
4
vdr.1
@ -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 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"
|
.TH vdr 1 "19 Feb 2015" "2.2" "Video Disk Recorder"
|
||||||
.SH NAME
|
.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
|
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
|
||||||
vdr can switch to a lesser privileged user id during normal
|
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
|
.TP
|
||||||
.BI \-\-updindex= rec
|
.BI \-\-updindex= rec
|
||||||
Update the index file for the given recording.
|
Update the index file for the given recording.
|
||||||
|
14
vdr.c
14
vdr.c
@ -22,7 +22,7 @@
|
|||||||
*
|
*
|
||||||
* The project's page is at http://www.tvdr.de
|
* 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>
|
#include <getopt.h>
|
||||||
@ -92,12 +92,12 @@
|
|||||||
|
|
||||||
static int LastSignal = 0;
|
static int LastSignal = 0;
|
||||||
|
|
||||||
static bool SetUser(const char *UserName, bool UserDump)
|
static bool SetUser(const char *User, bool UserDump)
|
||||||
{
|
{
|
||||||
if (UserName) {
|
if (User) {
|
||||||
struct passwd *user = getpwnam(UserName);
|
struct passwd *user = isnumber(User) ? getpwuid(atoi(User)) : getpwnam(User);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
fprintf(stderr, "vdr: unknown user: '%s'\n", UserName);
|
fprintf(stderr, "vdr: unknown user: '%s'\n", User);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (setgid(user->pw_gid) < 0) {
|
if (setgid(user->pw_gid) < 0) {
|
||||||
@ -509,7 +509,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (VdrUser && geteuid() == 0) {
|
if (VdrUser && geteuid() == 0) {
|
||||||
StartedAsRoot = true;
|
StartedAsRoot = true;
|
||||||
if (strcmp(VdrUser, "root")) {
|
if (strcmp(VdrUser, "root") && strcmp(VdrUser, "0")) {
|
||||||
if (!SetKeepCaps(true))
|
if (!SetKeepCaps(true))
|
||||||
return 2;
|
return 2;
|
||||||
if (!SetUser(VdrUser, UserDump))
|
if (!SetUser(VdrUser, UserDump))
|
||||||
@ -592,7 +592,7 @@ int main(int argc, char *argv[])
|
|||||||
" (default: %s)\n"
|
" (default: %s)\n"
|
||||||
" -t TTY, --terminal=TTY controlling tty\n"
|
" -t TTY, --terminal=TTY controlling tty\n"
|
||||||
" -u USER, --user=USER run as user USER; only applicable if started as\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"
|
" --updindex=REC update index for recording REC and exit\n"
|
||||||
" --userdump allow coredumps if -u is given (debugging)\n"
|
" --userdump allow coredumps if -u is given (debugging)\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"
|
||||||
|
Loading…
Reference in New Issue
Block a user