From ee7f92714ad53c5bc362447fc98670d873863411 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sun, 27 Mar 2016 17:15:08 -0500 Subject: [PATCH] authd/provider: add stats handling hooking --- authd/provider.c | 7 +++++++ authd/provider.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/authd/provider.c b/authd/provider.c index 941e4059..b512b4a0 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -74,6 +74,9 @@ load_provider(struct auth_provider *provider) rb_dictionary_add(authd_option_handlers, handler->option, handler); } + if(provider->stats_handler.letter != '\0') + authd_stat_handlers[provider->stats_handler.letter] = provider->stats_handler.handler; + provider->init(); rb_dlinkAdd(provider, &provider->node, &auth_providers); } @@ -88,6 +91,10 @@ unload_provider(struct auth_provider *provider) for(handler = provider->opt_handlers; handler->option != NULL; handler++) rb_dictionary_delete(authd_option_handlers, handler->option); } + + if(provider->stats_handler.letter != '\0') + authd_stat_handlers[provider->stats_handler.letter] = NULL; + provider->destroy(); rb_dlinkDelete(&provider->node, &auth_providers); } diff --git a/authd/provider.h b/authd/provider.h index 3c2773cc..c5462c93 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -65,6 +65,12 @@ typedef bool (*provider_start_t)(struct auth_client *); typedef void (*provider_cancel_t)(struct auth_client *); typedef void (*provider_complete_t)(struct auth_client *, provider_t); +struct auth_stats_handler +{ + const char letter; + authd_stat_handler handler; +}; + struct auth_provider { rb_dlink_node node; @@ -78,6 +84,8 @@ struct auth_provider provider_cancel_t cancel; /* Authentication cancelled */ provider_complete_t completed; /* Callback for when other performers complete (think dependency chains) */ + struct auth_stats_handler stats_handler; + struct auth_opts_handler *opt_handlers; };