1 --- sysvinit-2.85/src/init.c.selinux 2005-10-14 14:16:24.000000000 -0400
2 +++ sysvinit-2.85/src/init.c 2005-10-14 14:16:24.000000000 -0400
5 #include <sys/syslog.h>
7 +#include <selinux/selinux.h>
19 if ((p = strrchr(argv[0], '/')) != NULL)
20 @@ -2576,6 +2579,20 @@
21 maxproclen += strlen(argv[f]) + 1;
24 + if (getenv("SELINUX_INIT") == NULL) {
25 + putenv("SELINUX_INIT=YES");
26 + if (selinux_init_load_policy(&enforce) == 0 ) {
27 + execv(myname, argv);
30 + /* SELinux in enforcing mode but load_policy failed */
31 + /* At this point, we probably can't open /dev/console, so log() won't work */
32 + printf("Unable to load SELinux Policy. Machine is in enforcing mode. Halting now.\n");
41 --- sysvinit-2.85/src/Makefile.selinux 2005-10-14 14:16:24.000000000 -0400
42 +++ sysvinit-2.85/src/Makefile 2005-10-14 14:16:24.000000000 -0400
46 init: init.o init_utmp.o
47 - $(CC) $(LDFLAGS) $(STATIC) -o $@ init.o init_utmp.o
48 + $(CC) $(LDFLAGS) $(STATIC) -o $@ init.o init_utmp.o -lsepol -lselinux
50 halt: halt.o ifdown.o hddown.o utmp.o reboot.h
51 $(CC) $(LDFLAGS) -o $@ halt.o ifdown.o hddown.o utmp.o
53 $(CC) $(LDFLAGS) -o $@ runlevel.o
55 sulogin: sulogin.o md5_broken.o md5_crypt_broken.o arc4random.o bcrypt.o blowfish.o
56 - $(CC) $(LDFLAGS) $(STATIC) -o $@ $^ $(LCRYPT)
57 + $(CC) $(LDFLAGS) $(STATIC) -o $@ $^ $(LCRYPT) -lselinux
60 $(CC) $(LDFLAGS) -o $@ dowall.o wall.o
61 --- sysvinit-2.85/src/sulogin.c.selinux 2005-10-14 14:16:24.000000000 -0400
62 +++ sysvinit-2.85/src/sulogin.c 2005-10-14 14:18:42.000000000 -0400
67 +#include <selinux/selinux.h>
68 +#include <selinux/get_context_list.h>
74 signal(SIGINT, SIG_DFL);
75 signal(SIGTSTP, SIG_DFL);
76 signal(SIGQUIT, SIG_DFL);
77 + if (is_selinux_enabled > 0) {
78 + security_context_t scon=NULL;
81 + if (getseuserbyname("root", &seuser, &level) == 0)
82 + if (get_default_context_with_level(seuser, level, 0, &scon) > 0) {
83 + if (setexeccon(scon) != 0)
84 + fprintf(stderr, "setexeccon faile\n");
90 execl(sushell, shell, NULL);