+
+void
+handle_cancel_connection(int parc, char *parv[])
+{
+ struct auth_client *auth;
+ long lcid;
+
+ if(parc < 2)
+ {
+ warn_opers(L_CRIT, "provider: received too few params for new connection (2 expected, got %d)", parc);
+ exit(EX_PROVIDER_ERROR);
+ }
+
+ if((lcid = strtol(parv[1], NULL, 16)) > UINT32_MAX)
+ {
+ warn_opers(L_CRIT, "provider: got a request to cancel a connection that can't exist: %lx", lcid);
+ exit(EX_PROVIDER_ERROR);
+ }
+
+ if((auth = rb_dictionary_retrieve(auth_clients, RB_UINT_TO_POINTER((uint32_t)lcid))) == NULL)
+ {
+ /* This could happen as a race if we've accepted/rejected but they cancel, so don't die here.
+ * --Elizafox */
+ return;
+ }
+
+ cancel_providers(auth);
+}
+
+static void
+provider_timeout_event(void *notused __unused)
+{
+ struct auth_client *auth;
+ rb_dictionary_iter iter;
+ const time_t curtime = rb_current_time();
+
+ RB_DICTIONARY_FOREACH(auth, &iter, auth_clients)
+ {
+ rb_dlink_node *ptr;
+
+ RB_DLINK_FOREACH(ptr, auth_providers.head)
+ {
+ struct auth_provider *provider = ptr->data;
+ const time_t timeout = auth->timeout[provider->id];
+
+ if(is_provider_on(auth, provider->id) && provider->timeout != NULL &&
+ timeout > 0 && timeout < curtime)
+ {
+ provider->timeout(auth);
+ }
+ }
+ }
+}