| 32 |
|
* any messages from it. |
| 33 |
|
* --Bleep Thomas Helvey <tomh@inxpress.net> |
| 34 |
|
*/ |
| 35 |
+ |
|
| 36 |
|
#include "stdinc.h" |
| 37 |
|
#include "list.h" |
| 38 |
|
#include "ircd_defs.h" |
| 39 |
|
#include "fdlist.h" |
| 40 |
|
#include "s_auth.h" |
| 41 |
< |
#include "s_conf.h" |
| 41 |
< |
#include "balloc.h" |
| 41 |
> |
#include "conf.h" |
| 42 |
|
#include "client.h" |
| 43 |
– |
#include "common.h" |
| 43 |
|
#include "event.h" |
| 44 |
|
#include "hook.h" |
| 45 |
|
#include "irc_string.h" |
| 47 |
|
#include "packet.h" |
| 48 |
|
#include "irc_res.h" |
| 49 |
|
#include "s_bsd.h" |
| 50 |
< |
#include "s_log.h" |
| 50 |
> |
#include "log.h" |
| 51 |
|
#include "send.h" |
| 52 |
+ |
#include "mempool.h" |
| 53 |
|
|
| 54 |
|
|
| 55 |
|
static const char *HeaderMessages[] = { |
| 76 |
|
|
| 77 |
|
#define sendheader(c, i) sendto_one((c), HeaderMessages[(i)], me.name) |
| 78 |
|
|
| 79 |
< |
static BlockHeap *auth_heap = NULL; |
| 79 |
> |
static mp_pool_t *auth_pool = NULL; |
| 80 |
|
static dlink_list auth_doing_list = { NULL, NULL, 0 }; |
| 81 |
|
|
| 82 |
|
static EVH timeout_auth_queries_event; |
| 94 |
|
void |
| 95 |
|
init_auth(void) |
| 96 |
|
{ |
| 97 |
< |
auth_heap = BlockHeapCreate("auth", sizeof(struct AuthRequest), AUTH_HEAP_SIZE); |
| 97 |
> |
auth_pool = mp_pool_new(sizeof(struct AuthRequest), MP_CHUNK_SIZE_AUTH); |
| 98 |
|
auth_cb = register_callback("start_auth", start_auth); |
| 99 |
|
eventAddIsh("timeout_auth_queries_event", timeout_auth_queries_event, NULL, 1); |
| 100 |
|
} |
| 105 |
|
static struct AuthRequest * |
| 106 |
|
make_auth_request(struct Client *client) |
| 107 |
|
{ |
| 108 |
< |
struct AuthRequest *request = BlockHeapAlloc(auth_heap); |
| 108 |
> |
struct AuthRequest *request = mp_pool_get(auth_pool); |
| 109 |
|
|
| 110 |
+ |
memset(request, 0, sizeof(*request)); |
| 111 |
|
client->localClient->auth = request; |
| 112 |
|
request->client = client; |
| 113 |
|
request->timeout = CurrentTime + CONNECTTIMEOUT; |
| 130 |
|
|
| 131 |
|
client->localClient->auth = NULL; |
| 132 |
|
dlinkDelete(&auth->node, &auth_doing_list); |
| 133 |
< |
BlockHeapFree(auth_heap, auth); |
| 133 |
> |
mp_pool_release(auth); |
| 134 |
|
|
| 135 |
|
/* |
| 136 |
|
* When a client has auth'ed, we want to start reading what it sends |
| 251 |
|
{ |
| 252 |
|
report_error(L_ALL, "creating auth stream socket %s:%s", |
| 253 |
|
get_client_name(auth->client, SHOW_IP), errno); |
| 254 |
< |
ilog(L_ERROR, "Unable to create auth socket for %s", |
| 254 |
> |
ilog(LOG_TYPE_IRCD, "Unable to create auth socket for %s", |
| 255 |
|
get_client_name(auth->client, SHOW_IP)); |
| 256 |
|
++ServerStats.is_abad; |
| 257 |
|
return 0; |
| 420 |
|
sendheader(auth->client, REPORT_FAIL_DNS); |
| 421 |
|
} |
| 422 |
|
|
| 423 |
< |
ilog(L_INFO, "DNS/AUTH timeout %s", |
| 423 |
> |
ilog(LOG_TYPE_IRCD, "DNS/AUTH timeout %s", |
| 424 |
|
get_client_name(auth->client, SHOW_IP)); |
| 425 |
|
release_auth_client(auth); |
| 426 |
|
} |
| 464 |
|
getpeername(auth->client->localClient->fd.fd, (struct sockaddr *)&them, |
| 465 |
|
&tlen)) |
| 466 |
|
{ |
| 467 |
< |
ilog(L_INFO, "auth get{sock,peer}name error for %s", |
| 467 |
> |
ilog(LOG_TYPE_IRCD, "auth get{sock,peer}name error for %s", |
| 468 |
|
get_client_name(auth->client, SHOW_IP)); |
| 469 |
|
auth_error(auth); |
| 470 |
|
return; |
| 595 |
|
fd_close(&auth->fd); |
| 596 |
|
|
| 597 |
|
dlinkDelete(&auth->node, &auth_doing_list); |
| 598 |
< |
BlockHeapFree(auth_heap, auth); |
| 598 |
> |
mp_pool_release(auth); |
| 599 |
|
} |