Todd C. Miller [Fri, 21 May 2010 16:19:55 +0000 (12:19 -0400)]
Set user_tty to "unknown" if there is no tty, like sudo 1.7 does
(it is used when logging). Note that user_ttypath will still be
NULL if there is no tty.
Todd C. Miller [Thu, 20 May 2010 11:33:14 +0000 (07:33 -0400)]
When execve() of the command fails, it is possible to receive SIGCHLD
before we've read the error status from the pipe. Re-order things
such that we send the final status at the very end and prefer error
status over wait status.
Todd C. Miller [Tue, 18 May 2010 22:50:20 +0000 (18:50 -0400)]
Additional checks to make sure we don't close /dev/tty by mistake.
When flushing, sleep in select as long as we have buffers that need
to be written out.
Todd C. Miller [Tue, 18 May 2010 21:43:10 +0000 (17:43 -0400)]
Now that we can use pipes for stdin/stdout/stderr there is no
longer a need to error out when there is no tty. We just need
to make sure we don't try to use the tty fd if it is -1.
Todd C. Miller [Mon, 17 May 2010 14:25:27 +0000 (10:25 -0400)]
Remove check_sudoedit function pointer in struct sudo_policy.
Instead, sudo will set sudoedit=true in the settings array.
The plugin should check for this and modify argv_out as appropriate
in check_policy.
Todd C. Miller [Sun, 16 May 2010 23:27:04 +0000 (19:27 -0400)]
If plugin sets "sudoedit=true" in the command info, enable
sudoedit mode even if not invoked as sudoedit. This allows
a plugin to enable sudoedit when the user runs an editor.
Todd C. Miller [Thu, 13 May 2010 21:11:31 +0000 (17:11 -0400)]
Change how we handle the sudoedit argv. We now require that there
be a "--" in argv to separate the editor and any command line arguments
from the files to be edited.
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.