Commit Graph

146 Commits

Author SHA1 Message Date
Todd C. Miller
d702ee9813 Use log_warning() not log_fatal() for the "Invalid authentication
methods compiled into sudo" message.  We return -1 on error anyway.
2014-04-07 08:59:48 -06:00
Todd C. Miller
4e3e5077e1 Remove unused FLAG_USER auth flag. We have no auth methods that
require that authentication be run as the invoking user.
2014-02-27 15:51:40 -07:00
Todd C. Miller
7ace435d44 Move right brace outside #ifdef HAVE_DISPCRYPT; found by cppcheck. 2014-01-08 16:23:06 -07:00
Todd C. Miller
b2c456341a Move symbol extern defs into sudoers.h 2013-12-16 14:18:42 -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
Todd C. Miller
96eb2c4f8f Add warning_gettext() wrapper function that changes to the user locale,
then calls gettext().
Add U_ macro that calls warning_gettext() instead of gettext().
Rename warning2()/error2() back to warning_nodebug()/error_nodebug().
2013-11-18 08:59:57 -07:00
Todd C. Miller
65c6f34aa4 If pam_open_session() fails don't call pam_getenvlist() with a NULL
pam handle.
2013-10-22 14:47:51 -06:00
Todd C. Miller
6b0a909d9a Do not use "setup" as a verb; bug #614 2013-09-03 14:47:34 -06:00
Todd C. Miller
e54f11ae47 Fix comment. 2013-08-19 09:19:24 -06:00
Todd C. Miller
ebbdee421a Remove now-obsolete arg to env_merge() 2013-08-18 14:33:35 -06:00
Todd C. Miller
f72f47aa1d Call pam_getenvlist() after we've opened the session to get the
session-specific environment variables.
2013-08-17 06:22:46 -06:00
Todd C. Miller
91ec1c476c It is not possible for auth to be NULL here. 2013-08-15 15:22:50 -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
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
d6282d154a Update copyright years. 2013-04-24 09:35:02 -04:00
Todd C. Miller
1162b55040 Rename log_error() -> log_warning() for consistency with warning()/fatal() 2013-04-18 14:14:03 -04:00
Todd C. Miller
2c3a4e0354 The NO_EXIT flag was removed a while ago. 2013-04-18 14:13:05 -04:00
Todd C. Miller
bce9a96a6d Add missing "not" in error message when mixing standalone and
non-standalone authentication methods.
2013-04-11 15:55:32 -04:00
Todd C. Miller
6f718ee3cd Check for crypt() returning NULL. Traditionally, crypt() never returned
NULL but newer versions of eglibc have a crypt() that does.  Bug #598
2013-04-11 13:10:40 -04:00
Todd C. Miller
e9726e5974 Better PAM error messages 2013-04-11 09:09:53 -04:00
Todd C. Miller
c00cc3bfe3 Better error messages 2013-04-11 09:03:37 -04:00
Todd C. Miller
9914cd8a76 Don't add the "Password: " string we look up in the PAM text domain
to the sudoers.pot file.
2013-04-09 09:40:36 -04:00
Todd C. Miller
1791721ef2 Only delete creds if we actually established them.
Print an error if pam_setcred() fails and we actually authenticated.
2013-03-07 16:17:44 -05:00
Todd C. Miller
9a4bd3cce4 Fix PAM compilation: def_pam_session, not just pam_session. 2013-02-28 08:38:06 -05:00
Todd C. Miller
0eef336edf Fix debug_decl for sudo_auth_begin_session and sudo_auth_end_session. 2013-02-24 13:04:58 -05:00
Todd C. Miller
59692ad282 Add pam_session sudoers option. 2013-02-24 06:15:37 -05:00
Todd C. Miller
d3ff0f31ee Dummy out close function if there is no end_session for the auth
method and the front-end can handle a NULL close function.  Avoids
the extra sudo process when we don't actually need it.
2013-02-24 05:54:57 -05:00
Todd C. Miller
1d7072fe09 Don't include <sys/param.h>. We only needed it for MAXPATHLEN,
MAXHOSTNAMELEN and the MIN/MAX macros.  We now use PATH_MAX and
HOST_NAME_MAX throughout without falling back on MAXPATHLEN or
MAXHOSTNAMELEN and define our own MIN/MAX macros as needed.
2012-12-04 10:40:47 -05:00
Todd C. Miller
7b3d268687 Call gettext() on parameters for warning()/warningx() instead of
having warning() do it for us.
2012-11-25 09:34:04 -05:00
Todd C. Miller
a0c53bd751 Call gettext inside log_error et al instead of having the caller do it. This way we can display any messages to the user in their own locale but log in the sudoers local. 2012-11-08 15:37:44 -05:00
Todd C. Miller
595d3b2651 Display warning/error messages in the user's locale. 2012-11-08 15:37:44 -05:00
Todd C. Miller
f454a852cb audit_failure() now calls gettext itself using the sudoers locale. 2012-11-08 15:37:43 -05:00
Todd C. Miller
60ba369791 Change a log_fatal() into log_error() when no auth methods are
configured.  The caller already checks the return value.
2012-08-22 12:51:46 -04:00
Todd C. Miller
8b03f3e7d0 Move log_denial() calls and logic to log_failure().
Move authentication failure logging to log_auth_failure().
Both of these call audit_failure() for us.

