Skip to content

Commit

Permalink
windc: update test windc plugin to use new load SPI
Browse files Browse the repository at this point in the history
  • Loading branch information
lhoward committed Jan 4, 2019
1 parent befe1b8 commit e739c4d
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion tests/plugin/windc.c
@@ -1,3 +1,4 @@
#include <string.h>
#include <krb5.h>
#include <hdb.h>
#include <kdc.h>
Expand Down Expand Up @@ -75,11 +76,47 @@ client_access(void *ctx,
return 0;
}

krb5plugin_windc_ftable windc = {
static krb5plugin_windc_ftable windc = {
KRB5_WINDC_PLUGING_MINOR,
windc_init,
windc_fini,
pac_generate,
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;
}

0 comments on commit e739c4d

Please sign in to comment.