/* So the basic design here is to have "authentication providers" that do
* things like query ident and blacklists and even open proxies.
*
- * Providers are registered statically in the struct auth_providers array. You will
- * probably want to add an item to the provider_t enum also.
+ * Providers are registered in the auth_providers linked list. It is planned to
+ * use a bitmap to store provider ID's later.
*
* Providers can either return failure immediately, immediate acceptance, or
* do work in the background (calling set_provider to signal this).
*
- * It is up to providers to keep their own state on clients if they need to.
+ * A dictionary is provided in auth_client for storage of provider-specific data.
*
* All providers must implement at a minimum a perform_provider function. You
* don't have to implement the others if you don't need them.
{
if(auth_clients[i].cid)
{
- /* TBD - is this the right thing?
- * (NOTE - this error message is designed for morons) */
- reject_client(&auth_clients[i], 0, true,
- "IRC server reloading... try reconnecting in a few seconds");
+ /* TBD - is this the right thing? */
+ reject_client(&auth_clients[i], 0,
+ "Authentication system is down... try reconnecting in a few seconds");
}
}
}
}
-/* Reject a client, cancel outstanding providers if any if hard set to true */
-void reject_client(struct auth_client *auth, provider_t id, bool hard, const char *reason)
+/* Reject a client */
+void reject_client(struct auth_client *auth, provider_t id, const char *reason)
{
uint16_t cid = auth->cid;
char reject;
unset_provider(auth, id);
- if(hard && auth->providers)
+ if(auth->providers)
{
cancel_providers(auth);
memset(&auth_clients[cid], 0, sizeof(struct auth_client));
struct auth_provider *provider;
struct auth_client *auth;
long lcid = strtol(cid, NULL, 16);
+ char name[20];
rb_dlink_node *ptr;
if(lcid >= MAX_CLIENTS)
rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip));
auth->c_port = (uint16_t)atoi(c_port);
+ snprintf("%d provider data", sizeof(name), auth->cid);
+ auth->data = rb_dictionary_create(name, rb_uint32cmp);
+
RB_DLINK_FOREACH(ptr, auth_providers.head)
{
provider = ptr->data;