Todd C. Miller [Wed, 21 Aug 2013 16:09:04 +0000 (10:09 -0600)]
Add configure checks for the exec functions we will dummy out. This
is only really needed on Mac OS X when symbol interposition is being
performed but won't hurt elsewhere.
Todd C. Miller [Tue, 20 Aug 2013 21:14:17 +0000 (15:14 -0600)]
Fix installation of sudo_noexec on Mac OS X.
Use library symbol interposition on Mac OS X 10.4 and higher so
we don't need to set DYLD_FORCE_FLAT_NAMESPACE=1.
Todd C. Miller [Sat, 17 Aug 2013 11:08:20 +0000 (07:08 -0400)]
Fix error display from ldap_ssl_client_init(). There are two error
codes. The return value can be decoded via ldap_err2string() but the
ssl reason code cannot (you have to look it up in a table online).
Todd C. Miller [Sat, 17 Aug 2013 12:34:09 +0000 (06:34 -0600)]
When merging the PAM environment, allow environment variables set
in PAM to override ones set by sudo as long as they do not match
the env_keep or env_check lists.
Todd C. Miller [Fri, 16 Aug 2013 19:50:48 +0000 (13:50 -0600)]
Don't redefine opterr, optind, optopt, optarg in getopt_long.c.
Add a check for optreset which is a BSD extension and provide a
definition in getopt_long.c if it is not present.
Todd C. Miller [Thu, 15 Aug 2013 20:09:53 +0000 (14:09 -0600)]
Add support to the debug subsystem for zero-length strings. This
can happen for things like warning(NULL) or fatal(NULL) where we
just want to log the errno string.
Todd C. Miller [Thu, 15 Aug 2013 15:56:17 +0000 (09:56 -0600)]
Move the -C (user_closefrom) check until after set_cmnd() so that
closefrom_override can be used in a command-specific Defaults line.
Fixes bug #610 from Mengtao Sun.
Todd C. Miller [Wed, 14 Aug 2013 22:36:41 +0000 (16:36 -0600)]
If not using a pty and the child process gets SIGTTOU or SIGTTIN
and sudo is the foreground process, make the child the foreground
process and continue it.
Todd C. Miller [Wed, 14 Aug 2013 19:49:14 +0000 (13:49 -0600)]
Add limited support for "sudo -l -h other_host". Since group lookups
are done on the local host, rules that use group membership may be
incorrect if the group database is not synchronized between hosts.
Todd C. Miller [Wed, 14 Aug 2013 16:30:51 +0000 (10:30 -0600)]
Simplify usage messages a bit and make --help output more closely
resemble GNU usage wrt long options. Sync usage and man page
SYNOPSYS sections and improve long options in the manual pages.
Now that we have long options we don't need to give the mnemonic
for the single-character options in the description.
Todd C. Miller [Mon, 12 Aug 2013 15:14:38 +0000 (09:14 -0600)]
Don't allow max_groups to be set to zero, it just complicates things
needlessly. Fixes an assertion in visudo when there is a group-based
Defaults entry.
Todd C. Miller [Thu, 8 Aug 2013 17:40:36 +0000 (11:40 -0600)]
Refactor code to parse list of gids into its own function that is
shared by the sudo front-end and the sudoers module.
Make uid/gid parse error be fatal, not just a warning.
Todd C. Miller [Wed, 7 Aug 2013 21:04:58 +0000 (15:04 -0600)]
Avoid a crash on Mac OS X 10.8 (at least) when we close libdispatch's
fds out from under it before executing the command. Switch to just
setting the close on exec flag instead.
Todd C. Miller [Wed, 7 Aug 2013 19:13:56 +0000 (13:13 -0600)]
Add atoid() function to convert a string to an id_t (uid, gid or
pid). We have to be careful to choose() either strtol() or strtoul()
depending on whether the string appears to be signed or unsigned.
Always using strtoul() is unsafe on 64-bit platforms since the
uid might be represented as a negative number and (unsigned long)-1
on a 64-bit system is 0xffffffffffffffff not 0xffffffff.
Fixes a problem with uids larger than 0x7fffffff on 32-bit platforms.
Todd C. Miller [Wed, 7 Aug 2013 17:23:19 +0000 (11:23 -0600)]
Add atoid() function to convert a string to an id_t (uid, gid or
pid). We have to be careful to choose() either strtol() or strtoul()
depending on whether the string appears to be signed or unsigned.
Always using strtoul() is unsafe on 64-bit platforms since the
uid might be represented as a negative number and (unsigned long)-1
on a 64-bit system is 0xffffffffffffffff not 0xffffffff.
Fixes a problem with uids larger than 0x7fffffff on 32-bit platforms.
Todd C. Miller [Sat, 3 Aug 2013 14:30:06 +0000 (08:30 -0600)]
Implement memset_s() and use it instead of zero_bytes().
A new constant, SUDO_CONV_REPL_MAX, is defined by the plugin
API as the max conversation reply length. This constant can be
used as a max value for memset_s() when clearing passwords
filled in by the conversation function.
Todd C. Miller [Mon, 29 Jul 2013 21:34:49 +0000 (15:34 -0600)]
Instead of setting RLIMIT_NPROC to unlimited when sudo initializes,
just save RLIMIT_NPROC in exec_setup() before the final setuid()
and restore it immediately after. We don't need to modify RLIMIT_NPROC
for simple euid changes, just for changing the real (and saved)
uids before we exec. This also means we no longer need to worry
about _SC_CHILD_MAX returning -1. Bug #565
Todd C. Miller [Sun, 28 Jul 2013 23:06:43 +0000 (17:06 -0600)]
Now that the ldap code runs with the real and effective uid set to
0, it is not possible for the gssapi libs to find the user's krb5
credential cache file. To work around this, we make a temporary
copy of the user's credential cache specified by KRB5CCNAME (opened
with the user's effective uid) and point gssapi to it. To set the
credential cache file name, we dynamically look up gss_krb5_ccache_name()
and use it if available, otherwise fall back to setting KRB5CCNAME.