76 |
|
|
77 |
|
#define sendheader(c, i) sendto_one((c), HeaderMessages[(i)], me.name) |
78 |
|
|
79 |
– |
static mp_pool_t *auth_pool = NULL; |
79 |
|
static dlink_list auth_doing_list = { NULL, NULL, 0 }; |
80 |
|
|
81 |
|
static EVH timeout_auth_queries_event; |
82 |
|
|
83 |
|
static PF read_auth_reply; |
84 |
|
static CNCB auth_connect_callback; |
86 |
– |
static CBFUNC start_auth; |
87 |
– |
|
88 |
– |
struct Callback *auth_cb = NULL; |
85 |
|
|
86 |
|
/* auth_init |
87 |
|
* |
90 |
|
void |
91 |
|
auth_init(void) |
92 |
|
{ |
97 |
– |
auth_pool = mp_pool_new(sizeof(struct AuthRequest), MP_CHUNK_SIZE_AUTH); |
98 |
– |
auth_cb = register_callback("start_auth", start_auth); |
93 |
|
eventAddIsh("timeout_auth_queries_event", timeout_auth_queries_event, NULL, 1); |
94 |
|
} |
95 |
|
|
99 |
|
static struct AuthRequest * |
100 |
|
make_auth_request(struct Client *client) |
101 |
|
{ |
102 |
< |
struct AuthRequest *request = mp_pool_get(auth_pool); |
102 |
> |
struct AuthRequest *request = &client->localClient->auth; |
103 |
|
|
104 |
|
memset(request, 0, sizeof(*request)); |
105 |
< |
client->localClient->auth = request; |
106 |
< |
request->client = client; |
107 |
< |
request->timeout = CurrentTime + CONNECTTIMEOUT; |
105 |
> |
|
106 |
> |
request->client = client; |
107 |
> |
request->timeout = CurrentTime + CONNECTTIMEOUT; |
108 |
|
|
109 |
|
return request; |
110 |
|
} |
122 |
|
if (IsDoingAuth(auth) || IsDNSPending(auth)) |
123 |
|
return; |
124 |
|
|
125 |
< |
client->localClient->auth = NULL; |
126 |
< |
dlinkDelete(&auth->node, &auth_doing_list); |
133 |
< |
mp_pool_release(auth); |
125 |
> |
if (dlinkFind(&auth_doing_list, auth)) |
126 |
> |
dlinkDelete(&auth->node, &auth_doing_list); |
127 |
|
|
128 |
|
/* |
129 |
|
* When a client has auth'ed, we want to start reading what it sends |
356 |
|
* output - NONE |
357 |
|
* side effects - starts auth (identd) and dns queries for a client |
358 |
|
*/ |
359 |
< |
static void * |
360 |
< |
start_auth(va_list args) |
359 |
> |
void |
360 |
> |
start_auth(struct Client *client) |
361 |
|
{ |
369 |
– |
struct Client *client = va_arg(args, struct Client *); |
362 |
|
struct AuthRequest *auth = NULL; |
363 |
|
|
364 |
|
assert(client != NULL); |
377 |
|
} |
378 |
|
|
379 |
|
gethost_byaddr(auth_dns_callback, auth, &client->localClient->ip); |
388 |
– |
|
389 |
– |
return NULL; |
380 |
|
} |
381 |
|
|
382 |
|
/* |
584 |
|
if (IsDoingAuth(auth)) |
585 |
|
fd_close(&auth->fd); |
586 |
|
|
587 |
< |
dlinkDelete(&auth->node, &auth_doing_list); |
588 |
< |
mp_pool_release(auth); |
587 |
> |
if (dlinkFind(&auth_doing_list, auth)) |
588 |
> |
dlinkDelete(&auth->node, &auth_doing_list); |
589 |
|
} |