]> granicus.if.org Git - sudo/log
sudo
6 years agoAdd a section on convertion from file-based sudoers.
Todd C. Miller [Thu, 29 Mar 2018 13:13:31 +0000 (07:13 -0600)]
Add a section on convertion from file-based sudoers.

6 years agoAdd support for "cvtsudoers -d all"
Todd C. Miller [Wed, 28 Mar 2018 23:43:58 +0000 (17:43 -0600)]
Add support for "cvtsudoers -d all"

6 years agoAdd -d option to control what type of Defaults entries are converted.
Todd C. Miller [Wed, 28 Mar 2018 14:33:07 +0000 (08:33 -0600)]
Add -d option to control what type of Defaults entries are converted.

6 years agoIn pty_close() we still need to check whether the pty master and
Todd C. Miller [Tue, 27 Mar 2018 22:00:08 +0000 (16:00 -0600)]
In pty_close() we still need to check whether the pty master and
slave fds are open before closing them.  When no tty is present but
we are I/O logging pty_close() will be called when there is no
actual pty in use.

6 years agoregen
Todd C. Miller [Tue, 27 Mar 2018 21:57:02 +0000 (15:57 -0600)]
regen

6 years agoignore *.ldif2sudo regress output
Todd C. Miller [Mon, 26 Mar 2018 16:36:29 +0000 (10:36 -0600)]
ignore *.ldif2sudo regress output

6 years agoIn pty_close() there is no need to remove events associated with
Todd C. Miller [Mon, 26 Mar 2018 12:28:23 +0000 (06:28 -0600)]
In pty_close() there is no need to remove events associated with
the pty slave as there are none.  We also don't need to check for
the pty fds being -1 since they are not closed elsewhere and
pty_close() is only called if pty_setup() succeeds.

6 years agoMove cvtsudoers to section 1.
Todd C. Miller [Sun, 25 Mar 2018 22:16:48 +0000 (16:16 -0600)]
Move cvtsudoers to section 1.

6 years agoIn pty_close() close the slave and remove any events associated
Todd C. Miller [Sun, 25 Mar 2018 12:03:19 +0000 (06:03 -0600)]
In pty_close() close the slave and remove any events associated
with it.  Fixes a potential hang when performing the final flush
on non-BSD systems.

6 years agoFix typo in strcmp(), we are comparing var not val.
Todd C. Miller [Fri, 23 Mar 2018 15:54:52 +0000 (09:54 -0600)]
Fix typo in strcmp(), we are comparing var not val.

6 years agosync
Todd C. Miller [Fri, 23 Mar 2018 12:56:49 +0000 (06:56 -0600)]
sync

6 years agosync
Todd C. Miller [Fri, 23 Mar 2018 12:46:38 +0000 (06:46 -0600)]
sync

6 years agoregen
Todd C. Miller [Thu, 22 Mar 2018 19:30:25 +0000 (13:30 -0600)]
regen

6 years agoAdd -M option to cvtsudoers to force the use of the local passwd
Todd C. Miller [Thu, 22 Mar 2018 19:24:41 +0000 (13:24 -0600)]
Add -M option to cvtsudoers to force the use of the local passwd
and group databases when matching.

6 years agoAdd cvtsudoers command line option to suppress certain parts of the
Todd C. Miller [Thu, 22 Mar 2018 17:38:39 +0000 (11:38 -0600)]
Add cvtsudoers command line option to suppress certain parts of the
security policy.  Can be used to suppress displaying of Defaults
entries, aliases or privileges.

6 years agoSilence a false positive from the clang static analyzer.
Todd C. Miller [Wed, 21 Mar 2018 21:03:17 +0000 (15:03 -0600)]
Silence a false positive from the clang static analyzer.

6 years agoSilence a false positive from the clang static analyzer.
Todd C. Miller [Wed, 21 Mar 2018 20:55:17 +0000 (14:55 -0600)]
Silence a false positive from the clang static analyzer.

