|
|
bb7cd1 |
From b7aa85ea053aa78fa23de98d6c48e155f0cc06bc Mon Sep 17 00:00:00 2001
|
|
|
bb7cd1 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
bb7cd1 |
Date: Mon, 12 Jun 2017 14:42:47 +0200
|
|
|
bb7cd1 |
Subject: [PATCH 182/182] krb5: use plain principal if password is expired
|
|
|
bb7cd1 |
MIME-Version: 1.0
|
|
|
bb7cd1 |
Content-Type: text/plain; charset=UTF-8
|
|
|
bb7cd1 |
Content-Transfer-Encoding: 8bit
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Similar as in https://pagure.io/SSSD/sssd/issue/3426 enterprise
|
|
|
bb7cd1 |
principals should be avoided while requesting a kadmin/changepw@REALM
|
|
|
bb7cd1 |
principal for a password change.
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Resolves https://pagure.io/SSSD/sssd/issue/3419
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
|
|
|
bb7cd1 |
(cherry picked from commit 7e2ec7caa2d1c17e475fff78c5025496b8695509)
|
|
|
bb7cd1 |
---
|
|
|
bb7cd1 |
src/providers/krb5/krb5_child.c | 11 ++++++++++-
|
|
|
bb7cd1 |
1 file changed, 10 insertions(+), 1 deletion(-)
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c
|
|
|
bb7cd1 |
index 3cd8bfba76a35acd2c885ee2aac4765a6c1cc03c..3a76b900444dea50ec0b783496e22d25aad797ab 100644
|
|
|
bb7cd1 |
--- a/src/providers/krb5/krb5_child.c
|
|
|
bb7cd1 |
+++ b/src/providers/krb5/krb5_child.c
|
|
|
bb7cd1 |
@@ -64,6 +64,7 @@ struct cli_opts {
|
|
|
bb7cd1 |
struct krb5_req {
|
|
|
bb7cd1 |
krb5_context ctx;
|
|
|
bb7cd1 |
krb5_principal princ;
|
|
|
bb7cd1 |
+ krb5_principal princ_orig;
|
|
|
bb7cd1 |
char* name;
|
|
|
bb7cd1 |
krb5_creds *creds;
|
|
|
bb7cd1 |
bool otp;
|
|
|
bb7cd1 |
@@ -1975,7 +1976,7 @@ static errno_t tgt_req_child(struct krb5_req *kr)
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
set_changepw_options(kr->options);
|
|
|
bb7cd1 |
- kerr = krb5_get_init_creds_password(kr->ctx, kr->creds, kr->princ,
|
|
|
bb7cd1 |
+ kerr = krb5_get_init_creds_password(kr->ctx, kr->creds, kr->princ_orig,
|
|
|
bb7cd1 |
password_or_responder(password),
|
|
|
bb7cd1 |
sss_krb5_prompter, kr, 0,
|
|
|
bb7cd1 |
SSSD_KRB5_CHANGEPW_PRINCIPAL,
|
|
|
bb7cd1 |
@@ -2303,6 +2304,8 @@ static int krb5_cleanup(struct krb5_req *kr)
|
|
|
bb7cd1 |
sss_krb5_free_unparsed_name(kr->ctx, kr->name);
|
|
|
bb7cd1 |
if (kr->princ != NULL)
|
|
|
bb7cd1 |
krb5_free_principal(kr->ctx, kr->princ);
|
|
|
bb7cd1 |
+ if (kr->princ_orig != NULL)
|
|
|
bb7cd1 |
+ krb5_free_principal(kr->ctx, kr->princ_orig);
|
|
|
bb7cd1 |
if (kr->ctx != NULL)
|
|
|
bb7cd1 |
krb5_free_context(kr->ctx);
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
@@ -2847,6 +2850,12 @@ static int k5c_setup(struct krb5_req *kr, uint32_t offline)
|
|
|
bb7cd1 |
return kerr;
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
+ kerr = krb5_parse_name(kr->ctx, kr->upn, &kr->princ_orig);
|
|
|
bb7cd1 |
+ if (kerr != 0) {
|
|
|
bb7cd1 |
+ KRB5_CHILD_DEBUG(SSSDBG_CRIT_FAILURE, kerr);
|
|
|
bb7cd1 |
+ return kerr;
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
kerr = krb5_unparse_name(kr->ctx, kr->princ, &kr->name);
|
|
|
bb7cd1 |
if (kerr != 0) {
|
|
|
bb7cd1 |
KRB5_CHILD_DEBUG(SSSDBG_CRIT_FAILURE, kerr);
|
|
|
bb7cd1 |
--
|
|
|
bb7cd1 |
2.9.4
|
|
|
bb7cd1 |
|