commit 782443d4c1c104013cae4ab9cb693275003a396f from: Stefan Sperling date: Thu Jun 01 13:17:01 2023 UTC make root users start out in privileged mode Suggested by chris@ commit - 39f32a8cb2d67c53ffdc7dabda62007ebcefd13b commit + 782443d4c1c104013cae4ab9cb693275003a396f blob - 9ba61d37637b0bb62d90fcd2821475b4bcd990ab blob + 746039c12f247f72374cc49c9792c96bcbe0ed52 --- main.c +++ main.c @@ -162,8 +162,19 @@ main(int argc, char *argv[]) /* * We start out in privileged mode. * We are already running as root as per -e option handling. + * The privexec flag also affects the behaviour of commands + * such as 'disable' and 'quit'. 'disable' will pass control + * back to the parent process which runs in non-privileged + * mode. "quit' does the same with a special exit code to let + * the parent know that it should exit immediately. */ priv = 1; + } else if (getuid() == 0) { + /* + * Root users always start out in privileged mode. + * They can use 'disable' if they want to exit priv mode. + */ + priv = 1; } top = setjmp(toplevel) == 0;