Todd C. Miller
6286ce1d16
Store column number for aliases, defaults and userspecs too.
...
This is used to provided the column number along with the line
number in error messages. For aliases we store the column of the
alias name, not the value since that is what visudo generally needs.
2020-11-02 05:39:06 -07:00
Todd C. Miller
607076d8a0
Pass runchroot to match_digest() too.
...
We use the open fd for the actual I/O but having runchroot makes
it possible to report the correct file name in error messages.
2020-10-06 10:54:39 -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
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
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
4eca443246
Allow a list of digests to be specified for a command.
2020-03-11 11:17:52 -06: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
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
e28ba02c78
Fix a typo.
2019-05-22 08:58:51 -06:00
Todd C. Miller
1e1ef61902
Add SPDX-License-Identifier to files.
2019-04-29 07:21:51 -06:00
Todd C. Miller
c0a12d9d95
Be sure to include sudo_queue.h where needed instead of relying on other headers.
2019-02-19 08:31:08 -07:00
Todd C. Miller
36d4373403
Split command match code out into match_command.c.
...
Also remove unused SUDOERS_NAME_MATCH code.
2019-02-18 11:35:52 -07:00
Todd C. Miller
a04409747c
Split out digest matching into its own file.
2019-02-17 06:47:37 -07:00
Todd C. Miller
391ed95f50
Allow the group set by "sudo -g" to be any of the target user's groups.
...
Previously, this was only allowed if the group matched the target
user's primary group ID (from the passwd database entry).
The sudoers policy will now allow the group if it is one of the
target user's supplemental groups as well.
2018-10-27 06:37:34 -06:00
Todd C. Miller
4782b22a47
Move ldif -> sudoers conversion code into parse_ldif.c
2018-08-26 20:02:49 -06:00
Todd C. Miller
b2e3adccf3
Make alias_apply() take 3 arguments, the first being a pointer to the
...
struct sudoers_parse_tree.
2018-08-24 09:52:53 -06:00
Todd C. Miller
1e5af35564
Refactor code to convert defaults to tags and do conversion on
...
output for "sudo -l".
Remove the short_list (was long_list) global in favor of a verbose
argument.
2018-08-05 07:17:34 -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
574c9fcd7a
Add base64_encode() by Jon Mayo.
2018-05-19 19:03:47 -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
f9be3a48a2
Simplify the nss interface such that each sudoers provider fills
...
in a per-nss list of userspecs and defaults instead of using separate
lookup and list functions. This makes it possible to have a single
implementation of the code for sudoers lookup and listing.
2018-05-14 09:05:03 -06:00
Todd C. Miller
9e91d3f451
When the -d option is used, remove aliases used by the non-converted
...
Defaults settings if the aliases are not also referenced by userspecs.
2018-04-09 11:13:33 -06:00
Todd C. Miller
7663ae7b27
Add option to prune non-matching entries from cvtsudoers output with -m
...
option is used.
2018-04-04 09:51:05 -06:00
Todd C. Miller
18ba38ef4c
Refactor common alias code out of cvtsudoers and visudo and into alias.c.
2018-04-02 07:41:09 -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
ff79de8592
Initial support filtering by user, group and host in cvtsudoers.
...
Currently forces alias expansion when a filter is applied and the
entire matching user or host list is printed, even the non-matching
entries. This effectively allows you to grep sudoers by user, group
and host.
2018-03-21 12:24:11 -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
bb31544fcc
In sudoers_format_userspecs make the separator optional and silence
...
a printf format warning.
2018-03-06 13:42:56 -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
670d8e6d77
Special case comment lines in lbufs.
2018-03-04 07:03:41 -07:00
Todd C. Miller
c9b70940cf
When formatting as sudoers, flush the lbuf after each userspec.
2018-03-03 07:42:10 -07:00
Todd C. Miller
64e99328e3
Move sudoers formatting code into fmtsudoers.
2018-02-09 18:22:04 -07:00
Todd C. Miller
2522229e86
Rename sudo_file_append_default() -> sudo_lbuf_append_default() and
...
use it for ldap and sssd too.
2018-02-09 18:22:02 -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
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
f4ce2b25fc
Move SUDOERS_QUOTED define to parse.h
2018-02-02 06:28:04 -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
022ac87d66
avoid padding in struct cmndspec
2017-06-09 08:58:44 -06:00
Todd C. Miller
b5e7b7bd2c
Move the file digest code out of match.c and into filedigest.c.
...
Inspired by RedHat changes that used libgcrypt.
Also add digest_type_to_name() to map a sudo digest type (int)
to a name (string) and use it.
2017-02-20 16:44:12 -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
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
09438e5b42
Include parse.h in timestr.c which is where function prototype lives.
2017-02-13 13:44:11 -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