0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 23:10:54 +01:00

authd: add provider data getter/setter functions

This commit is contained in:
Elizabeth Myers 2016-04-04 03:33:25 -05:00
parent fc9013d6b0
commit 74909c9ada
2 changed files with 21 additions and 3 deletions

View file

@ -374,3 +374,18 @@ provider_timeout_event(void *notused __unused)
} }
} }
} }
void *
get_provider_data(struct auth_client *auth, uint32_t id)
{
lrb_assert(id < rb_dlink_list_length(&auth_providers));
return auth->data[(size_t)id];
}
void
set_provider_data(struct auth_client *auth, uint32_t id, void *data)
{
lrb_assert(id < rb_dlink_list_length(&auth_providers));
auth->data[(size_t)id] = data;
}

View file

@ -93,14 +93,14 @@ struct auth_provider
struct auth_opts_handler *opt_handlers; struct auth_opts_handler *opt_handlers;
}; };
extern rb_dlink_list auth_providers;
extern rb_dictionary *auth_clients;
extern struct auth_provider rdns_provider; extern struct auth_provider rdns_provider;
extern struct auth_provider ident_provider; extern struct auth_provider ident_provider;
extern struct auth_provider blacklist_provider; extern struct auth_provider blacklist_provider;
extern struct auth_provider opm_provider; extern struct auth_provider opm_provider;
extern rb_dlink_list auth_providers;
extern rb_dictionary *auth_clients;
void load_provider(struct auth_provider *provider); void load_provider(struct auth_provider *provider);
void unload_provider(struct auth_provider *provider); void unload_provider(struct auth_provider *provider);
@ -115,6 +115,9 @@ void reject_client(struct auth_client *auth, provider_t id, const char *data, co
void handle_new_connection(int parc, char *parv[]); void handle_new_connection(int parc, char *parv[]);
void handle_cancel_connection(int parc, char *parv[]); 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);
/* Provider is operating on this auth_client (set this if you have async work to do) */ /* Provider is operating on this auth_client (set this if you have async work to do) */
static inline void static inline void
set_provider_on(struct auth_client *auth, provider_t provider) set_provider_on(struct auth_client *auth, provider_t provider)