Todd C. Miller [Wed, 14 Apr 2010 10:24:27 +0000 (06:24 -0400)]
Set errorfile to the sudoers path if we set parse_error manually.
This prevents a NULL dereference in printf() when checking a sudoers
file in strict mode when alias errors are present.
Todd C. Miller [Fri, 9 Apr 2010 10:10:07 +0000 (06:10 -0400)]
Qualify the command even if it is in the current working directory,
e.g. "./foo" instead of just returning "foo". This removes an ambiguity
between real commands and possible pseudo-commands in command matching.
Todd C. Miller [Mon, 8 Mar 2010 19:27:30 +0000 (14:27 -0500)]
Use parent process group id instead of parent process id when checking
foreground status and suspending parent. Fixes an issue when running
commands under /usr/bin/time and others.
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().
Todd C. Miller [Wed, 14 Oct 2009 13:01:04 +0000 (13:01 +0000)]
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.
Todd C. Miller [Sun, 11 Oct 2009 21:41:36 +0000 (21:41 +0000)]
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.