Commit Graph

2057 Commits

Author SHA1 Message Date
Todd C. Miller
1bccd14180 runas_pw can no longer be NULL 2016-09-19 06:08:00 -06:00
Todd C. Miller
9a55c0c25d user_matched and group_matched must be type int, not bool 2016-09-15 15:22:06 -06:00
Todd C. Miller
b165a5ff71 Use RUNAS_USER_SPECIFIED and RUNAS_GROUP_SPECIFIED when deciding
whether to check runas user/group instead of checking runas_pw or
runas_gr.
2016-09-15 13:47:38 -06:00
Todd C. Miller
0ff95dfaaa When matching against runas_default use userpw_matches() instead
of just strcasecmp().
2016-09-15 13:36:43 -06:00
Todd C. Miller
a750bebf10 Set RUNAS_USER_SPECIFIED when -u is specified and/or RUNAS_GROUP_SPECIFIED
when -g is specified.
2016-09-15 13:16:38 -06:00
Todd C. Miller
d64153967e Fix printing of the default runas user when a RunAsGroup is specified
but no RunAsUser is present.
2016-09-15 11:29:27 -06:00
Todd C. Miller
fb32867e4c Only match against runas_default if both sudoRunAsUser and
sudoRunAsGroup are missing.
2016-09-15 10:46:57 -06:00
Todd C. Miller
d2af18c1fa runas_pw can no longer be NULL here 2016-09-15 09:40:41 -06:00
Todd C. Miller
ef82f792a1 Update check for whether or not the runas user was set in the ldap
and sssd backends to match the sudoers file backend.  Introduces
the runas_user_set() macro to improve readability.  Previously,
runas_pw was set late, now it is set before checking sudoers.
2016-09-15 09:37:53 -06:00
Todd C. Miller
50d0191de3 Disable Address Sanitizer leak detection for tests which generate
parse errors.  The parser leaks a bit on error.
2016-09-15 08:33:01 -06:00
Todd C. Miller
37099a6e7d Fix underflow in get_ipa_hostname() when trimming trailing
whitespace.
2016-09-15 05:54:53 -06:00
Todd C. Miller
ff753d1e16 Support negated sudoHost entries. 2016-09-14 10:33:27 -06:00
Todd C. Miller
f51fbfa40d Support negated sudoHost entries. 2016-09-14 10:22:52 -06:00
Todd C. Miller
ca2a1f3109 Don't check the username when matching a host netgroup unless
def_netgroup_tuple is enabled.
2016-09-13 09:12:42 -06:00
Todd C. Miller
c73dec723c Move valid domain name check into a new valid_domain() function.
Fix memory leak if getdomainname(2) fails and avoid using heap
garbage for the domain name matching in this case.
2016-09-13 09:06:25 -06:00
Todd C. Miller
7687dd6527 sync with translationproject.org 2016-09-12 14:59:22 -06:00
Todd C. Miller
86ce2f89fd sync with translationproject.org 2016-09-11 07:50:12 -06:00
Todd C. Miller
ead485b96b Fix typo that broke short host name matching when the fqdn
flag is enabled.  Bug #757
2016-09-09 16:26:22 -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
33fb814e85 sync with translationproject.org 2016-09-07 11:08:12 -06:00
Todd C. Miller
b80309e6d8 In sudoers_main() avoid setting rval prematurely. Prevents a crash
when auditing fails after successfully authenticating.  Bug #756
2016-09-05 19:44:46 -06:00
Todd C. Miller
43084d8f91 Apply match_group_by_gid early. 2016-09-05 06:21:23 -06:00
Todd C. Miller
881814c9f9 Don't try to support line continuation in /etc/environment. 2016-09-01 14:35:40 -06:00
Todd C. Miller
c0db5c1234 No line continuation support in ldap.conf. 2016-09-01 12:45:42 -06:00
Todd C. Miller
17ad75d50b Add a flags option to sudo_parseln() and a flag to only mach comments
at the beginning of the line.  Use the flag when parsing ldap.conf.
2016-09-01 09:19:20 -06:00
Todd C. Miller
c9572db75a use strict 2016-08-31 14:33:24 -06:00
Todd C. Miller
7a54b49fc4 Define def_foo in terms of the I_FOO index instead of a bare number. 2016-08-31 14:27:40 -06:00
Todd C. Miller
8ee6f0d1de sync with translationproject.org 2016-08-31 12:31:27 -06:00
Todd C. Miller
b610137efa regen 2016-08-31 05:50:18 -06:00
Todd C. Miller
9cfd556853 Add match_group_by_gid Defaults option to allow sites with slow
group lookups and a small number of groups in sudoers to match
groups by group ID instead of by group name.
2016-08-30 13:42:42 -06:00
Todd C. Miller
5b51b7f11a Fix "sudo -l command" in the LDAP and SSS backends when the command
is not allowed.
2016-08-29 10:04:24 -06:00
Todd C. Miller
7918f7e7eb Use sudo_strsplit() instead of doing the equivalent manually. 2016-08-26 11:07:19 -06:00
Todd C. Miller
a246c9570a Fix memset size typo in previous commit. 2016-08-25 10:36:53 -06:00
Todd C. Miller
c5cfc9584c Add regress for check_defaults() use-after-free bug. 2016-08-25 08:33:07 -06:00
Todd C. Miller
99b9699793 Fix use-after-free in check_defaults(), reported by Radovan Sroka
of RedHat.
2016-08-25 08:32:45 -06:00
Todd C. Miller
8d89d8395f sync with translationproject.org 2016-08-21 19:23:52 -06:00
Todd C. Miller
ba91ebb14b regen pot files 2016-08-21 14:10:56 -06:00
Todd C. Miller
d8a65715d6 Avoid duplicate warnings when we cannot write to the log file.
Also send the warning in mail if possible.
2016-08-17 14:51:20 -06:00
Todd C. Miller
3e4c7eed31 Move the ignoring of I/O log plugin errors into the I/O log plugin
itself.
2016-08-17 14:38:00 -06:00
Todd C. Miller
ed18d0d5f8 Make the behavior when we cannot write to a log or audit file
configurable.  File log failures are ignored by default for consistency
with syslog.  Audit errors are ignored by default to allow the admin
to fix the issue.  I/O log file errors are still fatal by default
since if I/O logging is activated it is usually to have an audit trail.
Bug #751
2016-08-17 07:22:51 -06:00
Todd C. Miller
9ccd260842 Make sure we print an error message to stderr (and not just send
mail) if do_logfile() fails.  Bug #751
2016-08-15 07:25:18 -06:00
Todd C. Miller
043b3d223b Separate out the supplemental group ID checks from the supplemental
group name checks in user_in_group().  We now call sudo_get_gidlist()
only when the group name in sudoers begins with a '#' (which is
seldom used).
2016-08-13 21:12:22 -06:00
Todd C. Miller
985ab1dd3e Cache the user's group IDs and group names separately and only
resolve group IDs -> names when needed.  If the sudoers file doesn't
contain groups we will no longer try to resolve all the user's group
IDs to names, which can be expensive on some systems.
2016-08-13 16:27:44 -06:00
Todd C. Miller
c3b8e97a6e Remove the "op" parameter from all the store_foo() functions except
store_list() where it is actually needed.  For the others, a NULL
value indicates the setting was negated.  This unconfuses static
analyzers (and perhaps humans too).
2016-08-12 16:41:51 -06:00
Todd C. Miller
8c2b6fb34e Flags always have a NULL value. Regression introduced by refactor
of set_default_entry().
2016-08-12 15:03:54 -06:00
Todd C. Miller
1ca261c305 Set rc to true when setting a flag Defaults value. 2016-08-12 11:32:36 -06:00
Todd C. Miller
caf064e17b Refactor the error parts of set_default_entry() so the switch() is
mostly just calls to store_foo() functions.  Avoids a lot of
duplicated error checking and silences a cppcheck false positive.
2016-08-12 10:37:41 -06:00
Todd C. Miller
9051c92cb3 In set_default_entry() check for unsupported Defaults type. 2016-08-12 09:37:11 -06:00
Todd C. Miller
7ac77b094c Check sudoers_initlocale return value and treat as oom.
Coverity CID 141832
2016-08-12 06:00:17 -06:00
Todd C. Miller
a08ea1b14d Set runas_pw early and adjust runaslist_matches() to deal. Since
we now set runas_default early there is no need to call update_defaults
with SETDEF_RUNAS after sudoers has been parsed.
2016-08-10 10:56:05 -06:00