From 2e1e0b9981d0f8894ad175211be010dd49b27e7f Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Mon, 4 Apr 2016 04:24:49 -0500 Subject: [PATCH] authd: add provider timeout setting API --- authd/provider.c | 14 ++++++++++++++ authd/provider.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/authd/provider.c b/authd/provider.c index dd63d6a8..43475170 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -389,3 +389,17 @@ set_provider_data(struct auth_client *auth, uint32_t id, void *data) auth->data[(size_t)id] = data; } +void +set_provider_timeout_relative(struct auth_client *auth, uint32_t id, time_t timeout) +{ + lrb_assert(id < rb_dlink_list_length(&auth_providers)); + auth->timeout[(size_t)id] = timeout + rb_current_time(); +} + +void +set_provider_timeout_absolute(struct auth_client *auth, uint32_t id, time_t timeout) +{ + lrb_assert(id < rb_dlink_list_length(&auth_providers)); + auth->timeout[(size_t)id] = timeout; +} + diff --git a/authd/provider.h b/authd/provider.h index fdf1211e..8e9a7863 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -117,6 +117,8 @@ void handle_cancel_connection(int parc, char *parv[]); void *get_provider_data(struct auth_client *auth, uint32_t id); void set_provider_data(struct auth_client *auth, uint32_t id, void *data); +void set_provider_timeout_relative(struct auth_client *auth, uint32_t id, time_t timeout); +void set_provider_timeout_absolute(struct auth_client *auth, uint32_t id, time_t timeout); /* Provider is operating on this auth_client (set this if you have async work to do) */ static inline void