6 years agoFix memory leak on error path.
Todd C. Miller [Wed, 21 Mar 2018 20:43:17 +0000 (14:43 -0600)]
Fix memory leak on error path.

6 years agoregen
Todd C. Miller [Wed, 21 Mar 2018 19:33:44 +0000 (13:33 -0600)]
regen

6 years agoMove cvtsudoers string functions into cvtsudoers.c
Todd C. Miller [Wed, 21 Mar 2018 19:29:47 +0000 (13:29 -0600)]
Move cvtsudoers string functions into cvtsudoers.c

6 years agoregen
Todd C. Miller [Wed, 21 Mar 2018 19:29:18 +0000 (13:29 -0600)]
regen

6 years agoInitial support filtering by user, group and host in cvtsudoers.
Todd C. Miller [Wed, 21 Mar 2018 18:24:11 +0000 (12:24 -0600)]
Initial support filtering by user, group and host in cvtsudoers.
Currently forces alias expansion when a filter is applied and the
entire matching user or host list is printed, even the non-matching
entries.  This effectively allows you to grep sudoers by user, group
and host.

6 years agoAdd free_default() to free a struct defaults pointer so we have a
Todd C. Miller [Wed, 21 Mar 2018 18:11:19 +0000 (12:11 -0600)]
Add free_default() to free a struct defaults pointer so we have a
single place where we free the defaults.  A pointer to the previous
Default's binding may be passed in to avoid freeing an already free
binding.

6 years agoDecrease bullet width to 1n.
Todd C. Miller [Wed, 21 Mar 2018 12:52:50 +0000 (06:52 -0600)]
Decrease bullet width to 1n.

6 years agoAdd aix_setauthdb() before the initial getpwuid() call.
Todd C. Miller [Sat, 17 Mar 2018 13:49:08 +0000 (07:49 -0600)]
Add aix_setauthdb() before the initial getpwuid() call.

6 years agofix compilation on Solaris
Todd C. Miller [Sun, 11 Mar 2018 03:16:20 +0000 (20:16 -0700)]
fix compilation on Solaris

6 years agoMake "sudoreplay -m 0" skip the pauses entirely.
Todd C. Miller [Thu, 8 Mar 2018 14:53:29 +0000 (07:53 -0700)]
Make "sudoreplay -m 0" skip the pauses entirely.

6 years agoDocument that a negative value for -m will elmininate the pauses.
Todd C. Miller [Thu, 8 Mar 2018 13:22:21 +0000 (06:22 -0700)]
Document that a negative value for -m will elmininate the pauses.

6 years agoUpdate copyright date, remove unneeded include and add a few comments.
Todd C. Miller [Tue, 6 Mar 2018 22:59:31 +0000 (15:59 -0700)]
Update copyright date, remove unneeded include and add a few comments.

6 years agoUse fmtsudoers functions in testsudoers.
Todd C. Miller [Tue, 6 Mar 2018 22:09:21 +0000 (15:09 -0700)]
Use fmtsudoers functions in testsudoers.

6 years agoAdd test for empty runas user list.
Todd C. Miller [Tue, 6 Mar 2018 21:39:11 +0000 (14:39 -0700)]
Add test for empty runas user list.

6 years agoDon't print an empty user list as ALL.
Todd C. Miller [Tue, 6 Mar 2018 21:38:17 +0000 (14:38 -0700)]
Don't print an empty user list as ALL.

6 years agoIn sudoers_format_userspecs make the separator optional and silence
Todd C. Miller [Tue, 6 Mar 2018 20:42:56 +0000 (13:42 -0700)]
In sudoers_format_userspecs make the separator optional and silence
a printf format warning.

6 years agoUse correct defines when checking for sysctl kinfo_proc support.
Todd C. Miller [Tue, 6 Mar 2018 19:05:07 +0000 (12:05 -0700)]
Use correct defines when checking for sysctl kinfo_proc support.

6 years agoFix crash when converting sudoers entry with a runas list that is
Todd C. Miller [Tue, 6 Mar 2018 19:00:37 +0000 (12:00 -0700)]
Fix crash when converting sudoers entry with a runas list that is
present but empty.

