Blame SOURCES/no_subsequent_on_chauthtok.patch

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