Commit Graph

101 Commits

Author SHA1 Message Date
Todd C. Miller
3423d0af7c Don't try to syntax check an unrecognized Defaults value in visudo. 2016-10-28 08:24:51 -06:00
Todd C. Miller
e3825cbedd When checking syslog facility or priority, move the string
compare into the body of the loop and return if it matches.
If we finish the loop it means we didn't find a match.
This makes the code a little bit more readable.
2016-10-26 10:46:03 -06:00
Todd C. Miller
fc1b4155d7 Replace bare ";" in the body of for() loops with "continue;" for
improved readability.
2016-10-26 10:42:28 -06:00
Todd C. Miller
44c2679f83 Add syslog_maxlen to control the max size of syslog messages. 2016-10-18 15:51:47 -06:00
Todd C. Miller
43084d8f91 Apply match_group_by_gid early. 2016-09-05 06:21:23 -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
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
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
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
56ead73886 Load sudoers group plugin via an early callback. 2016-08-09 13:14:31 -06:00
Todd C. Miller
0bf2d9b162 Instead of deferring setting early defaults until we have traversed
the entire defaults list, just defer running the callbacks.  Otherwise,
if the last early default setting we see has a bad value we won't
set any defaults of that type even if there was an earlier one that
was valid.
2016-08-08 17:04:20 -06:00
Todd C. Miller
e5a7891ec8 Run callbacks once in set_default_entry() instead of each of the
store_foo() functions.
2016-08-08 16:47:11 -06:00
Todd C. Miller
2b150925dc Flag settings have a NULL value so we can't use that to test whether
an entry in struct early_default is set or not.  Add a "set" member
and use that instead.
2016-07-28 06:05:39 -06:00
Todd C. Miller
a014a2abd4 Fix --with-fqdn, the value should be NULL since it is a flag. 2016-07-27 15:03:48 -06:00
Todd C. Miller
16551031f9 Add support for early defaults to the ldap and sssd backends. 2016-07-27 14:20:17 -06:00
Todd C. Miller
2c21663b22 Split set_default_entry() out of set_default() so we can call it
from check_defaults() to validate the defaults value.  In visudo,
suppress warnings from update_defaults() and rely on check_defaults()
to provide warnings.
2016-07-23 09:10:48 -06:00
Todd C. Miller
29d842dbaf Split binding match code out of default_type_matches() into
default_binding_matches().  We can now use default_type_matches()
in check_defaults().
2016-07-23 08:45:43 -06:00
Todd C. Miller
256ca993b9 Update defaults in visudo after sudoers has been edited so we pick
up locale changes.  The init_defaults() function will now re-init
the sudoers locale.
2016-07-22 10:41:56 -06:00
Todd C. Miller
684161618d Fix regression that would cause early defaults entries to be
set multiple times.
2016-07-20 13:35:04 -06:00
Todd C. Miller
6daf3c5ce1 Only set early defaults once, regardless of how many times the
variable is set in sudoers.  This avoids running an early callback
more than once.  For example, we don't want to call cb_fqdn() if
sudo is compiled with FQDN set but sudoers has "Defaults !fqdn".
2016-07-19 14:58:06 -06:00
Todd C. Miller
5e9173df7a Make strings const in functions that set defaults as they are
not modified.
2016-07-19 14:55:27 -06:00
Todd C. Miller
7218dbe542 Implement callbacks for defaults flags (T_FLAG). 2016-07-18 12:37:45 -06:00
Todd C. Miller
36b18c6e64 Convert fqdn to a callback and add it to the list of early defaults. 2016-07-18 12:19:07 -06:00
Todd C. Miller
9b42640ef5 Change defaults callbacks to take a union sudo_defs_val * instead
of a char *.
2016-07-18 12:11:25 -06:00
Todd C. Miller
6ddc95a47c When updating defaults, process certain values fist since they can
influence how other defaults are parsed.  Currently, runas_default
and sudoers_locale are processed early.
2016-07-18 11:37:32 -06:00
Todd C. Miller
de0208a01b Make sudoedit_checkdir the default and update the documentation accordingly. 2016-01-19 14:16:25 -07:00
Todd C. Miller
5a77989a33 Add support for matching the entire netgroup tuple (user, host, domain). 2016-01-12 14:59:44 -07: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
4a07b472f0 Only include stddef.h where it is needed. 2015-06-20 05:34:35 -06:00
Todd C. Miller
c36415417f Add function name to "unable to allocate memory" warnings. 2015-06-19 14:51:17 -06:00
Todd C. Miller
dc883f2454 We require ANSI C so stop using the obsolete STDC_HEADERS. 2015-06-19 14:29:27 -06:00
Todd C. Miller
138aa2ccd1 Remove BROKEN_SYSLOG define which was for obsolete versions of HP-UX.
Remove last remnants of 4.2BSD syslog support.
2015-06-18 17:53:49 -06:00
Todd C. Miller
d004b02fc6 Use non-exiting allocatings in the sudoers plugin. 2015-06-17 06:49:59 -06:00
Todd C. Miller
59ab26dbcc Go back to a 2 args debug_decl and just use the "default" instance,
now renamed "active".
2015-02-01 08:24:49 -07:00
Todd C. Miller
e9914a91b1 The sudoers plugin now defines its own list of debugging subsystem names
and defines.
2014-10-22 13:30:52 -06:00
Todd C. Miller
866cfc4fc3 Add support for multiple Debug lines per program. Callers may
register arbitrary debug facilities or use built-in defaults.  We
now use separate Debug statements for plugins and programs.
2014-10-22 13:23:05 -06:00
Todd C. Miller
36a5767e3e efree -> sudo_efree for consistency 2014-07-10 15:35:04 -06:00
Todd C. Miller
a8fa112a53 atobool -> sudo_strtobool
atoid-> sudo_strtoid
atomode -> sudo_strtomode
2014-06-27 14:53:54 -06:00
Todd C. Miller
2d61d38c23 Add sudo_ prefix to alloc.c functions and rename alloc.h -> sudo_alloc.h 2014-06-27 10:48:31 -06:00
Todd C. Miller
aecef4aa1d Rename warning/fatal -> sudo_warn/sudo_fatal to avoid namespace
pollution in libsudo_util.so.
2014-06-27 09:30:52 -06:00
Todd C. Miller
278a8ba391 pam_setcred should default to true; from Gary Winiger
Bug #642
2014-04-15 07:11:29 -06:00
Todd C. Miller
8287e21d36 Add use_netgroups sudoers option. For LDAP-based sudoers, netgroup
support requires an expensive substring match on the server.  If
netgroups are not needed, this option can be disabled to reduce the
load on the LDAP server.
2014-02-07 14:58:48 -07:00
Todd C. Miller
659b1f0e34 Switch to new time stamp file format. Each user now has a single
file which may contain multiple records when per-tty time stamps
are in use (the default).  The time stamps use a monotonic timer
where available and are once again stored in /var/run/sudo.  The
lecture status is now stored separately from the time stamps in a
different directory.
2014-01-30 15:50:40 -07:00
Todd C. Miller
ef2cff1d33 Now that we have proper number parsing functions we should store
T_UINT defaults values as unsigned int, not int.
2013-12-11 14:43:04 -07:00