6 years agoLess confusing sysctl checks for kinfo_proc.
Todd C. Miller [Tue, 6 Mar 2018 00:35:02 +0000 (17:35 -0700)]
Less confusing sysctl checks for kinfo_proc.

6 years agoAdd case_insensitive_group and case_insensitive_user sudoers options,
Todd C. Miller [Mon, 5 Mar 2018 17:42:02 +0000 (10:42 -0700)]
Add case_insensitive_group and case_insensitive_user sudoers options,
which are enabled by default.

6 years agoKill dead store found by clang-analyzer.
Todd C. Miller [Sun, 4 Mar 2018 18:59:45 +0000 (11:59 -0700)]
Kill dead store found by clang-analyzer.

6 years agoAdd tests for round-tripping sudoers -> ldif -> sudoers
Todd C. Miller [Fri, 2 Mar 2018 18:30:19 +0000 (11:30 -0700)]
Add tests for round-tripping sudoers -> ldif -> sudoers

6 years agoInitial support for adding comments that will be emitted when
Todd C. Miller [Sun, 4 Mar 2018 14:03:43 +0000 (07:03 -0700)]
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.

6 years agoSpecial case comment lines in lbufs.
Todd C. Miller [Sun, 4 Mar 2018 14:03:41 +0000 (07:03 -0700)]
Special case comment lines in lbufs.

6 years agoWhen formatting as sudoers, flush the lbuf after each userspec.
Todd C. Miller [Sat, 3 Mar 2018 14:42:10 +0000 (07:42 -0700)]
When formatting as sudoers, flush the lbuf after each userspec.

6 years agoHandle escaped commas when skipping over the cn.
Todd C. Miller [Sun, 4 Mar 2018 14:03:38 +0000 (07:03 -0700)]
Handle escaped commas when skipping over the cn.

6 years agoAdd missing sudoOrder support to parse_ldif().
Todd C. Miller [Fri, 2 Mar 2018 18:27:01 +0000 (11:27 -0700)]
Add missing sudoOrder support to parse_ldif().

6 years agoAdd missing support for converting LOG_INPUT/LOG_OUTPUT tags and
Todd C. Miller [Fri, 2 Mar 2018 18:12:14 +0000 (11:12 -0700)]
Add missing support for converting LOG_INPUT/LOG_OUTPUT tags and
expand support for NOMAIL tags.

6 years agoDon't emit an empty sudoRole for global defaults if there are none.
Todd C. Miller [Fri, 2 Mar 2018 17:59:19 +0000 (10:59 -0700)]
Don't emit an empty sudoRole for global defaults if there are none.

6 years agoAvoid changing the order of non-negated hosts and commands.
Todd C. Miller [Fri, 2 Mar 2018 17:58:50 +0000 (10:58 -0700)]
Avoid changing the order of non-negated hosts and commands.
We still put negated hosts/commands at the end of the list.

6 years agoHandle parsing boolean options that have no explicit value.
Todd C. Miller [Fri, 2 Mar 2018 17:44:33 +0000 (10:44 -0700)]
Handle parsing boolean options that have no explicit value.

6 years agoRefactor the code that actually converts the role to sudoers format
Todd C. Miller [Fri, 2 Mar 2018 16:27:27 +0000 (09:27 -0700)]
Refactor the code that actually converts the role to sudoers format
into role_to_sudoers() now that it is more involved than just calling
sudo_ldap_role_to_priv().

6 years agoWhen merging two privileges, use the runas lists of the previous
Todd C. Miller [Fri, 2 Mar 2018 13:42:29 +0000 (06:42 -0700)]
When merging two privileges, use the runas lists of the previous
privilege when possible.  Otherwise, the generated sudoers line
will include a runas list for commands that is not necessary.

