35 |
|
#include "irc_string.h" |
36 |
|
#include "sprintf_irc.h" |
37 |
|
#include "s_bsd.h" |
38 |
– |
#include "irc_getnameinfo.h" |
38 |
|
#include "ircd.h" |
39 |
|
#include "list.h" |
40 |
|
#include "listener.h" |
43 |
|
#include "s_conf.h" |
44 |
|
#include "s_log.h" |
45 |
|
#include "s_serv.h" |
47 |
– |
#include "s_stats.h" |
46 |
|
#include "send.h" |
47 |
|
#include "supported.h" |
48 |
|
#include "whowas.h" |
49 |
|
#include "memory.h" |
50 |
|
#include "packet.h" |
51 |
+ |
#include "rng_mt.h" |
52 |
|
#include "userhost.h" |
53 |
|
#include "hook.h" |
54 |
|
#include "s_misc.h" |
286 |
|
const char *nick, const char *username) |
287 |
|
{ |
288 |
|
const struct AccessItem *aconf = NULL; |
290 |
– |
char ipaddr[HOSTIPLEN]; |
289 |
|
dlink_node *ptr = NULL; |
290 |
|
dlink_node *m = NULL; |
291 |
|
|
301 |
|
if (!IsPingSent(source_p) && |
302 |
|
source_p->localClient->random_ping == 0) |
303 |
|
{ |
304 |
< |
source_p->localClient->random_ping = (unsigned long)rand(); |
305 |
< |
sendto_one(source_p, "PING :%lu", |
304 |
> |
do |
305 |
> |
source_p->localClient->random_ping = genrand_int32(); |
306 |
> |
while (!source_p->localClient->random_ping); |
307 |
> |
|
308 |
> |
sendto_one(source_p, "PING :%u", |
309 |
|
source_p->localClient->random_ping); |
310 |
|
SetPingSent(source_p); |
311 |
|
return; |
340 |
|
|
341 |
|
if (IsNeedIdentd(aconf)) |
342 |
|
{ |
343 |
< |
ServerStats->is_ref++; |
343 |
> |
++ServerStats.is_ref; |
344 |
|
sendto_one(source_p, ":%s NOTICE %s :*** Notice -- You need to install " |
345 |
|
"identd to use this server", me.name, source_p->name); |
346 |
|
exit_client(source_p, &me, "Install identd"); |
369 |
|
|
370 |
|
if (!match_conf_password(pass, aconf)) |
371 |
|
{ |
372 |
< |
ServerStats->is_ref++; |
372 |
> |
++ServerStats.is_ref; |
373 |
|
sendto_one(source_p, form_str(ERR_PASSWDMISMATCH), |
374 |
|
me.name, source_p->name); |
375 |
|
exit_client(source_p, &me, "Bad Password"); |
385 |
|
/* report if user has &^>= etc. and set flags as needed in source_p */ |
386 |
|
report_and_set_user_flags(source_p, aconf); |
387 |
|
|
388 |
+ |
if (IsDead(client_p)) |
389 |
+ |
return; |
390 |
+ |
|
391 |
|
/* Limit clients - |
392 |
|
* We want to be able to have servers and F-line clients |
393 |
|
* connect, so save room for "buffer" connections. |
402 |
|
sendto_realops_flags(UMODE_FULL, L_ALL, |
403 |
|
"Too many clients, rejecting %s[%s].", |
404 |
|
nick, source_p->host); |
405 |
< |
ServerStats->is_ref++; |
405 |
> |
++ServerStats.is_ref; |
406 |
|
exit_client(source_p, &me, "Sorry, server is full - try later"); |
407 |
|
return; |
408 |
|
} |
414 |
|
|
415 |
|
sendto_realops_flags(UMODE_REJ, L_ALL, "Invalid username: %s (%s@%s)", |
416 |
|
nick, source_p->username, source_p->host); |
417 |
< |
ServerStats->is_ref++; |
417 |
> |
++ServerStats.is_ref; |
418 |
|
ircsprintf(tmpstr2, "Invalid username [%s]", source_p->username); |
419 |
|
exit_client(source_p, &me, tmpstr2); |
420 |
|
return; |
425 |
|
if (check_xline(source_p)) |
426 |
|
return; |
427 |
|
|
424 |
– |
if (IsDead(client_p)) |
425 |
– |
return; |
426 |
– |
|
428 |
|
if (me.id[0]) |
429 |
|
{ |
430 |
|
const char *id = execute_callback(uid_get_cb, source_p); |
436 |
|
hash_add_id(source_p); |
437 |
|
} |
438 |
|
|
438 |
– |
irc_getnameinfo((struct sockaddr *)&source_p->localClient->ip, |
439 |
– |
source_p->localClient->ip.ss_len, ipaddr, |
440 |
– |
HOSTIPLEN, NULL, 0, NI_NUMERICHOST); |
441 |
– |
|
439 |
|
sendto_realops_flags(UMODE_CCONN, L_ALL, |
440 |
|
"Client connecting: %s (%s@%s) [%s] {%s} [%s]", |
441 |
|
nick, source_p->username, source_p->host, |
442 |
|
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
443 |
< |
"255.255.255.255" : ipaddr, get_client_class(source_p), |
443 |
> |
"255.255.255.255" : source_p->sockhost, |
444 |
> |
get_client_class(source_p), |
445 |
|
source_p->info); |
446 |
|
|
447 |
|
sendto_realops_flags(UMODE_CCONN_FULL, L_ALL, |
448 |
|
"CLICONN %s %s %s %s %s %s %s 0 %s", |
449 |
|
nick, source_p->username, source_p->host, |
450 |
|
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
451 |
< |
"255.255.255.255" : ipaddr, |
451 |
> |
"255.255.255.255" : source_p->sockhost, |
452 |
|
get_client_class(source_p), |
453 |
|
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
454 |
|
"<hidden>" : source_p->client_host, |
457 |
|
source_p->info); |
458 |
|
|
459 |
|
|
462 |
– |
/* If they have died in send_* don't do anything. */ |
463 |
– |
if (IsDead(source_p)) |
464 |
– |
return; |
465 |
– |
|
460 |
|
if (ConfigFileEntry.invisible_on_connect) |
461 |
|
{ |
462 |
|
source_p->umodes |= UMODE_INVISIBLE; |
463 |
< |
Count.invisi++; |
463 |
> |
++Count.invisi; |
464 |
|
} |
465 |
|
|
466 |
|
if ((++Count.local) > Count.max_loc) |
480 |
|
/* Increment our total user count here */ |
481 |
|
if (++Count.total > Count.max_tot) |
482 |
|
Count.max_tot = Count.total; |
483 |
< |
Count.totalrestartcount++; |
483 |
> |
++Count.totalrestartcount; |
484 |
|
|
485 |
|
source_p->localClient->allow_read = MAX_FLOOD_BURST; |
486 |
|
|
521 |
|
assert(source_p->username != username); |
522 |
|
|
523 |
|
strlcpy(source_p->host, host, sizeof(source_p->host)); |
530 |
– |
strlcpy(source_p->info, realname, sizeof(source_p->info)); |
524 |
|
strlcpy(source_p->username, username, sizeof(source_p->username)); |
525 |
|
|
526 |
|
/* |
1203 |
|
get_client_name(source_p, HIDE_IP), |
1204 |
|
source_p->sockhost); |
1205 |
|
|
1206 |
< |
ServerStats->is_ref++; |
1206 |
> |
++ServerStats.is_ref; |
1207 |
|
if (REJECT_HOLD_TIME > 0) |
1208 |
|
{ |
1209 |
|
sendto_one(source_p, ":%s NOTICE %s :Bad user info", |