Todd C. Miller [Mon, 27 Aug 2012 19:38:57 +0000 (15:38 -0400)]
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.
Todd C. Miller [Mon, 27 Aug 2012 19:33:31 +0000 (15:33 -0400)]
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
Todd C. Miller [Wed, 22 Aug 2012 16:47:18 +0000 (12:47 -0400)]
Move log_denial() calls and logic to log_failure().
Move authentication failure logging to log_auth_failure().
Both of these call audit_failure() for us.
This subtly changes logging for commands that are denied by sudoers
but where the user failed to enter the correct password. Previously,
these would be logged as "N incorrect password attempts" but now
are logged as "command not allowed". Fixes bug #563
Todd C. Miller [Fri, 17 Aug 2012 14:31:34 +0000 (10:31 -0400)]
Add new check_defaults() function to check (but not update) the
Defaults entries. Visudo can now use this instead of update_defaults
to check all the defaults regardless instead of just the global
Defaults entries.
Todd C. Miller [Tue, 7 Aug 2012 17:43:55 +0000 (13:43 -0400)]
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.
Todd C. Miller [Tue, 31 Jul 2012 17:36:59 +0000 (13:36 -0400)]
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.
Todd C. Miller [Mon, 30 Jul 2012 15:15:14 +0000 (11:15 -0400)]
Active Directory apparently requires that tenths of a second be
present in a date so append .0 to the "now" value in the time filter.
Also remove space for the global AND from TIMEFILTER_LENGTH since
it was not being used consistently. Buffers of TIMEFILTER_LENGTH
now need to account for the terminating NUL byte.
Todd C. Miller [Fri, 29 Jun 2012 16:55:22 +0000 (12:55 -0400)]
Add support for ldaps using Tivoli LDAP libraries.
Add ldap.conf option to specify Tivoli key db password.
Allow TLS ciphers to be configured for Tivoli.
Todd C. Miller [Thu, 28 Jun 2012 18:58:34 +0000 (14:58 -0400)]
Treat LDAP_OPT_CONNECT_TIMEOUT (Tivoli Directory Server 6.3) the
same as LDAP_OPT_CONNECT_TIMEOUT (OpenSSH).
Don't make failure to a set an ldap option fatal.
Todd C. Miller [Thu, 31 May 2012 20:58:22 +0000 (16:58 -0400)]
Quiet lintian warnings for .deb files:
* install sudoedit and the sudoedit manual as symbolic links, not
hard links and package them as such.
* set -e in %pos and %preun for debian
* add lintian overrides file
* fix modes to be more in line with what Debian expects
* add correct section
* install LICENSE as copyright and ChangeLog as changelog
* create stub changelog.debian
Todd C. Miller [Thu, 31 May 2012 20:51:15 +0000 (16:51 -0400)]
Replace out of date MAN_POSTINSTALL with MANCOMPRESS and MANCOMPRESSEXT
which can be used to compress the installed manual pages.
Compress the man pages for .deb files to appease lintian.
Todd C. Miller [Fri, 25 May 2012 20:38:55 +0000 (16:38 -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 [Wed, 23 May 2012 19:37:24 +0000 (15:37 -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 [Wed, 23 May 2012 19:06:11 +0000 (15:06 -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 [Wed, 23 May 2012 18:21:07 +0000 (14:21 -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.
Todd C. Miller [Wed, 23 May 2012 18:17:41 +0000 (14:17 -0400)]
Don't try to restore the terminal if we are not the foreground
process. Otherwise, we may be stopped by SIGTTOU when we try to
update the terminal settings when cleaning up.