Commit Graph

194 Commits

Author SHA1 Message Date
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
Todd C. Miller
03536ca93e Update clean and cleandir targets 2010-04-23 22:55:34 -04:00
Todd C. Miller
4b04e875ed Move fileops.c defines and prototypes to filesops.h 2010-04-23 06:02:39 -04:00
Todd C. Miller
b4a26b7691 Use timeval directly instead of converting to timespec when dealing
with file times and time of day.
2010-04-20 16:44:02 -04:00
Todd C. Miller
bc813db528 Add a "noninteractive" boolean to the settings passed in to the plugin's
open function that is set when the user specifies the -n flag.
2010-04-14 08:41:53 -04:00
Todd C. Miller
ea523b17a4 Use a pipe to pass back errno to the parent if execve() fails.
If we get an error in script_child(), kill the command and exit.
2010-04-13 19:40:32 -04:00
Todd C. Miller
f19be6da31 Handle plugin's open function returning -2 (usage error). 2010-04-13 09:36:43 -04:00
Todd C. Miller
40533f381e If execve() fails, leave it to the plugin to print an error string. 2010-04-13 07:39:06 -04:00
Todd C. Miller
e472e4ae01 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().
2010-04-13 06:31:55 -04:00
Todd C. Miller
7ce802792e NULL-terminate env_add 2010-04-12 07:56:32 -04:00
Todd C. Miller
0494774f30 Call the I/O log open function before the I/O version function. 2010-04-11 17:13:11 -04:00
Todd C. Miller
711b8d1c04 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.
2010-04-10 10:31:47 -04:00
Todd C. Miller
93126eb5ab Don't set SA_RESTART when registering SIGALRM handler.
Do set SA_RESTART when registering SIGWINCH handler.
2010-04-08 20:17:26 -04:00
Todd C. Miller
b457f13718 If log_input or log_output returns false, terminate the command. 2010-04-08 09:40:27 -04:00
Todd C. Miller
5b3d150932 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.
2010-04-08 07:40:04 -04:00
Todd C. Miller
a3f4278388 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.
2010-04-08 06:12:47 -04:00
Todd C. Miller
2634cf08cc Avoid installing signal handlers that are io-logger specific. Fixes
job control when no io logger is enabled.
2010-04-05 16:27:30 -04:00
Todd C. Miller
43b6359df3 Fix out-of-tree builds 2010-04-04 14:01:21 -04:00
Todd C. Miller
8c91f0a30c Create our own sys_siglist for systems without it for use by strsignal() 2010-04-02 07:47:19 -04:00
Todd C. Miller
44341c9c15 Main sudo should not block signals; the plugin should do this in
check_policy.
2010-04-01 06:35:19 -04:00
Todd C. Miller
ca2eee07b5 Fix a sizeof(ptr) vs. sizeof(*ptr) 2010-03-31 20:30:34 -04:00
Todd C. Miller
c3e87c2db3 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.
2010-03-31 12:43:26 -04:00
Todd C. Miller
6c71d6afa4 Load the sudoers I/O plugin by default too now that it is hooked up. 2010-03-31 05:42:58 -04:00
Todd C. Miller
5d6f19671c It looks like AIX doesn't need to push STREAMS modules for ptys. 2010-03-30 12:06:27 -04:00
Todd C. Miller
e17f1e5cbd Delay calling the I/O plugin open function until the policy plugin
returns success.
2010-03-28 08:41:06 -04:00
Todd C. Miller
43ea59f64f Fix iteration over runas_groups list. 2010-03-22 18:08:17 -04:00
Todd C. Miller
7af5cdfaf4 Fix setting of groups list 2010-03-22 08:26:05 -04:00
Todd C. Miller
4b36657781 Pass in preserve_groups when the -P flag is specified as per the design 2010-03-22 08:11:06 -04:00
Todd C. Miller
74ce00482f term.c does not needto include sudo.h 2010-03-21 12:57:00 -04:00
Todd C. Miller
6b180d24da Fix the -s and -i flags and add support for the "implied_shell"
option.  If the user does not specify a command, sudo will now pass
in the path to the user's shell and set impied_shell=true.  The
plugin can them either check the command normally or return -2 to
cause sudo to print a usage message and exit.
2010-03-21 08:54:06 -04:00
Todd C. Miller
2e27226a0d Bring back SUDOERS_PLUGIN but add .dylib -> .so conversion for
Darwin where libraries end in .dylib but modules end in .so
2010-03-19 20:01:00 -04:00
Todd C. Miller
eec5235d19 Rewrite compat/getprogname.c and add setprogname().
The progname is now passed to the plugin via the settings array.
2010-03-19 07:52:31 -04:00
Todd C. Miller
6f771f39b3 Add support for embedded newlines. 2010-03-19 06:59:02 -04:00
Todd C. Miller
5be1b80169 Hard-code sudoers.so instead of using SUDOERS_PLUGIN since libtool
appears to always install a shared object with the .so suffix.
2010-03-18 12:02:05 -04:00
Todd C. Miller
ba9d2f5bb6 Play more nicely with libtool and let it build libreplace (was libmissing)
for us.
2010-03-18 11:42:12 -04:00
Todd C. Miller
b4f4afdf69 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.
2010-03-18 06:42:17 -04:00