Todd C. Miller [Thu, 31 May 2012 18:02:26 +0000 (14:02 -0400)]
Debian fixes:
* fix modes to be more in line with what Debian expects
* add section
* install LICENSE as copyright and ChangeLog as changelog
* create stub changelog.debian
Todd C. Miller [Fri, 25 May 2012 20:24:42 +0000 (16:24 -0400)]
When replaying a log of stdout or stderr, do newline to carriage
return + linefeed conversion. We cannot have termios do this for
us since we've disabled output postprocessing (POST) when setting
raw mode.
Todd C. Miller [Mon, 21 May 2012 17:59:02 +0000 (13:59 -0400)]
If sudoers_mode is group-readable but the actual sudoers file is
not, open the file as uid 0, not uid 1. This fixes a problem when
sudoers has a more restrictive mode than what sudo expects to find.
In older versions, sudo would silently chmod the file to add the
group-readable bit.
Todd C. Miller [Thu, 17 May 2012 14:20:14 +0000 (10:20 -0400)]
Don't prompt for a password if the user is in the exempt group, is
root, or is running the command as themselves even if the -k option
was specified. This makes "sudo -k command" consistent with the
behavior one would get if the user ran "sudo -k" immediately before
running the command.
Todd C. Miller [Mon, 23 Apr 2012 20:38:16 +0000 (16:38 -0400)]
Call the policy's init_session() function before we fork the child.
That way, the session is created and destroyed in the same process,
which is needed by some modules, such as pam_mount.
Todd C. Miller [Mon, 23 Apr 2012 17:08:57 +0000 (13:08 -0400)]
Split global and per-connection LDAP options into separate arrays.
Set global LDAP options before calling ldap_initialize() or ldap_init().
After we have an LDAP handle, set the per-connection options.
Fixes a problem with OpenLDAP using the nss crypto backend; bug #342
Todd C. Miller [Fri, 20 Apr 2012 13:41:18 +0000 (09:41 -0400)]
Do not pass libtool the -static-libtool-libs option when building
sudo and sesh. Otherwise, libtool may prefer a static version of
an installed library over a dynamic one when linking.
Todd C. Miller [Mon, 16 Apr 2012 14:18:32 +0000 (10:18 -0400)]
Include sys/mkdev.h if present instead of sys/sysmacros.h for
minor(). This is needed on Solaris (at least) where the makedev
macros in sysmacros.h are obsolete and library functions should be
used instead.
Todd C. Miller [Fri, 13 Apr 2012 20:00:32 +0000 (16:00 -0400)]
When looking for a device match, do a breadth-first search instead
of depth-first. We already special case /dev/pts/ so chances are
good that if it is not a pseudo-tty it is in the base of /dev/.
Also avoid a stat(2) when possible if struct dirent has d_type.
Todd C. Miller [Wed, 11 Apr 2012 23:51:56 +0000 (19:51 -0400)]
Instead of treating ^C from tgetpass() specially, always
return AUTH_INTR if tgetpass() returned NULL.
Treat PAM_AUTHINFO_UNAVAIL like PAM_AUTH_ERR which Mac OS X
returns this when there is no tty.
Todd C. Miller [Wed, 11 Apr 2012 18:48:08 +0000 (14:48 -0400)]
Rototill code to determine the tty. For Linux, we now look up the
tty device in /proc/pid/stat instead of trying to open /proc/pid/fd/[0-2].
The sudo_ttyname_dev() function maps the given device number to a
string. On BSD, we can use devname(). On Solaris, _ttyname_dev()
does what we want.
TODO: write /dev/ traversal code for the generic sudo_ttyname_dev().
Todd C. Miller [Tue, 10 Apr 2012 18:35:30 +0000 (14:35 -0400)]
Better support for SVR4-style /proc entries where we can't use
ttyname() on the /proc/pid/fd/[0-2] entries. We can, however,
attempt to map the device number back to the correct pseudo-tty
slave device.
Todd C. Miller [Tue, 10 Apr 2012 14:18:39 +0000 (10:18 -0400)]
Linux select() may return ENOMEM if there is a kernel resource
shortage. Older Solaris select() may return EIO instead of EBADF
when the tty goes away. If we get an unhandled select() failure,
kill the child and exit cleanly.
Todd C. Miller [Fri, 6 Apr 2012 16:45:30 +0000 (12:45 -0400)]
Ignore SIGTTIN and SIGTTOU in main sudo process when I/O logging.
It is better to receive EIO from read()/write() than to be suspended
when we don't expect it. Fixes a problem when our terminal is
revoked which can happen when, e.g. our sshd is killed unceremoniously.
Also, only change the value of "alive" from true to false, never
from false to true. It is possible for us to receive notification
of the child having stopped after it is already dead. This does
not mean it has risen from the grave.