|
|
469442 |
diff --git a/src/acct.c b/src/acct.c
|
|
|
469442 |
index 0dce4f9..f87001b 100644
|
|
|
469442 |
--- a/src/acct.c
|
|
|
469442 |
+++ b/src/acct.c
|
|
|
469442 |
@@ -83,7 +83,8 @@ pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
|
|
|
469442 |
}
|
|
|
469442 |
|
|
|
469442 |
/* Read our options. */
|
|
|
469442 |
- options = _pam_krb5_options_init(pamh, argc, argv, ctx);
|
|
|
469442 |
+ options = _pam_krb5_options_init(pamh, argc, argv, ctx,
|
|
|
469442 |
+ _pam_krb5_option_role_general);
|
|
|
469442 |
if (options == NULL) {
|
|
|
469442 |
warn("error parsing options (shouldn't happen)");
|
|
|
469442 |
_pam_krb5_free_ctx(ctx);
|
|
|
469442 |
diff --git a/src/auth.c b/src/auth.c
|
|
|
469442 |
index c0257cf..eb93dc1 100644
|
|
|
469442 |
--- a/src/auth.c
|
|
|
469442 |
+++ b/src/auth.c
|
|
|
469442 |
@@ -100,7 +100,8 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags,
|
|
|
469442 |
_pam_krb5_free_ctx(ctx);
|
|
|
469442 |
return PAM_SERVICE_ERR;
|
|
|
469442 |
}
|
|
|
469442 |
- options = _pam_krb5_options_init(pamh, argc, argv, ctx);
|
|
|
469442 |
+ options = _pam_krb5_options_init(pamh, argc, argv, ctx,
|
|
|
469442 |
+ _pam_krb5_option_role_general);
|
|
|
469442 |
if (options == NULL) {
|
|
|
469442 |
warn("error parsing options (shouldn't happen)");
|
|
|
469442 |
v5_free_get_init_creds_opt(ctx, gic_options);
|
|
|
469442 |
diff --git a/src/options.c b/src/options.c
|
|
|
469442 |
index 05539dc..60f5438 100644
|
|
|
469442 |
--- a/src/options.c
|
|
|
469442 |
+++ b/src/options.c
|
|
|
469442 |
@@ -321,7 +321,8 @@ free_l(char **l)
|
|
|
469442 |
struct _pam_krb5_options *
|
|
|
469442 |
_pam_krb5_options_init(pam_handle_t *pamh, int argc,
|
|
|
469442 |
PAM_KRB5_MAYBE_CONST char **argv,
|
|
|
469442 |
- krb5_context ctx)
|
|
|
469442 |
+ krb5_context ctx,
|
|
|
469442 |
+ enum _pam_krb5_option_role role)
|
|
|
469442 |
{
|
|
|
469442 |
struct _pam_krb5_options *options;
|
|
|
469442 |
int try_first_pass, use_first_pass, initial_prompt, subsequent_prompt;
|
|
|
469442 |
@@ -622,7 +623,7 @@ _pam_krb5_options_init(pam_handle_t *pamh, int argc,
|
|
|
469442 |
/* private option */
|
|
|
469442 |
options->use_first_pass = 1;
|
|
|
469442 |
options->use_second_pass = 1;
|
|
|
469442 |
- options->use_third_pass = 1;
|
|
|
469442 |
+ options->use_third_pass = (role != _pam_krb5_option_role_chauthtok);
|
|
|
469442 |
options->permit_password_callback = 0;
|
|
|
469442 |
use_first_pass = option_b(argc, argv,
|
|
|
469442 |
ctx, options->realm,
|
|
|
469442 |
diff --git a/src/options.h b/src/options.h
|
|
|
469442 |
index 42ab7ee..c01376f 100644
|
|
|
469442 |
--- a/src/options.h
|
|
|
469442 |
+++ b/src/options.h
|
|
|
469442 |
@@ -106,10 +106,16 @@ struct _pam_krb5_options {
|
|
|
469442 |
int n_mappings;
|
|
|
469442 |
};
|
|
|
469442 |
|
|
|
469442 |
+enum _pam_krb5_option_role {
|
|
|
469442 |
+ _pam_krb5_option_role_general,
|
|
|
469442 |
+ _pam_krb5_option_role_chauthtok,
|
|
|
469442 |
+};
|
|
|
469442 |
+
|
|
|
469442 |
struct _pam_krb5_options *_pam_krb5_options_init(pam_handle_t *pamh,
|
|
|
469442 |
int argc,
|
|
|
469442 |
PAM_KRB5_MAYBE_CONST char **argv,
|
|
|
469442 |
- krb5_context ctx);
|
|
|
469442 |
+ krb5_context ctx,
|
|
|
469442 |
+ enum _pam_krb5_option_role role);
|
|
|
469442 |
void _pam_krb5_options_free(pam_handle_t *pamh,
|
|
|
469442 |
krb5_context ctx,
|
|
|
469442 |
struct _pam_krb5_options *options);
|
|
|
469442 |
diff --git a/src/pam_krb5.5.in b/src/pam_krb5.5.in
|
|
|
469442 |
index ef07b96..144d446 100644
|
|
|
469442 |
--- a/src/pam_krb5.5.in
|
|
|
469442 |
+++ b/src/pam_krb5.5.in
|
|
|
469442 |
@@ -220,7 +220,8 @@ controls whether or not pam_krb5.so will allow the Kerberos library to ask
|
|
|
469442 |
the user for a password or other information, if the previously-entered
|
|
|
469442 |
password is somehow insufficient for authenticating the user. This is
|
|
|
469442 |
commonly needed to allow a user to log in when that user's password has
|
|
|
469442 |
-expired. The default is \fBtrue\fR.
|
|
|
469442 |
+expired. The default is \fBfalse\fR during password changes, and
|
|
|
469442 |
+\fBtrue\fR otherwise.
|
|
|
469442 |
|
|
|
469442 |
If the calling application does not properly support PAM conversations
|
|
|
469442 |
(possibly due to limitations of a network protocol which it is serving),
|
|
|
469442 |
diff --git a/src/pam_krb5_cchelper.c b/src/pam_krb5_cchelper.c
|
|
|
469442 |
index faea620..98e4f73 100644
|
|
|
469442 |
--- a/src/pam_krb5_cchelper.c
|
|
|
469442 |
+++ b/src/pam_krb5_cchelper.c
|
|
|
469442 |
@@ -201,9 +201,16 @@ main(int argc, const char **argv)
|
|
|
469442 |
|
|
|
469442 |
/* We'll need a writable string for use as the template. */
|
|
|
469442 |
ccname = xstrdup(argv[2]);
|
|
|
469442 |
- if ((ccname == NULL) || (strchr(ccname, ':') == NULL)) {
|
|
|
469442 |
+ if (ccname == NULL) {
|
|
|
469442 |
return 4;
|
|
|
469442 |
}
|
|
|
469442 |
+ if (strchr(ccname, ':') == NULL) {
|
|
|
469442 |
+ p = malloc(strlen(ccname) + 6);
|
|
|
469442 |
+ if (p != NULL) {
|
|
|
469442 |
+ snprintf(p, strlen(ccname) + 6, "FILE:%s", ccname);
|
|
|
469442 |
+ ccname = p;
|
|
|
469442 |
+ }
|
|
|
469442 |
+ }
|
|
|
469442 |
workccname = NULL;
|
|
|
469442 |
|
|
|
469442 |
/* Parse the UID, if given. */
|
|
|
469442 |
diff --git a/src/pam_newpag.c b/src/pam_newpag.c
|
|
|
469442 |
index ff03b20..374cd3c 100644
|
|
|
469442 |
--- a/src/pam_newpag.c
|
|
|
469442 |
+++ b/src/pam_newpag.c
|
|
|
469442 |
@@ -76,7 +76,8 @@ maybe_setpag(const char *fn, pam_handle_t *pamh, int flags,
|
|
|
469442 |
}
|
|
|
469442 |
|
|
|
469442 |
/* Read our options. */
|
|
|
469442 |
- options = _pam_krb5_options_init(pamh, argc, argv, ctx);
|
|
|
469442 |
+ options = _pam_krb5_options_init(pamh, argc, argv, ctx,
|
|
|
469442 |
+ _pam_krb5_option_role_general);
|
|
|
469442 |
if (options == NULL) {
|
|
|
469442 |
warn("error parsing options (shouldn't happen)");
|
|
|
469442 |
_pam_krb5_free_ctx(ctx);
|
|
|
469442 |
diff --git a/src/password.c b/src/password.c
|
|
|
469442 |
index 75b7817..11c9719 100644
|
|
|
469442 |
--- a/src/password.c
|
|
|
469442 |
+++ b/src/password.c
|
|
|
469442 |
@@ -103,7 +103,8 @@ pam_sm_chauthtok(pam_handle_t *pamh, int flags,
|
|
|
469442 |
_pam_krb5_free_ctx(ctx);
|
|
|
469442 |
return PAM_SERVICE_ERR;
|
|
|
469442 |
}
|
|
|
469442 |
- options = _pam_krb5_options_init(pamh, argc, argv, ctx);
|
|
|
469442 |
+ options = _pam_krb5_options_init(pamh, argc, argv, ctx,
|
|
|
469442 |
+ _pam_krb5_option_role_chauthtok);
|
|
|
469442 |
if (options == NULL) {
|
|
|
469442 |
warn("error parsing options (shouldn't happen)");
|
|
|
469442 |
v5_free_get_init_creds_opt(ctx, gic_options);
|
|
|
469442 |
diff --git a/src/session.c b/src/session.c
|
|
|
469442 |
index 2c2ef2e..206d44b 100644
|
|
|
469442 |
--- a/src/session.c
|
|
|
469442 |
+++ b/src/session.c
|
|
|
469442 |
@@ -91,7 +91,8 @@ _pam_krb5_open_session(pam_handle_t *pamh, int flags,
|
|
|
469442 |
}
|
|
|
469442 |
|
|
|
469442 |
/* Read our options. */
|
|
|
469442 |
- options = _pam_krb5_options_init(pamh, argc, argv, ctx);
|
|
|
469442 |
+ options = _pam_krb5_options_init(pamh, argc, argv, ctx,
|
|
|
469442 |
+ _pam_krb5_option_role_general);
|
|
|
469442 |
if (options == NULL) {
|
|
|
469442 |
warn("error parsing options (shouldn't happen)");
|
|
|
469442 |
_pam_krb5_free_ctx(ctx);
|
|
|
469442 |
@@ -288,7 +289,8 @@ _pam_krb5_close_session(pam_handle_t *pamh, int flags,
|
|
|
469442 |
}
|
|
|
469442 |
|
|
|
469442 |
/* Read our options. */
|
|
|
469442 |
- options = _pam_krb5_options_init(pamh, argc, argv, ctx);
|
|
|
469442 |
+ options = _pam_krb5_options_init(pamh, argc, argv, ctx,
|
|
|
469442 |
+ _pam_krb5_option_role_general);
|
|
|
469442 |
if (options == NULL) {
|
|
|
469442 |
_pam_krb5_free_ctx(ctx);
|
|
|
469442 |
return PAM_SERVICE_ERR;
|
|
|
469442 |
diff --git a/src/sly.c b/src/sly.c
|
|
|
469442 |
index 97835c9..bb398eb 100644
|
|
|
469442 |
--- a/src/sly.c
|
|
|
469442 |
+++ b/src/sly.c
|
|
|
469442 |
@@ -147,7 +147,8 @@ _pam_krb5_sly_maybe_refresh(pam_handle_t *pamh, int flags, const char *why,
|
|
|
469442 |
}
|
|
|
469442 |
|
|
|
469442 |
/* Read our options. */
|
|
|
469442 |
- options = _pam_krb5_options_init(pamh, argc, argv, ctx);
|
|
|
469442 |
+ options = _pam_krb5_options_init(pamh, argc, argv, ctx,
|
|
|
469442 |
+ _pam_krb5_option_role_general);
|
|
|
469442 |
if (options == NULL) {
|
|
|
469442 |
warn("error parsing options (shouldn't happen)");
|
|
|
469442 |
_pam_krb5_free_ctx(ctx);
|