diff options
| author | Matthew Dillon <dillon@FreeBSD.org> | 2002-06-26 00:42:40 +0000 |
|---|---|---|
| committer | Matthew Dillon <dillon@FreeBSD.org> | 2002-06-26 00:42:40 +0000 |
| commit | b22ac97b33caa46a73d316bc18f55445b11d454f (patch) | |
| tree | 6a19479c40c914ff594d669557d4b7a7cc07ed15 /usr.bin/su | |
| parent | 6592cfde7aa74e6414f0d1f496765111b4d85c67 (diff) | |
Notes
Diffstat (limited to 'usr.bin/su')
| -rw-r--r-- | usr.bin/su/su.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c index ec11570e70097..6348099c92c53 100644 --- a/usr.bin/su/su.c +++ b/usr.bin/su/su.c @@ -132,6 +132,8 @@ main(int argc, char *argv[]) char *username, *cleanenv, *class, shellbuf[MAXPATHLEN]; const char *p, *user, *shell, *mytty, **nargv; + struct sigaction sa, sa_int, sa_quit, sa_tstp; + shell = class = cleanenv = NULL; asme = asthem = fastlogin = statusp = 0; user = "root"; @@ -314,6 +316,12 @@ main(int argc, char *argv[]) * 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); statusp = 1; child_pid = fork(); @@ -339,6 +347,9 @@ main(int argc, char *argv[]) PAM_END(); exit(1); case 0: + sigaction(SIGINT, &sa_int, NULL); + sigaction(SIGQUIT, &sa_quit, NULL); + sigaction(SIGTSTP, &sa_tstp, NULL); /* * Set all user context except for: Environmental variables * Umask Login records (wtmp, etc) Path |
