Don't use SIGPIPE, SIGXCPU or geteuid() if they aren't available
in kdc/main.c
This commit is contained in:

committed by
Love Hornquist Astrand

parent
fa8a92471c
commit
6aa28bcc91
@@ -64,6 +64,7 @@ sigterm(int sig)
|
|||||||
static void
|
static void
|
||||||
switch_environment(void)
|
switch_environment(void)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_GETEUID
|
||||||
if ((runas_string || chroot_string) && geteuid() != 0)
|
if ((runas_string || chroot_string) && geteuid() != 0)
|
||||||
errx(1, "no running as root, can't switch user/chroot");
|
errx(1, "no running as root, can't switch user/chroot");
|
||||||
|
|
||||||
@@ -86,6 +87,7 @@ switch_environment(void)
|
|||||||
if (setuid(pw->pw_uid) < 0)
|
if (setuid(pw->pw_uid) < 0)
|
||||||
err(1, "setuid(%s)", runas_string);
|
err(1, "setuid(%s)", runas_string);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -128,9 +130,13 @@ main(int argc, char **argv)
|
|||||||
#else
|
#else
|
||||||
signal(SIGINT, sigterm);
|
signal(SIGINT, sigterm);
|
||||||
signal(SIGTERM, sigterm);
|
signal(SIGTERM, sigterm);
|
||||||
|
#ifndef NO_SIGXCPU
|
||||||
signal(SIGXCPU, sigterm);
|
signal(SIGXCPU, sigterm);
|
||||||
|
#endif
|
||||||
|
#ifndef NO_SIGPIPE
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#ifdef SUPPORT_DETACH
|
#ifdef SUPPORT_DETACH
|
||||||
if (detach_from_console)
|
if (detach_from_console)
|
||||||
daemon(0, 0);
|
daemon(0, 0);
|
||||||
|
Reference in New Issue
Block a user