| 27 |
|
#include <openssl/rsa.h> |
| 28 |
|
#include "rsa.h" |
| 29 |
|
#endif |
| 30 |
< |
#include "tools.h" |
| 30 |
> |
#include "list.h" |
| 31 |
|
#include "channel.h" |
| 32 |
|
#include "channel_mode.h" |
| 33 |
|
#include "client.h" |
| 37 |
|
#include "fdlist.h" |
| 38 |
|
#include "hash.h" |
| 39 |
|
#include "irc_string.h" |
| 40 |
– |
#include "inet_misc.h" |
| 40 |
|
#include "sprintf_irc.h" |
| 41 |
|
#include "ircd.h" |
| 42 |
|
#include "ircd_defs.h" |
| 43 |
|
#include "s_bsd.h" |
| 45 |
– |
#include "irc_getnameinfo.h" |
| 46 |
– |
#include "list.h" |
| 44 |
|
#include "numeric.h" |
| 45 |
|
#include "packet.h" |
| 46 |
|
#include "irc_res.h" |
| 234 |
|
} |
| 235 |
|
#endif /* HAVE_LIBCRYPTO */ |
| 236 |
|
|
| 240 |
– |
/* my_name_for_link() |
| 241 |
– |
* return wildcard name of my server name |
| 242 |
– |
* according to given config entry --Jto |
| 243 |
– |
*/ |
| 244 |
– |
const char * |
| 245 |
– |
my_name_for_link(struct ConfItem *conf) |
| 246 |
– |
{ |
| 247 |
– |
struct AccessItem *aconf; |
| 248 |
– |
|
| 249 |
– |
aconf = (struct AccessItem *)map_to_conf(conf); |
| 250 |
– |
if (aconf->fakename != NULL) |
| 251 |
– |
return aconf->fakename; |
| 252 |
– |
else |
| 253 |
– |
return me.name; |
| 254 |
– |
} |
| 255 |
– |
|
| 237 |
|
/* |
| 238 |
|
* write_links_file |
| 239 |
|
* |
| 367 |
|
* non-matching lookups. |
| 368 |
|
*/ |
| 369 |
|
if (MyClient(source_p)) |
| 370 |
< |
target_p = find_client(parv[server]); |
| 370 |
> |
target_p = hash_find_client(parv[server]); |
| 371 |
|
else |
| 372 |
|
target_p = find_person(client_p, parv[server]); |
| 373 |
|
|
| 375 |
|
if (target_p->from == source_p->from && !MyConnect(target_p)) |
| 376 |
|
target_p = NULL; |
| 377 |
|
|
| 378 |
< |
if (target_p == NULL && (target_p = find_server(parv[server]))) |
| 378 |
> |
if (target_p == NULL && (target_p = hash_find_server(parv[server]))) |
| 379 |
|
if (target_p->from == source_p->from && !MyConnect(target_p)) |
| 380 |
|
target_p = NULL; |
| 381 |
|
|
| 389 |
|
{ |
| 390 |
|
if (!wilds) |
| 391 |
|
{ |
| 392 |
< |
if (!(target_p = find_server(parv[server]))) |
| 392 |
> |
if (!(target_p = hash_find_server(parv[server]))) |
| 393 |
|
{ |
| 394 |
|
sendto_one(source_p, form_str(ERR_NOSUCHSERVER), |
| 395 |
< |
me.name, parv[0], parv[server]); |
| 395 |
> |
me.name, source_p->name, parv[server]); |
| 396 |
|
return(HUNTED_NOSUCH); |
| 397 |
|
} |
| 398 |
|
} |
| 420 |
|
if(!IsRegistered(target_p)) |
| 421 |
|
{ |
| 422 |
|
sendto_one(source_p, form_str(ERR_NOSUCHSERVER), |
| 423 |
< |
me.name, parv[0], parv[server]); |
| 423 |
> |
me.name, source_p->name, parv[server]); |
| 424 |
|
return HUNTED_NOSUCH; |
| 425 |
|
} |
| 426 |
|
|
| 443 |
|
} |
| 444 |
|
|
| 445 |
|
sendto_one(source_p, form_str(ERR_NOSUCHSERVER), |
| 446 |
< |
me.name, parv[0], parv[server]); |
| 446 |
> |
me.name, source_p->name, parv[server]); |
| 447 |
|
return(HUNTED_NOSUCH); |
| 448 |
|
} |
| 449 |
|
|
| 473 |
|
DLINK_FOREACH(ptr, server_items.head) |
| 474 |
|
{ |
| 475 |
|
conf = ptr->data; |
| 476 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
| 476 |
> |
aconf = map_to_conf(conf); |
| 477 |
|
|
| 478 |
|
/* Also when already connecting! (update holdtimes) --SRB |
| 479 |
|
*/ |
| 480 |
< |
if (!(aconf->status & CONF_SERVER) || aconf->port <= 0 || |
| 480 |
> |
if (!(aconf->status & CONF_SERVER) || !aconf->port || |
| 481 |
|
!(IsConfAllowAutoConn(aconf))) |
| 482 |
|
continue; |
| 483 |
|
|
| 484 |
< |
cltmp = (struct ClassItem *)map_to_conf(aconf->class_ptr); |
| 484 |
> |
cltmp = map_to_conf(aconf->class_ptr); |
| 485 |
|
|
| 486 |
|
/* Skip this entry if the use of it is still on hold until |
| 487 |
|
* future. Otherwise handle this entry (and set it on hold |
| 506 |
|
/* Found a CONNECT config with port specified, scan clients |
| 507 |
|
* and see if this server is already connected? |
| 508 |
|
*/ |
| 509 |
< |
if (find_server(conf->name) != NULL) |
| 509 |
> |
if (hash_find_server(conf->name) != NULL) |
| 510 |
|
continue; |
| 511 |
|
|
| 512 |
|
if (CurrUserCount(cltmp) < MaxTotal(cltmp)) |
| 544 |
|
} |
| 545 |
|
|
| 546 |
|
int |
| 547 |
+ |
valid_servname(const char *name) |
| 548 |
+ |
{ |
| 549 |
+ |
unsigned int length = 0; |
| 550 |
+ |
unsigned int dots = 0; |
| 551 |
+ |
const char *p = name; |
| 552 |
+ |
|
| 553 |
+ |
for (; *p; ++p) |
| 554 |
+ |
{ |
| 555 |
+ |
if (!IsServChar(*p)) |
| 556 |
+ |
return 0; |
| 557 |
+ |
|
| 558 |
+ |
++length; |
| 559 |
+ |
|
| 560 |
+ |
if (*p == '.') |
| 561 |
+ |
++dots; |
| 562 |
+ |
} |
| 563 |
+ |
|
| 564 |
+ |
return dots != 0 && length <= HOSTLEN; |
| 565 |
+ |
} |
| 566 |
+ |
|
| 567 |
+ |
int |
| 568 |
|
check_server(const char *name, struct Client *client_p, int cryptlink) |
| 569 |
|
{ |
| 570 |
|
dlink_node *ptr; |
| 586 |
|
DLINK_FOREACH(ptr, server_items.head) |
| 587 |
|
{ |
| 588 |
|
conf = ptr->data; |
| 589 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
| 589 |
> |
aconf = map_to_conf(conf); |
| 590 |
|
|
| 591 |
|
if (!match(name, conf->name)) |
| 592 |
|
continue; |
| 670 |
|
ClearCap(client_p, CAP_TBURST); |
| 671 |
|
} |
| 672 |
|
|
| 671 |
– |
/* Don't unset CAP_HUB here even if the server isn't a hub, |
| 672 |
– |
* it only indicates if the server thinks it's lazylinks are |
| 673 |
– |
* leafs or not.. if you unset it, bad things will happen |
| 674 |
– |
*/ |
| 673 |
|
if (aconf != NULL) |
| 674 |
|
{ |
| 675 |
|
struct sockaddr_in *v4; |
| 857 |
|
if (!IsClient(target_p)) |
| 858 |
|
return; |
| 859 |
|
|
| 860 |
< |
send_umode(NULL, target_p, 0, IsOperHiddenAdmin(target_p) ? |
| 860 |
> |
send_umode(NULL, target_p, 0, HasOFlag(target_p, OPER_FLAG_HIDDEN_ADMIN) ? |
| 861 |
|
SEND_UMODES & ~UMODE_ADMIN : SEND_UMODES, ubuf); |
| 862 |
|
|
| 863 |
|
if (ubuf[0] == '\0') |
| 867 |
|
} |
| 868 |
|
|
| 869 |
|
/* XXX Both of these need to have a :me.name or :mySID!?!?! */ |
| 870 |
< |
if (HasID(target_p) && IsCapable(client_p, CAP_TS6)) |
| 871 |
< |
sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
| 872 |
< |
target_p->servptr->id, |
| 873 |
< |
target_p->name, target_p->hopcount + 1, |
| 874 |
< |
(unsigned long) target_p->tsinfo, |
| 875 |
< |
ubuf, target_p->username, target_p->host, |
| 876 |
< |
(MyClient(target_p) && IsIPSpoof(target_p)) ? |
| 877 |
< |
"0" : target_p->sockhost, target_p->id, target_p->info); |
| 870 |
> |
if (IsCapable(client_p, CAP_SVS)) |
| 871 |
> |
{ |
| 872 |
> |
if (HasID(target_p) && IsCapable(client_p, CAP_TS6)) |
| 873 |
> |
sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s %lu :%s", |
| 874 |
> |
target_p->servptr->id, |
| 875 |
> |
target_p->name, target_p->hopcount + 1, |
| 876 |
> |
(unsigned long) target_p->tsinfo, |
| 877 |
> |
ubuf, target_p->username, target_p->host, |
| 878 |
> |
(MyClient(target_p) && IsIPSpoof(target_p)) ? |
| 879 |
> |
"0" : target_p->sockhost, target_p->id, |
| 880 |
> |
(unsigned long)target_p->servicestamp, target_p->info); |
| 881 |
> |
else |
| 882 |
> |
sendto_one(client_p, "NICK %s %d %lu %s %s %s %s %lu :%s", |
| 883 |
> |
target_p->name, target_p->hopcount + 1, |
| 884 |
> |
(unsigned long) target_p->tsinfo, |
| 885 |
> |
ubuf, target_p->username, target_p->host, |
| 886 |
> |
target_p->servptr->name, (unsigned long)target_p->servicestamp, |
| 887 |
> |
target_p->info); |
| 888 |
> |
} |
| 889 |
|
else |
| 890 |
< |
sendto_one(client_p, "NICK %s %d %lu %s %s %s %s :%s", |
| 891 |
< |
target_p->name, target_p->hopcount + 1, |
| 892 |
< |
(unsigned long) target_p->tsinfo, |
| 893 |
< |
ubuf, target_p->username, target_p->host, |
| 894 |
< |
target_p->servptr->name, target_p->info); |
| 890 |
> |
{ |
| 891 |
> |
if (HasID(target_p) && IsCapable(client_p, CAP_TS6)) |
| 892 |
> |
sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
| 893 |
> |
target_p->servptr->id, |
| 894 |
> |
target_p->name, target_p->hopcount + 1, |
| 895 |
> |
(unsigned long) target_p->tsinfo, |
| 896 |
> |
ubuf, target_p->username, target_p->host, |
| 897 |
> |
(MyClient(target_p) && IsIPSpoof(target_p)) ? |
| 898 |
> |
"0" : target_p->sockhost, target_p->id, target_p->info); |
| 899 |
> |
else |
| 900 |
> |
sendto_one(client_p, "NICK %s %d %lu %s %s %s %s :%s", |
| 901 |
> |
target_p->name, target_p->hopcount + 1, |
| 902 |
> |
(unsigned long) target_p->tsinfo, |
| 903 |
> |
ubuf, target_p->username, target_p->host, |
| 904 |
> |
target_p->servptr->name, target_p->info); |
| 905 |
> |
} |
| 906 |
|
|
| 907 |
|
if (IsConfAwayBurst((struct AccessItem *)map_to_conf(client_p->serv->sconf))) |
| 908 |
|
if (!EmptyString(target_p->away)) |
| 977 |
|
char *host; |
| 978 |
|
const char *inpath; |
| 979 |
|
static char inpath_ip[HOSTLEN * 2 + USERLEN + 6]; |
| 960 |
– |
dlink_node *m; |
| 980 |
|
dlink_node *ptr; |
| 981 |
|
|
| 982 |
|
assert(client_p != NULL); |
| 1016 |
|
} |
| 1017 |
|
} |
| 1018 |
|
|
| 1019 |
< |
aconf = (struct AccessItem *)map_to_conf(conf); |
| 1019 |
> |
aconf = map_to_conf(conf); |
| 1020 |
|
|
| 1021 |
|
if (IsUnknown(client_p) && !IsConfCryptLink(aconf)) |
| 1022 |
|
{ |
| 1024 |
|
* 2. Check aconf->spasswd, not aconf->passwd. |
| 1025 |
|
*/ |
| 1026 |
|
if (!EmptyString(aconf->spasswd)) |
| 1027 |
< |
{ |
| 1028 |
< |
/* only send ts6 format PASS if we have ts6 enabled */ |
| 1010 |
< |
if (me.id[0] != '\0') /* Send TS 6 form only if id */ |
| 1011 |
< |
sendto_one(client_p, "PASS %s TS %d %s", |
| 1012 |
< |
aconf->spasswd, TS_CURRENT, me.id); |
| 1013 |
< |
else |
| 1014 |
< |
sendto_one(client_p, "PASS %s TS 5", |
| 1015 |
< |
aconf->spasswd); |
| 1016 |
< |
} |
| 1027 |
> |
sendto_one(client_p, "PASS %s TS %d %s", |
| 1028 |
> |
aconf->spasswd, TS_CURRENT, me.id); |
| 1029 |
|
|
| 1030 |
|
/* Pass my info to the new server |
| 1031 |
|
* |
| 1020 |
– |
* If this is a HUB, pass on CAP_HUB |
| 1032 |
|
* Pass on ZIP if supported |
| 1033 |
|
* Pass on TB if supported. |
| 1034 |
|
* - Dianora |
| 1035 |
|
*/ |
| 1036 |
|
|
| 1037 |
< |
send_capabilities(client_p, aconf, (ServerInfo.hub ? CAP_HUB : 0) |
| 1038 |
< |
| (IsConfCompressed(aconf) ? CAP_ZIP : 0) |
| 1037 |
> |
send_capabilities(client_p, aconf, |
| 1038 |
> |
(IsConfCompressed(aconf) ? CAP_ZIP : 0) |
| 1039 |
|
| (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0), 0); |
| 1040 |
|
|
| 1041 |
|
/* SERVER is the last command sent before switching to ziplinks. |
| 1049 |
|
* Nagle is already disabled at this point --adx |
| 1050 |
|
*/ |
| 1051 |
|
sendto_one(client_p, "SERVER %s 1 :%s%s", |
| 1052 |
< |
my_name_for_link(conf), |
| 1042 |
< |
ConfigServerHide.hidden ? "(H) " : "", |
| 1043 |
< |
(me.info[0]) ? (me.info) : "IRCers United"); |
| 1052 |
> |
me.name, ConfigServerHide.hidden ? "(H) " : "", me.info); |
| 1053 |
|
send_queued_write(client_p); |
| 1054 |
|
} |
| 1055 |
|
|
| 1073 |
|
SetServlink(client_p); |
| 1074 |
|
} |
| 1075 |
|
|
| 1076 |
< |
/* only send ts6 format SVINFO if we have ts6 enabled */ |
| 1068 |
< |
sendto_one(client_p, "SVINFO %d %d 0 :%lu", |
| 1069 |
< |
(me.id[0] ? TS_CURRENT : 5), TS_MIN, |
| 1076 |
> |
sendto_one(client_p, "SVINFO %d %d 0 :%lu", TS_CURRENT, TS_MIN, |
| 1077 |
|
(unsigned long)CurrentTime); |
| 1078 |
|
|
| 1079 |
|
/* assumption here is if they passed the correct TS version, they also passed an SID */ |
| 1107 |
|
/* Some day, all these lists will be consolidated *sigh* */ |
| 1108 |
|
dlinkAdd(client_p, &client_p->lnode, &me.serv->server_list); |
| 1109 |
|
|
| 1110 |
< |
m = dlinkFind(&unknown_list, client_p); |
| 1104 |
< |
assert(NULL != m); |
| 1110 |
> |
assert(dlinkFind(&unknown_list, client_p)); |
| 1111 |
|
|
| 1112 |
< |
dlinkDelete(m, &unknown_list); |
| 1113 |
< |
dlinkAdd(client_p, m, &serv_list); |
| 1112 |
> |
dlink_move_node(&client_p->localClient->lclient_node, |
| 1113 |
> |
&unknown_list, &serv_list); |
| 1114 |
|
|
| 1115 |
|
Count.myserver++; |
| 1116 |
|
|
| 1121 |
|
make_server(client_p); |
| 1122 |
|
|
| 1123 |
|
/* fixing eob timings.. -gnp */ |
| 1124 |
< |
client_p->firsttime = CurrentTime; |
| 1124 |
> |
client_p->localClient->firsttime = CurrentTime; |
| 1125 |
> |
|
| 1126 |
> |
|
| 1127 |
> |
if (find_matching_name_conf(SERVICE_TYPE, client_p->name, NULL, NULL, 0)) |
| 1128 |
> |
AddFlag(client_p, FLAGS_SERVICE); |
| 1129 |
|
|
| 1130 |
|
/* Show the real host/IP to admins */ |
| 1131 |
|
sendto_realops_flags(UMODE_ALL, L_ADMIN, |
| 1162 |
|
if (target_p == client_p) |
| 1163 |
|
continue; |
| 1164 |
|
|
| 1155 |
– |
if ((conf = target_p->serv->sconf) && |
| 1156 |
– |
match(my_name_for_link(conf), client_p->name)) |
| 1157 |
– |
continue; |
| 1158 |
– |
|
| 1165 |
|
if (IsCapable(target_p, CAP_TS6) && HasID(client_p)) |
| 1166 |
|
sendto_one(target_p, ":%s SID %s 2 %s :%s%s", |
| 1167 |
|
me.id, client_p->name, client_p->id, |
| 1192 |
|
** is destroyed...) |
| 1193 |
|
*/ |
| 1194 |
|
|
| 1189 |
– |
conf = client_p->serv->sconf; |
| 1190 |
– |
|
| 1195 |
|
DLINK_FOREACH_PREV(ptr, global_serv_list.tail) |
| 1196 |
|
{ |
| 1197 |
|
target_p = ptr->data; |
| 1198 |
|
|
| 1199 |
|
/* target_p->from == target_p for target_p == client_p */ |
| 1200 |
< |
if (target_p->from == client_p) |
| 1197 |
< |
continue; |
| 1198 |
< |
|
| 1199 |
< |
if (match(my_name_for_link(conf), target_p->name)) |
| 1200 |
> |
if (IsMe(target_p) || target_p->from == client_p) |
| 1201 |
|
continue; |
| 1202 |
|
|
| 1203 |
|
if (IsCapable(client_p, CAP_TS6)) |
| 1454 |
|
{ |
| 1455 |
|
struct Client *target_p = ptr->data; |
| 1456 |
|
|
| 1457 |
< |
if (!IsBursted(target_p) && target_p->from != client_p) |
| 1457 |
> |
if (!HasFlag(target_p, FLAGS_BURSTED) && target_p->from != client_p) |
| 1458 |
|
sendnick_TS(client_p, target_p); |
| 1459 |
|
|
| 1460 |
< |
ClearBursted(target_p); |
| 1460 |
> |
DelFlag(target_p, FLAGS_BURSTED); |
| 1461 |
|
} |
| 1462 |
|
|
| 1463 |
|
/* We send the time we started the burst, and let the remote host determine an EOB time, |
| 1499 |
|
sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s", |
| 1500 |
|
me.name, (unsigned long)chptr->channelts, chptr->chname, |
| 1501 |
|
(unsigned long)chptr->topic_time, |
| 1502 |
< |
chptr->topic_info ? chptr->topic_info : "", |
| 1503 |
< |
chptr->topic ? chptr->topic : ""); |
| 1502 |
> |
chptr->topic_info, |
| 1503 |
> |
chptr->topic); |
| 1504 |
|
else if (IsCapable(client_p, CAP_TB)) |
| 1505 |
|
{ |
| 1506 |
|
if (ConfigChannel.burst_topicwho) |
| 1508 |
|
sendto_one(client_p, ":%s TB %s %lu %s :%s", |
| 1509 |
|
me.name, chptr->chname, |
| 1510 |
|
(unsigned long)chptr->topic_time, |
| 1511 |
< |
chptr->topic_info, chptr->topic ? chptr->topic : ""); |
| 1511 |
> |
chptr->topic_info, chptr->topic); |
| 1512 |
|
} |
| 1513 |
|
else |
| 1514 |
|
{ |
| 1515 |
|
sendto_one(client_p, ":%s TB %s %lu :%s", |
| 1516 |
|
me.name, chptr->chname, |
| 1517 |
|
(unsigned long)chptr->topic_time, |
| 1518 |
< |
chptr->topic ? chptr->topic : ""); |
| 1518 |
> |
chptr->topic); |
| 1519 |
|
} |
| 1520 |
|
} |
| 1521 |
|
} |
| 1540 |
|
ms = ptr->data; |
| 1541 |
|
target_p = ms->client_p; |
| 1542 |
|
|
| 1543 |
< |
if (!IsBursted(target_p)) |
| 1543 |
> |
if (!HasFlag(target_p, FLAGS_BURSTED)) |
| 1544 |
|
{ |
| 1545 |
< |
SetBursted(target_p); |
| 1545 |
> |
AddFlag(target_p, FLAGS_BURSTED); |
| 1546 |
|
|
| 1547 |
|
if (target_p->from != client_p) |
| 1548 |
|
sendnick_TS(client_p, target_p); |
| 1590 |
|
conf = unmap_conf_item(aconf); |
| 1591 |
|
|
| 1592 |
|
/* log */ |
| 1593 |
< |
irc_getnameinfo((struct sockaddr*)&aconf->ipnum, aconf->ipnum.ss_len, |
| 1594 |
< |
buf, HOSTIPLEN, NULL, 0, NI_NUMERICHOST); |
| 1593 |
> |
getnameinfo((struct sockaddr *)&aconf->ipnum, aconf->ipnum.ss_len, |
| 1594 |
> |
buf, sizeof(buf), NULL, 0, NI_NUMERICHOST); |
| 1595 |
|
ilog(L_NOTICE, "Connect to %s[%s] @%s", aconf->user, aconf->host, |
| 1596 |
|
buf); |
| 1597 |
|
|
| 1598 |
|
/* Still processing a DNS lookup? -> exit */ |
| 1599 |
< |
if (aconf->dns_query != NULL) |
| 1599 |
> |
if (aconf->dns_pending) |
| 1600 |
|
{ |
| 1601 |
< |
sendto_realops_flags(UMODE_ALL, L_OPER, |
| 1602 |
< |
"Error connecting to %s: Error during DNS lookup", conf->name); |
| 1601 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 1602 |
> |
"Error connecting to %s: DNS lookup for connect{} in progress.", |
| 1603 |
> |
conf->name); |
| 1604 |
> |
return (0); |
| 1605 |
> |
} |
| 1606 |
> |
|
| 1607 |
> |
if (aconf->dns_failed) |
| 1608 |
> |
{ |
| 1609 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, |
| 1610 |
> |
"Error connecting to %s: DNS lookup for connect{} failed.", |
| 1611 |
> |
conf->name); |
| 1612 |
|
return (0); |
| 1613 |
|
} |
| 1614 |
|
|
| 1615 |
|
/* Make sure this server isn't already connected |
| 1616 |
|
* Note: aconf should ALWAYS be a valid C: line |
| 1617 |
|
*/ |
| 1618 |
< |
if ((client_p = find_server(conf->name)) != NULL) |
| 1618 |
> |
if ((client_p = hash_find_server(conf->name)) != NULL) |
| 1619 |
|
{ |
| 1620 |
|
sendto_realops_flags(UMODE_ALL, L_ADMIN, |
| 1621 |
|
"Server %s already present from %s", |
| 1638 |
|
strlcpy(client_p->host, aconf->host, sizeof(client_p->host)); |
| 1639 |
|
|
| 1640 |
|
/* We already converted the ip once, so lets use it - stu */ |
| 1641 |
< |
strlcpy(client_p->sockhost, buf, HOSTIPLEN); |
| 1641 |
> |
strlcpy(client_p->sockhost, buf, sizeof(client_p->sockhost)); |
| 1642 |
|
|
| 1643 |
|
/* create a socket for the server connection */ |
| 1644 |
|
if (comm_open(&client_p->localClient->fd, aconf->ipnum.ss.ss_family, |
| 1848 |
|
#endif |
| 1849 |
|
|
| 1850 |
|
/* jdc -- Check and send spasswd, not passwd. */ |
| 1851 |
< |
if (!EmptyString(aconf->spasswd) && (me.id[0] != '\0')) |
| 1851 |
> |
if (!EmptyString(aconf->spasswd)) |
| 1852 |
|
/* Send TS 6 form only if id */ |
| 1853 |
|
sendto_one(client_p, "PASS %s TS %d %s", |
| 1854 |
|
aconf->spasswd, TS_CURRENT, me.id); |
| 1845 |
– |
else |
| 1846 |
– |
sendto_one(client_p, "PASS %s TS 5", |
| 1847 |
– |
aconf->spasswd); |
| 1855 |
|
|
| 1856 |
|
/* Pass my info to the new server |
| 1857 |
|
* |
| 1851 |
– |
* If this is a HUB, pass on CAP_HUB |
| 1858 |
|
* Pass on ZIP if supported |
| 1859 |
|
* Pass on TB if supported. |
| 1860 |
|
* - Dianora |
| 1861 |
|
*/ |
| 1862 |
< |
send_capabilities(client_p, aconf, (ServerInfo.hub ? CAP_HUB : 0) |
| 1863 |
< |
| (IsConfCompressed(aconf) ? CAP_ZIP : 0) |
| 1862 |
> |
send_capabilities(client_p, aconf, |
| 1863 |
> |
(IsConfCompressed(aconf) ? CAP_ZIP : 0) |
| 1864 |
|
| (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0), 0); |
| 1865 |
|
|
| 1866 |
|
sendto_one(client_p, "SERVER %s 1 :%s%s", |
| 1867 |
< |
my_name_for_link(conf), |
| 1862 |
< |
ConfigServerHide.hidden ? "(H) " : "", |
| 1867 |
> |
me.name, ConfigServerHide.hidden ? "(H) " : "", |
| 1868 |
|
me.info); |
| 1869 |
|
|
| 1870 |
|
/* If we've been marked dead because a send failed, just exit |
| 1897 |
|
cptr = ptr->data; |
| 1898 |
|
|
| 1899 |
|
if (cptr && cptr->name[0]) |
| 1900 |
< |
if (match(cptr->name, name) || match(name, cptr->name)) |
| 1900 |
> |
if (match(name, cptr->name)) |
| 1901 |
|
return cptr; |
| 1902 |
|
} |
| 1903 |
|
|
| 1968 |
|
return; |
| 1969 |
|
} |
| 1970 |
|
|
| 1971 |
< |
send_capabilities(client_p, aconf, (ServerInfo.hub ? CAP_HUB : 0) |
| 1972 |
< |
| (IsConfCompressed(aconf) ? CAP_ZIP : 0) |
| 1971 |
> |
send_capabilities(client_p, aconf, |
| 1972 |
> |
(IsConfCompressed(aconf) ? CAP_ZIP : 0) |
| 1973 |
|
| (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0), CAP_ENC_MASK); |
| 1974 |
|
|
| 1975 |
< |
if (me.id[0]) |
| 1971 |
< |
sendto_one(client_p, "PASS . TS %d %s", TS_CURRENT, me.id); |
| 1972 |
< |
|
| 1975 |
> |
sendto_one(client_p, "PASS . TS %d %s", TS_CURRENT, me.id); |
| 1976 |
|
sendto_one(client_p, "CRYPTLINK SERV %s %s :%s%s", |
| 1977 |
< |
my_name_for_link(conf), key_to_send, |
| 1977 |
> |
me.name, key_to_send, |
| 1978 |
|
ConfigServerHide.hidden ? "(H) " : "", me.info); |
| 1979 |
|
|
| 1980 |
|
SetHandshake(client_p); |