Commit Graph

841 Commits

Author SHA1 Message Date
Todd C. Miller
380fa828dc Sync with translationproject.org 2013-02-05 10:53:59 -05:00
Todd C. Miller
e96d583045 Sync with translationproject.org 2013-02-03 13:46:48 -05:00
Todd C. Miller
78ca828a3c Sync with translationproject.org 2013-02-01 16:00:50 -05:00
Todd C. Miller
23649bef16 Remove ttyname() fall back code on systems where we can query the
kernel for the tty device via /proc or sysctl().  If there is no
controlling tty, it is better to just treat the tty as unknown
rather than to blindly use what is hooked up to std{in,out,err}.
2013-01-31 11:05:56 -05:00
Todd C. Miller
630b47e22f Add group_source setting in sudo.conf to allow the admin to specify
how a user's groups are looked up.  Legal values are static (just
the kernel list from getgroups), dynamic (whatever the group database
includes) and adaptive (only use group db if kernel group list is
full).
2013-01-27 13:53:11 -05:00
Todd C. Miller
ef8e141248 Ignore duplicate entries in sudo.conf and report the line number
when there is an error.  Warn, don't abort if there is more than
one policy plugin.
2013-01-23 06:33:53 -05:00
Todd C. Miller
e764604485 Remove extra flag to sudo_sigaction(). We want to trap the signal
regardless of whether or not it is ignored by the underlying command
since there's no way to know what signal handlers the command will
install.  Now we just use sudo_sigaction() to set a flag in
saved_signals[] to indicate whether a signal needs to be restored
before exec.
2013-01-19 15:10:01 -05:00
Todd C. Miller
855a11af2b Move signal code into its own source file and add sudo_sigaction()
wrapper that has an extra flag to check the saved_signals list to
only install the handler if the signal is not already ignored.
Bump plugin API version for the new front-end signal behavior.
2013-01-17 13:29:46 -05:00
Todd C. Miller
99704cc101 Catch SIGINT, SIGQUIT and SIGTSTP in the front end before we execute
the command.  If we get SIGINT or SIGQUIT, call the plugin close()
functions as if the command was interrupted.  If we get SIGTSTP,
uninstall the handler and deliver SIGTSTP to ourselves.
2013-01-17 09:20:45 -05:00
Todd C. Miller
541315212e Rename handle_signals() to dispatch_signals().
Block other signals in handler() so we don't have to worry about
the write() being interrupted.
2013-01-17 09:17:54 -05:00
Todd C. Miller
2be741d8ae Rename signal handler to avoid name clash with one in exec.c 2013-01-16 15:28:36 -05:00
Todd C. Miller
90c6ace770 Add missing call to save_signals(). 2013-01-13 15:24:12 -05:00
Todd C. Miller
70976f30ea Fill in the comment block at the top of the .pot files and preserve
it when regenerating them.
2013-01-11 17:08:49 -05:00
Todd C. Miller
9479bb623b Add exec_background option in plugin command info and a sudoers
option to match.  When set, commands are started in the background
and automatically foregrounded as needed.  There are issues with
some ill-mannered programs (like Linux su) so this is not the
default.
2013-01-11 14:34:09 -05:00
Todd C. Miller
64bf4bb057 Add SESH_OBJS variable for sesh object files. 2013-01-11 14:28:52 -05:00
Todd C. Miller
8b3edcc4a8 Always resume the command in the foreground if sudo itself is the
foreground process.  This helps work around poorly behaved programs
that catch SIGTTOU/SIGTTIN but suspend themselves with SIGSTOP.  At
worst, sudo will go into the background but upon resume the command
will be runnable.  Otherwise, we can get into a situation where the
command will immediately suspend itself.
2013-01-11 10:09:06 -05:00
Todd C. Miller
6e560f2bab Break out stack smashing protector options into SSP_CFLAGS and
SSP_LDFLAGS so we can use it everywhere (unlike LT_LDFLAGS).
2013-01-03 14:20:49 -05:00
Todd C. Miller
782da0aa81 No need to restore default signal handler for SIGSTOP as it is not
catchable.  Attempting to do so is harmless but sigaction() will
fail and set errno to EINVAL which makes it looks like there is an
error.
2012-12-28 11:03:23 -05:00
Todd C. Miller
d129290ec3 Print SIGCONT_FG and SIGCONT_BG properly in debug output. 2012-12-28 11:01:36 -05:00
Todd C. Miller
1d7072fe09 Don't include <sys/param.h>. We only needed it for MAXPATHLEN,
MAXHOSTNAMELEN and the MIN/MAX macros.  We now use PATH_MAX and
HOST_NAME_MAX throughout without falling back on MAXPATHLEN or
MAXHOSTNAMELEN and define our own MIN/MAX macros as needed.
2012-12-04 10:40:47 -05:00
Todd C. Miller
3c9da162e4 Use MAX_HOST_NAME+1 (limits.h) instead of MAXHOSTNAMELEN (sys/param.h
or netdb.h).
2012-12-04 10:18:41 -05:00
Todd C. Miller
d3ab8b080b Define sudo_ttyname_dev() for the HAVE_STRUCT_PSINFO_PR_TTYDEV case
too.
2012-11-27 10:49:46 -05:00
Todd C. Miller
dd5d0eada7 Quiet a gcc warning and add comment about needing to keep the
handle open.
2012-11-27 10:29:55 -05:00
Todd C. Miller
2632ec7e69 Move warn/error into common and make static builds work. 2012-11-25 09:34:40 -05:00
Todd C. Miller
c2c6616a0c Move _sudo_printf from src/conversation.c to common/sudo_printf.c.
Add sudo_printf function pointer that is initialized to _sudo_printf()
instead of requiring a sudo_conv function pointer everywhere.  The
plugin will reset sudo_printf to point to the version passed in via
the plugin open function.  Now plugin_error.c can just call sudo_printf
in all cases.  The sudoers binaries no longer need their own version
of sudo_printf.
2012-11-25 09:34:33 -05:00
Todd C. Miller
88c6446daf Do locale swapping in the warning()/error() macros themselves instead
of in the underlying functions.
2012-11-25 09:34:15 -05:00
Todd C. Miller
4bde57b8b2 Rename warning2()/error2() -> warning_nodebug()/error_nodebug(). 2012-11-25 09:34:10 -05:00
Todd C. Miller
7b3d268687 Call gettext() on parameters for warning()/warningx() instead of
having warning() do it for us.
2012-11-25 09:34:04 -05:00
Todd C. Miller
3b5f786994 No need to change locale in front-end warning()/error(). 2012-11-25 09:25:15 -05:00
Todd C. Miller
8195fe1bd2 repair spacing 2012-11-13 08:54:31 -05:00
Todd C. Miller
acf8af9aac #unifdef HAVE_SETLOCALE, it is C89 so no need to check for it. 2012-11-12 08:51:58 -05:00
Todd C. Miller
c1db4b1546 Always include locale.h from gettext.h so we no longer need to
include locale.h from the .c files.
2012-11-11 20:23:53 -05:00
Todd C. Miller
83dde2fbb6 Add os-specific initialization functions for solaris (workaround
setuid locale problem in Solaris 11) and openbsd (set malloc_options
if SUDO_DEVEL).  Also move set_project() to solaris.c.
2012-11-11 07:11:22 -05:00
Todd C. Miller
595d3b2651 Display warning/error messages in the user's locale. 2012-11-08 15:37:44 -05:00
Todd C. Miller
f8660f9988 Add variants of warn/error and sudo_debug_printf that take a va_list
instead of a variable number of args.
2012-11-08 15:37:42 -05:00
Todd C. Miller
e6207003b1 The -a option should be #ifdef HAVE_BSD_AUTH_H, not -A. 2012-11-06 11:00:22 -05:00
Todd C. Miller
84eedd3f79 sudo_ttyname_dev() is unused if there is no /proc or sysctl(). 2012-10-02 15:29:52 -04:00
Todd C. Miller
a3a1574cdf Explicitly mark main() as public in executables to avoid an HP-UX
ld warning.
2012-10-02 15:08:02 -04:00
Todd C. Miller
592f6fefb0 Start commands in the background when I/O logging is enabled. We
can't do this on Mac OS X due to a kernel bug in tc[gs]etattr(2)
which returns EINTR on signal instead of restarting automatically.
2012-09-25 13:49:51 -04:00
Todd C. Miller
616d713e9b Handle SIGCONT_FG and SIGCONT_BG when converting signal number to
string in deliver_signal().
2012-09-25 13:31:20 -04:00
Todd C. Miller
0e94e8ca91 Fix running commands that need the terminal in the background when
I/O logging is enabled.  E.g. "sudo vi &".  When the command is
foregrounded, it will now resume properly.
2012-09-24 15:06:14 -04:00
Todd C. Miller
1d90c0ad71 No need to translate "unable to allocate memory" when we can just
use the system translation via strerror().
2012-09-17 16:59:26 -04:00
Todd C. Miller
885b6e7cda When setting the signal handler for SIGTSTP to the default value
in non-I/O log mode, store the old handler value for when we restore
it after resume.
2012-09-16 18:40:39 -04:00
Todd C. Miller
a71e685aa9 regen .po files 2012-09-01 17:10:36 -04:00
Todd C. Miller
ae21fb299d Silence compiler warnings. 2012-08-29 14:40:25 -04:00
Todd C. Miller
ab7dda035a Replace strsigname() with sig2str(), emulating it as needed. 2012-08-29 14:25:09 -04:00
Todd C. Miller
71e2d8290b Use fseeko() for legacy utmp handling if available. 2012-08-29 10:32:49 -04:00
Todd C. Miller
37269d662a Pass on SIGTSTP to the command if it was sent by a user process
(not the kernel or the terminal) when we are not I/O logging and
set the default SIGTSTP handler when we re-send the signal to
ourself, restoring our handler after we resume.
2012-08-27 11:22:33 -04:00
Todd C. Miller
29907e357c Shells typically change their process group when they start up so
that they can implement job control.  Most well-behaved shells
change the pgrp back to its original value before suspending so we
must not try to restore in that case, lest we race with the child
upon resume, potentially stopping sudo with SIGTTOU while the command
continues to run.  Some shells, such as pdksh, just suspend the
shell by sending SIGSTOP to themselves without restoring the pgrp.
In this case we need to change the pgrp back for them.
Should fix bug #568
2012-08-27 10:29:59 -04:00
Todd C. Miller
537dc94b9e Use strsigname() to print signal names in the debug output.
If the system has no strsigname(), use our own.
2012-08-26 20:12:51 -04:00