Commit Graph

1109 Commits

Author SHA1 Message Date
Todd C. Miller
2f251caf47 Fix compilation on Solaris 11. 2013-08-15 10:39:40 -06:00
Todd C. Miller
251c79a77b Add missing missing.h 2013-08-15 10:08:27 -06:00
Todd C. Miller
c376c71618 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.
2013-08-15 09:56:17 -06:00
Todd C. Miller
d0e3867587 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.
2013-08-14 13:49:14 -06:00
Todd C. Miller
8b1d645534 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.
2013-08-14 10:30:51 -06:00
Todd C. Miller
91e66c481f Fix setting of mailer argv[0] to basename of mailerpath.
No need to strdup() mailerpath as it is not modified.
2013-08-13 14:53:55 -06:00
Todd C. Miller
04b290e385 Make sure the mailer exists and is a regular file before trying
to exec it.
2013-08-13 14:48:24 -06:00
Todd C. Miller
39d630f2f2 If tty_tickets are enabled but there is no tty, use a ticket file
based on the parent pid.
2013-08-13 12:55:17 -06:00
Todd C. Miller
9b2fb418ca 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.
2013-08-12 09:14:38 -06:00
Todd C. Miller
8b4fbc5cc0 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.
2013-08-08 11:40:36 -06:00
Todd C. Miller
fe23e7c038 Add endpointer and separator args to atoid() 2013-08-08 06:11:52 -06:00
Todd C. Miller
dde7331a0f Use atoid() in more places. 2013-08-07 15:49:03 -06:00
Todd C. Miller
40cb480f07 Move atoid() to common so it can be used in src and compat too. 2013-08-07 15:10:45 -06:00
Todd C. Miller
c3fb47a88e 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.
2013-08-07 13:13:56 -06:00
Todd C. Miller
5dc56ea81d 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.
2013-08-07 11:23:19 -06:00
Todd C. Miller
972ee9a0fb Avoid "perm stack underflow" error when logging the unknown uid error. 2013-08-07 10:13:04 -06:00
Todd C. Miller
23a2bdbcba In rewind_perms() there is nothing to do if perm_stack_depth == 0. 2013-08-07 09:42:14 -06:00
Todd C. Miller
3898f5d7ff Add pam_setcred sudoers option to allow the user to control whether
pam_setcred() is called on the user's behalf.
2013-08-06 14:44:21 -06:00
Todd C. Miller
52954481e1 Add pam_service and pam_login_service sudoers settings to control
the service name passed to pam_start.
2013-08-06 11:01:36 -06:00
Todd C. Miller
1f3ea50afd 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.
2013-08-03 08:30:06 -06:00
Todd C. Miller
8c867be419 Do not try to install plugins when shared modules are disabled
(sudoers already had the check).
2013-08-01 10:51:46 -06:00
Todd C. Miller
d882303b88 Update dependencies to take into account compat/getopt.h and
compat/dlfcn.h.
2013-08-01 10:51:06 -06:00
Todd C. Miller
62da46a9cb Add some warnings and debugging to sasl ccname handling. 2013-07-31 15:20:14 -06:00
Todd C. Miller
c0c782ae14 Fix write loop invariant in sudo_krb5_copy_cc_file() 2013-07-31 15:03:46 -06:00
Todd C. Miller
09e752274e Strip off leading FILE: or WRFILE: prefix before trying to copy
the user's credential cache.
2013-07-30 15:37:04 -06:00
Todd C. Miller
b1c8f0575b 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.
2013-07-28 17:06:43 -06:00
Todd C. Miller
39575aecf2 Long option support for visudo and sudoreplay. 2013-07-19 09:42:25 -06:00
Todd C. Miller
e53e80187d Sync with translationproject.org 2013-07-16 07:32:57 -06:00
Todd C. Miller
6dff70db03 Go back to ignoring the return value of pam_setcred() since with
stacked PAM auth modules a failure from one module may override
PAM_SUCCESS from another.  If the first module in the stack fails,
the others may be run (and succeed) but an error will be returned.
This can cause a spurious warning on systems with non-local users
(e.g. pam_ldap or pam_sss) where pam_unix is consulted first.
2013-07-11 17:50:03 -04:00
Todd C. Miller
4d6cb6efff Fix pasto; sudo_sss_extract_digest() not sudo_ldap_extract_digest().
From Dan Harnett.
2013-07-09 10:35:26 -06:00
Todd C. Miller
ab61c02546 Replace sequence number-based cycle detection in visudo with a
"used" flag in struct alias.  The caller is required to call
alias_put() when it is done with the alias.  Inspired by a patch
from Daniel Kopecek.
2013-05-22 11:32:08 -04:00
Todd C. Miller
8a57f129ac Eliminate a few relocations related to sudoers_io. 2013-05-20 11:06:13 -04:00
Todd C. Miller
32a29d596d Sync with translationproject.org 2013-05-20 10:20:04 -04:00
Todd C. Miller
1e5e5fb440 No longer store the ctime of a devpts tty. The handling of ctime
on devpts in Linux has been changed to conform to POSIX.  As a
result we can no longer assume that the ctime will stay unchanged
throughout the life of the session.  We store the session ID in the
time stamp file so there is a much smaller chance of the time stamp
file being reused by a new login.  While here, store the uid/gid
in the timestamp file too for good measure.
2013-05-03 16:14:12 -04:00
Todd C. Miller
f6e8fb8b1c Quiet a few -Wunused-result compiler warnings. 2013-05-01 11:02:09 -04:00
Todd C. Miller
a971ac4233 Sync with translationproject.org 2013-04-29 14:04:51 -04:00
Todd C. Miller
8aaea60a79 regen 2013-04-29 14:02:23 -04:00
Todd C. Miller
368a6558ca Change some error/errorx -> fatal/fatalx in comments and xgettext
flags.
2013-04-26 16:06:05 -04:00
Todd C. Miller
e17e4c951a Updated translations from translationproject.org including new
Turkish translation.
2013-04-26 09:16:22 -04:00
Todd C. Miller
fa6c857112 Allow ldap_conf and ldap_secret to be specified as plugin arguments
in sudo.conf
2013-04-25 14:49:02 -04:00
Todd C. Miller
a40de4135e Replace DPRINTF with DPRINTF1 and DPRINTF2 macros that use
SUDO_DEBUG_DIAG and SUDO_DEBUG_INFO respectively for logging to the
debug file with the ldap subsystem.
The sudoers_debug setting in ldap.conf is still honored for now but
will be removed in a future release.
2013-04-25 10:12:42 -04:00
Todd C. Miller
8248fb3299 Add support for converting sudoers files with SHA-2 command digests. 2013-04-24 16:02:20 -04:00
Todd C. Miller
e05d2732aa Add copyright notice to scripts 2013-04-24 15:47:39 -04:00
Todd C. Miller
5a7e54d375 Add regress for SHA-2 digests. 2013-04-24 15:38:03 -04:00
Todd C. Miller
50bdd5f131 Clear up an llvm checker warning which appears to be a false positive
and fix an old XXX while I'm at it.
2013-04-24 11:55:21 -04:00
Todd C. Miller
8ca50e13b7 No need to translate this error message. 2013-04-24 11:11:21 -04:00
Todd C. Miller
d6282d154a Update copyright years. 2013-04-24 09:35:02 -04:00
Todd C. Miller
7b4f990d1d Systrace support was removed long ago. 2013-04-24 09:17:11 -04:00
Todd C. Miller
2923a6652b Remove some files that were mistakenly added. 2013-04-23 16:37:52 -04:00
Todd C. Miller
95b50f84af Use time(&now) instead of now = time(NULL) when storing the current
time in a time_t (better compiler error checking).
Better parsing and printing of 64-bit time_t on 32-bit platforms.
2013-04-23 13:15:22 -04:00