Todd C. Miller
5f857e6e54
Make SELinux support compile again. Needs more work to be complete.
2010-05-24 18:18:50 -04:00
Todd C. Miller
0487aee6b4
Bring back closefrom settings.
2010-05-24 15:40:36 -04:00
Todd C. Miller
8a8830e34f
Substitute @SHELL@ into Makefiles
2010-05-21 21:29:44 -04:00
Todd C. Miller
51b558e753
Update to libtool-2.2.6b. I haven't made any local modifications
...
this time, which should be OK since we install sudo_noexec.so by
hand now.
2010-05-21 17:59:47 -04:00
Todd C. Miller
6b370cb020
Use libtool to clean objects
2010-05-21 16:53:21 -04:00
Todd C. Miller
95d939f9bb
Install sudo_plugin.h as part of "make install" and make other install
...
targets callable from the top-level Makefile
2010-05-21 15:31:36 -04:00
Todd C. Miller
16c2769ed9
Close the I/O pipes aftering dup2()ing them to std{in,out,err}.
...
Fixes extra fds being present in the command when it is part of a pipeline.
2010-05-21 14:50:26 -04:00
Todd C. Miller
064cffd575
Cosmetic changes:
...
add comments, remove orphaned prototype and make a global static.
2010-05-21 12:01:11 -04:00
Todd C. Miller
a9a16d7331
Move check for maxfd == -1 to flush_output where it belongs.
2010-05-20 17:34:53 -04:00
Todd C. Miller
d18b458e1f
Break out of select loop if all the fds we want to select on are -1.
2010-05-20 17:13:22 -04:00
Todd C. Miller
20c125297f
Avoid possible malloc(0) if plugin returns an empty groups list.
2010-05-20 17:10:16 -04:00
Todd C. Miller
9360e67a3d
Add debugging info when calling plugin close function
2010-05-20 17:01:53 -04:00
Todd C. Miller
882fe3ac41
Avoid closing stdin/stdout/stderr when we are piping output.
2010-05-20 17:01:27 -04:00
Todd C. Miller
f8ff268318
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.
2010-05-20 07:33:14 -04:00
Todd C. Miller
0eec7335af
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.
2010-05-18 18:50:20 -04:00
Todd C. Miller
6a2a182e0f
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.
2010-05-18 17:43:10 -04:00
Todd C. Miller
55ef027d88
Add argc and argv to I/O logger open function.
2010-05-17 10:38:56 -04:00
Todd C. Miller
fa717176b2
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.
2010-05-17 10:25:27 -04:00
Todd C. Miller
3ac9aee52e
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.
2010-05-16 19:27:04 -04:00
Todd C. Miller
e336dac874
Attempt to fix building on systems that only have setuid.
2010-05-14 16:35:03 -04:00
Todd C. Miller
39652bf75f
Fix compilation on HP-UX
2010-05-13 20:10:21 -04:00
Todd C. Miller
7c9c5855fd
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.
2010-05-13 17:11:31 -04:00
Todd C. Miller
fdd28d411f
Work in progress support for sudoedit. The actual interface used by the
...
plugin for sudoedit is likely to change.
2010-05-13 14:09:21 -04:00
Todd C. Miller
396317ffe9
Avoid a potential race condition if SIGCHLD is received immediately
...
before we call select().
2010-05-12 11:13:40 -04:00
Todd C. Miller
8ea8de47fa
Fix pasto in mulitple signal fix and use _NSIG not NSIG since that
...
is what our compat checks set.
2010-05-11 13:33:42 -04:00
Todd C. Miller
cafc6a4f66
Fix SIGPIPE handling. Now that we use may use pipes for stdin/stdout
...
we need to pass any SIGPIPE we receive to the running command.
2010-05-11 08:59:59 -04:00
Todd C. Miller
02f8c187a5
Also start the command in the background if stdin is not a tty.
2010-05-11 08:12:02 -04:00
Todd C. Miller
c2d0888bf9
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).
2010-05-10 17:23:35 -04:00
Todd C. Miller
cbb3010d73
Use an array for signals received instead of a single variable so
...
we don't lose any when there are multiple different signals.
2010-05-10 15:13:48 -04:00
Todd C. Miller
5adda153ae
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).
2010-05-10 15:02:50 -04:00
Todd C. Miller
23a9bf2c07
Flush the iobufs on suspend or child exit using the same logic
...
as the main event loop.
2010-05-07 10:15:25 -04:00
Todd C. Miller
b08a96eea7
Free memory after we are done with it.
2010-05-07 10:14:12 -04:00
Todd C. Miller
3cbbf27e9d
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.
2010-05-05 16:11:13 -04:00
Todd C. Miller
b4d16ae1af
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.
2010-05-05 09:47:12 -04:00
Todd C. Miller
782f494003
Add separate I/O logging functions for tty in/out and stdin/stdout/stderr.
...
NOTE: stdin logging does not currently work and is disabled for now.
2010-05-05 07:29:28 -04:00
Todd C. Miller
9fbec34fed
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.
2010-05-04 19:17:31 -04:00
Todd C. Miller
e3f561668f
Only set user's tty to blocking mode when doing the final flush.
...
Flush pipes as well as pty master when the process is done.
2010-05-04 09:09:12 -04:00
Todd C. Miller
0eda64b235
Do not need the opost flag to term_copy() now that we use pipes for
...
stdout/stderr when they are not a tty.
2010-05-03 10:41:26 -04:00
Todd C. Miller
dd256f25ca
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.
2010-05-03 10:12:54 -04:00
Todd C. Miller
5475020561
Move audit sources into the sudoers plugin dir; the driver does not use them.
2010-04-30 15:38:33 -04:00
Todd C. Miller
d346e50903
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.
2010-04-30 15:13:47 -04:00
Todd C. Miller
23f9bb59ec
fmt_string is used by the sudoers plugin too so do not include sudo.h
...
(which is not really needed here anyway)
2010-04-30 13:40:57 -04:00
Todd C. Miller
5e9ec6a365
Fix building with non-BSD versions of make such as GNU make.
...
Requires VPATH support, which should be in any non-neolithic make.
2010-04-30 12:18:06 -04:00
Todd C. Miller
f42cf76d8a
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.
2010-04-30 12:01:15 -04:00
Todd C. Miller
0c7e3235f6
Remove extraneous $srcdir and use more .c.lo and .c.o rules instead
...
of explicit rules in the dependency.
2010-04-30 11:14:31 -04:00
Todd C. Miller
8fc1ebd4f4
Print signal info after restoring the tty mode, not before.
2010-04-29 16:52:50 -04:00
Todd C. Miller
f45b1e82ed
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
2010-04-29 16:47:27 -04:00
Todd C. Miller
935aef4983
Simplify dependencies by using .c.o and .c.lo rules.
2010-04-27 12:06:41 -04:00
Todd C. Miller
1c67169b9d
Substitute in @PROGS@ into src/Makefile to add sesh
2010-04-27 11:56:51 -04:00
Todd C. Miller
c8733dbc6e
Add sudo_noexec.la to "all" target, otherwise it only gets built
...
at install time.
2010-04-26 21:30:41 -04:00