mirror of
https://github.com/troglobit/finit.git
synced 2026-12-04 21:58:19 +00:00
tty: add basic security, call sulogin in rescue mode (notty)
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
96534789db
commit
221ab20898
2 files changed
+9
No files matched your search
@@ -51,6 +51,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _PATH_LOGIT FINIT_LIBPATH_ "/logit"
|
#define _PATH_LOGIT FINIT_LIBPATH_ "/logit"
|
||||||
|
#define _PATH_SULOGIN FINIT_LIBPATH_ "/sulogin"
|
||||||
|
|
||||||
#define CMD_SIZE 256
|
#define CMD_SIZE 256
|
||||||
#define LINE_SIZE 1024
|
#define LINE_SIZE 1024
|
||||||
|
|||||||
@@ -240,7 +240,15 @@ int tty_exec(svc_t *svc)
|
|||||||
char *dev;
|
char *dev;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
/* try to protect system with sulogin, fall back to root shell */
|
||||||
if (svc->notty) {
|
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
|
* Become session leader and set controlling TTY
|
||||||
* to enable Ctrl-C and job control in shell.
|
* to enable Ctrl-C and job control in shell.
|
||||||
|
|||||||
Reference in new issue
Block a user