Commit Graph

2805 Commits

Author SHA1 Message Date
Todd C. Miller
6ee731caff Log when user-specified command line options are rejected by sudoers.
We already audit those but in some cases they were not logged as well.
2020-09-23 08:02:43 -06:00
Todd C. Miller
6f8e1b9741 Fix potential NULL deref in debug code. 2020-09-23 08:59:18 -06:00
Todd C. Miller
09835b7198 Close the passwd db before calling getpwnam_shadow(3).
Otherwise, we will get the non-shadow passwd entry ("*") since we
called setpassent(3) earlier to keep the passwd db open.
2020-09-23 08:55:43 -06:00
Todd C. Miller
d4428133b4 Updated translations from translationproject.org 2020-09-19 09:57:33 -06:00
Todd C. Miller
874c2b27c6 Use a simple string compare on systems without crypt(3).
This is only used on systems without PAM, BSD authentication or AIX
authentication.  Bug #940.
2020-09-18 08:18:07 -06:00
Todd C. Miller
9f6a3d35cb Updated translations from translationproject.org 2020-09-16 13:28:03 -06:00
Todd C. Miller
1154e1d605 Back out sudo 1.9.3b1 version change. 2020-09-16 06:19:42 -06:00
Todd C. Miller
def99ffd78 Fix typo in warning for T_CHPATH, list '~' not '*' twice.
Bug #938
2020-09-14 06:54:15 -06:00
Todd C. Miller
86df234e14 Update .pot files for 1.9.3. 2020-09-12 08:29:18 -06:00
Todd C. Miller
3fc3b62d72 Add missing check for strdup() failure.
Coverity CID 214243
2020-09-10 08:10:05 -06:00
Todd C. Miller
c200e71637 Add callback for runchroot Defaults and require password -D/-R checks.
Using a command-based Default for runchroot will still only work for
paths that exist both in and outside the chroot.
2020-09-09 19:18:24 -06:00
Todd C. Miller
10d3d69aa1 Pass a struct to the match functions to track the resolved command.
This makes it possible to update user_cmnd and cmnd_status modified
by per-rule CHROOT settings.
2020-09-09 15:26:45 -06:00
Todd C. Miller
b6dbfe5094 Take the chroot into account when search for the command.
This could a a user-specific chroot via the -R option, a runchroot
Defaults value, or a per-command CHROOT spec in the sudoers rule.
2020-09-09 15:26:44 -06:00
Todd C. Miller
e561f5b857 Use the same pattern of redefining TESTDIR as test10.sh.
Adapted from a diff from Tim Rice.
2020-09-04 17:24:09 -06:00
Todd C. Miller
f6a14c9414 Include strings.h for strcasecmp(3).
From Tim Rice
2020-09-04 15:59:27 -06:00
Todd C. Miller
f6d477692f Regen for check_exptilde.o 2020-09-04 15:53:41 -06:00
Todd C. Miller
fb64210f75 Be consistent and use __hpux not __hpux__ like the rest of sudo. 2020-09-04 15:28:56 -06:00
Todd C. Miller
eaa95acb31 Post-process protoc-c files to avoid depending on anonymous unions.
Based on a patch from Michael Osipov.
GitHub issue #60
2020-09-04 13:17:51 -06:00
Todd C. Miller
8a8a24560e Fix copy and paste error; Coverity CID 214191 2020-09-03 13:23:27 -06:00
Todd C. Miller
24d5ee5893 Fix memory leak on error found by the clang 10.01 analyzer. 2020-09-03 13:07:38 -06:00
Todd C. Miller
fd06e588ee If the command was run in a chroot, add it to the log. 2020-09-02 16:57:55 -06:00
Todd C. Miller
226307591c Log the runcwd not submitcwd in the sudo-style log file.
The log entry should reflect the working directory the command
actually ran in.
2020-09-02 11:23:26 -06:00
Todd C. Miller
a51d194a73 Add test of multiple syntax errors.
Where possible, the portion of the line before the error should be
still be interpreted.
2020-09-02 12:40:39 -06:00
Todd C. Miller
578789c56f Fix error recovery in a privilege after a ':' separator. 2020-09-02 11:01:09 -06:00
Todd C. Miller
fc563286ff Initialize runchroot and runcwd in init_options() 2020-09-02 09:34:43 -06:00
Todd C. Miller
e3b85171f8 Regenerate the parser with "bison -y" for verbose syntax error messages. 2020-09-01 21:34:30 -06:00
Todd C. Miller
1676f0ceeb Support "*" for CWD/CHROOT to allow user to specify cwd or chroot.
Adds two new command line options, -D (--chdir) and -R (--chroot)
that can only be used when sudoers sets runcwd or runchroot to "*".
2020-09-01 14:10:02 -06:00
Todd C. Miller
bd254e1042 Read/write runchroot and runcwd entries in the JSON event log. 2020-09-01 06:26:05 -06:00
Todd C. Miller
9ff960457a Add support for runchroot and runcwd to "sudo -l" and cvtsudoers. 2020-09-01 06:26:05 -06:00
Todd C. Miller
86513c78b6 Unit test for exptilde 2020-09-01 06:26:05 -06:00
Todd C. Miller
6bdfd010d2 Add CHROOT and CWD sudoers options.
Also matching runchroot and runcwd Defaults settings.
2020-09-01 06:26:00 -06:00
Todd C. Miller
c4a579cf8a Pass resource limits values to the plugin in user_info[]
Sudo resets the resource limits early in its execution so
the plugin cannot tell what the original limits were itself.
2020-08-31 16:37:01 -06:00
Todd C. Miller
84e6e6ccf9 Update copyright year on some files where it was out of date. 2020-08-31 14:09:36 -06:00
Todd C. Miller
1b300f78de Remove superfluous "parse error in sudoers near line N" message.
The sudoers parser now produces better syntax error messages so we
don't need visudo to print its own.
2020-08-27 16:08:18 -06:00
Todd C. Miller
03eb3d6db9 Don't override errorfile and errorlineno set by check_aliases().
Now that alias parsing stores the file and line number, visudo can
use that information to go to the line with an error when re-editing.
2020-08-27 16:06:45 -06:00
Todd C. Miller
609910cc21 sudoers error recovery can be configured via an "error_recovery" setting.
This setting is an argument to the sudoers plugin, similar to how
sudoers_file, sudoers_mode, sudoers_uid, etc. are implemented.
The default value is true.
2020-08-17 13:14:30 -06:00
Todd C. Miller
360c264760 Make this test pass with bison's verbose error messages. 2020-08-17 07:41:48 -06:00
Todd C. Miller
c7bc24d40b Recover from a syntax error after the ':' in a privilege spec.
For compound privilege specs, don't throw away the entire thing if
we have a syntax error, only the part after the error is encountered.
2020-08-16 15:19:53 -06:00
Todd C. Miller
11803027c6 Add explicit end-of-line matching in the parser for better error messages.
A valid line in sudoers must end in a newline or EOF.
Previously, it was possible (though not documented) to have multiple
user specs on a single line.  Now, each must be on its own line.
2020-08-16 14:59:45 -06:00
Todd C. Miller
d72a48dc78 Add NOMATCH token and use it in the lexer for an unmatched pattern.
The ERROR token is now only used for errors detected by the lexer
and for which we've already printed an error.  This lets us remove
the hack in sudoerserror() and just check last_token to determine
whether or not to display the error.
2020-08-16 06:42:15 -06:00
Todd C. Miller
de9c77ba7e Enable error recovery for syntax erorrs that don't end with a newline.
A syntax error on the last line of a sudoers file with no trailing
newline is now recoverable.
2020-08-15 11:38:56 -06:00
Todd C. Miller
94eb14c214 Add error recovery for unexpected tokens after include/includedir. 2020-08-15 11:29:46 -06:00
Todd C. Miller
a940a2c78e Fix some warnings from pvs-studio 2020-08-12 20:01:39 -06:00
Todd C. Miller
961a4afe67 Fix some warnings from pvs-studio 2020-08-12 13:45:09 -06:00
Todd C. Miller
fb8ed8ba66 Use angle quotes when including gram.h and def_data.c.
Otherwise, we can include the wrong file when doing an out-of-source
build when configured using --with-devel.
2020-08-12 10:28:33 -06:00
Todd C. Miller
cbad17a994 Move inclusion of compat headers up with the system headers.
Now that sudo_dso_public is defined in config.h we don't need sudo_compat.h
before including the compat headers.
2020-08-12 10:07:07 -06:00
Todd C. Miller
985af422d2 Rename __dso_public -> sudo_dso_public and move to config.h. 2020-08-12 09:57:42 -06:00
Todd C. Miller
076d0376db We no longer need to include sudo_gettext.h before sudo_compat.h 2020-08-12 09:50:35 -06:00
Todd C. Miller
ce97ca28db Use OpenBSD-compatible freezero() in place of explicit_bzero() + free() 2020-08-10 19:24:33 -06:00
Todd C. Miller
cef6e3687e Switch from memset_s() -> explicit_bzero().
memset_s() (and all of Annex K) is likely to be removed from the
a future version of the standard.
2020-08-10 19:24:32 -06:00