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
Todd C. Miller
5e1084c08a
Ignore PAM_SESSION_ERR from pam_open_session() since this can
...
apparently happen on systems using Solaris-derived PAM. Other
errors from pam_open_session() are treated as fatal. This avoids
the "policy plugin failed session initialization" error message
seen on some systems.
2016-05-25 08:33:57 -06:00
Todd C. Miller
b9dde14808
No need to set pass to NULL after freeing at the end of the loop
...
it since it is already set to NULL each time through the loop.
2016-05-16 10:18:31 -06:00
Todd C. Miller
90fdb6a316
Do not write directly to stdout/stderr, use sudo_printf which calls
...
the conversation function.
2016-05-14 19:33:28 -06:00
Todd C. Miller
4f46e07209
Avoid adding an extraneous warning string to sudoers.pot.
2016-05-12 10:33:32 -06:00
Todd C. Miller
b0be9895d9
Now that pam_open_session() failure is fatal we should print and log
...
an error from it. Bug #744
2016-05-11 15:01:45 -06:00
Todd C. Miller
b2d1c457ce
If the auth_type setting in /etc/security/login.cfg is set to
...
PAM_AUTH but pam_start() fails, fall back to use AIX authentication.
Skip the auth_type check if sudo is not compiled with PAM support.
2016-03-22 16:31:28 -06:00
Todd C. Miller
48dff84081
Work around an ambiguity in the PAM spec with respect to the conversation
...
function. It is not clear whether the "struct pam_message **msg" is an
array of pointers or a pointer to an array. Linux-PAM and OpenPAM use
an array of pointers while Solaris/HP-UX/AIX uses a pointer to an array.
Bug #726 .
2016-03-09 09:39:46 -07:00
Todd C. Miller
5dd7ac20e1
Log the number of PAM messages in the conversation function at debug
...
level.
2016-02-26 09:30:31 -07:00
Todd C. Miller
873d5cc5ff
Try to deconfuse static analyzers a bit.
2016-01-27 16:19:22 -07:00
Todd C. Miller
ab11cdde2c
auth_getpass() returns a dynamically allocated copy of the plaintext
...
password which needs to be freed after checking (and clearing) it.
2016-01-27 15:36:50 -07:00
Todd C. Miller
2afb2f2048
Repair challenge/response prompting for BSD authentication which
...
got broken while it was converted to use the conversation function.
2015-10-06 15:00:47 -06:00
Todd C. Miller
2ecda6d65c
Use the auth_getpass (and the plugin conversation fuction) for Tru64
...
SIA. This prevents sudo from sleeping while holding the tty ticket
lock.
2015-10-06 10:25:53 -06:00
Todd C. Miller
0649a261e7
Fix passing of the callback pointer to the conversation function.
...
This was preventing the on_suspend and on_resume functions from
being called on PAM systems.
2015-09-24 13:43:17 -06:00
Todd C. Miller
98a15d9879
Add a struct sudo_conv_callback that contains on_suspend and on_resume
...
function pointer args plus a closure pointer and at it to the
conversation function.
2015-09-07 06:06:08 -06:00
Todd C. Miller
2b6085760c
In sudo_pam_begin_session() and sudo_pam_end_session() return
...
AUTH_FATAL on error, not AUTH_FAILURE. In sudo_auth_begin_session()
treat anything other than AUTH_SUCCESS as a fatal error.
2015-08-10 20:17:02 -06:00
Todd C. Miller
db5376001f
Sprinkle some debugging.
2015-08-10 10:56:47 -06:00
Todd C. Miller
7187c19c83
Add warning if calloc() fails.
...
Add debugging for other unexpected errors.
2015-07-14 14:00:18 -06:00
Todd C. Miller
0b241088b3
There's no need to conditionalize the #include <unistd.h>, we require
...
a POSIX system.
2015-07-02 09:08:28 -06:00
Todd C. Miller
ea5ce39c92
When checking whether the PAM prompt matches "Password:", also check
...
for the untranslated version. The PAM module might not be using the
localized string even though it exists. From Joel Pelaez Jorge.
Fixes Bug #701
2015-06-25 09:12:15 -06:00
Todd C. Miller
4a07b472f0
Only include stddef.h where it is needed.
2015-06-20 05:34:35 -06:00
Todd C. Miller
c36415417f
Add function name to "unable to allocate memory" warnings.
2015-06-19 14:51:17 -06:00
Todd C. Miller
dc883f2454
We require ANSI C so stop using the obsolete STDC_HEADERS.
2015-06-19 14:29:27 -06:00
Todd C. Miller
d004b02fc6
Use non-exiting allocatings in the sudoers plugin.
2015-06-17 06:49:59 -06:00
Todd C. Miller
69e62f316e
Use reallocarray() instead of sudo_emallocarray() and return an
...
error on allocation failure.
2015-05-20 10:59:03 -06:00
Todd C. Miller
212ff5d964
In our krb5_get_init_creds_opt_alloc() replacement use malloc()
...
instead of sudo_emalloc() and return KRB5_CC_NOMEM on allocation
failure. Only old versions of Kerberos V will need this.
2015-05-20 10:58:17 -06:00
Todd C. Miller
1298ea9107
Add target for "make splint". A few files need extra guards to avoid
...
errors on systems where they would not otherwise be compiled.
No warnings from splint.
2015-05-21 11:07:13 -06:00
Todd C. Miller
cbcaaa299a
No need to cast malloc() return value.
2015-05-14 10:47:09 -06:00
Todd C. Miller
caf5d45e0f
Previously, debug_return_bool was the same as debug_return_int
...
except that it logged true/false for 1/0. However, this appears
to trigger a bug in some compilers. To avoid this, debug_return_bool
now uses bool, not int. Callers that were passing it an int have
been converted to use debug_return_int instead.
2015-05-07 10:33:23 -06:00
Todd C. Miller
a604f0f02d
Pam conversation function changes:
...
o use PAM_BUF_ERR as the return value when calloc() fails.
o sanity check the value of num_msg
o remove the workaround for old Apple PAM
o PAM_AUTH_ERR is not a valid PAM conversation function return value
If getpass_error is set after a call to pam_verify (usually because
the user pressed ^C), return AUTH_INTR immediately instead of
checking the pam_verify return value.
2015-02-23 11:12:45 -07:00
Todd C. Miller
e11f32fd42
On AIX use the value of auth_type in /etc/security/login.cfg to
...
determine whether to use LAM or PAM unless the user specified the
--with-pam or --with-aixauth configure flags.
2015-02-23 11:12:43 -07:00
Todd C. Miller
9b514ed83c
Historically, crypt() returned the empty string on error, which
...
ensured that crypt("", "") would return "", which supported matcing
empty encrypted passwords with no additional code. Some modern
versions of crypt() (such as glibc) return NULL on error so we need
an explicit test to match an empty plaintext password and an empty
encrypted password.
2015-02-19 14:17:57 -07:00
Todd C. Miller
59ab26dbcc
Go back to a 2 args debug_decl and just use the "default" instance,
...
now renamed "active".
2015-02-01 08:24:49 -07:00
Todd C. Miller
e9914a91b1
The sudoers plugin now defines its own list of debugging subsystem names
...
and defines.
2014-10-22 13:30:52 -06:00
Todd C. Miller
866cfc4fc3
Add support for multiple Debug lines per program. Callers may
...
register arbitrary debug facilities or use built-in defaults. We
now use separate Debug statements for plugins and programs.
2014-10-22 13:23:05 -06:00
Todd C. Miller
496c2e287b
Add a space after "Password:" in default password prompt so it is
...
easier to read when pwfeedback is enabled.
2014-09-27 10:24:19 -06:00
Todd C. Miller
b7444e0f83
Simplify how we count the password tries
2014-09-27 10:17:21 -06:00
Todd C. Miller
355834c76a
Block SIGINT and SIGQUIT while verifying passwords so that
...
authentication modules that use sleep() are not interrupted.
If the user interrupted authentication, exit the loop.
2014-09-27 10:16:31 -06:00
Todd C. Miller
d28c525ede
If all authentication methods fail init/setup, fail with an error.
2014-09-26 20:55:19 -06:00
Todd C. Miller
4105734743
Move pass_warn() so that it is defined before it is called().
2014-09-26 20:39:40 -06:00
Todd C. Miller
36a5767e3e
efree -> sudo_efree for consistency
2014-07-10 15:35:04 -06:00
Todd C. Miller
2d61d38c23
Add sudo_ prefix to alloc.c functions and rename alloc.h -> sudo_alloc.h
2014-06-27 10:48:31 -06:00
Todd C. Miller
aecef4aa1d
Rename warning/fatal -> sudo_warn/sudo_fatal to avoid namespace
...
pollution in libsudo_util.so.
2014-06-27 09:30:52 -06:00
Todd C. Miller
337a712745
Pass argc to audit functions too. Will be needed for Solaris audit
...
support.
2014-05-13 09:41:53 -06:00
Todd C. Miller
b0f1fa7d05
Rename log_warning flags and only send mail if SLOG_SEND_MAIL is
...
set instead of mailing by default like we used to.
2014-05-02 20:54:01 -06:00
Todd C. Miller
954a3e77b1
Add log_warningx
2014-05-02 16:40:30 -06:00
Todd C. Miller
5086194c67
Eliminate calls to fatal()/fatalx()/log_fatal() in env.c and just
...
pass back a return value.
2014-04-30 16:57:12 -06:00
Todd C. Miller
e8bb08cc46
Use calloc() instead of malloc(n * s) followed by memset().
...
From Jean-Philippe Ouellet.
2014-04-22 16:06:04 -06:00
Todd C. Miller
134b2a4228
Rename emalloc2() -> emallocarray() and erealloc3() -> ereallocarray().
2014-04-22 16:02:28 -06:00
Todd C. Miller
7d91691e1f
Use PAM_REINITIALIZE_CRED instead of PAM_ESTABLISH_CRED when
...
changing the user. This is the correct flag to use with
a program that changes the uid like su or sudo and fixes a
role problem on Solaris. From Gary Winiger; Bug #642
2014-04-15 07:16:57 -06:00