Todd C. Miller [Wed, 11 Jan 2012 20:40:42 +0000 (15:40 -0500)]
The device name returned by devname() does not include the /dev/
prefix so we need to add it ourselves. Also add debug warning if
KERN_PROC sysctl fails or devname() can't resolve the tty device
to a name.
Todd C. Miller [Fri, 6 Jan 2012 18:26:10 +0000 (13:26 -0500)]
Do not include GLOB_MARK in the flags we pass to glob(3). Fixes a
bug where a pattern like "/usr/*" include /usr/bin/ in the results,
which would be incorrectly be interpreted as if the sudoers file
had specified a directory. From Vitezslav Cizek.
Todd C. Miller [Fri, 6 Jan 2012 18:25:57 +0000 (13:25 -0500)]
Add --enable-kerb5-instance configure option to allow people using
Kerberos V authentication to use a custom instance. Adapted from
a diff by Michael E Burr.
Todd C. Miller [Thu, 5 Jan 2012 20:54:00 +0000 (15:54 -0500)]
Do not include GLOB_MARK in the flags we pass to glob(3). Fixes a
bug where a pattern like "/usr/*" include /usr/bin/ in the results,
which would be incorrectly be interpreted as if the sudoers file
had specified a directory. From Vitezslav Cizek.
Todd C. Miller [Thu, 5 Jan 2012 20:39:05 +0000 (15:39 -0500)]
Add --enable-kerb5-instance configure option to allow people using
Kerberos V authentication to use a custom instance. Adapted from
a diff by Michael E Burr.
Todd C. Miller [Wed, 4 Jan 2012 18:03:37 +0000 (13:03 -0500)]
When trying to determine the tty, fall back on /proc/ppid/fd/{0,1,2}
if the main process's fds 0-2 are not hooked up to a tty. Adapted
from a diff by Zdenek Behan.
Todd C. Miller [Wed, 4 Jan 2012 18:03:23 +0000 (13:03 -0500)]
When not logging I/O, put command in its own pgrp and make that the
controlling pgrp if the command is in the foreground. 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 [Wed, 4 Jan 2012 18:01:41 +0000 (13:01 -0500)]
When running a login shell with a login_class specified, use
LOGIN_SETENV instead of rolling our own login.conf setenv support
since FreeBSD's login.conf has more than just setenv capabilities.
This requires us to swap the plugin-provided envp for the global
environ before calling setusercontext() and then stash the resulting
environ pointer back into the command details, which is kind of a
hack.
Todd C. Miller [Wed, 4 Jan 2012 17:57:06 +0000 (12:57 -0500)]
Handle different Unix domain socket (actually socketpair) semantics
in BSD vs. Linux. In BSD if one end of the socketpair goes away
select() returns the fd as readable and the read will fail with
ECONNRESET. This doesn't appear to happen on Linux so if we notice
that the monitor process has died when I/O logging is enabled,
behave like the command has exited. This means we log the wait
status of the monitor, not the command, but there is nothing else
we can do at that point. This should only be an issue if SIGKILL
is sent to the monitor process.
Todd C. Miller [Wed, 4 Jan 2012 17:56:54 +0000 (12:56 -0500)]
Catch common signals in the monitor process so they get passed to
the command. Fixes a problem when the entire login session is
killed when ssh is disconnected or the terminal window is closed.
Previously, the monitor would exit and plugin's close method would
not be called.
Todd C. Miller [Wed, 4 Jan 2012 17:56:09 +0000 (12:56 -0500)]
Add support for setenv entries in login.conf. We can't use LOGIN_SETENV
since the plugin sets up the envp the command is executed with.
Also regen the Makefile.in files while here. Fixes bug #527
Todd C. Miller [Wed, 4 Jan 2012 17:54:54 +0000 (12:54 -0500)]
Fetch the login class for the user we authenticate specifically when
using BSD authentication. That user may have a different login class
than what we will use to run the command. When setting the login
class for the command, use the target user's struct passwd, not
the invoking user's. Fixes bug 526