aboutsummaryrefslogtreecommitdiff
path: root/src/kdc
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2013-04-26 15:50:05 -0400
committerGreg Hudson <ghudson@mit.edu>2013-05-03 16:11:28 -0400
commite50482720a805ecd8c160e4a8f4a846e6327dca2 (patch)
tree9614b63f7a7c003e60332be49f3900dd1c9752de /src/kdc
parent8c4db8f776c65b50fe3af82fd62a67022dd9a6d5 (diff)
downloadkrb5-e50482720a805ecd8c160e4a8f4a846e6327dca2.zip
krb5-e50482720a805ecd8c160e4a8f4a846e6327dca2.tar.gz
krb5-e50482720a805ecd8c160e4a8f4a846e6327dca2.tar.bz2
Add kdcpreauth callback to check for client keys
Add a new have_client_keys callback to the kdcpreauth interface, allowing modules to efficiently check whether the client DB entry has any keys matching the request enctypes. ticket: 7630
Diffstat (limited to 'src/kdc')
-rw-r--r--src/kdc/kdc_preauth.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/kdc/kdc_preauth.c b/src/kdc/kdc_preauth.c
index c2bcab9..b7f9e15 100644
--- a/src/kdc/kdc_preauth.c
+++ b/src/kdc/kdc_preauth.c
@@ -542,8 +542,23 @@ event_context(krb5_context context, krb5_kdcpreauth_rock rock)
return rock->vctx;
}
+static krb5_boolean
+have_client_keys(krb5_context context, krb5_kdcpreauth_rock rock)
+{
+ krb5_kdc_req *request = rock->request;
+ krb5_key_data *kd;
+ int i;
+
+ for (i = 0; i < request->nktypes; i++) {
+ if (krb5_dbe_find_enctype(context, rock->client, request->ktype[i],
+ -1, 0, &kd) == 0)
+ return TRUE;
+ }
+ return FALSE;
+}
+
static struct krb5_kdcpreauth_callbacks_st callbacks = {
- 1,
+ 2,
max_time_skew,
client_keys,
free_keys,
@@ -552,7 +567,8 @@ static struct krb5_kdcpreauth_callbacks_st callbacks = {
get_string,
free_string,
client_entry,
- event_context
+ event_context,
+ have_client_keys
};
static krb5_error_code