* Fix some minor problems
* init - enable is_selinux_enabled() to detect selinuxfs
This commit is contained in:
parent
2950c304a1
commit
210e6a26a6
@ -18,6 +18,8 @@
|
||||
* init - add the possiblity to ignore further interrupts from keyboard
|
||||
* init - add the possiblity to set sane terminal line settings
|
||||
* sulogin - add the possibility to reset the terminal io
|
||||
* Fix some minor problems
|
||||
* init - enable is_selinux_enabled() to detect selinuxfs
|
||||
|
||||
sysvinit (2.88dsf) UNRELEASED; urgency=low
|
||||
|
||||
|
@ -51,7 +51,11 @@ static sigjmp_buf jbuf;
|
||||
* Alarm handler
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
# ifdef __GNUC__
|
||||
static void handler(int arg __attribute__((unused)))
|
||||
# else
|
||||
static void handler(int arg)
|
||||
# endif
|
||||
{
|
||||
siglongjmp(jbuf, 1);
|
||||
}
|
||||
|
26
src/init.c
26
src/init.c
@ -54,6 +54,7 @@
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
#include <selinux/selinux.h>
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
|
||||
@ -2839,18 +2840,23 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
if (getenv("SELINUX_INIT") == NULL && !is_selinux_enabled()) {
|
||||
putenv("SELINUX_INIT=YES");
|
||||
if (selinux_init_load_policy(&enforce) == 0 ) {
|
||||
execv(myname, argv);
|
||||
} else {
|
||||
if (enforce > 0) {
|
||||
/* SELinux in enforcing mode but load_policy failed */
|
||||
/* At this point, we probably can't open /dev/console, so log() won't work */
|
||||
fprintf(stderr,"Unable to load SELinux Policy. Machine is in enforcing mode. Halting now.\n");
|
||||
exit(1);
|
||||
if (getenv("SELINUX_INIT") == NULL) {
|
||||
const int rc = mount("proc", "/proc", "proc", 0, 0);
|
||||
if (is_selinux_enabled() > 0) {
|
||||
putenv("SELINUX_INIT=YES");
|
||||
if (rc == 0) umount2("/proc", MNT_DETACH);
|
||||
if (selinux_init_load_policy(&enforce) == 0) {
|
||||
execv(myname, argv);
|
||||
} else {
|
||||
if (enforce > 0) {
|
||||
/* SELinux in enforcing mode but load_policy failed */
|
||||
/* At this point, we probably can't open /dev/console, so log() won't work */
|
||||
fprintf(stderr,"Unable to load SELinux Policy. Machine is in enforcing mode. Halting now.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rc == 0) umount2("/proc", MNT_DETACH);
|
||||
}
|
||||
#endif
|
||||
/* Start booting. */
|
||||
|
@ -95,7 +95,12 @@ void hardsleep(int secs)
|
||||
/*
|
||||
* Break off an already running shutdown.
|
||||
*/
|
||||
# ifdef __GNUC__
|
||||
void stopit(int sig __attribute__((unused)))
|
||||
# else
|
||||
void stopit(int sig)
|
||||
# endif
|
||||
|
||||
{
|
||||
unlink(NOLOGIN);
|
||||
unlink(FASTBOOT);
|
||||
|
@ -403,7 +403,7 @@ void sushell(struct passwd *pwd)
|
||||
signal(SIGTSTP, saved_sigtstp);
|
||||
signal(SIGQUIT, saved_sigquit);
|
||||
#ifdef WITH_SELINUX
|
||||
if (is_selinux_enabled > 0) {
|
||||
if (is_selinux_enabled() > 0) {
|
||||
security_context_t scon=NULL;
|
||||
char *seuser=NULL;
|
||||
char *level=NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user