Todd C. Miller [Tue, 24 Feb 2015 18:19:21 +0000 (11:19 -0700)]
We cannot (easily) use clock_gettime(CLOCK_MONOTONIC) directly as
it may be present but not implemented. Add sudo_gettime_real() and
sudo_gettime_mono() functions to get the real and monotonic times
respectively. Now sudo_gettime_mono() checks the value of
sysconf(_SC_MONOTONIC_CLOCK) before calling clock_gettime(CLOCK_MONOTONIC)
and falls back on sudo_gettime_real() as needed. The Mach version
of sudo_gettime_mono() uses mach_absolute_time().
This should fix problems with timestamp files on systems where
the CLOCK_MONOTONIC is defined but not actually implemented.
Todd C. Miller [Mon, 23 Feb 2015 18:12:45 +0000 (11:12 -0700)]
Pam conversation function changes:
o use PAM_BUF_ERR as the return value when calloc() fails.
o sanity check the value of num_msg
o remove the workaround for old Apple PAM
o PAM_AUTH_ERR is not a valid PAM conversation function return value
If getpass_error is set after a call to pam_verify (usually because
the user pressed ^C), return AUTH_INTR immediately instead of
checking the pam_verify return value.
Todd C. Miller [Mon, 23 Feb 2015 18:12:43 +0000 (11:12 -0700)]
On AIX use the value of auth_type in /etc/security/login.cfg to
determine whether to use LAM or PAM unless the user specified the
--with-pam or --with-aixauth configure flags.
Todd C. Miller [Thu, 19 Feb 2015 21:17:57 +0000 (14:17 -0700)]
Historically, crypt() returned the empty string on error, which
ensured that crypt("", "") would return "", which supported matcing
empty encrypted passwords with no additional code. Some modern
versions of crypt() (such as glibc) return NULL on error so we need
an explicit test to match an empty plaintext password and an empty
encrypted password.
Todd C. Miller [Mon, 16 Feb 2015 03:30:11 +0000 (20:30 -0700)]
Add mail_all_cmnds to always mail when a user runs a command (or
tries to) including sudoedit. The mail_always flag goes back to
its old semantic of always mailing when sudo is run.
Todd C. Miller [Thu, 19 Feb 2015 16:59:25 +0000 (09:59 -0700)]
Almost no systems actually define OPEN_MAX since it is dynamic on
modern OSes. If sysconf(_SC_OPEN_MAX) ever fails, fall back on
_POSIX_OPEN_MAX instead. We can assume modern systems have sysconf().
Also remove checks for strrchr() and strtoll() for which the HAVE_*
defines are no longer used.
Todd C. Miller [Fri, 6 Feb 2015 18:01:05 +0000 (11:01 -0700)]
Sanity check the TZ environment variable by special casing it in
env_check. The --with-tzdir configure option can be used to
specify the zoneinfo directory if configure doesn't find it.
Todd C. Miller [Thu, 5 Feb 2015 18:17:26 +0000 (11:17 -0700)]
Fix a potential crash when getpwnam() of the running user fails
and we don't replace the negative cached entry with a faked up one.
From Stephane Chazelas
Todd C. Miller [Thu, 5 Feb 2015 18:17:24 +0000 (11:17 -0700)]
Handle sudo_get_grlist() returning NULL which can happen if
getgrouplist() fails even after allocating the appropriate amount
of memory. From Stephane Chazelas
Todd C. Miller [Fri, 30 Jan 2015 20:07:21 +0000 (13:07 -0700)]
Avoid setting the tty to non-blocking mode so "sudoreplay | cat"
(for example) works as expected. We only read a single byte from
the keyboard and only when interactive anyway so this should be fine.
Todd C. Miller [Fri, 30 Jan 2015 17:45:15 +0000 (10:45 -0700)]
Avoid a cppcheck warning about undefined behavior (using the address
of a stack buffer - 1) and fix a memory leak of the iov when
doing nl->crnl conversion.
Todd C. Miller [Thu, 29 Jan 2015 21:08:30 +0000 (14:08 -0700)]
Add support for querying netgroups directly via LDAP since there
is no other way to look up all the netgroups for a user (unlike
regular groups). This introduces netgroup_base and netgroup_search_filter
options to ldap.conf. Based on a diff from Steven Soulen.
Todd C. Miller [Wed, 10 Dec 2014 21:00:12 +0000 (14:00 -0700)]
Remove artificial limit on length of pattern and string. It is
possible to use fnmatch() on things other than paths (such as
arguments) so a limit of PATH_MAX does not make sense. Fixes a bug
where rules would fail to match if the length of the arguments were
larger than PATH_MAX (usually 1024).