Todd C. Miller [Mon, 3 May 2010 14:12:54 +0000 (10:12 -0400)]
Use pipes to the sudo process if stdout or stderr is not a tty.
Still needs some polishing and a decision as to whether it is
desirable to add additonal entry points for logging stdout/stderr/stdin
when they are not ttys. That would allow a replay program to keep
things separate and to know whether the terminal needs to be in raw
mode at replay time.
Todd C. Miller [Fri, 30 Apr 2010 19:13:47 +0000 (15:13 -0400)]
Use angle brackets when including headers that can only be found when
an -I flag is specified. The files in the compat dir could get away
with double quotes here but I've converted all the source files
to use angle brackets for consistency.
Todd C. Miller [Fri, 30 Apr 2010 17:53:33 +0000 (13:53 -0400)]
Hack around VPATH semantic differences by symlinking files we need from
../../src into the current directory and build those. A better fix would
be to either make a .a or .la file with those files in it or simply
use a single, flat, Makefile instead of per-subdirs Makefiles.
Todd C. Miller [Fri, 30 Apr 2010 16:01:15 +0000 (12:01 -0400)]
Re-enable bsm audit. Currently auditing is done within the sudoers
plugin itself. If possible, this should really be done in the main
driver but we don't presently have the needed data to do that. This
will be re-evaluated when Linux audit support is added.
Todd C. Miller [Thu, 29 Apr 2010 20:47:27 +0000 (16:47 -0400)]
Defer call to alarm() until after we fork the child.
Pass correct pid to terminate_child()
If the command exits due to signal, set alive to false like we do when it
exits normally.
Add missing check for errpipe[0] != -1 before using it in FD_ISSET
Todd C. Miller [Sat, 24 Apr 2010 23:05:11 +0000 (19:05 -0400)]
Don't stash ctime in on-disk tty ticket info for now; on many (most?)
systems the ctime is updated when the tty is written to. Once I
have a better idea of what systems do not update ctime on ttys (and
have a way to test for this) the ctime stash will be conditionally
re-enabled.
Todd C. Miller [Thu, 22 Apr 2010 14:16:18 +0000 (10:16 -0400)]
Store info from stat(2)ing the tty in the tty ticket when tty tickets
are in use. On most systems, this closes the loophole whereby a user
can log out of a tty, log back in and still have the timestamp be valid.
Todd C. Miller [Tue, 20 Apr 2010 21:00:31 +0000 (17:00 -0400)]
Convert perm setting to push/pop model; still needs some work
Use the stashed runas groups instead of using getgrouplist()
Reset perms to the initial value on error
Todd C. Miller [Wed, 14 Apr 2010 10:38:32 +0000 (06:38 -0400)]
Add workaround for the lack of the environ pointer on Mac OS X
in dlopen()ed modules. Use of environ in the sudoers plugin should
ultimately be removed but this will do for the moment.
Todd C. Miller [Wed, 14 Apr 2010 10:24:42 +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 [Tue, 13 Apr 2010 10:31:55 +0000 (06:31 -0400)]
If execve fails in logging mode, pass the errno directly to the grandparent
on the backchannel and exit. The immediate parent will get SIGCHLD and
try to report that status but its parent will no longer be listening.
It would probably be cleaner to pass this over a pipe in script_child().
Todd C. Miller [Sat, 10 Apr 2010 14:31:47 +0000 (10:31 -0400)]
Only need to take action on SIGCHLD in parent if no I/O logger.
If there is an I/O logger we will receive ECONNRESET or EPIPE when
we try to read from the socketpair.
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 [Thu, 8 Apr 2010 11:40:04 +0000 (07:40 -0400)]
Better signal handling.
Instead of using a single variable to store the received signal, use
an array so we can't lose a signal when multiple are sent.
Fix process termination by SIGALRM in non-I/O logger mode.
Fix relaying terminal signals to the child in non-I/O logger mode.
Todd C. Miller [Thu, 8 Apr 2010 10:12:47 +0000 (06:12 -0400)]
Fix a race between when we get the child pid in the parent and when
the child process exits. The problem exhibited as a hang after a
short-lived process, e.g. "sudo id" when no IO logger was enabled.
Todd C. Miller [Sun, 4 Apr 2010 12:40:23 +0000 (08:40 -0400)]
Free str after using it in the version method. Use sudo_conv, not
io_conv since we don't have the IO conversation function pointer
in the I/O version method anymore now that io_open is delayed.
Todd C. Miller [Wed, 31 Mar 2010 16:43:26 +0000 (12:43 -0400)]
Unlike most operating systems, HP-UX select() is not interrupted
by SIGCHLD when the signal is registered with SA_RESTART. If
we clear SA_RESTART when calling sigaction() for SIGCHLD we get
the expected behavior and the code in the select() loops already
handles EINTR correctly.