Todd C. Miller [Thu, 8 Mar 2012 16:30:21 +0000 (11:30 -0500)]
Disable environment hooks after we get user_env back to make sure
a plugin can't to modify user_env after we "own" it. This is kind
of a hack but we don't want the init_session plugin function to
modify user_env.
Todd C. Miller [Wed, 7 Mar 2012 21:35:42 +0000 (16:35 -0500)]
Initial cut at a hooks implementation. The plugin can register
hooks for getenv, putenv, setenv and unsetenv. This makes it
possible for the plugin to trap changes to the environment made by
authentication methods such as PAM or BSD auth so that such changes
are reflected in the environment passed back to sudo for execve().
Todd C. Miller [Fri, 2 Mar 2012 16:04:09 +0000 (11:04 -0500)]
Add support for plugin args at the end of a Plugin line in sudo.conf.
Bump the minor number accordingly and update the documentation. A
plugin must check the sudo front end's version before using the
plugin_args parameter since it is only supported for API version
1.2 and higher.
Todd C. Miller [Tue, 28 Feb 2012 19:16:39 +0000 (14:16 -0500)]
Check the owner and mode in -c (check) mode unless the -f option
is specified. Previously, the owner and mode were checked on the
main sudoers file when the -s (strict) option was given, but this
was not documented.
Todd C. Miller [Mon, 27 Feb 2012 18:28:15 +0000 (13:28 -0500)]
We need sysconfdir in compat/Makfile to get the proper sudo.conf
path. Add standard prefix and foodir expansion in all Makefiles
to avoid this problem in the future.
Todd C. Miller [Wed, 22 Feb 2012 18:04:03 +0000 (13:04 -0500)]
Relax the user/group/mode checks on sudoers files. As long as the
file is owned by the right user, not world-writable and not writable
by a group other than the one specified at configure time (gid 0
by default), the file is considered OK. Note that visudo will still
set the mode to the value specified at configure time.
Todd C. Miller [Tue, 21 Feb 2012 18:26:02 +0000 (13:26 -0500)]
Check for LD_PRELOAD variants in configure instead of checkign cpp
symbols. In disable_execute(), compute the length of the new envp
and allocate it once instead of reallocating on demand. Also append
old value of LD_PRELOAD (if any) to the new value.
Todd C. Miller [Thu, 9 Feb 2012 16:11:58 +0000 (11:11 -0500)]
Use -m not -M for install-sh for everything except setuid.
Install locale .mo files mode 0444, not 0644.
If timedir parent doesn't exist, use default dir mode, not 0700.
Todd C. Miller [Mon, 6 Feb 2012 20:46:17 +0000 (15:46 -0500)]
More complete fix for LDR_PRELOAD on AIX. The addition of
set_perm(PERM_ROOT) before calling the nss open functions (needed
to avoid a GNU TLS bug) also broke LDR_PRELOAD. Setting the effective
and then real uid to 0 for PERM_ROOT works around the issue.
Todd C. Miller [Mon, 6 Feb 2012 18:33:46 +0000 (13:33 -0500)]
Set real uid to root before calling sudo_edit() or run_command()
so that the monitor process is owned by root and not by the user.
Otherwise, on AIX at least, the monitor process shows up in ps as
belonging to the user (and can be killed by the user).
Todd C. Miller [Mon, 6 Feb 2012 18:29:19 +0000 (13:29 -0500)]
For PERM_ROOT when using setreuid(), only set the euid to 0 prior
to the call to setuid(0) if the current euid is non-zero. This
effectively restores the state of things prior to rev 7bfeb629fccb.
Fixes a problem on AIX where LDR_PRELOAD was not being honored for
the command being executed.
Todd C. Miller [Fri, 3 Feb 2012 19:57:03 +0000 (14:57 -0500)]
Normally, sudo disables core dumps while it is running. This
behavior can now be modified at run time with a line in sudo.conf
like "Set disable_coredumps false"
Todd C. Miller [Wed, 1 Feb 2012 16:27:50 +0000 (11:27 -0500)]
Error out if user specified --with-pam but we can't find the headers
or library. Also throw an error if the headers are present but the
library is not and vice versa.
Todd C. Miller [Wed, 25 Jan 2012 21:29:08 +0000 (16:29 -0500)]
The change in 818e82ecbbfc that caused to exit when the monitor
dies created a race condition between the monitor exiting and the
status being read. All we really want to do is make sure that
select() notifies us that there is a status change when the monitor
dies unexpectedly so shutdown the socketpair connected to the monitor
for writing when it dies. That way we can still read the status
that is pending on the socket and select() on Linux will tell us
that the fd is ready.
Todd C. Miller [Wed, 25 Jan 2012 19:58:02 +0000 (14:58 -0500)]
Refactor disable_execute() and my_execve() into exec_common.c for
use by sesh.c. This fixes NOEXEC when SELinux is used. Instead
of disabling exec in exec_setup(), disable it immediately before
executing the command. Adapted from a diff by Arno Schuring.
Todd C. Miller [Fri, 20 Jan 2012 15:28:56 +0000 (10:28 -0500)]
Add custom version of AC_CHECK_LIB that uses the extra libs in the
cache value name. With this we no longer need to rely on a modified
version of autoconf.
Todd C. Miller [Thu, 19 Jan 2012 16:03:22 +0000 (11:03 -0500)]
For "sudo -g" prepend the specified group ID to the beginning of
the groups list. This matches BSD convention where the effective
gid is the first entry in the group list. This is required on newer
FreeBSD where the effective gid is not tracked separately and thus
setgroups() changes the egid if this convention is not followed.
Fixes bug #532
Todd C. Miller [Tue, 17 Jan 2012 15:27:33 +0000 (10:27 -0500)]
When not logging I/O, use a signal handler that only forwards SIGINT,
SIGQUIT and SIGHUP when they are user-generated signals. Fixes a
race in the non-I/O logging path where the command may receive two
keyboard-generated signals; one from the kernel and one from the
sudo process.
Todd C. Miller [Mon, 16 Jan 2012 15:40:11 +0000 (10:40 -0500)]
Only run compat regress tests on compat objects we actually build.
Fixes "make check" in the compat dir for systems that don't implement
character classes in fnmatch() or glob(). Bug #531
Todd C. Miller [Fri, 13 Jan 2012 14:49:20 +0000 (09:49 -0500)]
Include parent directories in case they don't already exist. This
fixes a directory permissions problem with the AIX package when the
/usr/local directories don't already exist.
Todd C. Miller [Thu, 12 Jan 2012 12:50:40 +0000 (07:50 -0500)]
Add a check for devname() returning a fully-qualified pathname.
None of the devname() implementations do this today but you never
know when this might change.