Commit Graph

1800 Commits

Author SHA1 Message Date
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
e0ac766473 Pass quiet flag to init_parser() and update_defaults() when doing
first parse of sudoers.
2016-07-23 05:53:35 -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
65579b69eb Set sudoers locale before calling sudoersparse(). We don't need
to restore the user's locale since warnings are displayed in the
user's locale anyway.
2016-07-20 19:58:42 -06:00
Todd C. Miller
ef24bd5c3c Set the locale to the sudoers locale when parsing and restore the
user's locale afterward.  Also set the warn/fatal locale helper
function so warning messages during a sudoers parse are displayed
in the user's own locale.
2016-07-20 16:41:23 -06:00
Todd C. Miller
6ba2769ba8 Add forward decl of union sudo_defs_val to silence a gcc warning. 2016-07-20 16:39:26 -06:00
Todd C. Miller
e257f2c9e3 Set the warn/fatal locale helper function in sudoers_policy_init()
so warning messages during sudoers loading are displayed in the
user's own locale.
2016-07-20 15:52:32 -06:00
Todd C. Miller
b5c2ca2fe5 Move sudoers locale callback function to locale.c and user it in
visudo and testsudoers.
2016-07-20 14:16:00 -06:00
Todd C. Miller
30f7ecca10 In cb_sudoers_locale() actually set the locale in addition to storing
its name.  Otherwise, it won't take effect until sudoers lookup time.
2016-07-20 13:36:45 -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
08e369572e In cb_fqdn() just return if the fqdn flag is set to false. 2016-07-19 14:52:33 -06:00
Todd C. Miller
7218dbe542 Implement callbacks for defaults flags (T_FLAG). 2016-07-18 12:37:45 -06:00
Todd C. Miller
d92a396da5 add debug_decl for cb_runas_default and cb_sudoers_locale 2016-07-18 12:20:46 -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
eae8bc9d56 Fix typo introduced in last commit to fix fill_args() overflow check. 2016-07-16 20:59:59 -06:00
Todd C. Miller
73b0ac4bc1 Fix underflow checl in fill_args(). 2016-07-16 20:54:07 -06:00
Todd C. Miller
88ba54f478 Make sure we account for the trailing NUL when computing arg_size
in fill_args().  Bug #752
2016-07-16 20:12:17 -06:00
Todd C. Miller
0f816c4401 Make arg_size and arg_len unsigned since we do bitwise operations
on them.
2016-07-16 16:22:40 -06:00
Todd C. Miller
6f5b8cf757 Only remove backup files as part of "make uninstall" when INSTALL_BACKUP
is set.
2016-07-08 12:56:47 -06:00
Todd C. Miller
144e3bb53f Only keep backups of installed files on HP-UX where you cannot
unlink a shared library that is in use.
2016-07-08 12:37:41 -06:00
Todd C. Miller
19c80f8aee Ignore a missing or insecure #includedir, it is not a fatal error. 2016-07-03 06:19:43 -06:00
Todd C. Miller
026b403f27 Make sure we always call sudoerserror() on error in read_dir_files(),
otherwise sudo will not treat it as a fatal error.
2016-07-03 06:16:19 -06:00
Todd C. Miller
7bfe2e7969 Set the sudoers locale before opening the sudoers file.
Previously the sudoers locale was used when evaluating sudoers
but not during the inital parse.  Bug #748
2016-06-30 12:40:19 -06:00
Todd C. Miller
5a176e8509 Add debugging 2016-06-30 12:38:30 -06:00
Todd C. Miller
c56d52ea62 Don't link test programs with the sudoers-specific locale code
if we don't need to.
2016-06-30 12:12:18 -06:00
Todd C. Miller
cbd2cf290b sudoreplay does not need to link with the sudoers-specific locale code. 2016-06-30 11:27:22 -06:00
Todd C. Miller
81e33e1f56 new_digest was prototyped as static but not explicitly declared
static.
2016-06-27 06:00:11 -06:00
Todd C. Miller
9c7680e016 Some versions of HP-UX make will ignore suffix rules if they are
empty.
2016-06-27 05:48:19 -06:00
Todd C. Miller
f683cbd582 Add definition of nitems for those without it and use it throughout. 2016-06-23 10:58:07 -06:00
Todd C. Miller
72f18cff9a Fold lines at 80 characters for the clean: target 2016-06-13 15:12:44 -06:00
Todd C. Miller
ea23932af0 sync with translationproject.org 2016-06-12 18:57:09 -06:00
Todd C. Miller
d9e14bc659 LDAP sudoers doesn't support negated users, groups or netgroups. 2016-06-12 09:36:19 -06:00
Todd C. Miller
e2de0027dc When matching paths with glob(3), check returned matches against
user_cmnd first if it is fully-qualified.  This avoids a lot of
needless stat(2) calls and avoids a mismatch between safe_cmnd and
argv[0] if there are multiple matches with the same inode/dev due
to links.  Bug #746.
2016-06-09 11:41:09 -06:00
Todd C. Miller
ce28b15eca sync with translationproject.org 2016-06-09 10:51:40 -06:00
Todd C. Miller
12ab5b8108 sync with translationproject.org 2016-06-09 07:12:38 -06:00
Todd C. Miller
734b43c6b0 regen 2016-06-06 10:07:58 -06:00
Todd C. Miller
3169259821 Ignore empty ipa_hostname 2016-06-05 14:42:54 -06:00
Todd C. Miller
c6a21bd53d Better martching of ipa_hostname in sssd.conf 2016-06-05 05:40:32 -06:00
Todd C. Miller
9b027676c0 Use the value of ipa_hostname from /etc/sssd/sssd.conf if present
instead of the system hostname.
2016-06-04 19:52:10 -06:00
Todd C. Miller
ccf88d3bb2 When matching host, short-circuit the loop when we get a match.
Only check username as part of the netgroup when netgroup_tuple is
enabled.
2016-06-03 14:07:40 -06:00
Todd C. Miller
a71cac91f2 Avoid using !strcmp() 2016-06-03 13:58:12 -06:00
Todd C. Miller
b6beccf19e SSSD doesn't handle netgroups, we have to ensure they are correctly filtered
in sudo. The rules may contain mixed sudoUser specification so we have to
check not only for netgroup membership but also for user and group matches.
Adapted from a patch from Daniel Kopecek.
2016-06-02 10:47:39 -06:00
Todd C. Miller
a24f4b8248 Return PAM_CONV_ERR from the conversation function if getpass returns
NULL or the user pressed ^C.
2016-06-01 14:48:31 -06:00