static void
accept_opm(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, void *data)
{
+ struct auth_client *auth = NULL;
struct opm_listener *listener = data;
struct rb_sockaddr_storage localaddr;
unsigned int llen = sizeof(struct rb_sockaddr_storage);
- rb_dlink_node *ptr;
+ rb_dictionary_iter iter;
if(status != 0 || listener == NULL)
{
}
/* Correlate connection with client(s) */
- RB_DLINK_FOREACH(ptr, auth_clients.head)
+ RB_DICTIONARY_FOREACH(auth, &iter, auth_clients)
{
- struct auth_client *auth = ptr->data;
-
if(GET_SS_FAMILY(&auth->c_addr) != GET_SS_FAMILY(&localaddr))
continue;
static bool
create_listener(const char *ip, uint16_t port)
{
+ struct auth_client *auth;
struct opm_listener *listener;
struct rb_sockaddr_storage addr;
- rb_dlink_node *ptr, *nptr;
+ rb_dictionary_iter iter;
rb_fde_t *F;
int opt = 1;
/* Cancel clients that may be on old listener
* XXX - should rescan clients that need it
*/
- RB_DLINK_FOREACH_SAFE(ptr, nptr, auth_clients.head)
+ RB_DICTIONARY_FOREACH(auth, &iter, auth_clients)
{
- struct auth_client *auth = ptr->data;
opm_cancel(auth);
}
static void
opm_destroy(void)
{
- rb_dlink_node *ptr, *nptr;
+ struct auth_client *auth;
+ rb_dictionary_iter iter;
/* Nuke all opm lookups */
- RB_DLINK_FOREACH_SAFE(ptr, nptr, auth_clients.head)
+ RB_DICTIONARY_FOREACH(auth, &iter, auth_clients)
{
- struct auth_client *auth = ptr->data;
opm_cancel(auth);
}
}
{
if(listeners[LISTEN_IPV4].F != NULL || listeners[LISTEN_IPV6].F != NULL)
{
- rb_dlink_node *ptr, *nptr;
+ struct auth_client *auth;
+ rb_dictionary_iter iter;
/* Close the listening socket */
if(listeners[LISTEN_IPV4].F != NULL)
listeners[LISTEN_IPV4].F = listeners[LISTEN_IPV6].F = NULL;
- RB_DLINK_FOREACH_SAFE(ptr, nptr, auth_clients.head)
+ RB_DICTIONARY_FOREACH(auth, &iter, auth_clients)
{
- struct auth_client *auth = ptr->data;
opm_cancel(auth);
}
}
static void
delete_opm_scanner(const char *key __unused, int parc __unused, const char **parv)
{
+ struct auth_client *auth;
struct opm_proxy *proxy;
protocol_t proto = get_protocol_from_string(parv[0]);
int iport = atoi(parv[1]);
- rb_dlink_node *ptr, *nptr;
+ rb_dictionary_iter iter;
if(iport <= 0 || iport > 65535)
{
}
/* Abort remaining clients on this scanner */
- RB_DLINK_FOREACH_SAFE(ptr, nptr, auth_clients.head)
+ RB_DICTIONARY_FOREACH(auth, &iter, auth_clients)
{
- struct auth_client *auth = ptr->data;
+ rb_dlink_node *ptr;
struct opm_lookup *lookup = get_provider_data(auth, SELF_PID);
- rb_dlink_node *optr;
if(lookup == NULL)
continue;
- RB_DLINK_FOREACH(optr, lookup->scans.head)
+ RB_DLINK_FOREACH(ptr, lookup->scans.head)
{
- struct opm_scan *scan = optr->data;
+ struct opm_scan *scan = ptr->data;
if(scan->proxy->port == proxy->port && scan->proxy->proto == proxy->proto)
{
static void
delete_opm_scanner_all(const char *key __unused, int parc __unused, const char **parv __unused)
{
+ struct auth_client *auth;
rb_dlink_node *ptr, *nptr;
+ rb_dictionary_iter iter;
RB_DLINK_FOREACH_SAFE(ptr, nptr, proxy_scanners.head)
{
rb_dlinkDelete(ptr, &proxy_scanners);
}
- RB_DLINK_FOREACH_SAFE(ptr, nptr, auth_clients.head)
+ RB_DICTIONARY_FOREACH(auth, &iter, auth_clients)
{
- struct auth_client *auth = ptr->data;
opm_cancel(auth);
}