19 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
20 |
|
* USA |
21 |
|
* |
22 |
< |
* $Id: packet.c,v 7.131 2005/09/18 20:09:03 adx Exp $ |
22 |
> |
* $Id$ |
23 |
|
*/ |
24 |
|
#include "stdinc.h" |
25 |
< |
#include "tools.h" |
25 |
> |
#include "list.h" |
26 |
|
#include "s_bsd.h" |
27 |
|
#include "s_conf.h" |
28 |
|
#include "s_serv.h" |
29 |
|
#include "client.h" |
30 |
|
#include "common.h" |
31 |
|
#include "ircd.h" |
32 |
– |
#include "list.h" |
32 |
|
#include "parse.h" |
33 |
|
#include "fdlist.h" |
34 |
|
#include "packet.h" |
36 |
|
#include "memory.h" |
37 |
|
#include "hook.h" |
38 |
|
#include "send.h" |
40 |
– |
#include "irc_getnameinfo.h" |
39 |
|
|
40 |
|
#define READBUF_SIZE 16384 |
41 |
|
|
164 |
|
client_dopacket(client_p, readBuf, dolen); |
165 |
|
} |
166 |
|
} |
167 |
< |
else if(IsClient(client_p)) |
167 |
> |
else if (IsClient(client_p)) |
168 |
|
{ |
169 |
< |
if (ConfigFileEntry.no_oper_flood && (IsOper(client_p) || IsCanFlood(client_p))) |
169 |
> |
if (ConfigFileEntry.no_oper_flood && (HasUMode(client_p, UMODE_OPER) || IsCanFlood(client_p))) |
170 |
|
{ |
171 |
|
if (ConfigFileEntry.true_no_oper_flood) |
172 |
|
checkflood = -1; |
388 |
|
} |
389 |
|
|
390 |
|
/* |
391 |
+ |
* iorecv_default - append a packet to the recvq dbuf |
392 |
+ |
*/ |
393 |
+ |
void * |
394 |
+ |
iorecv_default(va_list args) |
395 |
+ |
{ |
396 |
+ |
struct Client *client_p = va_arg(args, struct Client *); |
397 |
+ |
int length = va_arg(args, int); |
398 |
+ |
char *buf = va_arg(args, char *); |
399 |
+ |
|
400 |
+ |
dbuf_put(&client_p->localClient->buf_recvq, buf, length); |
401 |
+ |
return NULL; |
402 |
+ |
} |
403 |
+ |
|
404 |
+ |
/* |
405 |
|
* read_packet - Read a 'packet' of data from a connection and process it. |
406 |
|
*/ |
407 |
|
void |
438 |
|
errno = EWOULDBLOCK; |
439 |
|
case SSL_ERROR_SYSCALL: |
440 |
|
break; |
441 |
+ |
case SSL_ERROR_SSL: |
442 |
+ |
if (errno == EAGAIN) |
443 |
+ |
break; |
444 |
|
default: |
445 |
|
length = errno = 0; |
446 |
|
} |
449 |
|
#endif |
450 |
|
{ |
451 |
|
length = recv(fd->fd, readBuf, READBUF_SIZE, 0); |
437 |
– |
#ifdef _WIN32 |
438 |
– |
if (length < 0) |
439 |
– |
errno = WSAGetLastError(); |
440 |
– |
#endif |
452 |
|
} |
453 |
|
|
454 |
|
if (length <= 0) |
466 |
|
|
467 |
|
execute_callback(iorecv_cb, client_p, length, readBuf); |
468 |
|
|
469 |
< |
if (client_p->lasttime < CurrentTime) |
470 |
< |
client_p->lasttime = CurrentTime; |
471 |
< |
if (client_p->lasttime > client_p->since) |
472 |
< |
client_p->since = CurrentTime; |
469 |
> |
if (client_p->localClient->lasttime < CurrentTime) |
470 |
> |
client_p->localClient->lasttime = CurrentTime; |
471 |
> |
if (client_p->localClient->lasttime > client_p->localClient->since) |
472 |
> |
client_p->localClient->since = CurrentTime; |
473 |
|
ClearPingSent(client_p); |
474 |
|
|
464 |
– |
dbuf_put(&client_p->localClient->buf_recvq, readBuf, length); |
465 |
– |
|
475 |
|
/* Attempt to parse what we have */ |
476 |
|
parse_client_queued(client_p); |
477 |
|
|
484 |
|
&& (dbuf_length(&client_p->localClient->buf_recvq) > |
485 |
|
(unsigned int)ConfigFileEntry.client_flood)) |
486 |
|
{ |
487 |
< |
if (!(ConfigFileEntry.no_oper_flood && IsOper(client_p))) |
487 |
> |
if (!(ConfigFileEntry.no_oper_flood && HasUMode(client_p, UMODE_OPER))) |
488 |
|
{ |
489 |
|
exit_client(client_p, client_p, "Excess Flood"); |
490 |
|
return; |