6 years agoUse a case-insensitive comparison when matching user and group names
Todd C. Miller [Fri, 2 Mar 2018 03:31:01 +0000 (20:31 -0700)]
Use a case-insensitive comparison when matching user and group names
in sudoers with the passwd or group database.  This can be necessary
when users and groups are stored in AD or LDAP.

6 years agoFix clean target for *.sudo regress files
Todd C. Miller [Thu, 1 Mar 2018 17:35:32 +0000 (10:35 -0700)]
Fix clean target for *.sudo regress files

6 years agoignore more binaries
Todd C. Miller [Thu, 1 Mar 2018 17:33:47 +0000 (10:33 -0700)]
ignore more binaries

6 years agoFix use of uninitialized variable (conf) if sudoers_debug_register()
Todd C. Miller [Thu, 1 Mar 2018 17:18:48 +0000 (10:18 -0700)]
Fix use of uninitialized variable (conf) if sudoers_debug_register()
happens to fail.

6 years agoSplit conversion code out of parse_ldif() and into ldif_to_sudoers().
Todd C. Miller [Wed, 28 Feb 2018 23:21:09 +0000 (16:21 -0700)]
Split conversion code out of parse_ldif() and into ldif_to_sudoers().

6 years agoQuiet a clang analyzer warning.
Todd C. Miller [Wed, 28 Feb 2018 21:44:54 +0000 (14:44 -0700)]
Quiet a clang analyzer warning.

6 years agorename ldap_common.c -> ldap_util.c
Todd C. Miller [Wed, 28 Feb 2018 21:24:33 +0000 (14:24 -0700)]
rename ldap_common.c -> ldap_util.c

6 years agoWhen converting from ldif to sudoers, sudoRole objects with the
Todd C. Miller [Wed, 28 Feb 2018 21:02:50 +0000 (14:02 -0700)]
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.

6 years agoplug memory leaks
Todd C. Miller [Wed, 28 Feb 2018 21:02:11 +0000 (14:02 -0700)]
plug memory leaks

6 years agoRestore line to set MODE_PRESERVE_ENV in flags when the -E command
Todd C. Miller [Wed, 28 Feb 2018 14:05:36 +0000 (07:05 -0700)]
Restore line to set MODE_PRESERVE_ENV in flags when the -E command
line option is used.  The caller doesn't check MODE_PRESERVE_ENV
these days but parse_args uses it to detect usage errors when -E
is used along with a mutually excusive option.  Problem found by
Yuriy Vostrikov.

6 years agoAdd missing close parenthesis in "Including other files from within
Todd C. Miller [Tue, 27 Feb 2018 00:59:58 +0000 (17:59 -0700)]
Add missing close parenthesis in "Including other files from within
sudoers" section.  Bug #824

6 years agoWhen converting from LDAP to sudoers, put negated hosts and commands
Todd C. Miller [Sun, 25 Feb 2018 13:30:32 +0000 (06:30 -0700)]
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.

6 years agoWe may need the hostname to resolve %h escapes in include files.
Todd C. Miller [Sun, 25 Feb 2018 01:46:00 +0000 (18:46 -0700)]
We may need the hostname to resolve %h escapes in include files.

6 years agoSetting a sudoOrder start point of 0 will disable creation of
Todd C. Miller [Sat, 24 Feb 2018 21:35:38 +0000 (14:35 -0700)]
Setting a sudoOrder start point of 0 will disable creation of
sudoOrder attributes in the resulting LDIF output.

6 years agoDon't need to fill in struct sudo_user since we don't do matching.
Todd C. Miller [Sat, 24 Feb 2018 16:28:01 +0000 (09:28 -0700)]
Don't need to fill in struct sudo_user since we don't do matching.

6 years agoAdd support for setting default options in a config file. In
Todd C. Miller [Sat, 24 Feb 2018 16:23:14 +0000 (09:23 -0700)]
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.

6 years agocvtsudoers can now read LDIF
Todd C. Miller [Thu, 22 Feb 2018 20:17:55 +0000 (13:17 -0700)]
cvtsudoers can now read LDIF

