Andrej Borsenkow <[EMAIL PROTECTED]> writes:
> Chmouel Boudjnah wrote:
>
> > Andrej Borsenkow <[EMAIL PROTECTED]> writes:
> >
> >
> >>O.K., I have found why it happens. Here goes.
> >>
> >
> > ok fixed in latest util-linux of cooker..
> >
> >
>
> No, sorry. It now tries to open /dev/tty but in wrong place - in parent,
> not in child.
ok i understand now, the setsid is definitvely broken (for ash shell
:-(), i'll revert the changes here, can you try this[1] :
--- util-linux-2.11e/login-utils/login.c.chmou Thu Jun 7 20:49:09 2001
+++ util-linux-2.11e/login-utils/login.c Fri Jun 8 21:14:03 2001
@@ -1071,15 +1071,8 @@
* We must fork before setuid() because we need to call
* pam_close_session() as root.
*/
- /*
- * Problem: if the user's shell is a shell like ash that doesnt do
- * setsid() or setpgrp(), then a ctrl-\, sending SIGQUIT to every
- * process in the pgrp, will kill us.
- * Solution: use TIOCNOTTY and setsid().
- */
signal(SIGINT, SIG_IGN);
- signal(SIGHUP, SIG_IGN); /* ignore signal from TIOCNOTTY below */
-
+
childPid = fork();
if (childPid < 0) {
int errsv = errno;
@@ -1088,18 +1081,11 @@
PAM_END;
exit(0);
} else if (childPid) {
- /* parent - wait for child to finish, then cleanup session */
- ioctl(0, TIOCNOTTY, NULL);
- signal(SIGHUP, SIG_DFL);
-
wait(NULL);
PAM_END;
exit(0);
}
/* child */
- setsid();
- /* reopen, as we need controlling tty in the child */
- opentty(ttyn);
#endif
signal(SIGHUP, SIG_DFL);
signal(SIGINT, SIG_DFL);
Footnotes:
[1] or get the file https://qa.mandrakesoft.com/~chmou/misc/login