[Pkg-shadow-devel] Bug#380522: X is unexpected signal
Nicolas François
nicolas.francois at centraliens.net
Thu Aug 3 20:21:14 UTC 2006
On Thu, Aug 03, 2006 at 09:47:26PM +0200, Samuel Thibault wrote:
>
> + /* If we were init, we need to start the session */
> + if (getppid() == 1) {
> + setsid();
> + if (ioctl(0, TIOCSCTTY, 1))
> + fprintf(stderr,_("TIOCSCTTY failed on %s"),tty);
> + }
Is there another way to detect when a new session is necessary?
i.e. Is there a way to predict that ^Z and ^C will fail?
Testing the PID could fail with kernel patches that randomize the PIDs.
Also, I really don't know what the users expect when they use
init=/bin/login
Kind Regards,
--
Nekral
>
> /* We call set_groups() above because this clobbers pam_groups.so */
> #ifndef USE_PAM
> Index: shadow-4.0.17/src/sulogin.c
> ===================================================================
> --- shadow-4.0.17.orig/src/sulogin.c 2006-05-13 01:13:10.000000000 +0200
> +++ shadow-4.0.17/src/sulogin.c 2006-07-14 09:31:59.669240742 +0200
> @@ -35,6 +35,7 @@
> #include <pwd.h>
> #include <signal.h>
> #include <stdio.h>
> +#include <sys/ioctl.h>
> #include "defines.h"
> #include "getdef.h"
> #include "prototypes.h"
> @@ -142,6 +143,12 @@
> #endif
> exit (1); /* must be a terminal */
> }
> + /* If we were init, we need to start the session */
> + if (getppid() == 1) {
> + setsid();
> + if (ioctl(0, TIOCSCTTY, 1))
> + fprintf(stderr,_("TIOCSCTTY failed"));
> + }
> while (*envp) /* add inherited environment, */
> addenv (*envp++, NULL); /* some variables change later */
>
More information about the Pkg-shadow-devel
mailing list