From e739c4d0c21a931c426d9b6dae789c6ec7137d09 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Fri, 4 Jan 2019 15:17:20 +1100 Subject: [PATCH] windc: update test windc plugin to use new load SPI --- tests/plugin/windc.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/tests/plugin/windc.c b/tests/plugin/windc.c index 44518dcf7..8ee122f0c 100644 --- a/tests/plugin/windc.c +++ b/tests/plugin/windc.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -75,7 +76,7 @@ client_access(void *ctx, return 0; } -krb5plugin_windc_ftable windc = { +static krb5plugin_windc_ftable windc = { KRB5_WINDC_PLUGING_MINOR, windc_init, windc_fini, @@ -83,3 +84,39 @@ krb5plugin_windc_ftable windc = { pac_verify, client_access }; + +static const krb5plugin_windc_ftable *const windc_plugins[] = { + &windc +}; + +krb5_error_code +windc_plugin_load(krb5_context context, + krb5_get_instance_func_t *get_instance, + size_t *num_plugins, + const krb5plugin_windc_ftable *const **plugins); + +static uintptr_t +windc_get_instance(const char *libname) +{ + if (strcmp(libname, "kdc") == 0) + return kdc_get_instance(libname); + else if (strcmp(libname, "hdb") == 0) + return hdb_get_instance(libname); + else if (strcmp(libname, "krb5") == 0) + return krb5_get_instance(libname); + + return 0; +} + +krb5_error_code +windc_plugin_load(krb5_context context, + krb5_get_instance_func_t *get_instance, + size_t *num_plugins, + const krb5plugin_windc_ftable *const **plugins) +{ + *get_instance = windc_get_instance; + *num_plugins = sizeof(windc_plugins) / sizeof(windc_plugins[0]); + *plugins = windc_plugins; + + return 0; +}