Todd C. Miller [Fri, 11 Jan 2013 19:34:09 +0000 (14:34 -0500)]
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.
Todd C. Miller [Fri, 11 Jan 2013 15:09:06 +0000 (10:09 -0500)]
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.
Todd C. Miller [Fri, 28 Dec 2012 16:03:23 +0000 (11:03 -0500)]
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.
Todd C. Miller [Tue, 4 Dec 2012 15:40:47 +0000 (10:40 -0500)]
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.
Todd C. Miller [Sun, 25 Nov 2012 14:34:33 +0000 (09:34 -0500)]
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.
Todd C. Miller [Sun, 25 Nov 2012 14:34:26 +0000 (09:34 -0500)]
Add plugin_setjmp() wrapper for siglongjmp(error_jmp, 1) so we don't
need error_jmp to be extern. Also add plugin_clearjmp() that clears
a flag so error()/errorx() knows when to call exit() vs. longjmp().
Todd C. Miller [Sun, 25 Nov 2012 14:33:52 +0000 (09:33 -0500)]
Allow sudoers programs (visudo, sudoreplay, visudo) to use
plugin_error.c instead of the error.c from the front-end. This
means sudoers_setlocale() needs to be independent of the sudo_user
struct and the defaults table. The sudoers locale is now updated
via a callback.
Todd C. Miller [Sun, 25 Nov 2012 14:33:33 +0000 (09:33 -0500)]
Include setjmp.h in sudoers.h
Move error_jmp into plugin_error.c
Rename sudoers_plugin_cleanup sudoers_cleanup
Make sudoers warning/error functions work when sudo_conv is NULL
Todd C. Miller [Mon, 12 Nov 2012 22:04:24 +0000 (17:04 -0500)]
Rename mkdir_parents() io_mkdirs() and add a flag to specify whether
path is a temporary, in which case the final component is created
via mkdtemp() instead of mkdir().
Todd C. Miller [Mon, 12 Nov 2012 14:41:56 +0000 (09:41 -0500)]
Add calls to set_perms(PERM_ROOT) becore logging to a file. We
should already be root but since we cache the current permission
status it is basically free. That way, if more of sudoers runs as
non-root in the future logging will still work correctly.
Todd C. Miller [Sun, 11 Nov 2012 12:11:22 +0000 (07:11 -0500)]
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.
Todd C. Miller [Thu, 8 Nov 2012 20:37:44 +0000 (15:37 -0500)]
Call gettext inside log_error et al instead of having the caller do it. This way we can display any messages to the user in their own locale but log in the sudoers local.
Todd C. Miller [Thu, 8 Nov 2012 20:37:43 +0000 (15:37 -0500)]
Convert setlocale() to sudoers_setlocale() in the sudoers module.
This only converts existing uses, there are more places where we
need to sprinkle sudoers_setlocale() calls.
Todd C. Miller [Thu, 8 Nov 2012 20:37:43 +0000 (15:37 -0500)]
Add simple locale switching to make it easy to switch from the
user's locale to the sudoers locale without making excessive
setlocale() calls when we don't need to.
Todd C. Miller [Tue, 6 Nov 2012 16:19:51 +0000 (11:19 -0500)]
Do not inform the user that the command was not permitted by the
policy if they do not successfully authenticate. This is a regression
introduced in sudo 1.8.6.
Todd C. Miller [Tue, 23 Oct 2012 14:21:24 +0000 (10:21 -0400)]
Use a list for the possible values of Tag_Spec with a minimal indent
to improve readability. In the pod version, these were =head3.
Also use .St -p1003.1 instead of just POSIX when talking about
glob() and fnmatch().