Commit Graph

2385 Commits

Author SHA1 Message Date
Todd C. Miller
61b6ae64de When outputting sudoers, if a word includes spaces, print it in
double quotes.  Also escape spaces in the command path.
2018-02-03 06:18:47 -07:00
Todd C. Miller
3354cbd021 Add sudoers output format to cvtsudoers. In the future this may
be used with filters to emit a partial sudoers file instead of a
full one.
2018-02-02 14:29:19 -07:00
Todd C. Miller
df08d0d8f4 When printing a member name, quote sudoers special characters unless
it is a UID/GID, in which case we print the '#' unquoted.
2018-02-02 14:29:17 -07:00
Todd C. Miller
f4ce2b25fc Move SUDOERS_QUOTED define to parse.h 2018-02-02 06:28:04 -07:00
Todd C. Miller
07d9cec271 Remove extraneous break statement and fix some whitespace. 2018-01-30 11:12:38 -07:00
Todd C. Miller
5e9e641b3d Check the return value of sudoers_debug_register().
Coverity CID 182574
2018-01-29 14:02:21 -07:00
Todd C. Miller
f3ef0f5091 Fix memory leak, su->count is now 0 when it is unused, not 1.
Covertity CID 182573
2018-01-29 13:58:25 -07:00
Todd C. Miller
7766278031 Quiet a clang analyzer false positive. 2018-01-29 11:50:56 -07:00
Todd C. Miller
b374effcb4 Quote special characters when creating the cn as per RFC2253 2018-01-29 11:00:43 -07:00
Todd C. Miller
7f310d7386 Remove sudoers2ldif, it has been replaced by cvtsudoers. 2018-01-29 09:18:48 -07:00
Todd C. Miller
831de0fc8b Add -b option to specify the base dn. 2018-01-28 19:58:10 -07:00
Todd C. Miller
4acaa9c74a Switch the default output format to LDIF 2018-01-28 19:36:16 -07:00
Todd C. Miller
7e5e1f6a6d Execute cvtsudoers if the user runs "visudo -x" but also emit a
warning.
2018-01-28 16:34:16 -07:00
Todd C. Miller
63321f19a9 Revert 04ec05108b2b, change the default input source back to stdin. 2018-01-28 16:11:02 -07:00
Todd C. Miller
6272829dcc Add LDIF conversion to sudoers tests 2018-01-28 10:07:15 -07:00
Todd C. Miller
7dd620981b Add notbefore and notafter support to the backends. 2018-01-28 07:09:22 -07:00
Todd C. Miller
681fb2e76e Add ldif backend to cvtsudoers, to replace sudoers2ldif 2018-01-27 20:08:02 -07:00
Todd C. Miller
7638e71730 fix make check 2018-01-27 19:52:20 -07:00
Todd C. Miller
cc31b3fd40 Parse sudoers in the front end, not the back end. 2018-01-26 17:29:56 -07:00
Todd C. Miller
98c19a68c9 Use the built-in sudoers file location as the default sudoers file
for cvtsudoers and move parse_sudoers_options() to stubs.c since
it is shared between visudo.c and cvtsudoers.c.
2018-01-26 13:15:10 -07:00
Todd C. Miller
0f3030d502 Move common stub functions required by the parser out of visudo.c
and cvtsudoers.c and into stubs.c.
2018-01-26 12:51:24 -07:00
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