mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 13:33:09 +07:00
tty: add basic security, call sulogin in rescue mode (notty)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
#endif
|
||||
|
||||
#define _PATH_LOGIT FINIT_LIBPATH_ "/logit"
|
||||
#define _PATH_SULOGIN FINIT_LIBPATH_ "/sulogin"
|
||||
|
||||
#define CMD_SIZE 256
|
||||
#define LINE_SIZE 1024
|
||||
|
||||
@@ -240,7 +240,15 @@ int tty_exec(svc_t *svc)
|
||||
char *dev;
|
||||
int i, j;
|
||||
|
||||
/* try to protect system with sulogin, fall back to root shell */
|
||||
if (svc->notty) {
|
||||
/* util-linux or busybox, no args for compat */
|
||||
if (whichp("sulogin"))
|
||||
return execlp("sulogin", "sulogin", NULL);
|
||||
/* check if bundled one is available */
|
||||
if (whichp(_PATH_SULOGIN) && !systemf(_PATH_SULOGIN))
|
||||
_exit(0);
|
||||
|
||||
/*
|
||||
* Become session leader and set controlling TTY
|
||||
* to enable Ctrl-C and job control in shell.
|
||||
|
||||
Reference in New Issue
Block a user