Commit Graph

31 Commits

Author SHA1 Message Date
Todd C. Miller
55c4f3bddd Introduce new_member_all() for code that doesn't include gram.h.
The ldap and sssd back-ends no longer require gram.h which fixes a
compilation issue with IBM LDAP.
2020-11-10 19:36:56 -07: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
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
03ad96e445 Use the fallthrough attribute instead of /* FALLTHROUGH */ comments. 2020-08-01 13:10:50 -06:00
Todd C. Miller
446ae3f507 Include string.h unconditionally and only use strings.h for strn?casecmp()
In the pre-POSIX days BSD had strings.h, not string.h.
Now strings.h is only used for non-ANSI string functions.
2020-05-18 07:59:24 -06:00
Todd C. Miller
3edd30a27d A struct member of type ALL should have its name field set to NULL. 2020-03-11 11:17:52 -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
dd37f08366 Plug memory leak on malloc failure. 2019-08-30 10:20:54 -06:00
Todd C. Miller
1e1ef61902 Add SPDX-License-Identifier to files. 2019-04-29 07:21:51 -06:00
Todd C. Miller
985600e7f0 Minor snprintf() usage tweaks:
1) don't assume snprintf() returns -1 on error, check for <0
2) when comparing return value of sizeof(foo), cast the sizeof, not the len
3) cast return value to void in cases where snprintf cannot fail
2019-01-20 07:49:48 -07:00
Todd C. Miller
1fe582a0e3 Add support for negated sudoRunAsUser and sudoRunAsGroup entries. 2018-10-28 15:46:27 -06:00
Todd C. Miller
6c3d20cb41 Convert PVS-Studio comment to ANSI C. 2018-10-26 08:39:09 -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
deccfe68f1 Fix a memory leak on malloc() error in sudo_ldap_role_to_priv().
Coverity CID 188804
2018-10-18 15:38:54 -06:00
Todd C. Miller
e1a402f1d6 sudo_ldap_parse_option() never returns '=' as the operator.
When parsing command_timeout, role, type, privs and limitprivs,
check that val is non-NULL instead.  Found by PVS Studio.
2018-10-16 12:49:34 -06:00
Todd C. Miller
5af2682283 Fix pasto when converting sudoNotAfter; from Miguel Sanders
Bug #845
2018-08-20 05:48:14 -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
154a5f59a9 Move digest code into libutil 2018-05-24 21:04:07 -06:00
Todd C. Miller
8ce49ecb2b Fix memory leak on error, CID 185602 2018-05-16 10:45:00 -06:00
Todd C. Miller
b7e6d04907 When building up the cmndspec, add the actual command member last.
This simplifies the logic regarding the SETENV tag and alsomakes
"out of memory" cleanup simpler.
2018-05-16 10:27:28 -06:00
Todd C. Miller
3ca0882d14 Sudo "ALL" implies the SETENV tag. 2018-05-16 10:01:52 -06:00
Todd C. Miller
93eec5fb9f Do not leak struct sudo_command when the command is ALL.
Coverity CID 185602.
2018-05-14 13:47:00 -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
71e98d9493 Include parse.h in sudoers.h since it will soon be required. 2018-05-14 09:05:02 -06:00
Todd C. Miller
cc3428398a Parse "ALL" as a command correctly. 2018-05-14 08:35:48 -06:00
Todd C. Miller
6da40a7b5b Fix typo in strcmp(), we are comparing var not val. 2018-03-23 09:54:52 -06: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
8c7f3e791c Add missing support for converting LOG_INPUT/LOG_OUTPUT tags and
expand support for NOMAIL tags.
2018-03-02 11:12:14 -07:00
Todd C. Miller
e96398cac2 Avoid changing the order of non-negated hosts and commands.
We still put negated hosts/commands at the end of the list.
2018-03-02 10:58:50 -07:00
Todd C. Miller
120bb6de7f rename ldap_common.c -> ldap_util.c 2018-02-28 14:24:33 -07:00