| 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" |
| 55 |
|
#include "msg.h" |
| 56 |
|
#include "pcre.h" |
| 57 |
+ |
#include "watch.h" |
| 58 |
|
|
| 59 |
|
int MaxClientCount = 1; |
| 60 |
|
int MaxConnectionCount = 1; |
| 67 |
|
static void user_welcome(struct Client *); |
| 68 |
|
static void report_and_set_user_flags(struct Client *, const struct AccessItem *); |
| 69 |
|
static int check_xline(struct Client *); |
| 70 |
– |
static int check_regexp_xline(struct Client *); |
| 70 |
|
static void introduce_client(struct Client *, struct Client *); |
| 71 |
|
static void *uid_get(va_list); |
| 72 |
|
|
| 95 |
|
0, /* @ */ |
| 96 |
|
0, /* A */ |
| 97 |
|
0, /* B */ |
| 98 |
< |
0, /* C */ |
| 98 |
> |
UMODE_CCONN_FULL, /* C */ |
| 99 |
|
UMODE_DEAF, /* D */ |
| 100 |
|
0, /* E */ |
| 101 |
|
0, /* F */ |
| 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 |
|
|
| 292 |
|
assert(source_p != NULL); |
| 293 |
|
assert(MyConnect(source_p)); |
| 294 |
|
assert(source_p->username != username); |
| 295 |
+ |
assert(!source_p->localClient->registration); |
| 296 |
+ |
|
| 297 |
+ |
ClearCap(client_p, CAP_TS6); |
| 298 |
|
|
| 299 |
|
if (ConfigFileEntry.ping_cookie) |
| 300 |
|
{ |
| 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 |
> |
source_p->localClient->random_ping = genrand_int32(); |
| 305 |
> |
sendto_one(source_p, "PING :%u", |
| 306 |
|
source_p->localClient->random_ping); |
| 307 |
|
SetPingSent(source_p); |
| 308 |
|
return; |
| 337 |
|
|
| 338 |
|
if (IsNeedIdentd(aconf)) |
| 339 |
|
{ |
| 340 |
< |
ServerStats->is_ref++; |
| 340 |
> |
++ServerStats.is_ref; |
| 341 |
|
sendto_one(source_p, ":%s NOTICE %s :*** Notice -- You need to install " |
| 342 |
|
"identd to use this server", me.name, source_p->name); |
| 343 |
|
exit_client(source_p, &me, "Install identd"); |
| 366 |
|
|
| 367 |
|
if (!match_conf_password(pass, aconf)) |
| 368 |
|
{ |
| 369 |
< |
ServerStats->is_ref++; |
| 369 |
> |
++ServerStats.is_ref; |
| 370 |
|
sendto_one(source_p, form_str(ERR_PASSWDMISMATCH), |
| 371 |
|
me.name, source_p->name); |
| 372 |
|
exit_client(source_p, &me, "Bad Password"); |
| 382 |
|
/* report if user has &^>= etc. and set flags as needed in source_p */ |
| 383 |
|
report_and_set_user_flags(source_p, aconf); |
| 384 |
|
|
| 385 |
+ |
if (IsDead(client_p)) |
| 386 |
+ |
return; |
| 387 |
+ |
|
| 388 |
|
/* Limit clients - |
| 389 |
|
* We want to be able to have servers and F-line clients |
| 390 |
|
* connect, so save room for "buffer" connections. |
| 399 |
|
sendto_realops_flags(UMODE_FULL, L_ALL, |
| 400 |
|
"Too many clients, rejecting %s[%s].", |
| 401 |
|
nick, source_p->host); |
| 402 |
< |
ServerStats->is_ref++; |
| 402 |
> |
++ServerStats.is_ref; |
| 403 |
|
exit_client(source_p, &me, "Sorry, server is full - try later"); |
| 404 |
|
return; |
| 405 |
|
} |
| 411 |
|
|
| 412 |
|
sendto_realops_flags(UMODE_REJ, L_ALL, "Invalid username: %s (%s@%s)", |
| 413 |
|
nick, source_p->username, source_p->host); |
| 414 |
< |
ServerStats->is_ref++; |
| 414 |
> |
++ServerStats.is_ref; |
| 415 |
|
ircsprintf(tmpstr2, "Invalid username [%s]", source_p->username); |
| 416 |
|
exit_client(source_p, &me, tmpstr2); |
| 417 |
|
return; |
| 419 |
|
|
| 420 |
|
assert(source_p == client_p); |
| 421 |
|
|
| 422 |
< |
/* end of valid user name check */ |
| 419 |
< |
if (check_xline(source_p) || check_regexp_xline(source_p)) |
| 422 |
> |
if (check_xline(source_p)) |
| 423 |
|
return; |
| 424 |
|
|
| 425 |
< |
if (IsDead(client_p)) |
| 423 |
< |
return; |
| 424 |
< |
|
| 425 |
< |
if (source_p->id[0] == '\0' && me.id[0]) |
| 425 |
> |
if (me.id[0]) |
| 426 |
|
{ |
| 427 |
< |
char *id = (char *) execute_callback(uid_get_cb, source_p); |
| 427 |
> |
const char *id = execute_callback(uid_get_cb, source_p); |
| 428 |
> |
|
| 429 |
|
while (hash_find_id(id) != NULL) |
| 430 |
|
id = uid_get(NULL); |
| 431 |
|
|
| 433 |
|
hash_add_id(source_p); |
| 434 |
|
} |
| 435 |
|
|
| 435 |
– |
irc_getnameinfo((struct sockaddr *)&source_p->localClient->ip, |
| 436 |
– |
source_p->localClient->ip.ss_len, ipaddr, |
| 437 |
– |
HOSTIPLEN, NULL, 0, NI_NUMERICHOST); |
| 438 |
– |
|
| 436 |
|
sendto_realops_flags(UMODE_CCONN, L_ALL, |
| 437 |
|
"Client connecting: %s (%s@%s) [%s] {%s} [%s]", |
| 438 |
|
nick, source_p->username, source_p->host, |
| 439 |
|
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
| 440 |
< |
"255.255.255.255" : ipaddr, get_client_class(source_p), |
| 440 |
> |
"255.255.255.255" : source_p->sockhost, |
| 441 |
> |
get_client_class(source_p), |
| 442 |
> |
source_p->info); |
| 443 |
> |
|
| 444 |
> |
sendto_realops_flags(UMODE_CCONN_FULL, L_ALL, |
| 445 |
> |
"CLICONN %s %s %s %s %s %s %s 0 %s", |
| 446 |
> |
nick, source_p->username, source_p->host, |
| 447 |
> |
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
| 448 |
> |
"255.255.255.255" : source_p->sockhost, |
| 449 |
> |
get_client_class(source_p), |
| 450 |
> |
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
| 451 |
> |
"<hidden>" : source_p->client_host, |
| 452 |
> |
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
| 453 |
> |
"<hidden>" : source_p->client_server, |
| 454 |
|
source_p->info); |
| 455 |
|
|
| 446 |
– |
/* If they have died in send_* don't do anything. */ |
| 447 |
– |
if (IsDead(source_p)) |
| 448 |
– |
return; |
| 456 |
|
|
| 457 |
|
if (ConfigFileEntry.invisible_on_connect) |
| 458 |
+ |
{ |
| 459 |
|
source_p->umodes |= UMODE_INVISIBLE; |
| 460 |
< |
Count.invisi++; |
| 460 |
> |
++Count.invisi; |
| 461 |
> |
} |
| 462 |
|
|
| 463 |
|
if ((++Count.local) > Count.max_loc) |
| 464 |
|
{ |
| 472 |
|
SetClient(source_p); |
| 473 |
|
|
| 474 |
|
source_p->servptr = &me; |
| 475 |
< |
dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->users); |
| 475 |
> |
dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->client_list); |
| 476 |
|
|
| 477 |
|
/* Increment our total user count here */ |
| 478 |
|
if (++Count.total > Count.max_tot) |
| 479 |
|
Count.max_tot = Count.total; |
| 480 |
< |
Count.totalrestartcount++; |
| 480 |
> |
++Count.totalrestartcount; |
| 481 |
|
|
| 482 |
|
source_p->localClient->allow_read = MAX_FLOOD_BURST; |
| 483 |
|
|
| 518 |
|
assert(source_p->username != username); |
| 519 |
|
|
| 520 |
|
strlcpy(source_p->host, host, sizeof(source_p->host)); |
| 512 |
– |
strlcpy(source_p->info, realname, sizeof(source_p->info)); |
| 521 |
|
strlcpy(source_p->username, username, sizeof(source_p->username)); |
| 522 |
|
|
| 515 |
– |
/* Increment our total user count here */ |
| 516 |
– |
if (++Count.total > Count.max_tot) |
| 517 |
– |
Count.max_tot = Count.total; |
| 518 |
– |
|
| 519 |
– |
source_p->from->serv->dep_users++; |
| 520 |
– |
|
| 523 |
|
/* |
| 524 |
|
* coming from another server, take the servers word for it |
| 525 |
|
*/ |
| 537 |
|
source_p->host, source_p->from->name); |
| 538 |
|
kill_client(client_p, source_p, "%s (Server doesn't exist)", me.name); |
| 539 |
|
|
| 538 |
– |
/* XXX */ |
| 540 |
|
SetKilled(source_p); |
| 541 |
|
exit_client(source_p, &me, "Ghosted Client"); |
| 542 |
|
return; |
| 557 |
|
return; |
| 558 |
|
} |
| 559 |
|
|
| 560 |
+ |
/* Increment our total user count here */ |
| 561 |
+ |
if (++Count.total > Count.max_tot) |
| 562 |
+ |
Count.max_tot = Count.total; |
| 563 |
+ |
|
| 564 |
|
SetClient(source_p); |
| 565 |
< |
dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->users); |
| 565 |
> |
dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->client_list); |
| 566 |
|
add_user_host(source_p->username, source_p->host, 1); |
| 567 |
|
SetUserHost(source_p); |
| 568 |
|
|
| 589 |
|
else |
| 590 |
|
send_umode(NULL, source_p, 0, SEND_UMODES, ubuf); |
| 591 |
|
|
| 592 |
+ |
watch_check_hash(source_p, RPL_LOGON); |
| 593 |
+ |
|
| 594 |
|
if (*ubuf == '\0') |
| 595 |
|
{ |
| 596 |
|
ubuf[0] = '+'; |
| 597 |
|
ubuf[1] = '\0'; |
| 598 |
|
} |
| 599 |
|
|
| 600 |
< |
/* arghhh one could try not introducing new nicks to ll leafs |
| 601 |
< |
* but then you have to introduce them "on the fly" in SJOIN |
| 602 |
< |
* not fun. |
| 596 |
< |
* Its not going to cost much more bandwidth to simply let new |
| 597 |
< |
* nicks just ride on through. |
| 598 |
< |
*/ |
| 600 |
> |
DLINK_FOREACH(server_node, serv_list.head) |
| 601 |
> |
{ |
| 602 |
> |
struct Client *server = server_node->data; |
| 603 |
|
|
| 604 |
< |
/* We now introduce nicks "on the fly" in SJOIN anyway -- |
| 605 |
< |
* you _need_ to if you aren't going to burst everyone initially. |
| 602 |
< |
* |
| 603 |
< |
* Only send to non CAP_LL servers, unless we're a lazylink leaf, |
| 604 |
< |
* in that case just send it to the uplink. |
| 605 |
< |
* -davidt |
| 606 |
< |
* rewritten to cope with SIDs .. eww eww eww --is |
| 607 |
< |
*/ |
| 604 |
> |
if (server == client_p) |
| 605 |
> |
continue; |
| 606 |
|
|
| 607 |
< |
/* XXX THESE NEED A PREFIX!?!?!? */ |
| 608 |
< |
if (!ServerInfo.hub && uplink && IsCapable(uplink, CAP_LL) && |
| 611 |
< |
client_p != uplink) |
| 612 |
< |
{ |
| 613 |
< |
if (IsCapable(uplink, CAP_TS6) && HasID(source_p)) |
| 614 |
< |
{ |
| 615 |
< |
sendto_one(uplink, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
| 607 |
> |
if (IsCapable(server, CAP_TS6) && HasID(source_p)) |
| 608 |
> |
sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
| 609 |
|
source_p->servptr->id, |
| 610 |
|
source_p->name, source_p->hopcount+1, |
| 611 |
< |
(unsigned long)source_p->tsinfo, |
| 611 |
> |
(unsigned long)source_p->tsinfo, |
| 612 |
|
ubuf, source_p->username, source_p->host, |
| 613 |
< |
((MyClient(source_p) && !IsIPSpoof(source_p)) ? |
| 614 |
< |
source_p->sockhost : "0"), |
| 622 |
< |
source_p->id, source_p->info); |
| 623 |
< |
} |
| 613 |
> |
(MyClient(source_p) && IsIPSpoof(source_p)) ? |
| 614 |
> |
"0" : source_p->sockhost, source_p->id, source_p->info); |
| 615 |
|
else |
| 616 |
< |
{ |
| 626 |
< |
sendto_one(uplink, "NICK %s %d %lu %s %s %s %s :%s", |
| 616 |
> |
sendto_one(server, "NICK %s %d %lu %s %s %s %s :%s", |
| 617 |
|
source_p->name, source_p->hopcount+1, |
| 618 |
< |
(unsigned long)source_p->tsinfo, |
| 618 |
> |
(unsigned long)source_p->tsinfo, |
| 619 |
|
ubuf, source_p->username, source_p->host, |
| 620 |
< |
source_p->servptr->name, |
| 631 |
< |
source_p->info); |
| 632 |
< |
} |
| 633 |
< |
} |
| 634 |
< |
else |
| 635 |
< |
{ |
| 636 |
< |
DLINK_FOREACH(server_node, serv_list.head) |
| 637 |
< |
{ |
| 638 |
< |
struct Client *server = server_node->data; |
| 639 |
< |
|
| 640 |
< |
if (IsCapable(server, CAP_LL) || server == client_p) |
| 641 |
< |
continue; |
| 642 |
< |
|
| 643 |
< |
if (IsCapable(server, CAP_TS6) && HasID(source_p)) |
| 644 |
< |
sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
| 645 |
< |
source_p->servptr->id, |
| 646 |
< |
source_p->name, source_p->hopcount+1, |
| 647 |
< |
(unsigned long)source_p->tsinfo, |
| 648 |
< |
ubuf, source_p->username, source_p->host, |
| 649 |
< |
((MyClient(source_p)&&!IsIPSpoof(source_p))?source_p->sockhost:"0"), |
| 650 |
< |
source_p->id, source_p->info); |
| 651 |
< |
else |
| 652 |
< |
sendto_one(server, "NICK %s %d %lu %s %s %s %s :%s", |
| 653 |
< |
source_p->name, source_p->hopcount+1, |
| 654 |
< |
(unsigned long)source_p->tsinfo, |
| 655 |
< |
ubuf, source_p->username, source_p->host, |
| 656 |
< |
source_p->servptr->name, |
| 657 |
< |
source_p->info); |
| 658 |
< |
} |
| 620 |
> |
source_p->servptr->name, source_p->info); |
| 621 |
|
} |
| 622 |
|
} |
| 623 |
|
|
| 793 |
|
return; |
| 794 |
|
} |
| 795 |
|
|
| 796 |
< |
source_p->flags |= FLAGS_GOTUSER; |
| 796 |
> |
source_p->localClient->registration &= ~REG_NEED_USER; |
| 797 |
|
|
| 798 |
|
/* |
| 799 |
|
* don't take the clients word for it, ever |
| 802 |
|
|
| 803 |
|
strlcpy(source_p->info, realname, sizeof(source_p->info)); |
| 804 |
|
|
| 805 |
+ |
/* stash for later */ |
| 806 |
+ |
strlcpy(source_p->client_host, host, sizeof(source_p->client_host)); |
| 807 |
+ |
strlcpy(source_p->client_server, server, sizeof(source_p->client_server)); |
| 808 |
+ |
|
| 809 |
|
if (!IsGotId(source_p)) |
| 810 |
|
{ |
| 811 |
|
/* save the username in the client |
| 814 |
|
strlcpy(source_p->username, username, sizeof(source_p->username)); |
| 815 |
|
} |
| 816 |
|
|
| 817 |
< |
if (source_p->name[0]) |
| 852 |
< |
{ |
| 817 |
> |
if (!source_p->localClient->registration) |
| 818 |
|
/* NICK already received, now I have USER... */ |
| 819 |
|
register_local_user(client_p, source_p, source_p->name, username); |
| 855 |
– |
} |
| 820 |
|
} |
| 821 |
|
|
| 822 |
|
/* change_simple_umode() |
| 827 |
|
static void * |
| 828 |
|
change_simple_umode(va_list args) |
| 829 |
|
{ |
| 830 |
+ |
struct Client *client_p; |
| 831 |
|
struct Client *source_p; |
| 832 |
|
int what; |
| 833 |
|
unsigned int flag; |
| 834 |
|
|
| 835 |
< |
va_arg(args, struct Client *); |
| 835 |
> |
client_p = va_arg(args, struct Client *); |
| 836 |
|
source_p = va_arg(args, struct Client *); |
| 837 |
|
what = va_arg(args, int); |
| 838 |
|
flag = va_arg(args, unsigned int); |
| 1018 |
|
/* send_umode() |
| 1019 |
|
* send the MODE string for user (user) to connection client_p |
| 1020 |
|
* -avalon |
| 1021 |
+ |
* |
| 1022 |
+ |
* inputs - client_p |
| 1023 |
+ |
* - source_p |
| 1024 |
+ |
* - int old |
| 1025 |
+ |
* - sendmask mask of modes to send |
| 1026 |
+ |
* - suplied umode_buf |
| 1027 |
+ |
* output - NONE |
| 1028 |
|
*/ |
| 1029 |
|
void |
| 1030 |
|
send_umode(struct Client *client_p, struct Client *source_p, |
| 1075 |
|
*m = '\0'; |
| 1076 |
|
|
| 1077 |
|
if (*umode_buf && client_p) |
| 1078 |
< |
sendto_one(client_p, ":%s MODE %s :%s", |
| 1079 |
< |
source_p->name, source_p->name, umode_buf); |
| 1078 |
> |
sendto_one(client_p, ":%s!%s@%s MODE %s :%s", |
| 1079 |
> |
source_p->name, source_p->username, |
| 1080 |
> |
source_p->host, source_p->name, umode_buf); |
| 1081 |
|
} |
| 1082 |
|
|
| 1083 |
|
/* send_umode_out() |
| 1090 |
|
send_umode_out(struct Client *client_p, struct Client *source_p, |
| 1091 |
|
unsigned int old) |
| 1092 |
|
{ |
| 1093 |
< |
char buf[IRCD_BUFSIZE]; |
| 1093 |
> |
char buf[IRCD_BUFSIZE] = { '\0' }; |
| 1094 |
|
dlink_node *ptr = NULL; |
| 1095 |
|
|
| 1096 |
|
send_umode(NULL, source_p, old, IsOperHiddenAdmin(source_p) ? |
| 1097 |
|
SEND_UMODES & ~UMODE_ADMIN : SEND_UMODES, buf); |
| 1098 |
|
|
| 1099 |
< |
if (*buf) |
| 1099 |
> |
if (buf[0]) |
| 1100 |
|
{ |
| 1101 |
|
DLINK_FOREACH(ptr, serv_list.head) |
| 1102 |
|
{ |
| 1103 |
|
struct Client *target_p = ptr->data; |
| 1104 |
|
|
| 1105 |
|
if ((target_p != client_p) && (target_p != source_p)) |
| 1106 |
< |
{ |
| 1107 |
< |
if ((!(ServerInfo.hub && IsCapable(target_p, CAP_LL))) || |
| 1108 |
< |
(target_p->localClient->serverMask & |
| 1136 |
< |
source_p->lazyLinkClientExists)) |
| 1137 |
< |
sendto_one(target_p, ":%s MODE %s :%s", |
| 1138 |
< |
ID_or_name(source_p, target_p), |
| 1139 |
< |
ID_or_name(source_p, target_p), buf); |
| 1140 |
< |
} |
| 1106 |
> |
sendto_one(target_p, ":%s MODE %s :%s", |
| 1107 |
> |
ID_or_name(source_p, target_p), |
| 1108 |
> |
ID_or_name(source_p, target_p), buf); |
| 1109 |
|
} |
| 1110 |
|
} |
| 1111 |
|
|
| 1179 |
|
static int |
| 1180 |
|
check_xline(struct Client *source_p) |
| 1181 |
|
{ |
| 1182 |
< |
struct ConfItem *conf; |
| 1183 |
< |
struct MatchItem *xconf; |
| 1216 |
< |
const char *reason; |
| 1182 |
> |
struct ConfItem *conf = NULL; |
| 1183 |
> |
const char *reason = NULL; |
| 1184 |
|
|
| 1185 |
< |
if ((conf = find_matching_name_conf(XLINE_TYPE, source_p->info, |
| 1186 |
< |
NULL, NULL, 0)) != NULL) |
| 1185 |
> |
if ((conf = find_matching_name_conf(XLINE_TYPE, source_p->info, NULL, NULL, 0)) || |
| 1186 |
> |
(conf = find_matching_name_conf(RXLINE_TYPE, source_p->info, NULL, NULL, 0))) |
| 1187 |
|
{ |
| 1188 |
< |
xconf = map_to_conf(conf); |
| 1222 |
< |
xconf->count++; |
| 1188 |
> |
struct MatchItem *reg = map_to_conf(conf); |
| 1189 |
|
|
| 1190 |
< |
if (xconf->reason != NULL) |
| 1191 |
< |
reason = xconf->reason; |
| 1190 |
> |
++reg->count; |
| 1191 |
> |
|
| 1192 |
> |
if (reg->reason != NULL) |
| 1193 |
> |
reason = reg->reason; |
| 1194 |
|
else |
| 1195 |
|
reason = "No Reason"; |
| 1196 |
|
|
| 1200 |
|
get_client_name(source_p, HIDE_IP), |
| 1201 |
|
source_p->sockhost); |
| 1202 |
|
|
| 1203 |
< |
ServerStats->is_ref++; |
| 1203 |
> |
++ServerStats.is_ref; |
| 1204 |
|
if (REJECT_HOLD_TIME > 0) |
| 1205 |
|
{ |
| 1206 |
|
sendto_one(source_p, ":%s NOTICE %s :Bad user info", |
| 1216 |
|
return 0; |
| 1217 |
|
} |
| 1218 |
|
|
| 1251 |
– |
static int |
| 1252 |
– |
check_regexp_xline(struct Client *source_p) |
| 1253 |
– |
{ |
| 1254 |
– |
struct ConfItem *conf = NULL; |
| 1255 |
– |
const char *reason = NULL; |
| 1256 |
– |
|
| 1257 |
– |
if ((conf = find_matching_name_conf(RXLINE_TYPE, source_p->info, NULL, NULL, 0))) |
| 1258 |
– |
{ |
| 1259 |
– |
struct MatchItem *reg = map_to_conf(conf); |
| 1260 |
– |
|
| 1261 |
– |
++reg->count; |
| 1262 |
– |
|
| 1263 |
– |
if (reg->reason != NULL) |
| 1264 |
– |
reason = reg->reason; |
| 1265 |
– |
else |
| 1266 |
– |
reason = "No Reason"; |
| 1267 |
– |
|
| 1268 |
– |
sendto_realops_flags(UMODE_REJ, L_ALL, |
| 1269 |
– |
"X-line (REGEX) Rejecting [%s] [%s], user %s [%s]", |
| 1270 |
– |
source_p->info, reason, |
| 1271 |
– |
get_client_name(source_p, HIDE_IP), |
| 1272 |
– |
source_p->sockhost); |
| 1273 |
– |
|
| 1274 |
– |
ServerStats->is_ref++; |
| 1275 |
– |
exit_client(source_p, &me, "Bad user info"); |
| 1276 |
– |
return 1; |
| 1277 |
– |
} |
| 1278 |
– |
|
| 1279 |
– |
return 0; |
| 1280 |
– |
} |
| 1281 |
– |
|
| 1219 |
|
/* oper_up() |
| 1220 |
|
* |
| 1221 |
|
* inputs - pointer to given client to oper |
| 1245 |
|
source_p->umodes |= (UMODE_SERVNOTICE|UMODE_OPERWALL| |
| 1246 |
|
UMODE_WALLOP|UMODE_LOCOPS); |
| 1247 |
|
|
| 1248 |
+ |
if (!(old & UMODE_INVISIBLE) && IsInvisible(source_p)) |
| 1249 |
+ |
++Count.invisi; |
| 1250 |
+ |
if ((old & UMODE_INVISIBLE) && !IsInvisible(source_p)) |
| 1251 |
+ |
--Count.invisi; |
| 1252 |
+ |
|
| 1253 |
|
assert(dlinkFind(&oper_list, source_p) == NULL); |
| 1254 |
|
dlinkAdd(source_p, make_dlink_node(), &oper_list); |
| 1255 |
|
|
| 1271 |
|
send_message_file(source_p, &ConfigFileEntry.opermotd); |
| 1272 |
|
} |
| 1273 |
|
|
| 1274 |
< |
/* |
| 1275 |
< |
* Quick and dirty UID code for new proposed SID on EFnet |
| 1276 |
< |
* |
| 1277 |
< |
*/ |
| 1274 |
> |
static char new_uid[TOTALSIDUID + 1]; /* allow for \0 */ |
| 1275 |
> |
|
| 1276 |
> |
int |
| 1277 |
> |
valid_sid(const char *sid) |
| 1278 |
> |
{ |
| 1279 |
|
|
| 1280 |
< |
static char new_uid[TOTALSIDUID+1]; /* allow for \0 */ |
| 1281 |
< |
static void add_one_to_uid(int i); |
| 1280 |
> |
if (strlen(sid) == IRC_MAXSID) |
| 1281 |
> |
if (IsDigit(*sid)) |
| 1282 |
> |
if (IsAlNum(*(sid + 1)) && IsAlNum(*(sid + 2))) |
| 1283 |
> |
return 1; |
| 1284 |
> |
|
| 1285 |
> |
return 0; |
| 1286 |
> |
} |
| 1287 |
|
|
| 1288 |
|
/* |
| 1289 |
|
* init_uid() |
| 1303 |
|
|
| 1304 |
|
if (ServerInfo.sid != NULL) |
| 1305 |
|
{ |
| 1306 |
< |
memcpy(new_uid, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid), |
| 1307 |
< |
IRC_MAXSID)); |
| 1308 |
< |
memcpy(&me.id, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid), |
| 1361 |
< |
IRC_MAXSID)); |
| 1306 |
> |
strlcpy(new_uid, ServerInfo.sid, sizeof(new_uid)); |
| 1307 |
> |
strlcpy(me.id, ServerInfo.sid, sizeof(me.id)); |
| 1308 |
> |
|
| 1309 |
|
hash_add_id(&me); |
| 1310 |
|
} |
| 1311 |
|
|
| 1313 |
|
if (new_uid[i] == '\0') |
| 1314 |
|
new_uid[i] = 'A'; |
| 1315 |
|
|
| 1316 |
< |
/* XXX if IRC_MAXUID != 6, this will have to be rewritten */ |
| 1316 |
> |
/* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */ |
| 1317 |
|
/* Yes nenolod, I have known it was off by one ever since I wrote it |
| 1318 |
|
* But *JUST* for you, though, it really doesn't look as *pretty* |
| 1319 |
|
* -Dianora |
| 1320 |
|
*/ |
| 1321 |
< |
memcpy(new_uid+IRC_MAXSID, "AAAAA@", IRC_MAXUID); |
| 1321 |
> |
memcpy(new_uid + IRC_MAXSID, "AAAAA@", IRC_MAXUID); |
| 1322 |
|
|
| 1323 |
|
entering_umode_cb = register_callback("entering_umode", NULL); |
| 1324 |
|
umode_cb = register_callback("changing_umode", change_simple_umode); |
| 1326 |
|
} |
| 1327 |
|
|
| 1328 |
|
/* |
| 1382 |
– |
* uid_get |
| 1383 |
– |
* |
| 1384 |
– |
* inputs - struct Client * |
| 1385 |
– |
* output - new UID is returned to caller |
| 1386 |
– |
* side effects - new_uid is incremented by one. |
| 1387 |
– |
*/ |
| 1388 |
– |
static void * |
| 1389 |
– |
uid_get(va_list args) |
| 1390 |
– |
{ |
| 1391 |
– |
add_one_to_uid(TOTALSIDUID-1); /* index from 0 */ |
| 1392 |
– |
return ((void *) new_uid); |
| 1393 |
– |
} |
| 1394 |
– |
|
| 1395 |
– |
/* |
| 1329 |
|
* add_one_to_uid |
| 1330 |
|
* |
| 1331 |
|
* inputs - index number into new_uid |
| 1345 |
|
new_uid[i] = 'A'; |
| 1346 |
|
add_one_to_uid(i-1); |
| 1347 |
|
} |
| 1348 |
< |
else new_uid[i] = new_uid[i] + 1; |
| 1348 |
> |
else |
| 1349 |
> |
++new_uid[i]; |
| 1350 |
|
} |
| 1351 |
|
else |
| 1352 |
|
{ |
| 1353 |
< |
/* XXX if IRC_MAXUID != 6, this will have to be rewritten */ |
| 1353 |
> |
/* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */ |
| 1354 |
|
if (new_uid[i] == 'Z') |
| 1355 |
< |
memcpy(new_uid+IRC_MAXSID, "AAAAAA", IRC_MAXUID); |
| 1355 |
> |
memcpy(new_uid + IRC_MAXSID, "AAAAAA", IRC_MAXUID); |
| 1356 |
|
else |
| 1357 |
< |
new_uid[i] = new_uid[i] + 1; |
| 1357 |
> |
++new_uid[i]; |
| 1358 |
|
} |
| 1359 |
|
} |
| 1360 |
|
|
| 1361 |
|
/* |
| 1362 |
+ |
* uid_get |
| 1363 |
+ |
* |
| 1364 |
+ |
* inputs - struct Client * |
| 1365 |
+ |
* output - new UID is returned to caller |
| 1366 |
+ |
* side effects - new_uid is incremented by one. |
| 1367 |
+ |
*/ |
| 1368 |
+ |
static void * |
| 1369 |
+ |
uid_get(va_list args) |
| 1370 |
+ |
{ |
| 1371 |
+ |
add_one_to_uid(TOTALSIDUID - 1); /* index from 0 */ |
| 1372 |
+ |
return new_uid; |
| 1373 |
+ |
} |
| 1374 |
+ |
|
| 1375 |
+ |
/* |
| 1376 |
|
* init_isupport() |
| 1377 |
|
* |
| 1378 |
|
* input - NONE |
| 1386 |
|
|
| 1387 |
|
add_isupport("CALLERID", NULL, -1); |
| 1388 |
|
add_isupport("CASEMAPPING", CASEMAP, -1); |
| 1389 |
+ |
add_isupport("DEAF", "D", -1); |
| 1390 |
|
add_isupport("KICKLEN", NULL, KICKLEN); |
| 1391 |
|
add_isupport("MODES", NULL, MAXMODEPARAMS); |
| 1392 |
|
add_isupport("NICKLEN", NULL, NICKLEN-1); |