Otherwise ident returns without setting itself running causing problems.
Move opm/blacklist before ident/rdns so that they can receive completion
notifications.
static uint32_t allocated_pids;
static struct ev_entry *timeout_ev;
+/* Set a provider's raw status */
+static inline void
+set_provider_status(struct auth_client *auth, uint32_t provider, provider_status_t status)
+{
+ auth->data[provider].status = status;
+}
+
+/* Set the provider as running */
+static inline void
+set_provider_running(struct auth_client *auth, uint32_t provider)
+{
+ auth->providers_active++;
+ set_provider_status(auth, provider, PROVIDER_STATUS_RUNNING);
+}
+
+/* Provider is no longer operating on this auth client */
+static inline void
+set_provider_done(struct auth_client *auth, uint32_t provider)
+{
+ set_provider_status(auth, provider, PROVIDER_STATUS_DONE);
+ auth->providers_active--;
+}
+
/* Initalise all providers */
void
init_providers(void)
auth_clients = rb_dictionary_create("pending auth clients", rb_uint32cmp);
timeout_ev = rb_event_addish("provider_timeout_event", provider_timeout_event, NULL, 1);
- load_provider(&rdns_provider);
- load_provider(&ident_provider);
+ /* FIXME must be started before rdns/ident to receive completion notification from them */
load_provider(&blacklist_provider);
load_provider(&opm_provider);
+
+ /* FIXME must be started after blacklist/opm in case of early completion notifications */
+ load_provider(&rdns_provider);
+ load_provider(&ident_provider);
}
/* Terminate all providers */
lrb_assert(provider->start != NULL);
/* Execute providers */
+ set_provider_running(auth, provider->id);
if(!provider->start(auth))
/* Rejected immediately */
goto done;
return auth->data[provider].status;
}
-/* Set a provider's raw status */
-static inline void
-set_provider_status(struct auth_client *auth, uint32_t provider, provider_status_t status)
-{
- auth->data[provider].status = status;
-}
-
-/* Set the provider as running
- * If you're doing asynchronous work call this */
-static inline void
-set_provider_running(struct auth_client *auth, uint32_t provider)
-{
- auth->providers_active++;
- set_provider_status(auth, provider, PROVIDER_STATUS_RUNNING);
-}
-
-/* Provider is no longer operating on this auth client
- * You should use provider_done and not this */
-static inline void
-set_provider_done(struct auth_client *auth, uint32_t provider)
-{
- set_provider_status(auth, provider, PROVIDER_STATUS_DONE);
- auth->providers_active--;
-}
-
/* Check if provider is operating on this auth client */
static inline bool
is_provider_running(struct auth_client *auth, uint32_t provider)
lrb_assert(get_provider_data(auth, SELF_PID) == NULL);
- if(!rb_dlink_list_length(&blacklist_list))
+ if(!rb_dlink_list_length(&blacklist_list)) {
/* Nothing to do... */
+ provider_done(auth, SELF_PID);
return true;
+ }
auth_client_ref(auth);
}
}
- set_provider_running(auth, SELF_PID);
return true;
}
{
rb_free(query);
notice_client(auth->cid, messages[REPORT_DISABLED]);
- set_provider_done(auth, SELF_PID);
+ provider_done(auth, SELF_PID);
return true;
}
ident_connected,
auth, ident_timeout);
- set_provider_running(auth, SELF_PID);
-
return true;
}
lrb_assert(get_provider_data(auth, SELF_PID) == NULL);
- if(!opm_enable || rb_dlink_list_length(&proxy_scanners) == 0)
+ if(!opm_enable || rb_dlink_list_length(&proxy_scanners) == 0) {
/* Nothing to do... */
+ provider_done(auth, SELF_PID);
return true;
+ }
auth_client_ref(auth);
opm_scan(auth);
}
- set_provider_running(auth, SELF_PID);
return true;
}
query->query = lookup_hostname(auth->c_ip, dns_answer_callback, auth);
notice_client(auth->cid, messages[REPORT_LOOKUP]);
- set_provider_running(auth, SELF_PID);
return true;
}