This subtly changes logging for commands that are denied by sudoers
but where the user failed to enter the correct password.  Previously,
these would be logged as "N incorrect password attempts" but now
are logged as "command not allowed".  Fixes bug #563
2012-07-10 12:42:33 -04:00
Todd C. Miller
989361c275 Pass PAM_SILENT when deleting creds to remove an annoying warning
message on Solaris.
2012-04-24 09:48:58 -04:00
Todd C. Miller
23b7a1fa5c Call the policy's init_session() function before we fork the child.
That way, the session is created and destroyed in the same process,
which is needed by some modules, such as  pam_mount.
2012-04-23 16:38:16 -04:00
Todd C. Miller
cf4562c031 Delete creds after closing the PAM session. 2012-04-23 16:11:49 -04:00
Todd C. Miller
dfc90ff0b1 Instead of treating ^C from tgetpass() specially, always
return AUTH_INTR if tgetpass() returned NULL.
Treat PAM_AUTHINFO_UNAVAIL like PAM_AUTH_ERR which Mac OS X
returns this when there is no tty.
2012-04-11 19:51:56 -04:00
Todd C. Miller
44ce5720de Remove the NO_EXIT flag to log_error() and add a log_fatal() function
that exits and is marked no_return.  Fixes false positives from
static analyzers and is easier for humans to read too.
2012-03-26 10:59:14 -04:00
Todd C. Miller
6d10909949 Pass a pointer to user_env in to the init_session policy plugin
function so session setup can modify the user environment as needed.
For PAM authentication, merge the PAM environment with the user
environment at init_session time.  We no longer need to swap in the
user_env for environ during session init, nor do we need to disable
the env hooks at init_session time.
2012-03-15 09:18:36 -04:00
Todd C. Miller
37770ecf1e Initial cut at a hooks implementation. The plugin can register
hooks for getenv, putenv, setenv and unsetenv.  This makes it
possible for the plugin to trap changes to the environment made by
authentication methods such as PAM or BSD auth so that such changes
are reflected in the environment passed back to sudo for execve().
2012-03-07 16:35:42 -05:00
Todd C. Miller
241b1db873 Add --enable-kerb5-instance configure option to allow people using
Kerberos V authentication to use a custom instance.  Adapted from
a diff by Michael E Burr.
2012-01-05 15:39:05 -05:00
Todd C. Miller
db3fd558be Remove inaccurate comment 2011-12-02 14:41:32 -05:00
Todd C. Miller
199eeb38d4 Fetch the login class for the user we authenticate specifically when
using BSD authentication.  That user may have a different login class
than what we will use to run the command.  When setting the login
class for the command, use the target user's struct passwd, not
the invoking user's.  Fixes bug 526
2011-12-02 14:29:54 -05:00
Todd C. Miller
21a2f95821 Use stdbool.h instead of rolling our own TRUE/FALSE macros. 2011-12-02 11:27:33 -05:00
Todd C. Miller
dd2fcf16d6 Fix typo, return_debug vs. debug_return 2011-11-29 14:41:00 -05:00
Todd C. Miller
5c29710f35 Remove obsolete securid auth method. 2011-11-13 11:54:06 -05:00
Todd C. Miller
6fd3e03857 Prefix authentication functions with a "sudo_" prefix to avoid
namespace problems.
2011-11-13 11:46:39 -05:00