Commit Graph

4626 Commits

Author SHA1 Message Date
Todd C. Miller
ce0fdd5544 Call krb5_get_init_creds_opt_init() in our emulated
krb5_get_init_creds_opt_alloc() for MIT kerberos.
2009-11-03 14:51:20 +00:00
Todd C. Miller
63fee47084 Add HAVE_ZLIB 2009-11-01 23:44:15 +00:00
Todd C. Miller
febc3cbb1f Need to ignore SIGTT{IN,OU} in child when running the command in the
background.  Also some minor cleanup.
2009-11-01 15:14:58 +00:00
Todd C. Miller
78cd63e074 Instead of calling sigsuspend when waiting for SIGUSR[12] from parent,
install the signal handlers w/o SA_RESTART and let them interrupt waitpid().
2009-10-31 17:40:19 +00:00
Todd C. Miller
94370b319f Pass along SIGHUP and SIGTERM from parent to child. 2009-10-31 17:14:52 +00:00
Todd C. Miller
e6567f46b6 Close unused bits of script_fds in processes that don't need them.
Restore default SIGCONT handler in child.
2009-10-31 16:48:34 +00:00
Todd C. Miller
aee3382ed1 Update foreground/background status in SIGCONT handler in parent process. 2009-10-31 16:45:59 +00:00
Todd C. Miller
e62dd7645f Defer setting terminal into raw mode until just before we fork()
and only do it if sudo is the foreground process.
If we get SIGTT{IN,OU} and sudo is already in the foreground be sure
to set raw mode before continuing the child.
2009-10-25 14:55:14 +00:00
Todd C. Miller
c77ef16fcd Fix handling of SIGTTOU/SIGTTIN in program being run. We now only
give the command the controlling tty if the main sudo process is the
foreground process.
2009-10-24 18:43:16 +00:00
Todd C. Miller
61b57817a5 Don't bother with sudo_waitpid() here for now. 2009-10-24 18:32:44 +00:00
Todd C. Miller
50f5d55163 fix non-zlib case 2009-10-24 13:16:40 +00:00
Todd C. Miller
470d3a1925 Remove non-wroking code that crept into rev 1.55 2009-10-23 11:40:22 +00:00
Todd C. Miller
602a62c01e First pass at zlib support for transcript data files 2009-10-22 23:50:16 +00:00
Todd C. Miller
aaa2f89eac remove vestiges of ZLDFLAGS 2009-10-22 23:46:40 +00:00
Todd C. Miller
db502bb584 Add missing variable declaration for when TIOCSCTTY is not defined.
Need to include sys/termio.h for TIOCSCTTY on some systems.
2009-10-22 14:53:13 +00:00
Todd C. Miller
03e0e4c747 when resuming command, send SIGCONT to its pgrp not just pid 2009-10-22 13:52:59 +00:00
Todd C. Miller
777c82a4d4 remove unused variable 2009-10-22 13:47:43 +00:00
Todd C. Miller
8fa5a519a0 include selinux.h for is_selinux_enabled() proto 2009-10-22 13:47:32 +00:00
Todd C. Miller
b231f074a2 Don't use log_error() in the child process. 2009-10-22 13:40:41 +00:00
Todd C. Miller
425026fa11 Do I/O in parent instead of child since the parent can have both
/dev/tty as well as the pty fds open.  The child just sets things
up and waits for its grandchild and writes the signal description
to the pty master if the command was killed by a signal.
2009-10-22 00:58:41 +00:00
Todd C. Miller
773865eb17 Move two struct forward declarations from sudo.h to missing.h 2009-10-18 17:45:21 +00:00
Todd C. Miller
27b221e439 Make comment at the top of script_exec() match reality. 2009-10-18 17:32:44 +00:00
Todd C. Miller
7281ad3bc0 if neither stdin nor stdout is a tty, check stderr 2009-10-18 15:38:06 +00:00
Todd C. Miller
c6ba8ebdd2 Add back dependecy of gram.h on gram.y 2009-10-18 15:11:59 +00:00
Todd C. Miller
1a5afcbb15 Make transcript mode work as long as we can figure out our tty, even if
it is not stdin.  We'd like to use /dev/tty but that won't be valid after
the setsid().
2009-10-18 14:46:01 +00:00
Todd C. Miller
e5087b7269 Add support for IRIX-style dynamic ptys 2009-10-17 12:54:07 +00:00
Todd C. Miller
8cb463adec Move alloc.c protos into alloc.h 2009-10-17 12:17:16 +00:00
Todd C. Miller
335b895c16 Move prototypes for missing libc functions to missing.h 2009-10-17 12:14:21 +00:00
Todd C. Miller
8c6960e7a8 Move prototypes for missing libc functions to missing.h 2009-10-17 00:03:00 +00:00
Todd C. Miller
52b2762f70 Disable transcript support if no tcsetpgrp until we support older BSD-style
job control.
2009-10-16 13:52:47 +00:00
Todd C. Miller
9544845ef8 Break out pty code into pty.c 2009-10-16 13:29:38 +00:00
Todd C. Miller
e443ee9ff4 add killpg macro if no killpg function 2009-10-16 12:11:10 +00:00
Todd C. Miller
babf9292df Push ptem and ldterm for STERAMS-based systems when allocating a pty. 2009-10-16 00:07:11 +00:00
Todd C. Miller
7d79b1da35 Sprinkle some more O_NOCTTY and call grantpt() before unlockpt() 2009-10-15 21:48:19 +00:00
Todd C. Miller
3ece4c837f Call tcgetpgrp() in the parent, not the child and have the child spin
until it is granted.  Fixes a race on darwin.
2009-10-15 13:46:11 +00:00
Todd C. Miller
52f3374ce3 Only use TIOCNOTTY in the non-setsid case. If no TIOCSCTTY, just
reopen slave.
2009-10-15 13:38:11 +00:00
Todd C. Miller
7411b071e4 In script mode, if the command is killed by a signal, print the
signal description as well as a core dump notification like the
shell does.
2009-10-14 20:04:16 +00:00
Todd C. Miller
233377a8b7 Add check for strsignal() and a simple implementation if it is not there but sys_siglist is 2009-10-14 20:04:04 +00:00
Todd C. Miller
7bfe0fe957 Add missing WUNTRACED and store the signal that stopped the grandchild
in suspended, not signo.
2009-10-14 13:37:23 +00:00
Todd C. Miller
cd8ba12194 g/c unused code 2009-10-14 13:20:24 +00:00
Todd C. Miller
0d04ffc40c Associate the grandchild's pgrp with the tty instead of the child's
and just get suspend notifications via SIGCHLD instead of directly.
This fixes a hang with programs that try to set terminal attributes
and is more consistent with how the shell handles things.
2009-10-14 13:01:04 +00:00
Todd C. Miller
d72afb29a3 Move setpgid() of child into the parent side of the fork() where it
belongs.
2009-10-12 14:30:46 +00:00
Todd C. Miller
bc1769df24 fix typo 2009-10-11 22:02:02 +00:00
Todd C. Miller
88b93973fe Run command in its own pgrp (like the shell does) for easier signalling.
No need to relay SIGINT or SIGQUIT to parent, just send to grandchild.
Don't want grandchild stopped events in the child (only termination).
Flush output after suspending grandchild before signalling parent.
2009-10-11 21:41:36 +00:00
Todd C. Miller
a3185d3e25 Back out revision 1.34; the problem lies elsewhere. 2009-10-11 14:16:22 +00:00
Todd C. Miller
f44c2261fd Don't set stdout to blocking mode when flushing remaining output. It
can cause us to hang when trying to exit.  Need to investigate why.
2009-10-11 14:13:35 +00:00
Todd C. Miller
03e3ca08db Handle SIGTTOU and remove some debugging. 2009-10-11 13:25:23 +00:00
Todd C. Miller
9afe6a842e Back out revision 1.10 as the signal that interrupts us may be
SIGTTOU or SIGTTIN which the caller must handle.
2009-10-11 13:02:06 +00:00
Todd C. Miller
09a7bb78fe Apparently we need to send SIGSTOP to the command as well as ourself
when we get SIGTSTP, the kernel doesn't automatically stop the process
for us.
2009-10-11 12:42:03 +00:00
Todd C. Miller
2cf1b81abf Use an extra process to act as the glue bewteen the sessions
associated with the user's controlling tty (what the shell uses)
and the tty that sudo is using to do its logging.  Basically, this
means that if we get, e.g. SIGTSTP from the process sudo is running,
we relay the signal to the parent so it's shell can do the job control.
2009-10-11 12:27:11 +00:00