Todd C. Miller [Sun, 21 Feb 2010 15:26:30 +0000 (10:26 -0500)]
No longer need to check for explicit death of the child (process #2)
since if it dies we will get EPIPE from the socketpair.
Fix a sizeof() that was causing a spurious error.
Convert SCRIPT_DEBUG to sudo_debug.
Todd C. Miller [Sun, 21 Feb 2010 15:24:27 +0000 (10:24 -0500)]
Make sudo_debug do a single vfprintf() which will result in a single
write call on most systems. Avoids problems with interleaved debug
printf from different processes. Also remove an extraneous error case
since recv() can't return a short read and add some more XXX.
Todd C. Miller [Sat, 20 Feb 2010 14:41:49 +0000 (09:41 -0500)]
Modular sudo front-end which loads policy and I/O plugins that do
most the actual work. Currently relies on dynamic loading using
dlopen(). See doc/plugin.pod for the plugin API.
Todd C. Miller [Sat, 26 Dec 2009 01:49:25 +0000 (01:49 +0000)]
Set stdin to non-blocking mode early instead of in check_input.
Use term_raw instead of term_cbreak since the data we get has
already been expanded via OPOST.
Todd C. Miller [Wed, 23 Dec 2009 23:53:04 +0000 (23:53 +0000)]
Enable/disable all postprocessing instead of just nl->crnl processing
since things like tab expansion matter too. However, if stdout is
a tty leave postprocessing on in the pty since we run into problems
doing it only on the real stdout with .e.g nvi.
Todd C. Miller [Sun, 15 Nov 2009 21:53:38 +0000 (21:53 +0000)]
Start command out in foreground mode if stdout is a tty. Works
around issues with some curses-based programs that don't handle
tcsetattr getting interrupted by a signal. Still allows us to
avoid hogging the tty if the command is part of a pipeline.
Todd C. Miller [Sun, 15 Nov 2009 21:42:17 +0000 (21:42 +0000)]
Use a socketpair to pass signals from parent to child. Child will
now pass command status change info back via the socketpair. This
allows the parent to distinguish between signals it has been sent
directly and signals the command has received. It also means the
parent can once again print the signal notifications to the tty so
all writes to the pty master occur in the parent. The command is
now always started in background mode with tty signals handled
by the parent.
Todd C. Miller [Wed, 4 Nov 2009 14:42:04 +0000 (14:42 +0000)]
Fix a few typos in the descriptions; from Jeff Makey
Only do the check for krb5_get_init_creds_opt_free() taking two
arguments if we find krb5_get_init_creds_opt_alloc(). Otherwise
we will get a false positive when using our own
krb5_get_init_creds_opt_free which takes only a single argument.
Todd C. Miller [Sun, 25 Oct 2009 14:55:14 +0000 (14:55 +0000)]
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.
Todd C. Miller [Sat, 24 Oct 2009 18:43:16 +0000 (18:43 +0000)]
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.
Todd C. Miller [Thu, 22 Oct 2009 00:58:41 +0000 (00:58 +0000)]
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.
Todd C. Miller [Sun, 18 Oct 2009 14:46:01 +0000 (14:46 +0000)]
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().