37 |
|
#include "list.h" |
38 |
|
#include "s_auth.h" |
39 |
|
#include "s_conf.h" |
40 |
+ |
#include "balloc.h" |
41 |
|
#include "client.h" |
42 |
|
#include "common.h" |
43 |
|
#include "event.h" |
78 |
|
|
79 |
|
#define sendheader(c, i) sendto_one((c), HeaderMessages[(i)], me.name) |
80 |
|
|
81 |
+ |
static BlockHeap *auth_heap = NULL; |
82 |
|
static dlink_list auth_doing_list = { NULL, NULL, 0 }; |
83 |
|
|
84 |
|
static EVH timeout_auth_queries_event; |
96 |
|
void |
97 |
|
init_auth(void) |
98 |
|
{ |
99 |
+ |
auth_heap = BlockHeapCreate("auth", sizeof(struct AuthRequest), AUTH_HEAP_SIZE); |
100 |
|
auth_cb = register_callback("start_auth", start_auth); |
101 |
|
eventAddIsh("timeout_auth_queries_event", timeout_auth_queries_event, NULL, 1); |
102 |
|
} |
107 |
|
static struct AuthRequest * |
108 |
|
make_auth_request(struct Client *client) |
109 |
|
{ |
110 |
< |
struct AuthRequest *request = MyMalloc(sizeof(struct AuthRequest)); |
110 |
> |
struct AuthRequest *request = BlockHeapAlloc(auth_heap); |
111 |
|
|
112 |
|
client->localClient->auth = request; |
113 |
|
request->client = client; |
131 |
|
|
132 |
|
client->localClient->auth = NULL; |
133 |
|
dlinkDelete(&auth->node, &auth_doing_list); |
134 |
+ |
BlockHeapFree(auth_heap, auth); |
135 |
|
|
136 |
|
/* |
137 |
|
* When a client has auth'ed, we want to start reading what it sends |
151 |
|
|
152 |
|
/* |
153 |
|
* auth_dns_callback - called when resolver query finishes |
154 |
< |
* if the query resulted in a successful search, hp will contain |
155 |
< |
* a non-null pointer, otherwise hp will be null. |
154 |
> |
* if the query resulted in a successful search, name will contain |
155 |
> |
* a non-NULL pointer, otherwise name will be NULL. |
156 |
|
* set the client on it's way to a connection completion, regardless |
157 |
|
* of success of failure |
158 |
|
*/ |
410 |
|
if (IsDoingAuth(auth)) |
411 |
|
{ |
412 |
|
++ServerStats.is_abad; |
413 |
+ |
ClearAuth(auth); |
414 |
|
sendheader(auth->client, REPORT_FAIL_ID); |
415 |
|
} |
416 |
|
|
417 |
|
if (IsDNSPending(auth)) |
418 |
|
{ |
419 |
|
delete_resolver_queries(auth); |
420 |
+ |
ClearDNSPending(auth); |
421 |
|
sendheader(auth->client, REPORT_FAIL_DNS); |
422 |
|
} |
423 |
|
|
601 |
|
|
602 |
|
fd_close(&auth->fd); |
603 |
|
dlinkDelete(&auth->node, &auth_doing_list); |
604 |
< |
MyFree(auth); |
604 |
> |
BlockHeapFree(auth_heap, auth); |
605 |
|
} |