summaryrefslogtreecommitdiffstats
path: root/source/libads
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-03-20 10:05:51 +0000
committerGünther Deschner <gd@samba.org>2006-03-20 10:05:51 +0000
commit050f7a7bf2457c2ae42e083c948492d51abbc2ae (patch)
tree5fe8441aef402f1009a7c50c92b10b8f2eedcb20 /source/libads
parent3405dff99a1fa1f2ab4c35e2a8efca5554b3b8df (diff)
downloadsamba-050f7a7bf2457c2ae42e083c948492d51abbc2ae.tar.gz
samba-050f7a7bf2457c2ae42e083c948492d51abbc2ae.tar.xz
samba-050f7a7bf2457c2ae42e083c948492d51abbc2ae.zip
r14576: Skip remaining keytab entries when we have a clear indication that
krb5_rd_req could decrypt the ticket but that ticket is just not valid at the moment (either not yet valid or already expired). (This also prevents an MIT kerberos related crash) Guenther
Diffstat (limited to 'source/libads')
-rw-r--r--source/libads/kerberos_verify.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/source/libads/kerberos_verify.c b/source/libads/kerberos_verify.c
index 220bf14e32c..83bdb3f8626 100644
--- a/source/libads/kerberos_verify.c
+++ b/source/libads/kerberos_verify.c
@@ -111,6 +111,22 @@ static BOOL ads_keytab_verify_ticket(krb5_context context, krb5_auth_context aut
DEBUG(10,("ads_keytab_verify_ticket: "
"krb5_rd_req_return_keyblock_from_keytab(%s) failed: %s\n",
entry_princ_s, error_message(ret)));
+
+ /* workaround for MIT:
+ * as krb5_ktfile_get_entry will
+ * explicitly close the
+ * krb5_keytab as soon as
+ * krb5_rd_req has sucessfully
+ * decrypted the ticket but the
+ * ticket is not valid yet (due
+ * to clockskew) there is no
+ * point in querying more
+ * keytab entries - Guenther */
+
+ if (ret == KRB5KRB_AP_ERR_TKT_NYV ||
+ ret == KRB5KRB_AP_ERR_TKT_EXPIRED) {
+ break;
+ }
} else {
DEBUG(3,("ads_keytab_verify_ticket: "
"krb5_rd_req_return_keyblock_from_keytab succeeded for principal %s\n",
@@ -243,11 +259,17 @@ static BOOL ads_secrets_verify_ticket(krb5_context context, krb5_auth_context au
krb5_free_keyblock(context, key);
break;
}
-
+
DEBUG((ret != KRB5_BAD_ENCTYPE) ? 3 : 10,
("ads_secrets_verify_ticket: enc type [%u] failed to decrypt with error %s\n",
(unsigned int)enctypes[i], error_message(ret)));
+ /* successfully decrypted but ticket is just not valid at the moment */
+ if (ret == KRB5KRB_AP_ERR_TKT_NYV ||
+ ret == KRB5KRB_AP_ERR_TKT_EXPIRED) {
+ break;
+ }
+
krb5_free_keyblock(context, key);
}