6 years agoFix a typo.
Todd C. Miller [Thu, 22 Feb 2018 20:17:37 +0000 (13:17 -0700)]
Fix a typo.

6 years agoDeal with user_name not being set in cvtsudoers.
Todd C. Miller [Thu, 22 Feb 2018 17:43:47 +0000 (10:43 -0700)]
Deal with user_name not being set in cvtsudoers.

6 years agoInitial support for parsing sudoers LDIF files in cvtsudoers.
Todd C. Miller [Thu, 22 Feb 2018 16:53:12 +0000 (09:53 -0700)]
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.

6 years agoFix LDIF conversion of commands with an associated digest.
Todd C. Miller [Thu, 22 Feb 2018 04:24:53 +0000 (21:24 -0700)]
Fix LDIF conversion of commands with an associated digest.

6 years agoIn array_to_member_list() use the correct type for netgroups and
Todd C. Miller [Thu, 22 Feb 2018 04:09:57 +0000 (21:09 -0700)]
In array_to_member_list() use the correct type for netgroups and
user groups.

6 years agoPrepend digest to command if present.
Todd C. Miller [Thu, 22 Feb 2018 04:08:37 +0000 (21:08 -0700)]
Prepend digest to command if present.
Fix printing of group IDs and non-unix groups.

6 years agoFix gcc false positive for uninitialized variable
Todd C. Miller [Thu, 22 Feb 2018 04:02:36 +0000 (21:02 -0700)]
Fix gcc false positive for uninitialized variable

6 years agoUpdate Polypkg to the latest version from git.
Todd C. Miller [Wed, 21 Feb 2018 04:08:31 +0000 (21:08 -0700)]
Update Polypkg to the latest version from git.

6 years agoUse setpassent() and setgroupent() on systems that support it to
Todd C. Miller [Tue, 20 Feb 2018 20:22:59 +0000 (13:22 -0700)]
Use setpassent() and setgroupent() on systems that support it to
keep the passwd and group database open.  Sudo does a lot of passwd
and group lookups so it can be beneficial to just leave the file
open.

6 years agoAdd option to cvtsudoers to expand aliases in the output.
Todd C. Miller [Mon, 19 Feb 2018 22:32:56 +0000 (15:32 -0700)]
Add option to cvtsudoers to expand aliases in the output.

6 years agoFix conversion of "ALL" in the JSON output format, which was being
Todd C. Miller [Mon, 19 Feb 2018 20:39:11 +0000 (13:39 -0700)]
Fix conversion of "ALL" in the JSON output format, which was being
printed as an alias.

6 years agoClarify that --with-rundir and --with-vardir take sudo-specific directory,
Todd C. Miller [Mon, 19 Feb 2018 18:27:30 +0000 (11:27 -0700)]
Clarify that --with-rundir and --with-vardir take sudo-specific directory,
e.g. /var/run/sudo and not just /var/run.  Bug #823

6 years agoIn pty_cleanup() we need to call sudo_term_restore() even if no I/O
Todd C. Miller [Mon, 19 Feb 2018 18:00:12 +0000 (11:00 -0700)]
In pty_cleanup() we need to call sudo_term_restore() even if no I/O
plugins are present as long as /dev/tty exists.  Fixes the use_pty
case with no I/O plugins.

6 years agoAdd sudo_ev_dispatch(), a wrapper for ev_loop() with no flags.
Todd C. Miller [Mon, 19 Feb 2018 18:00:10 +0000 (11:00 -0700)]
Add sudo_ev_dispatch(), a wrapper for ev_loop() with no flags.
Similar the dispatch function in libevent.

6 years agoUse /run in preference to /var/run if it exists.
Todd C. Miller [Mon, 19 Feb 2018 17:59:12 +0000 (10:59 -0700)]
Use /run in preference to /var/run if it exists.
Bug #822

6 years agomention common sudoers formatting changes
Todd C. Miller [Wed, 14 Feb 2018 18:30:49 +0000 (11:30 -0700)]
mention common sudoers formatting changes

