|
|
572004 |
From 158468507bb723aa62196846749c23c121d4b298 Mon Sep 17 00:00:00 2001
|
|
|
572004 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
572004 |
Date: Mon, 8 Apr 2019 10:55:39 +0200
|
|
|
572004 |
Subject: [PATCH] Do not use arcfour-hmac-md5 when discovering the salt
|
|
|
572004 |
|
|
|
572004 |
Since the arcfour-hmac-md5 encryption types does not use salts it cannot
|
|
|
572004 |
be used to discover the right salt.
|
|
|
572004 |
|
|
|
572004 |
Related to https://bugzilla.redhat.com/show_bug.cgi?id=1683745
|
|
|
572004 |
---
|
|
|
572004 |
library/adkrb5.c | 21 ++++++++++++++++++++-
|
|
|
572004 |
1 file changed, 20 insertions(+), 1 deletion(-)
|
|
|
572004 |
|
|
|
572004 |
diff --git a/library/adkrb5.c b/library/adkrb5.c
|
|
|
572004 |
index da835d7..be3ede5 100644
|
|
|
572004 |
--- a/library/adkrb5.c
|
|
|
572004 |
+++ b/library/adkrb5.c
|
|
|
572004 |
@@ -395,15 +395,33 @@ _adcli_krb5_keytab_discover_salt (krb5_context k5,
|
|
|
572004 |
krb5_keytab scratch;
|
|
|
572004 |
krb5_error_code code;
|
|
|
572004 |
int i;
|
|
|
572004 |
+ krb5_enctype *salt_enctypes = NULL;
|
|
|
572004 |
+ size_t c;
|
|
|
572004 |
+ size_t s;
|
|
|
572004 |
|
|
|
572004 |
/* TODO: This should be a unique name */
|
|
|
572004 |
|
|
|
572004 |
code = krb5_kt_resolve (k5, "MEMORY:adcli-discover-salt", &scratch);
|
|
|
572004 |
return_val_if_fail (code == 0, code);
|
|
|
572004 |
|
|
|
572004 |
+ for (c = 0; enctypes[c] != 0; c++); /* count enctypes */
|
|
|
572004 |
+ salt_enctypes = calloc (c + 1, sizeof (krb5_enctype));
|
|
|
572004 |
+ return_val_if_fail (salt_enctypes != NULL, ENOMEM);
|
|
|
572004 |
+
|
|
|
572004 |
+ /* ENCTYPE_ARCFOUR_HMAC does not use salts, so it cannot be used to
|
|
|
572004 |
+ * discover the right salt. */
|
|
|
572004 |
+ s = 0;
|
|
|
572004 |
+ for (c = 0; enctypes[c] != 0; c++) {
|
|
|
572004 |
+ if (enctypes[c] == ENCTYPE_ARCFOUR_HMAC) {
|
|
|
572004 |
+ continue;
|
|
|
572004 |
+ }
|
|
|
572004 |
+
|
|
|
572004 |
+ salt_enctypes[s++] = enctypes[c];
|
|
|
572004 |
+ }
|
|
|
572004 |
+
|
|
|
572004 |
for (i = 0; salts[i].data != NULL; i++) {
|
|
|
572004 |
code = _adcli_krb5_keytab_test_salt (k5, scratch, principal, kvno,
|
|
|
572004 |
- password, enctypes, &salts[i]);
|
|
|
572004 |
+ password, salt_enctypes, &salts[i]);
|
|
|
572004 |
if (code == 0) {
|
|
|
572004 |
*discovered = i;
|
|
|
572004 |
break;
|
|
|
572004 |
@@ -412,6 +430,7 @@ _adcli_krb5_keytab_discover_salt (krb5_context k5,
|
|
|
572004 |
}
|
|
|
572004 |
}
|
|
|
572004 |
|
|
|
572004 |
+ free (salt_enctypes);
|
|
|
572004 |
krb5_kt_close (k5, scratch);
|
|
|
572004 |
return code;
|
|
|
572004 |
}
|
|
|
572004 |
--
|
|
|
572004 |
2.21.0
|
|
|
572004 |
|