33 |
|
* --Bleep Thomas Helvey <tomh@inxpress.net> |
34 |
|
*/ |
35 |
|
#include "stdinc.h" |
36 |
– |
#include "tools.h" |
36 |
|
#include "list.h" |
37 |
+ |
#include "ircd_defs.h" |
38 |
+ |
#include "fdlist.h" |
39 |
|
#include "s_auth.h" |
40 |
|
#include "s_conf.h" |
41 |
|
#include "balloc.h" |
42 |
|
#include "client.h" |
42 |
– |
#include "common.h" |
43 |
|
#include "event.h" |
44 |
– |
#include "fdlist.h" /* fdlist_add */ |
44 |
|
#include "hook.h" |
45 |
|
#include "irc_string.h" |
47 |
– |
#include "sprintf_irc.h" |
46 |
|
#include "ircd.h" |
49 |
– |
#include "numeric.h" |
47 |
|
#include "packet.h" |
48 |
|
#include "irc_res.h" |
49 |
|
#include "s_bsd.h" |
50 |
|
#include "s_log.h" |
51 |
|
#include "send.h" |
52 |
< |
#include "memory.h" |
52 |
> |
|
53 |
|
|
54 |
|
static const char *HeaderMessages[] = { |
55 |
|
":%s NOTICE AUTH :*** Looking up your hostname...", |
140 |
|
|
141 |
|
dlinkAdd(client, &client->node, &global_client_list); |
142 |
|
|
143 |
< |
client->since = client->lasttime = client->firsttime = CurrentTime; |
143 |
> |
client->localClient->since = CurrentTime; |
144 |
> |
client->localClient->lasttime = CurrentTime; |
145 |
> |
client->localClient->firsttime = CurrentTime; |
146 |
|
client->flags |= FLAGS_FINISHED_AUTH; |
147 |
|
|
148 |
|
read_packet(&client->localClient->fd, client); |
249 |
|
{ |
250 |
|
report_error(L_ALL, "creating auth stream socket %s:%s", |
251 |
|
get_client_name(auth->client, SHOW_IP), errno); |
252 |
< |
ilog(L_ERROR, "Unable to create auth socket for %s", |
252 |
> |
ilog(LOG_TYPE_IRCD, "Unable to create auth socket for %s", |
253 |
|
get_client_name(auth->client, SHOW_IP)); |
254 |
|
++ServerStats.is_abad; |
255 |
|
return 0; |
418 |
|
sendheader(auth->client, REPORT_FAIL_DNS); |
419 |
|
} |
420 |
|
|
421 |
< |
ilog(L_INFO, "DNS/AUTH timeout %s", |
421 |
> |
ilog(LOG_TYPE_IRCD, "DNS/AUTH timeout %s", |
422 |
|
get_client_name(auth->client, SHOW_IP)); |
423 |
|
release_auth_client(auth); |
424 |
|
} |
444 |
|
char authbuf[32]; |
445 |
|
socklen_t ulen = sizeof(struct irc_ssaddr); |
446 |
|
socklen_t tlen = sizeof(struct irc_ssaddr); |
447 |
< |
u_int16_t uport, tport; |
447 |
> |
uint16_t uport, tport; |
448 |
|
#ifdef IPV6 |
449 |
|
struct sockaddr_in6 *v6; |
450 |
|
#else |
457 |
|
return; |
458 |
|
} |
459 |
|
|
460 |
< |
if (getsockname(auth->client->localClient->fd.fd, (struct sockaddr *) &us, |
461 |
< |
(socklen_t *) &ulen) || |
462 |
< |
getpeername(auth->client->localClient->fd.fd, (struct sockaddr *) &them, |
463 |
< |
(socklen_t *) &tlen)) |
460 |
> |
if (getsockname(auth->client->localClient->fd.fd, (struct sockaddr *)&us, |
461 |
> |
&ulen) || |
462 |
> |
getpeername(auth->client->localClient->fd.fd, (struct sockaddr *)&them, |
463 |
> |
&tlen)) |
464 |
|
{ |
465 |
< |
ilog(L_INFO, "auth get{sock,peer}name error for %s", |
465 |
> |
ilog(LOG_TYPE_IRCD, "auth get{sock,peer}name error for %s", |
466 |
|
get_client_name(auth->client, SHOW_IP)); |
467 |
|
auth_error(auth); |
468 |
|
return; |
484 |
|
them.ss_len = tlen; |
485 |
|
#endif |
486 |
|
|
487 |
< |
ircsprintf(authbuf, "%u , %u\r\n", tport, uport); |
487 |
> |
snprintf(authbuf, sizeof(authbuf), "%u , %u\r\n", tport, uport); |
488 |
|
|
489 |
|
if (send(fd->fd, authbuf, strlen(authbuf), 0) == -1) |
490 |
|
{ |
524 |
|
* |
525 |
|
* --nenolod |
526 |
|
*/ |
528 |
– |
#ifndef _WIN32 |
527 |
|
len = read(fd->fd, buf, AUTH_BUFSIZ); |
528 |
< |
#else |
531 |
< |
len = recv(fd->fd, buf, AUTH_BUFSIZ, 0); |
532 |
< |
#endif |
533 |
< |
|
528 |
> |
|
529 |
|
if (len < 0) |
530 |
|
{ |
536 |
– |
#ifdef _WIN32 |
537 |
– |
errno = WSAGetLastError(); |
538 |
– |
#endif |
531 |
|
if (ignoreErrno(errno)) |
532 |
|
comm_setselect(fd, COMM_SELECT_READ, read_auth_reply, auth, 0); |
533 |
|
else |