From 7003d3dbdfd0a7f4f6843068affb290c844ccb65 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Thu, 6 Oct 2011 16:18:56 +0000 Subject: Use type-safe callbacks in preauth interface Replace the generic get_data functions in clpreauth and kdcpreauth with structures containing callback functions. Each structure has a minor version number to allow adding new callbacks. For simplicity, the new fast armor key callbacks return aliases, which is how we would supply the armor key as a function parameter. The new client keys callback is paired with a free_keys callback to reduce the amount of cleanup code needed in modules. ticket: 6971 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25315 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/fast_factor.h | 42 ++---------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) (limited to 'src/include/fast_factor.h') diff --git a/src/include/fast_factor.h b/src/include/fast_factor.h index 734d37779..32581bd44 100644 --- a/src/include/fast_factor.h +++ b/src/include/fast_factor.h @@ -26,47 +26,9 @@ #ifndef FAST_FACTOR_H -/* - * Returns success with a null armor_key if FAST is available but not in use. - * Returns failure if the client library does not support FAST. - */ -static inline krb5_error_code -fast_get_armor_key(krb5_context context, krb5_clpreauth_get_data_fn get_data, - krb5_clpreauth_rock rock, krb5_keyblock **armor_key) -{ - krb5_error_code retval = 0; - krb5_data *data; - retval = get_data(context, rock, krb5_clpreauth_fast_armor, &data); - if (retval == 0) { - *armor_key = (krb5_keyblock *) data->data; - data->data = NULL; - get_data(context, rock, krb5_clpreauth_free_fast_armor, &data); - } - return retval; -} - -static inline krb5_error_code -fast_kdc_get_armor_key(krb5_context context, - krb5_kdcpreauth_get_data_fn get_data, - krb5_kdcpreauth_rock rock, - krb5_keyblock **armor_key) -{ - krb5_error_code retval; - krb5_data *data; - retval = (*get_data)(context, rock, krb5_kdcpreauth_fast_armor, &data); - if (retval == 0) { - *armor_key = (krb5_keyblock *) data->data; - data->data = NULL; - (*get_data)(context, rock, krb5_kdcpreauth_free_fast_armor, &data); - } - return retval; -} - - - static inline krb5_error_code fast_kdc_replace_reply_key(krb5_context context, - krb5_kdcpreauth_get_data_fn get, + krb5_kdcpreauth_callbacks cb, krb5_kdcpreauth_rock rock) { return 0; @@ -74,7 +36,7 @@ fast_kdc_replace_reply_key(krb5_context context, static inline krb5_error_code fast_set_kdc_verified(krb5_context context, - krb5_clpreauth_get_data_fn get_data, + krb5_clpreauth_callbacks cb, krb5_clpreauth_rock rock) { return 0; -- cgit