Todd C. Miller [Thu, 3 Jun 2010 15:31:22 +0000 (11:31 -0400)]
Pass in output function to lbuf_init() instead of writing to stdout.
A side effect is that the usage info can now go to stderr as it
should. Add support for embedded newlines in lbuf and use that
instead of multiple calls to lbuf_print.
Todd C. Miller [Thu, 3 Jun 2010 12:00:31 +0000 (08:00 -0400)]
Store info from stat(2)ing the tty in the tty ticket when tty tickets
are in use. If the tty lives on a devpts (Linux) or devices (Solaris)
filesystem, stash the ctime in the tty ticket file, as it is not
updated when the tty is written to. This helps us determine when
a tty has been reused without the user authenticating again with
sudo.
Todd C. Miller [Wed, 2 Jun 2010 14:25:20 +0000 (10:25 -0400)]
HP-UX ld uses +b instead or -R or -rpath
Fix typo in libvas check
libvas may need libdl for dlopen()
Add missing template for ENV_DEBUG
Adapted from Quest sudo
Todd C. Miller [Fri, 28 May 2010 13:45:01 +0000 (09:45 -0400)]
Handle duplicate variables in the environment. For unsetenv(),
keep looking even after remove the first instance. For sudo_putenv(),
check for and remove dupes after we replace an existing value.
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.