Todd C. Miller
dd88460800
We no longer need to include headers we don't use for sudo*.h files.
...
Previously we needed to include headers required by the various
sudo*h files. Now those files are more self-sufficient and we
should only include headers needed by code in the various .c files.
2020-05-18 06:47:04 -06:00
Todd C. Miller
0cf2e09e0c
Apply spelling fixes.
...
Fixes from PR #30 (ka7) and Bug #925 (fossies.org codespell)
2020-05-06 09:27:43 -06:00
Todd C. Miller
ea8445e364
Allow the ALL keyword to be specified with a digest list.
2020-03-11 11:19:37 -06:00
Todd C. Miller
4eca443246
Allow a list of digests to be specified for a command.
2020-03-11 11:17:52 -06:00
Todd C. Miller
486ee2b71f
debug_decl and debug_decl_vars now require a semicolon at the end.
2019-12-22 08:48:16 -07:00
Todd C. Miller
635445d471
Transparently handle the "sudo sudoedit" problem.
...
Some admin are confused about how to give users sudoedit permission
and many users try to run sudoedit via sudo instead of directly.
If the user runs "sudo sudoedit" sudo will now treat it as plain
"sudoedit" after issuing a warning. If the admin has specified a
fully-qualified path for sudoedit in sudoers, sudo will treat it
as just "sudoedit" and match accordingly. In visudo (but not sudo),
a fully-qualified path for sudoedit is now treated as an error.
2019-11-05 15:18:34 -07:00
Todd C. Miller
679cd38238
Plug memory leak on malloc failure.
2019-08-30 10:38:07 -06:00
Todd C. Miller
e99082e05b
Fix special handling of ipa_hostname that was lost in sudo 1.8.24.
...
We now include the long and short hostname in sudo parser container.
2019-08-15 14:20:12 -06:00
Todd C. Miller
1e1ef61902
Add SPDX-License-Identifier to files.
2019-04-29 07:21:51 -06:00
Todd C. Miller
1e6e048180
Rename FOLLOW and NOFOLLOW tokens FOLLOWLNK and NOFOLLOWLNK.
...
Fixes a namespace collision on Solaris when bison is used.
2019-02-12 12:02:02 -07:00
Todd C. Miller
6c3d20cb41
Convert PVS-Studio comment to ANSI C.
2018-10-26 08:39:09 -06:00
Todd C. Miller
019279a4b8
Fix some mangled text in the license block.
2018-10-26 08:19:41 -06:00
Todd C. Miller
64e5d34c57
Add comments in .c files so PVS-Studio will check them.
2018-10-21 08:46:05 -06:00
Todd C. Miller
70d519c8ad
o Move userspecs, defaults and aliases into a new struct sudoers_parse_tree.
...
o The parse tree is now passed to the alias, match and defaults functions.
o The nss API has been changed so that the nss parse() function returns
a pointer to a struct sudoers_parse_tree which will be filled in
by the getdefs() and query() functions.
2018-07-26 15:12:33 -06:00
Todd C. Miller
154a5f59a9
Move digest code into libutil
2018-05-24 21:04:07 -06:00
Todd C. Miller
f38317269d
Add free_userspecs() and free_default() and use them instead of
...
looping over the lists and calling free_userspec() and free_default().
2018-05-15 16:35:07 -06:00
Todd C. Miller
71e98d9493
Include parse.h in sudoers.h since it will soon be required.
2018-05-14 09:05:02 -06:00
Todd C. Miller
38ff661621
Fix a user after free crash as well as a memory leak when filtering
...
Defaults.
2018-04-13 10:49:05 -06:00
Todd C. Miller
821e8a07da
Silence a false positive from the clang static analyzer.
2018-03-21 14:55:17 -06:00
Todd C. Miller
bc5e2d06a7
Add free_default() to free a struct defaults pointer so we have a
...
single place where we free the defaults. A pointer to the previous
Default's binding may be passed in to avoid freeing an already free
binding.
2018-03-21 12:11:19 -06:00
Todd C. Miller
910f288948
fix compilation on Solaris
2018-03-10 20:16:20 -07:00
Todd C. Miller
5c36f9dec3
Initial support for adding comments that will be emitted when
...
sudoers is formatted. Currently adds a comment for the source
sudoRole when converting from ldif -> sudoers.
2018-03-04 07:03:43 -07:00
Todd C. Miller
3226f7e28b
Move common bits of ldap to sudoers conversion into ldap_common.c
...
and use it in sssd.c.
2018-02-09 18:21:40 -07:00
Todd C. Miller
4e2402a8e4
Convert ldap results into a sudoers userspec so we can use the "sudo
...
-l" output functions in parse.c.
2018-02-09 18:21:01 -07:00
Todd C. Miller
5cca4b6906
Refactor member freeing code into free_member().
...
Refactor userspec freeing code into free_userspec().
2018-02-05 13:33:29 -07:00
Todd C. Miller
b161ebe62d
Remove duplicate options %type
2018-01-17 09:52:09 -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
e5dee1557e
Add NOTBEFORE and NOTAFTER command options similar to what is
...
already available in LDAP.
2017-02-18 15:35:48 -07:00
Todd C. Miller
9b0622b58f
Better error message when the timeout value does not parse.
2017-02-15 15:13:37 -07:00
Todd C. Miller
0f3f4e028a
Plug some memory leaks found by ASAN.
2017-02-14 15:56:34 -07:00
Todd C. Miller
d7f7cf7a79
Only inherit SELinux role/type and Solaris privilege sets if
...
the command does not include any. Previously, a command with
only a role would inherit a type from the previous command
which is not what was intended.
2017-02-14 15:56:34 -07:00
Todd C. Miller
24cdbb8de1
Split out tags again so they must precede the command and not allow
...
them to be mixed in with options.
2017-02-14 15:56:34 -07:00
Todd C. Miller
3980f1531b
Add support for command timeouts in sudoers. After the timeout,
...
the command will be terminated.
2017-02-14 15:56:34 -07:00
Todd C. Miller
4f9dcd7264
Merge command tags, SELinux type/role and Solaris privs settings
...
into "command options". This relaxes the order of things so tags
and other options can be interspersed.
2017-02-14 15:56:34 -07:00
Todd C. Miller
7524c231cc
Store the file/lineno for alias and userspec entries so we can
...
provide that info if there is an error.
2016-11-12 19:22:32 -07:00
Todd C. Miller
90995c0acf
Add simple reference-counted string allocator and use it for passing
...
around references to the sudoers path. This lets us avoid making
copies of the sudoers path for the errorfile as well as each Defaults
entry.
2016-11-11 16:18:27 -07:00
Todd C. Miller
79ca752802
Go back to parsing Defaults entries in update_defaults instead of
...
as sudoers is read. Otherwise, we cannot properly support early
defaults like sudoers_locale.
2016-11-09 16:00:12 -07:00
Todd C. Miller
df8404dbd4
Instead of parsing sudoers Defaults twice, parse once while reading
...
sudoers and then just set the parsed value in update_defaults().
2016-11-06 18:59:49 -07:00
Todd C. Miller
75e29f163e
Add file:linenumber prefix to all Defaults warnings so we can see
...
them when running sudo too. For LDAP/SSSD we print the sudoRole
instead of the file name and omit the line number.
2016-11-02 17:07:32 -06:00
Todd C. Miller
f6ce83ea76
Only treat an unknown Defaults entry as a parse error in visudo,
...
not in sudo itself.
2016-11-01 15:08:11 -06:00
Todd C. Miller
8a48085184
Instead of checking Defaults values after the fact, check them at
...
sudoers parse time. This makes it possible to display the file and
line number with the problem and for visudo to go right to the
error.
2016-11-01 14:22:32 -06:00
Todd C. Miller
0aa216ed55
Refactor freeing of a member_list into free_members().
2016-11-01 14:15:07 -06:00
Todd C. Miller
9de491dc27
add_defaults() now calls sudoerserror() itself instead of the caller
...
assuming any error means out of member.
2016-11-01 14:13:47 -06:00
Todd C. Miller
5a8b60e4b4
Make a copy of the current sudoers path when assigning errorfile.
...
Fixes a potential use after free in visudo when there is an error
in one of the include files.
2016-10-31 15:21:18 -06:00
Todd C. Miller
3f022419ae
Be consistent with the naming of the variable used to store the
...
function return value. Previously, some code used "rval", some
used "ret". This standardizes on "ret" and uses "rc" for temporary
return codes.
2016-09-08 16:38:08 -06:00
Todd C. Miller
81e33e1f56
new_digest was prototyped as static but not explicitly declared
...
static.
2016-06-27 06:00:11 -06:00
Todd C. Miller
3354d27a17
Do not follow symbolic links in sudoedit by default. This behavior
...
can be controlled by the sudoedit_follow Defaults flag as well as
the FOLLOW/NOFOLLOW tags.
2015-08-06 13:20:01 -06:00
Todd C. Miller
d4211081c0
Add some debugging printfs when malloc fails and we don't have an
...
explicit call to sudo_warnx().
2015-07-14 15:28:01 -06:00
Todd C. Miller
0b241088b3
There's no need to conditionalize the #include <unistd.h>, we require
...
a POSIX system.
2015-07-02 09:08:28 -06:00
Todd C. Miller
c36415417f
Add function name to "unable to allocate memory" warnings.
2015-06-19 14:51:17 -06:00