Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jul 2002 10:31:44 +1000
From:      Tim Robbins <tjr@FreeBSD.ORG>
To:        David Xu <bsddiy@yahoo.com>
Cc:        current@FreeBSD.ORG
Subject:   Re: suspend bug
Message-ID:  <20020722103144.A64785@dilbert.robbins.dropbear.id.au>
In-Reply-To: <20020721112130.22708.qmail@web20903.mail.yahoo.com>; from bsddiy@yahoo.com on Sun, Jul 21, 2002 at 04:21:30AM -0700
References:  <20020721112130.22708.qmail@web20903.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jul 21, 2002 at 04:21:30AM -0700, David Xu wrote:

> I knew the bug, is this patch works for you?

No, it doesn't fix chpass or su, but it does fix ftp.

I don't know why, but this patch seems to fix su with sh/ksh/csh. It might
be useful in tracking down the kernel bug.


--- su.c.old	Mon Jul 22 10:22:48 2002
+++ su.c	Mon Jul 22 10:23:52 2002
@@ -133,6 +133,7 @@
 	const char	*p, *user, *shell, *mytty, **nargv;
 
 	struct sigaction sa, sa_int, sa_quit, sa_tstp;
+	sigset_t sset;
 
 	shell = class = cleanenv = NULL;
 	asme = asthem = fastlogin = statusp = 0;
@@ -316,12 +317,8 @@
 	 * We must fork() before setuid() because we need to call
 	 * pam_setcred(pamh, PAM_DELETE_CRED) as root.
 	 */
-	sa.sa_flags = SA_RESTART;
-	sa.__sigaction_u.__sa_handler = SIG_IGN;
-	sigemptyset(&sa.sa_mask);
-	sigaction(SIGINT, &sa, &sa_int);
-	sigaction(SIGQUIT, &sa, &sa_quit);
-	sigaction(SIGTSTP, &sa, &sa_tstp);
+	sigfillset(&sset);
+	sigprocmask(SIG_BLOCK, &sset, NULL);
 
 	statusp = 1;
 	child_pid = fork();
@@ -345,9 +342,7 @@
 		PAM_END();
 		exit(1);
 	case 0:
-		sigaction(SIGINT, &sa_int, NULL);
-		sigaction(SIGQUIT, &sa_quit, NULL);
-		sigaction(SIGTSTP, &sa_tstp, NULL);
+		sigprocmask(SIG_UNBLOCK, &sset, NULL);
 		/*
 		 * Set all user context except for: Environmental variables
 		 * Umask Login records (wtmp, etc) Path


Tim

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020722103144.A64785>