Todd C. Miller [Tue, 11 May 2010 18:25:14 +0000 (14:25 -0400)]
If the tty lives on a devpts 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 [Tue, 11 May 2010 16:11:03 +0000 (12:11 -0400)]
Link with -lpthread on HP-UX since a plugin may be linked with -lpthread
and dlopen() will fail if the shared object has a dependency on -lpthread
but the main program is not linked with it.
Todd C. Miller [Mon, 10 May 2010 21:23:35 +0000 (17:23 -0400)]
No need to use pseudo-cbreak mode now that we use pipes when stdout is
not a tty. Instead, check whether stdin is a tty and if not, delay
setting the tty to raw mode until the command tries to access it itself
(and receives SIGTTIN or SIGTTOU).
Todd C. Miller [Mon, 10 May 2010 19:02:50 +0000 (15:02 -0400)]
Do signal setup after turning off echo, not before. If we are using
a tty but are not the foreground pgrp this will generate SIGTTOU
so we want the default action to be taken (suspend process).
Todd C. Miller [Wed, 5 May 2010 20:11:13 +0000 (16:11 -0400)]
Go back to reseting io_buffer offset and length (and now also the
EOF handling) in the loop we do the FD_SET, not after we drain the
buffer after write() since we don't know what order reads and writes
will occur in.
Todd C. Miller [Wed, 5 May 2010 13:47:12 +0000 (09:47 -0400)]
Add support for logging stdin when it is not a tty.
There is still a bug where "cat | sudo cat" has problems because
both cat and sudo are trying to read from the tty.
Todd C. Miller [Tue, 4 May 2010 23:17:31 +0000 (19:17 -0400)]
Add pointer to a printf like function to plugin open functon.
This can be used instead of the conversation function to display
info and error messages.
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.