| 30 |
|
#include "rsa.h" |
| 31 |
|
#endif |
| 32 |
|
#include "list.h" |
| 33 |
– |
#include "channel.h" |
| 34 |
– |
#include "channel_mode.h" |
| 33 |
|
#include "client.h" |
| 34 |
|
#include "event.h" |
| 37 |
– |
#include "fdlist.h" |
| 35 |
|
#include "hash.h" |
| 36 |
|
#include "irc_string.h" |
| 37 |
|
#include "ircd.h" |
| 39 |
|
#include "s_bsd.h" |
| 40 |
|
#include "numeric.h" |
| 41 |
|
#include "packet.h" |
| 45 |
– |
#include "irc_res.h" |
| 42 |
|
#include "conf.h" |
| 43 |
|
#include "s_serv.h" |
| 44 |
|
#include "log.h" |
| 74 |
|
{ |
| 75 |
|
FILE *file = NULL; |
| 76 |
|
dlink_node *ptr = NULL, *ptr_next = NULL; |
| 77 |
< |
char buff[IRCD_BUFSIZE] = { '\0' }; |
| 77 |
> |
char buff[IRCD_BUFSIZE] = ""; |
| 78 |
|
|
| 79 |
|
if ((file = fopen(LIPATH, "w")) == NULL) |
| 80 |
|
return; |
| 123 |
|
{ |
| 124 |
|
FILE *file = NULL; |
| 125 |
|
char *p = NULL; |
| 126 |
< |
char buff[IRCD_BUFSIZE] = { '\0' }; |
| 126 |
> |
char buff[IRCD_BUFSIZE] = ""; |
| 127 |
|
|
| 128 |
|
if ((file = fopen(LIPATH, "r")) == NULL) |
| 129 |
|
return; |
| 130 |
|
|
| 131 |
|
while (fgets(buff, sizeof(buff), file)) |
| 132 |
|
{ |
| 133 |
< |
if ((p = strchr(buff, '\n')) != NULL) |
| 133 |
> |
if ((p = strchr(buff, '\n'))) |
| 134 |
|
*p = '\0'; |
| 135 |
|
|
| 136 |
|
dlinkAddTail(xstrdup(buff), make_dlink_node(), &flatten_links); |
| 159 |
|
* returns: (see #defines) |
| 160 |
|
*/ |
| 161 |
|
int |
| 162 |
< |
hunt_server(struct Client *client_p, struct Client *source_p, const char *command, |
| 162 |
> |
hunt_server(struct Client *source_p, const char *command, |
| 163 |
|
const int server, const int parc, char *parv[]) |
| 164 |
|
{ |
| 165 |
|
struct Client *target_p = NULL; |
| 181 |
|
if (MyClient(source_p)) |
| 182 |
|
target_p = hash_find_client(parv[server]); |
| 183 |
|
else |
| 184 |
< |
target_p = find_person(client_p, parv[server]); |
| 184 |
> |
target_p = find_person(source_p, parv[server]); |
| 185 |
|
|
| 186 |
|
if (target_p) |
| 187 |
|
if (target_p->from == source_p->from && !MyConnect(target_p)) |
| 202 |
|
{ |
| 203 |
|
if (!(target_p = hash_find_server(parv[server]))) |
| 204 |
|
{ |
| 205 |
< |
sendto_one(source_p, form_str(ERR_NOSUCHSERVER), |
| 210 |
< |
me.name, source_p->name, parv[server]); |
| 205 |
> |
sendto_one_numeric(source_p, &me, ERR_NOSUCHSERVER, parv[server]); |
| 206 |
|
return HUNTED_NOSUCH; |
| 207 |
|
} |
| 208 |
|
} |
| 218 |
|
continue; |
| 219 |
|
target_p = ptr->data; |
| 220 |
|
|
| 221 |
< |
if (IsRegistered(target_p) && (target_p != client_p)) |
| 221 |
> |
if (IsRegistered(target_p) && (target_p != source_p->from)) |
| 222 |
|
break; |
| 223 |
|
} |
| 224 |
|
} |
| 225 |
|
} |
| 226 |
|
} |
| 227 |
|
|
| 228 |
< |
if (target_p != NULL) |
| 228 |
> |
if (target_p) |
| 229 |
|
{ |
| 230 |
< |
if(!IsRegistered(target_p)) |
| 230 |
> |
if (!IsRegistered(target_p)) |
| 231 |
|
{ |
| 232 |
< |
sendto_one(source_p, form_str(ERR_NOSUCHSERVER), |
| 238 |
< |
me.name, source_p->name, parv[server]); |
| 232 |
> |
sendto_one_numeric(source_p, &me, ERR_NOSUCHSERVER, parv[server]); |
| 233 |
|
return HUNTED_NOSUCH; |
| 234 |
|
} |
| 235 |
|
|
| 239 |
|
if (match(target_p->name, parv[server])) |
| 240 |
|
parv[server] = target_p->name; |
| 241 |
|
|
| 242 |
+ |
/* This is a little kludgy but should work... */ |
| 243 |
|
sendto_one(target_p, command, ID_or_name(source_p, target_p), |
| 244 |
|
parv[1], parv[2], parv[3], parv[4], |
| 245 |
|
parv[5], parv[6], parv[7], parv[8]); |
| 246 |
|
return HUNTED_PASS; |
| 247 |
|
} |
| 248 |
|
|
| 249 |
< |
sendto_one(source_p, form_str(ERR_NOSUCHSERVER), |
| 255 |
< |
me.name, source_p->name, parv[server]); |
| 249 |
> |
sendto_one_numeric(source_p, &me, ERR_NOSUCHSERVER, parv[server]); |
| 250 |
|
return HUNTED_NOSUCH; |
| 251 |
|
} |
| 252 |
|
|
| 303 |
|
|
| 304 |
|
conf->until = CurrentTime + confrq; |
| 305 |
|
|
| 306 |
< |
/* Found a CONNECT config with port specified, scan clients |
| 306 |
> |
/* |
| 307 |
> |
* Found a CONNECT config with port specified, scan clients |
| 308 |
|
* and see if this server is already connected? |
| 309 |
|
*/ |
| 310 |
< |
if (hash_find_server(conf->name) != NULL) |
| 310 |
> |
if (hash_find_server(conf->name)) |
| 311 |
|
continue; |
| 312 |
|
|
| 313 |
|
if (conf->class->ref_count < conf->class->max_total) |
| 314 |
|
{ |
| 315 |
|
/* Go to the end of the list, if not already last */ |
| 316 |
< |
if (ptr->next != NULL) |
| 316 |
> |
if (ptr->next) |
| 317 |
|
{ |
| 318 |
|
dlinkDelete(ptr, &server_items); |
| 319 |
|
dlinkAddTail(conf, &conf->node, &server_items); |
| 322 |
|
if (find_servconn_in_progress(conf->name)) |
| 323 |
|
return; |
| 324 |
|
|
| 325 |
< |
/* We used to only print this if serv_connect() actually |
| 325 |
> |
/* |
| 326 |
> |
* We used to only print this if serv_connect() actually |
| 327 |
|
* succeeded, but since comm_tcp_connect() can call the callback |
| 328 |
|
* immediately if there is an error, we were getting error messages |
| 329 |
|
* in the wrong order. SO, we just print out the activated line, |
| 365 |
|
++dots; |
| 366 |
|
} |
| 367 |
|
|
| 368 |
< |
return dots != 0 && length <= HOSTLEN; |
| 368 |
> |
return dots && length <= HOSTLEN; |
| 369 |
|
} |
| 370 |
|
|
| 371 |
|
int |
| 376 |
|
struct MaskItem *server_conf = NULL; |
| 377 |
|
int error = -1; |
| 378 |
|
|
| 379 |
< |
assert(client_p != NULL); |
| 379 |
> |
assert(client_p); |
| 380 |
|
|
| 381 |
|
/* loop through looking for all possible connect items that might work */ |
| 382 |
|
DLINK_FOREACH(ptr, server_items.head) |
| 412 |
|
attach_conf(client_p, server_conf); |
| 413 |
|
|
| 414 |
|
|
| 415 |
< |
if (server_conf != NULL) |
| 415 |
> |
if (server_conf) |
| 416 |
|
{ |
| 417 |
|
struct sockaddr_in *v4; |
| 418 |
|
#ifdef IPV6 |
| 528 |
|
void |
| 529 |
|
send_capabilities(struct Client *client_p, int cap_can_send) |
| 530 |
|
{ |
| 531 |
< |
struct Capability *cap=NULL; |
| 532 |
< |
char msgbuf[IRCD_BUFSIZE]; |
| 537 |
< |
char *t; |
| 531 |
> |
char msgbuf[IRCD_BUFSIZE] = ""; |
| 532 |
> |
char *t = msgbuf; |
| 533 |
|
int tl; |
| 534 |
< |
dlink_node *ptr; |
| 540 |
< |
|
| 541 |
< |
t = msgbuf; |
| 534 |
> |
dlink_node *ptr = NULL; |
| 535 |
|
|
| 536 |
|
DLINK_FOREACH(ptr, cap_list.head) |
| 537 |
|
{ |
| 538 |
< |
cap = ptr->data; |
| 538 |
> |
struct Capability *cap = ptr->data; |
| 539 |
|
|
| 540 |
|
if (cap->cap & (cap_can_send|default_server_capabs)) |
| 541 |
|
{ |
| 558 |
|
void |
| 559 |
|
sendnick_TS(struct Client *client_p, struct Client *target_p) |
| 560 |
|
{ |
| 561 |
< |
char ubuf[IRCD_BUFSIZE]; |
| 561 |
> |
char ubuf[IRCD_BUFSIZE] = ""; |
| 562 |
|
|
| 563 |
|
if (!IsClient(target_p)) |
| 564 |
|
return; |
| 572 |
|
} |
| 573 |
|
|
| 574 |
|
if (IsCapable(client_p, CAP_SVS)) |
| 575 |
< |
{ |
| 576 |
< |
if (HasID(target_p) && IsCapable(client_p, CAP_TS6)) |
| 577 |
< |
sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s %s :%s", |
| 578 |
< |
target_p->servptr->id, |
| 579 |
< |
target_p->name, target_p->hopcount + 1, |
| 580 |
< |
(unsigned long) target_p->tsinfo, |
| 581 |
< |
ubuf, target_p->username, target_p->host, |
| 582 |
< |
(MyClient(target_p) && IsIPSpoof(target_p)) ? |
| 590 |
< |
"0" : target_p->sockhost, target_p->id, |
| 591 |
< |
target_p->svid, target_p->info); |
| 592 |
< |
else |
| 593 |
< |
sendto_one(client_p, "NICK %s %d %lu %s %s %s %s %s :%s", |
| 594 |
< |
target_p->name, target_p->hopcount + 1, |
| 595 |
< |
(unsigned long) target_p->tsinfo, |
| 596 |
< |
ubuf, target_p->username, target_p->host, |
| 597 |
< |
target_p->servptr->name, target_p->svid, |
| 598 |
< |
target_p->info); |
| 599 |
< |
} |
| 575 |
> |
sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s %s :%s", |
| 576 |
> |
target_p->servptr->id, |
| 577 |
> |
target_p->name, target_p->hopcount + 1, |
| 578 |
> |
(unsigned long) target_p->tsinfo, |
| 579 |
> |
ubuf, target_p->username, target_p->host, |
| 580 |
> |
(MyClient(target_p) && IsIPSpoof(target_p)) ? |
| 581 |
> |
"0" : target_p->sockhost, target_p->id, |
| 582 |
> |
target_p->svid, target_p->info); |
| 583 |
|
else |
| 584 |
< |
{ |
| 585 |
< |
if (HasID(target_p) && IsCapable(client_p, CAP_TS6)) |
| 586 |
< |
sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
| 587 |
< |
target_p->servptr->id, |
| 588 |
< |
target_p->name, target_p->hopcount + 1, |
| 589 |
< |
(unsigned long) target_p->tsinfo, |
| 590 |
< |
ubuf, target_p->username, target_p->host, |
| 608 |
< |
(MyClient(target_p) && IsIPSpoof(target_p)) ? |
| 609 |
< |
"0" : target_p->sockhost, target_p->id, target_p->info); |
| 610 |
< |
else |
| 611 |
< |
sendto_one(client_p, "NICK %s %d %lu %s %s %s %s :%s", |
| 612 |
< |
target_p->name, target_p->hopcount + 1, |
| 613 |
< |
(unsigned long) target_p->tsinfo, |
| 614 |
< |
ubuf, target_p->username, target_p->host, |
| 615 |
< |
target_p->servptr->name, target_p->info); |
| 616 |
< |
} |
| 584 |
> |
sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
| 585 |
> |
target_p->servptr->id, |
| 586 |
> |
target_p->name, target_p->hopcount + 1, |
| 587 |
> |
(unsigned long) target_p->tsinfo, |
| 588 |
> |
ubuf, target_p->username, target_p->host, |
| 589 |
> |
(MyClient(target_p) && IsIPSpoof(target_p)) ? |
| 590 |
> |
"0" : target_p->sockhost, target_p->id, target_p->info); |
| 591 |
|
|
| 592 |
|
if (!EmptyString(target_p->certfp)) |
| 593 |
< |
sendto_one(client_p, ":%s CERTFP %s", |
| 620 |
< |
ID_or_name(target_p, client_p), target_p->certfp); |
| 593 |
> |
sendto_one(client_p, ":%s CERTFP %s", target_p->id, target_p->certfp); |
| 594 |
|
|
| 595 |
|
if (target_p->away[0]) |
| 596 |
< |
sendto_one(client_p, ":%s AWAY :%s", ID_or_name(target_p, client_p), |
| 624 |
< |
target_p->away); |
| 596 |
> |
sendto_one(client_p, ":%s AWAY :%s", target_p->id, target_p->away); |
| 597 |
|
|
| 598 |
|
} |
| 599 |
|
|
| 651 |
|
void |
| 652 |
|
server_estab(struct Client *client_p) |
| 653 |
|
{ |
| 682 |
– |
struct Client *target_p; |
| 654 |
|
struct MaskItem *conf = NULL; |
| 655 |
|
char *host; |
| 656 |
|
const char *inpath; |
| 660 |
|
const COMP_METHOD *compression = NULL, *expansion = NULL; |
| 661 |
|
#endif |
| 662 |
|
|
| 663 |
< |
assert(client_p != NULL); |
| 663 |
> |
assert(client_p); |
| 664 |
|
|
| 665 |
|
strlcpy(inpath_ip, get_client_name(client_p, SHOW_IP), sizeof(inpath_ip)); |
| 666 |
|
|
| 674 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 675 |
|
"Warning: Lost connect{} block " |
| 676 |
|
"for server %s(this shouldn't happen)!", host); |
| 677 |
< |
exit_client(client_p, &me, "Lost connect{} block!"); |
| 677 |
> |
exit_client(client_p, "Lost connect{} block!"); |
| 678 |
|
return; |
| 679 |
|
} |
| 680 |
|
|
| 693 |
|
{ |
| 694 |
|
++ServerStats.is_ref; |
| 695 |
|
sendto_one(client_p, "ERROR :I'm a leaf not a hub"); |
| 696 |
< |
exit_client(client_p, &me, "I'm a leaf"); |
| 696 |
> |
exit_client(client_p, "I'm a leaf"); |
| 697 |
|
return; |
| 698 |
|
} |
| 699 |
|
} |
| 711 |
|
sendto_one(client_p, "SVINFO %d %d 0 :%lu", TS_CURRENT, TS_MIN, |
| 712 |
|
(unsigned long)CurrentTime); |
| 713 |
|
|
| 743 |
– |
/* assumption here is if they passed the correct TS version, they also passed an SID */ |
| 744 |
– |
if (IsCapable(client_p, CAP_TS6)) |
| 745 |
– |
hash_add_id(client_p); |
| 746 |
– |
|
| 714 |
|
/* XXX Does this ever happen? I don't think so -db */ |
| 715 |
|
detach_conf(client_p, CONF_OPER); |
| 716 |
|
|
| 732 |
|
|
| 733 |
|
SetServer(client_p); |
| 734 |
|
|
| 768 |
– |
/* Update the capability combination usage counts. -A1kmm */ |
| 769 |
– |
set_chcap_usage_counts(client_p); |
| 770 |
– |
|
| 735 |
|
/* Some day, all these lists will be consolidated *sigh* */ |
| 736 |
|
dlinkAdd(client_p, &client_p->lnode, &me.serv->server_list); |
| 737 |
|
|
| 744 |
|
|
| 745 |
|
dlinkAdd(client_p, make_dlink_node(), &global_serv_list); |
| 746 |
|
hash_add_client(client_p); |
| 747 |
+ |
hash_add_id(client_p); |
| 748 |
|
|
| 749 |
|
/* doesnt duplicate client_p->serv if allocated this struct already */ |
| 750 |
|
make_server(client_p); |
| 797 |
|
|
| 798 |
|
fd_note(&client_p->localClient->fd, "Server: %s", client_p->name); |
| 799 |
|
|
| 800 |
< |
/* Old sendto_serv_but_one() call removed because we now |
| 801 |
< |
** need to send different names to different servers |
| 802 |
< |
** (domain name matching) Send new server to other servers. |
| 838 |
< |
*/ |
| 839 |
< |
DLINK_FOREACH(ptr, serv_list.head) |
| 840 |
< |
{ |
| 841 |
< |
target_p = ptr->data; |
| 842 |
< |
|
| 843 |
< |
if (target_p == client_p) |
| 844 |
< |
continue; |
| 845 |
< |
|
| 846 |
< |
if (IsCapable(target_p, CAP_TS6) && HasID(client_p)) |
| 847 |
< |
sendto_one(target_p, ":%s SID %s 2 %s :%s%s", |
| 848 |
< |
me.id, client_p->name, client_p->id, |
| 849 |
< |
IsHidden(client_p) ? "(H) " : "", |
| 850 |
< |
client_p->info); |
| 851 |
< |
else |
| 852 |
< |
sendto_one(target_p,":%s SERVER %s 2 :%s%s", |
| 853 |
< |
me.name, client_p->name, |
| 854 |
< |
IsHidden(client_p) ? "(H) " : "", |
| 855 |
< |
client_p->info); |
| 856 |
< |
} |
| 800 |
> |
sendto_server(client_p, NOCAPS, NOCAPS, ":%s SID %s 2 %s :%s%s", |
| 801 |
> |
me.id, client_p->name, client_p->id, |
| 802 |
> |
IsHidden(client_p) ? "(H) " : "", client_p->info); |
| 803 |
|
|
| 804 |
|
/* |
| 805 |
|
* Pass on my client information to the new server |
| 822 |
|
|
| 823 |
|
DLINK_FOREACH_PREV(ptr, global_serv_list.tail) |
| 824 |
|
{ |
| 825 |
< |
target_p = ptr->data; |
| 825 |
> |
struct Client *target_p = ptr->data; |
| 826 |
|
|
| 827 |
|
/* target_p->from == target_p for target_p == client_p */ |
| 828 |
|
if (IsMe(target_p) || target_p->from == client_p) |
| 829 |
|
continue; |
| 830 |
|
|
| 831 |
< |
if (IsCapable(client_p, CAP_TS6)) |
| 832 |
< |
{ |
| 833 |
< |
if (HasID(target_p)) |
| 834 |
< |
sendto_one(client_p, ":%s SID %s %d %s :%s%s", |
| 889 |
< |
ID(target_p->servptr), target_p->name, target_p->hopcount+1, |
| 890 |
< |
target_p->id, IsHidden(target_p) ? "(H) " : "", |
| 891 |
< |
target_p->info); |
| 892 |
< |
else /* introducing non-ts6 server */ |
| 893 |
< |
sendto_one(client_p, ":%s SERVER %s %d :%s%s", |
| 894 |
< |
ID(target_p->servptr), target_p->name, target_p->hopcount+1, |
| 895 |
< |
IsHidden(target_p) ? "(H) " : "", target_p->info); |
| 896 |
< |
} |
| 897 |
< |
else |
| 898 |
< |
sendto_one(client_p, ":%s SERVER %s %d :%s%s", |
| 899 |
< |
target_p->servptr->name, target_p->name, target_p->hopcount+1, |
| 900 |
< |
IsHidden(target_p) ? "(H) " : "", target_p->info); |
| 831 |
> |
sendto_one(client_p, ":%s SID %s %d %s :%s%s", |
| 832 |
> |
target_p->servptr->id, target_p->name, target_p->hopcount+1, |
| 833 |
> |
target_p->id, IsHidden(target_p) ? "(H) " : "", |
| 834 |
> |
target_p->info); |
| 835 |
|
|
| 836 |
|
if (HasFlag(target_p, FLAGS_EOB)) |
| 837 |
< |
sendto_one(client_p, ":%s EOB", ID_or_name(target_p, client_p)); |
| 837 |
> |
sendto_one(client_p, ":%s EOB", target_p->id, client_p); |
| 838 |
|
} |
| 839 |
|
|
| 840 |
|
server_burst(client_p); |
| 865 |
|
|
| 866 |
|
/* EOB stuff is now in burst_all */ |
| 867 |
|
/* Always send a PING after connect burst is done */ |
| 868 |
< |
sendto_one(client_p, "PING :%s", ID_or_name(&me, client_p)); |
| 868 |
> |
sendto_one(client_p, "PING :%s", me.id); |
| 869 |
|
} |
| 870 |
|
|
| 871 |
|
/* burst_all() |
| 883 |
|
{ |
| 884 |
|
struct Channel *chptr = ptr->data; |
| 885 |
|
|
| 886 |
< |
if (dlink_list_length(&chptr->members) != 0) |
| 886 |
> |
if (dlink_list_length(&chptr->members)) |
| 887 |
|
{ |
| 888 |
|
burst_members(client_p, chptr); |
| 889 |
|
send_channel_modes(client_p, chptr); |
| 906 |
|
} |
| 907 |
|
|
| 908 |
|
if (IsCapable(client_p, CAP_EOB)) |
| 909 |
< |
sendto_one(client_p, ":%s EOB", ID_or_name(&me, client_p)); |
| 909 |
> |
sendto_one(client_p, ":%s EOB", me.id); |
| 910 |
|
} |
| 911 |
|
|
| 912 |
|
/* |
| 934 |
|
* it to their old topic they had before. Read m_tburst.c:ms_tburst |
| 935 |
|
* for further information -Michael |
| 936 |
|
*/ |
| 937 |
< |
if (chptr->topic_time != 0) |
| 938 |
< |
sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s", |
| 1005 |
< |
ID_or_name(&me, client_p), |
| 937 |
> |
if (chptr->topic_time) |
| 938 |
> |
sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s", me.id, |
| 939 |
|
(unsigned long)chptr->channelts, chptr->chname, |
| 940 |
|
(unsigned long)chptr->topic_time, |
| 941 |
|
chptr->topic_info, |
| 995 |
|
int |
| 996 |
|
serv_connect(struct MaskItem *conf, struct Client *by) |
| 997 |
|
{ |
| 998 |
< |
struct Client *client_p; |
| 999 |
< |
char buf[HOSTIPLEN + 1]; |
| 998 |
> |
struct Client *client_p = NULL; |
| 999 |
> |
char buf[HOSTIPLEN + 1] = ""; |
| 1000 |
|
|
| 1001 |
|
/* conversion structs */ |
| 1002 |
|
struct sockaddr_in *v4; |
| 1070 |
– |
/* Make sure conf is useful */ |
| 1071 |
– |
assert(conf != NULL); |
| 1003 |
|
|
| 1004 |
+ |
/* Make sure conf is useful */ |
| 1005 |
+ |
assert(conf); |
| 1006 |
|
|
| 1007 |
|
getnameinfo((struct sockaddr *)&conf->addr, conf->addr.ss_len, |
| 1008 |
|
buf, sizeof(buf), NULL, 0, NI_NUMERICHOST); |
| 1015 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 1016 |
|
"Error connecting to %s: DNS lookup for connect{} in progress.", |
| 1017 |
|
conf->name); |
| 1018 |
< |
return (0); |
| 1018 |
> |
return 0; |
| 1019 |
|
} |
| 1020 |
|
|
| 1021 |
|
if (conf->dns_failed) |
| 1023 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 1024 |
|
"Error connecting to %s: DNS lookup for connect{} failed.", |
| 1025 |
|
conf->name); |
| 1026 |
< |
return (0); |
| 1026 |
> |
return 0; |
| 1027 |
|
} |
| 1028 |
|
|
| 1029 |
|
/* Make sure this server isn't already connected |
| 1030 |
|
* Note: conf should ALWAYS be a valid C: line |
| 1031 |
|
*/ |
| 1032 |
< |
if ((client_p = hash_find_server(conf->name)) != NULL) |
| 1032 |
> |
if ((client_p = hash_find_server(conf->name))) |
| 1033 |
|
{ |
| 1034 |
|
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
| 1035 |
|
"Server %s already present from %s", |
| 1038 |
|
"Server %s already present from %s", |
| 1039 |
|
conf->name, get_client_name(client_p, MASK_IP)); |
| 1040 |
|
if (by && IsClient(by) && !MyClient(by)) |
| 1041 |
< |
sendto_one(by, ":%s NOTICE %s :Server %s already present from %s", |
| 1042 |
< |
me.name, by->name, conf->name, |
| 1110 |
< |
get_client_name(client_p, MASK_IP)); |
| 1041 |
> |
sendto_one_notice(by, &me, ":Server %s already present from %s", |
| 1042 |
> |
conf->name, get_client_name(client_p, MASK_IP)); |
| 1043 |
|
return 0; |
| 1044 |
|
} |
| 1045 |
|
|
| 1061 |
|
report_error(L_ALL, "opening stream socket to %s: %s", |
| 1062 |
|
conf->name, errno); |
| 1063 |
|
SetDead(client_p); |
| 1064 |
< |
exit_client(client_p, &me, "Connection failed"); |
| 1064 |
> |
exit_client(client_p, "Connection failed"); |
| 1065 |
|
return 0; |
| 1066 |
|
} |
| 1067 |
|
|
| 1077 |
|
"Host %s is not enabled for connecting: no connect{} block", |
| 1078 |
|
conf->name); |
| 1079 |
|
if (by && IsClient(by) && !MyClient(by)) |
| 1080 |
< |
sendto_one(by, ":%s NOTICE %s :Connect to host %s failed.", |
| 1081 |
< |
me.name, by->name, client_p->name); |
| 1080 |
> |
sendto_one_notice(by, &me, ":Connect to host %s failed.", client_p->name); |
| 1081 |
> |
|
| 1082 |
|
SetDead(client_p); |
| 1083 |
< |
exit_client(client_p, client_p, "Connection failed"); |
| 1083 |
> |
exit_client(client_p, "Connection failed"); |
| 1084 |
|
return 0; |
| 1085 |
|
} |
| 1086 |
|
|
| 1110 |
|
{ |
| 1111 |
|
case AF_INET: |
| 1112 |
|
v4 = (struct sockaddr_in*)&conf->bind; |
| 1113 |
< |
if (v4->sin_addr.s_addr != 0) |
| 1113 |
> |
if (v4->sin_addr.s_addr) |
| 1114 |
|
{ |
| 1115 |
|
struct irc_ssaddr ipn; |
| 1116 |
|
memset(&ipn, 0, sizeof(struct irc_ssaddr)); |
| 1150 |
|
v6conf = (struct sockaddr_in6 *)&conf->bind; |
| 1151 |
|
v6 = (struct sockaddr_in6 *)&ipn; |
| 1152 |
|
|
| 1153 |
< |
if (memcmp(&v6conf->sin6_addr, &v6->sin6_addr, sizeof(struct in6_addr)) != 0) |
| 1153 |
> |
if (memcmp(&v6conf->sin6_addr, &v6->sin6_addr, sizeof(struct in6_addr))) |
| 1154 |
|
{ |
| 1155 |
|
memcpy(&ipn, &conf->bind, sizeof(struct irc_ssaddr)); |
| 1156 |
|
ipn.ss.ss_family = AF_INET6; |
| 1198 |
|
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
| 1199 |
|
"Lost connect{} block for %s", get_client_name(client_p, MASK_IP)); |
| 1200 |
|
|
| 1201 |
< |
exit_client(client_p, &me, "Lost connect{} block"); |
| 1201 |
> |
exit_client(client_p, "Lost connect{} block"); |
| 1202 |
|
return; |
| 1203 |
|
} |
| 1204 |
|
|
| 1253 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
| 1254 |
|
"Error connecting to %s: %s", client_p->name, |
| 1255 |
|
sslerr ? sslerr : "unknown SSL error"); |
| 1256 |
< |
exit_client(client_p, client_p, "Error during SSL handshake"); |
| 1256 |
> |
exit_client(client_p, "Error during SSL handshake"); |
| 1257 |
|
return; |
| 1258 |
|
} |
| 1259 |
|
} |
| 1295 |
|
ilog(LOG_TYPE_IRCD, "SSL_new() ERROR! -- %s", |
| 1296 |
|
ERR_error_string(ERR_get_error(), NULL)); |
| 1297 |
|
SetDead(client_p); |
| 1298 |
< |
exit_client(client_p, client_p, "SSL_new failed"); |
| 1298 |
> |
exit_client(client_p, "SSL_new failed"); |
| 1299 |
|
return; |
| 1300 |
|
} |
| 1301 |
|
|
| 1323 |
|
struct MaskItem *conf = NULL; |
| 1324 |
|
|
| 1325 |
|
/* First, make sure its a real client! */ |
| 1326 |
< |
assert(client_p != NULL); |
| 1326 |
> |
assert(client_p); |
| 1327 |
|
assert(&client_p->localClient->fd == fd); |
| 1328 |
|
|
| 1329 |
|
/* Next, for backward purposes, record the ip of the server */ |
| 1330 |
|
memcpy(&client_p->localClient->ip, &fd->connect.hostaddr, |
| 1331 |
|
sizeof(struct irc_ssaddr)); |
| 1332 |
+ |
|
| 1333 |
|
/* Check the status */ |
| 1334 |
|
if (status != COMM_OK) |
| 1335 |
|
{ |
| 1367 |
|
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
| 1368 |
|
"Lost connect{} block for %s", get_client_name(client_p, MASK_IP)); |
| 1369 |
|
|
| 1370 |
< |
exit_client(client_p, &me, "Lost connect{} block"); |
| 1370 |
> |
exit_client(client_p, "Lost connect{} block"); |
| 1371 |
|
return; |
| 1372 |
|
} |
| 1373 |
|
|