mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Now dropping capabilities after opening terminal
This commit is contained in:
parent
a843d03af1
commit
74460f22bf
1
HISTORY
1
HISTORY
@ -9785,3 +9785,4 @@ Video Disk Recorder Revision History
|
|||||||
- Added UPDATE-2.6.0, which was missing in the official 2.6.0 release.
|
- Added UPDATE-2.6.0, which was missing in the official 2.6.0 release.
|
||||||
- Fixed unexpected calls of the '-r' script when a recording is interrupted and
|
- Fixed unexpected calls of the '-r' script when a recording is interrupted and
|
||||||
the timer has not yet finished.
|
the timer has not yet finished.
|
||||||
|
- Now dropping capabilities after opening terminal.
|
||||||
|
34
vdr.c
34
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 5.7 2021/12/27 13:31:04 kls Exp $
|
* $Id: vdr.c 5.8 2022/06/01 14:24:57 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@ -525,22 +525,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set user id in case we were started as root:
|
|
||||||
|
|
||||||
if (VdrUser && geteuid() == 0) {
|
|
||||||
StartedAsRoot = true;
|
|
||||||
if (strcmp(VdrUser, "root") && strcmp(VdrUser, "0")) {
|
|
||||||
if (!SetKeepCaps(true))
|
|
||||||
return 2;
|
|
||||||
if (!SetUser(VdrUser, UserDump))
|
|
||||||
return 2;
|
|
||||||
if (!SetKeepCaps(false))
|
|
||||||
return 2;
|
|
||||||
if (!DropCaps())
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Help and version info:
|
// Help and version info:
|
||||||
|
|
||||||
if (DisplayHelp || DisplayVersion) {
|
if (DisplayHelp || DisplayVersion) {
|
||||||
@ -690,6 +674,22 @@ int main(int argc, char *argv[])
|
|||||||
tcgetattr(STDIN_FILENO, &savedTm);
|
tcgetattr(STDIN_FILENO, &savedTm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set user id in case we were started as root:
|
||||||
|
|
||||||
|
if (VdrUser && geteuid() == 0) {
|
||||||
|
StartedAsRoot = true;
|
||||||
|
if (strcmp(VdrUser, "root") && strcmp(VdrUser, "0")) {
|
||||||
|
if (!SetKeepCaps(true))
|
||||||
|
return 2;
|
||||||
|
if (!SetUser(VdrUser, UserDump))
|
||||||
|
return 2;
|
||||||
|
if (!SetKeepCaps(false))
|
||||||
|
return 2;
|
||||||
|
if (!DropCaps())
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isyslog("VDR version %s started", VDRVERSION);
|
isyslog("VDR version %s started", VDRVERSION);
|
||||||
if (StartedAsRoot && VdrUser)
|
if (StartedAsRoot && VdrUser)
|
||||||
isyslog("switched to user '%s'", VdrUser);
|
isyslog("switched to user '%s'", VdrUser);
|
||||||
|
Loading…
Reference in New Issue
Block a user