Commit Graph

679 Commits

Author SHA1 Message Date
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
Todd C. Miller
81d42ae4e6 sync with translationproject.org 2012-08-22 12:56:28 -04:00
Todd C. Miller
57f1c7fe05 Sync with translationproject.org and add Italian sudoers translation. 2012-08-17 09:56:44 -04:00
Todd C. Miller
805039bec5 Add missing check for I/O plugin API version when checking for the
presence of I/O plugin hooks.
2012-08-13 14:44:54 -04:00
Todd C. Miller
f32aaed29d Can't call debug code in the process_hooks_xxx functions() since
ctime() may look up the timezone via the TZ environment variable.
2012-08-13 14:39:40 -04:00
Todd C. Miller
e4e815dd82 Include signal.h before sudo_exec.h since it uses sigset_t * in the
fork_pty prototype.
2012-08-10 15:29:07 -04:00
Todd C. Miller
66ad86594e regen 2012-08-10 13:18:19 -04:00
Todd C. Miller
ef33ee45d9 Sync with translationproject.org and add new Slovenian translation. 2012-08-10 13:07:53 -04:00
Todd C. Miller
a7424cc002 If sudo.conf contains an I/O plugin but no policy plugin, use sudoers
for the policy plugin.  If a policy plugin is specified without an
I/O plugin, only the policy plugin will be loaded.
2012-08-09 14:11:41 -04:00
Todd C. Miller
0655deab57 Fix a comment, update a variable name in a prototype; all cosmetic. 2012-08-07 14:47:58 -04:00
Todd C. Miller
dc08cf3c99 If we receive a signal from the command we executed, do not forward
it back to the command.  This fixes a problem with BSD-derived
versions of the reboot command which send SIGTERM to all other
processes, including the sudo process.  Sudo would then deliver
SIGTERM to reboot which would die before calling the reboot() system
call, effectively leaving the system in single user mode.
2012-08-06 14:38:35 -04:00
Todd C. Miller
5e502bd6d6 When checking whether a signal is user-generated, compare si_code
against SI_USER instead of <= 0 since on HP-UX, terminal-related
signals get a code of 0.
2012-07-31 13:36:48 -04:00
Todd C. Miller
9c321baa78 SuSE Enterprise Linux uses RLIMIT_NPROC and _SC_CHILD_MAX interchangably.
This causes problems when setting RLIMIT_NPROC to RLIM_INFINITY due
to a bug in bash where bash tries to honor the value of _SC_CHILD_MAX
but treats a value of -1 as an error, and uses a default value of
32 instead.

Previously, we just checked RLIMIT_NPROC and, if it was unlimited,
restored the previous value of RLIMIT_NPROC.  However, that makes
it impossible to set nproc to unlimited.  We now only restore the
nproc resource limit if sysconf(_SC_CHILD_MAX) is negative.  In
most cases, pam_limits will set RLIMIT_NPROC for us.
2012-07-31 11:11:25 -04:00