Commit Graph

2114 Commits

Author SHA1 Message Date
Todd C. Miller
02d917e602 Rename export_sudoers() to convert_sudoers_json() and move the
check for the same input and output file to the front-end.
2018-01-26 12:28:49 -07:00
Todd C. Miller
80cb1b5da9 Move sudoers JSON conversion to cvtsudoers which will eventually
output to other formats too.
2018-01-26 11:20:37 -07:00
Todd C. Miller
bcfb092a4e Convert from time in minutes to timespec directly instead of
converting to double via strtod().  This makes it easier to catch
overflow.
2018-01-26 10:17:47 -07:00
Todd C. Miller
b3601253e6 Fall back to ppid time stamps if timestamp_type == kernel and no
tty is present.  This is consistent with timestamp_type == tty.
2018-01-23 11:18:18 -07:00
Todd C. Miller
52409b9c72 Do not call the TIOCSETVERAUTH ioctl with a negative number of seconds.
Also cap the max number of seconds at 3600 to avoid getting EINVAL
from TIOCSETVERAUTH.
2018-01-23 11:05:41 -07:00
Todd C. Miller
2e37959fec Better conversion from double to nanoseconds. 2018-01-22 17:27:25 -07:00
Todd C. Miller
4c0c225062 Store passwd_timeout and timestamp_timeout as a struct timespec
instead of as a float.  Remove timeout argument to auth_getpass()
as it was never used.
2018-01-22 12:18:48 -07:00
Todd C. Miller
44e4aac445 Don't rely on perl being installed in /usr/local/bin 2018-01-21 16:08:22 -07:00
Todd C. Miller
a885b952fb Remove use of AC_HEADER_TIME, only obsolete platforms actually
need this.  Also stop removing sys/time.h unless the source file
uses struct timeval.
2018-01-17 09:52:15 -07:00
Todd C. Miller
b161ebe62d Remove duplicate options %type 2018-01-17 09:52:09 -07:00
Todd C. Miller
594c2d4efd Add an approval function to the sudo auth API which is run after
the user's password has been verified.  The approval function is
run even if no password is required.  This is currently only used
for PAM (use pam_acct_mgmt) and BSD auth (auth_approval).
2018-01-16 10:27:58 -07:00
Todd C. Miller
f7896025ea treat uid as unsigned in error message 2018-01-15 10:29:38 -07:00
Todd C. Miller
aa516b0a51 Add missing plugins/sudoers/po/fur.mo file to repo. 2018-01-15 10:24:13 -07:00
Todd C. Miller
a47f47967c Convert from mono time to real time before displaying time stamps. 2018-01-12 11:03:22 -07:00
Todd C. Miller
da67a54906 Use PATH_MAX, not MAXPATHLEN. 2018-01-11 14:55:11 -07:00
Todd C. Miller
ff5ac3ef0e Add tsdump, a simple utility to dump a timestamp file. To build,
run "make tsdump" in the plugins/sudoers directory (it is not built
by default).  In order to map the tty device number to a name,
sudo_ttyname_dev() has been moved into libsudo_util.
2018-01-11 10:49:20 -07:00
Todd C. Miller
d5f4fdb814 sync with translationproject.org 2018-01-04 21:35:47 -07:00
Todd C. Miller
636bfad02d sync with translationproject.org 2017-12-28 08:09:53 -07:00
Todd C. Miller
f2fdda1aa7 Silence a clang analyzer false positive. 2017-12-22 13:27:08 -07:00
Todd C. Miller
00016b17a5 sync with translationproject.org 2017-12-22 12:47:07 -07:00
Todd C. Miller
7f99af859a Use a tty lock even for kernel time stamps so we can avoid simultaneous
password prompts.
2017-12-22 11:10:22 -07:00
Todd C. Miller
23ac62cfb5 Also honor SUDO_EDITOR in visudo. Previously is was only used
by sudoedit.
2017-12-22 10:22:33 -07:00
Todd C. Miller
fa2ab63da9 Stop looking for an editor as soon as we find one.
A similar fix was made to visudo some time ago.
2017-12-21 16:31:42 -07:00
Todd C. Miller
54158f6918 "time stamp" not "timestamp" 2017-12-21 14:21:48 -07:00
Todd C. Miller
feb48b8ebf Add "kernel" as a possible value of timestamp_type.
Currently only supported on OpenBSD.
2017-12-20 16:19:54 -07:00
Todd C. Miller
5f3797c754 Document the sudoers time stamp file format. 2017-12-20 13:01:06 -07:00
Todd C. Miller
ae8917a070 Verify start time of the current process, allowing for some clock
drift.  For Linux, process start time is relative to boot time, not
wallclock time.
2017-12-19 10:10:54 -07:00
Todd C. Miller
e73a5574ce regen 2017-12-18 10:52:45 -07:00
Todd C. Miller
6ce85b1746 Trivial test for process start time. We don't try to check the
resulting timespec as it differs by platform.  On most it is wallclock
time, on others it is relative to boot time (Linux).
2017-12-18 10:35:37 -07:00
Todd C. Miller
de2f455d3e Support start time on macOS and 4.4BSD 2017-12-17 07:40:21 -07:00
Todd C. Miller
428a487e0b Include sys/types.h for mode_t used in sudoers.h. 2017-12-16 20:55:01 -07:00
Todd C. Miller
b78296197d Fix compilation error on FreeBSD 2017-12-16 20:46:58 -07:00
Todd C. Miller
79caf1e68d Fix debug_decl(), it should be SUDOERS_DEBUG_UTIL
Add debugging for the successful case
For Linux, don't NUL out *ep before parsing with strtoull().
* * *
Add missing debug info for the System V /proc version.
2017-12-16 14:50:14 -07:00
Todd C. Miller
1709dc7f77 In the timestamp record, include the start time of the terminal
session leader for tty-based timestamps or the start time of the
parent process for ppid-based timestamps.  Idea from Duncan Overbruck.
2017-12-16 05:53:05 -07:00
Todd C. Miller
5cec5734cc If the lock record doesn't match the expected record size we need
to seek to the end of the record as we otherwise may have gone too
far (or not far enough).  Fixes interop problems when the time stamp
record changes size.
2017-12-15 21:08:38 -07:00
Todd C. Miller
6ca8447e00 An empty RunAsUser means run as the invoking user, similar to how
the sudoers files works.
2017-12-12 14:20:56 -07:00
Todd C. Miller
1350a30737 Add authfail_message sudoers option to allow the user to override
the default message of %d incorrect password attempt(s).
2017-12-11 12:43:58 -07:00
Todd C. Miller
5106bfc139 Allow the plugin to determine whether or not an empty timeout is
allowed.  For sudoers, an error will be returned for an empty timeout.
2017-12-11 09:20:41 -07:00
Todd C. Miller
b5463c2809 Return an error for an empty timeout string. Just use strtol() for
syntax checking instead of scanning with strspn().
2017-12-11 09:19:42 -07:00
Todd C. Miller
00a00ebd1d Better input validation of settings passed by the sudo front-end.
Instead of ignoring an empty setting, throw an error.
2017-12-10 07:45:49 -07:00
Todd C. Miller
b16912da1d Don't include syslog.h from logging.h, just include it in the two
.c files it is actually needed.
2017-12-08 15:00:41 -07:00
Todd C. Miller
48fba3c2cc update my email to Todd.Miller@sudo.ws 2017-12-03 17:53:40 -07:00
Todd C. Miller
01587b1b14 Add missing carriage return before prompt when replay is done. 2017-12-02 21:32:24 -07:00
Todd C. Miller
988328393a regen 2017-12-01 15:43:04 -07:00
Todd C. Miller
93828eca65 Avoid a double free when ipa_hostname is set in sssd.conf and it
is an unqualified host name.  From Daniel Kopecek.

Also move the "unable to allocate memory" warning into get_ipa_hostname()
itself to make it easier to see where the allocation failed in the
debug log.
2017-11-28 11:28:44 -07:00
Todd C. Miller
250209d7a8 When running a command as the invoking user we cannot use the gid
list from the front-end since it may not correspond to the user's
aux group vector as defined by the group database.
2017-11-28 09:48:43 -07:00
Todd C. Miller
dd47a0a416 Add missing initprogname() calls. 2017-11-28 09:06:44 -07:00
Todd C. Miller
ca2e1a455a Plug some memory leaks on error, some found by the clang static analyzer. 2017-11-16 09:43:24 -07:00
Todd C. Miller
bcc0eeb575 Avoid calling cmnd_matches() in list/verify mode if we already have
a match.
2017-11-15 15:09:25 -07:00
Todd C. Miller
88faa58735 In list (-l) or verify (-v) mode, if we have a match but authentication
is required, clear FLAG_NOPASSWD so that when listpw/verifypw is
set to "all" and there are multiple sudoers sources a password will
be required unless none of the entries in all sources require
authentication.  From Radovan Sroka of RedHat
2017-11-15 15:06:45 -07:00