Todd C. Miller
8275ab873f
Fix use of uninitialized variable (conf) if sudoers_debug_register()
...
happens to fail.
2018-03-01 10:18:48 -07:00
Todd C. Miller
73b5f961ee
Split conversion code out of parse_ldif() and into ldif_to_sudoers().
2018-02-28 16:21:09 -07:00
Todd C. Miller
8da213c8be
Quiet a clang analyzer warning.
2018-02-28 14:44:54 -07:00
Todd C. Miller
120bb6de7f
rename ldap_common.c -> ldap_util.c
2018-02-28 14:24:33 -07:00
Todd C. Miller
3a2ae844ec
When converting from ldif to sudoers, sudoRole objects with the
...
same user if possible. If both user and host are the same, merge
into a single privilege. This makes it possible to convert a
sudoers entry like:
aaron shanty = NOEXEC: /usr/bin/vi, /usr/bin/more, EXEC: /bin/sh
to ldif and then back to sudoers as a single line. Currently, the
ldif entries to be merged must have the same or adjacent sudoOrder
attributes.
2018-02-28 14:02:50 -07:00
Todd C. Miller
56bdde1339
plug memory leaks
2018-02-28 14:02:11 -07:00
Todd C. Miller
7919b9ad2e
When converting from LDAP to sudoers, put negated hosts and commands
...
at the end of the list. Since LDAP doesn't guarantee attribute order
we need to make sure negated entries always override non-negated ones.
2018-02-25 06:30:32 -07:00
Todd C. Miller
6f097eb023
We may need the hostname to resolve %h escapes in include files.
2018-02-24 18:46:00 -07:00
Todd C. Miller
b3a0c3272b
Setting a sudoOrder start point of 0 will disable creation of
...
sudoOrder attributes in the resulting LDIF output.
2018-02-24 14:35:38 -07:00
Todd C. Miller
111d79b53c
Don't need to fill in struct sudo_user since we don't do matching.
2018-02-24 09:28:01 -07:00
Todd C. Miller
5999cfb906
Add support for setting default options in a config file. In
...
addition to expand_aliases, input_format and output_format, both
the initial sudoOrder and the increment when updating sudoOrder for
subsequent sudoRole objects can be specified. Command line options
have also been added for the start order and increment.
2018-02-24 09:23:14 -07:00
Todd C. Miller
19502307aa
Deal with user_name not being set in cvtsudoers.
2018-02-22 10:43:47 -07:00
Todd C. Miller
ceea24b965
Initial support for parsing sudoers LDIF files in cvtsudoers.
...
This makes it possible to convert from LDAP sudoers to a traditional
sudoers file. Semantic differences between file sudoers and LDAP
sudoers mean that LDIF -> sudoers is not completely equivalent.
2018-02-22 09:53:12 -07:00
Todd C. Miller
8b22ed7837
Fix LDIF conversion of commands with an associated digest.
2018-02-21 21:24:53 -07:00
Todd C. Miller
91f97d2f23
In array_to_member_list() use the correct type for netgroups and
...
user groups.
2018-02-21 21:09:57 -07:00
Todd C. Miller
337ace6441
Prepend digest to command if present.
...
Fix printing of group IDs and non-unix groups.
2018-02-21 21:08:37 -07:00
Todd C. Miller
c13557b6cb
Fix gcc false positive for uninitialized variable
2018-02-21 21:02:36 -07:00
Todd C. Miller
4f9296928c
Add option to cvtsudoers to expand aliases in the output.
2018-02-19 15:32:56 -07:00
Todd C. Miller
3f204c5eb8
Fix conversion of "ALL" in the JSON output format, which was being
...
printed as an alias.
2018-02-19 13:39:11 -07:00
Todd C. Miller
42fe0409f6
Add sudo_ev_dispatch(), a wrapper for ev_loop() with no flags.
...
Similar the dispatch function in libevent.
2018-02-19 11:00:10 -07:00
Todd C. Miller
43a3a23fed
Move LDAP configuration bits into ldap_conf.c
2018-02-11 07:36:08 -07:00
Todd C. Miller
0c08de88cd
No longer need to include stddef.h
2018-02-10 13:37:59 -07:00
Todd C. Miller
e2213dc1e3
Remove dead store, found by cppcheck.
2018-02-10 09:44:34 -07:00
Todd C. Miller
34820c6b15
simplify iterator
2018-02-10 04:29:43 -07:00
Todd C. Miller
6e2a267060
Silence a false positive from cppcheck.
2018-02-10 04:08:42 -07:00
Todd C. Miller
d0d413d077
Cast version to int when printing. Avoids a cppcheck warning.
2018-02-10 04:00:17 -07:00
Todd C. Miller
4459ee42ed
Use an iterator instead of fragile pointer arithmetic to iterate
...
over value arrays in sudo_ldap_role_to_priv().
2018-02-09 22:06:56 -07:00
Todd C. Miller
64e99328e3
Move sudoers formatting code into fmtsudoers.
2018-02-09 18:22:04 -07:00
Todd C. Miller
dda1d6cef7
Clean up some XXX in parse.c
2018-02-09 18:22:03 -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
9d49592f14
Fix compilation with glibc where stdout is not constant.
2018-02-05 06:23:33 -07:00
Todd C. Miller
57e7b4b49e
For "sudo -l", if a word includes spaces, print it in double quotes.
...
Also escape spaces in the command path. This matches the sudoers
quoting rules.
2018-02-04 12:53:32 -07:00
Todd C. Miller
3189de5bb9
Display sudoNotBefore and sudoNotAfter in "sudo -l"
2018-02-03 14:56:00 -07:00
Todd C. Miller
105ced47b8
For "sudo -l", if a word includes spaces, print it in double quotes.
...
Also escape spaces in the command path. This matches the sudoers
quoting rules.
2018-02-03 06:59:37 -07:00
Todd C. Miller
40c200af18
Add back printing of negation operator ('!') when printing a word
...
with spaces in it.
2018-02-03 06:57:12 -07:00
Todd C. Miller
1aca11c788
Use visudo to validate "cvtsudoers -f sudoers" output.
2018-02-03 06:46:56 -07:00
Todd C. Miller
f31ba6c22f
Remove syslog_goodpri and syslog_badpri without a value that causes
...
visudo to report an error.
2018-02-03 06:45:39 -07:00
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