6 years agoMove LDAP configuration bits into ldap_conf.c
Todd C. Miller [Sun, 11 Feb 2018 14:36:08 +0000 (07:36 -0700)]
Move LDAP configuration bits into ldap_conf.c

6 years agoNo longer need to include stddef.h
Todd C. Miller [Sat, 10 Feb 2018 20:37:59 +0000 (13:37 -0700)]
No longer need to include stddef.h

6 years agoRemove dead store, found by cppcheck.
Todd C. Miller [Sat, 10 Feb 2018 16:44:34 +0000 (09:44 -0700)]
Remove dead store, found by cppcheck.

6 years agosimplify iterator
Todd C. Miller [Sat, 10 Feb 2018 11:29:43 +0000 (04:29 -0700)]
simplify iterator

6 years agoSilence a false positive from cppcheck.
Todd C. Miller [Sat, 10 Feb 2018 11:08:42 +0000 (04:08 -0700)]
Silence a false positive from cppcheck.

6 years agoCast version to int when printing. Avoids a cppcheck warning.
Todd C. Miller [Sat, 10 Feb 2018 11:00:17 +0000 (04:00 -0700)]
Cast version to int when printing.  Avoids a cppcheck warning.

6 years agoUse an iterator instead of fragile pointer arithmetic to iterate
Todd C. Miller [Sat, 10 Feb 2018 05:06:56 +0000 (22:06 -0700)]
Use an iterator instead of fragile pointer arithmetic to iterate
over value arrays in sudo_ldap_role_to_priv().

6 years agoMove sudoers formatting code into fmtsudoers.
Todd C. Miller [Sat, 10 Feb 2018 01:22:04 +0000 (18:22 -0700)]
Move sudoers formatting code into fmtsudoers.

6 years agoClean up some XXX in parse.c
Todd C. Miller [Sat, 10 Feb 2018 01:22:03 +0000 (18:22 -0700)]
Clean up some XXX in parse.c

6 years agoRename sudo_file_append_default() -> sudo_lbuf_append_default() and
Todd C. Miller [Sat, 10 Feb 2018 01:22:02 +0000 (18:22 -0700)]
Rename sudo_file_append_default() -> sudo_lbuf_append_default() and
use it for ldap and sssd too.

6 years agoMove common bits of ldap to sudoers conversion into ldap_common.c
Todd C. Miller [Sat, 10 Feb 2018 01:21:40 +0000 (18:21 -0700)]
Move common bits of ldap to sudoers conversion into ldap_common.c
and use it in sssd.c.

6 years agoConvert ldap results into a sudoers userspec so we can use the "sudo
Todd C. Miller [Sat, 10 Feb 2018 01:21:01 +0000 (18:21 -0700)]
Convert ldap results into a sudoers userspec so we can use the "sudo
-l" output functions in parse.c.

6 years agoDon't mark sudoers.dist volatile, it only gets used on systems that
Todd C. Miller [Thu, 8 Feb 2018 16:14:12 +0000 (09:14 -0700)]
Don't mark sudoers.dist volatile, it only gets used on systems that
don't have the concept of volatile files.

6 years agoRefactor member freeing code into free_member().
Todd C. Miller [Mon, 5 Feb 2018 20:33:29 +0000 (13:33 -0700)]
Refactor member freeing code into free_member().
Refactor userspec freeing code into free_userspec().

6 years agoFix compilation with glibc where stdout is not constant.
Todd C. Miller [Mon, 5 Feb 2018 13:23:33 +0000 (06:23 -0700)]
Fix compilation with glibc where stdout is not constant.

6 years agoFor "sudo -l", if a word includes spaces, print it in double quotes.
Todd C. Miller [Sun, 4 Feb 2018 19:53:32 +0000 (12:53 -0700)]
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.

6 years agoDisplay sudoNotBefore and sudoNotAfter in "sudo -l"
Todd C. Miller [Sat, 3 Feb 2018 21:56:00 +0000 (14:56 -0700)]
Display sudoNotBefore and sudoNotAfter in "sudo -l"