| 227 |
|
struct EncCapability * |
| 228 |
|
check_cipher(struct Client *client_p, struct AccessItem *aconf) |
| 229 |
|
{ |
| 230 |
< |
struct EncCapability *epref; |
| 230 |
> |
struct EncCapability *epref = NULL; |
| 231 |
|
|
| 232 |
|
/* Use connect{} specific info if available */ |
| 233 |
|
if (aconf->cipher_preference) |
| 234 |
|
epref = aconf->cipher_preference; |
| 235 |
< |
else |
| 235 |
> |
else if (ConfigFileEntry.default_cipher_preference) |
| 236 |
|
epref = ConfigFileEntry.default_cipher_preference; |
| 237 |
|
|
| 238 |
< |
/* If the server supports the capability in hand, return the matching |
| 238 |
> |
/* |
| 239 |
> |
* If the server supports the capability in hand, return the matching |
| 240 |
|
* conf struct. Otherwise, return NULL (an error). |
| 241 |
|
*/ |
| 242 |
< |
if (IsCapableEnc(client_p, epref->cap)) |
| 243 |
< |
return(epref); |
| 242 |
> |
if (epref && IsCapableEnc(client_p, epref->cap)) |
| 243 |
> |
return epref; |
| 244 |
|
|
| 245 |
< |
return(NULL); |
| 245 |
> |
return NULL; |
| 246 |
|
} |
| 247 |
|
#endif /* HAVE_LIBCRYPTO */ |
| 248 |
|
|
| 677 |
|
if (!IsConfCryptLink(server_aconf)) |
| 678 |
|
ClearCap(client_p, CAP_ENC); |
| 679 |
|
if (!IsConfTopicBurst(server_aconf)) |
| 680 |
+ |
{ |
| 681 |
|
ClearCap(client_p, CAP_TB); |
| 682 |
+ |
ClearCap(client_p, CAP_TBURST); |
| 683 |
+ |
} |
| 684 |
|
|
| 685 |
|
/* Don't unset CAP_HUB here even if the server isn't a hub, |
| 686 |
|
* it only indicates if the server thinks it's lazylinks are |
| 815 |
|
int tl; |
| 816 |
|
dlink_node *ptr; |
| 817 |
|
#ifdef HAVE_LIBCRYPTO |
| 818 |
< |
struct EncCapability *epref; |
| 818 |
> |
const struct EncCapability *epref = NULL; |
| 819 |
|
char *capend; |
| 820 |
|
int sent_cipher = 0; |
| 821 |
|
#endif |
| 842 |
|
/* use connect{} specific info if available */ |
| 843 |
|
if (aconf->cipher_preference) |
| 844 |
|
epref = aconf->cipher_preference; |
| 845 |
< |
else |
| 845 |
> |
else if (ConfigFileEntry.default_cipher_preference) |
| 846 |
|
epref = ConfigFileEntry.default_cipher_preference; |
| 847 |
|
|
| 848 |
< |
if ((epref->cap & enc_can_send)) |
| 848 |
> |
if (epref && (epref->cap & enc_can_send)) |
| 849 |
|
{ |
| 850 |
|
/* Leave the space -- it is removed later. */ |
| 851 |
|
tl = ircsprintf(t, "%s ", epref->name); |
| 857 |
|
t = capend; /* truncate string before ENC:, below */ |
| 858 |
|
} |
| 859 |
|
#endif |
| 860 |
< |
*(t-1) = '\0'; |
| 860 |
> |
*(t - 1) = '\0'; |
| 861 |
|
sendto_one(client_p, "CAPAB :%s", msgbuf); |
| 862 |
|
} |
| 863 |
|
|
| 1067 |
|
* - Dianora |
| 1068 |
|
*/ |
| 1069 |
|
|
| 1070 |
< |
send_capabilities(client_p, aconf, |
| 1071 |
< |
(IsConfLazyLink(aconf) ? find_capability("LL") : 0) |
| 1072 |
< |
| (IsConfCompressed(aconf) ? find_capability("ZIP") : 0) |
| 1073 |
< |
| (IsConfTopicBurst(aconf) ? find_capability("TB") : 0) |
| 1070 |
< |
, 0); |
| 1070 |
> |
send_capabilities(client_p, aconf, (ServerInfo.hub ? CAP_HUB : 0) |
| 1071 |
> |
| (IsConfLazyLink(aconf) ? CAP_LL : 0) |
| 1072 |
> |
| (IsConfCompressed(aconf) ? CAP_ZIP : 0) |
| 1073 |
> |
| (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0), 0); |
| 1074 |
|
|
| 1075 |
|
/* SERVER is the last command sent before switching to ziplinks. |
| 1076 |
|
* We set TCPNODELAY on the socket to make sure it gets sent out |
| 1342 |
|
memcpy(buf, &block->data[0], block->size); |
| 1343 |
|
buf += block->size; |
| 1344 |
|
} |
| 1345 |
+ |
|
| 1346 |
|
dbuf_clear(&lserver->buf_recvq); |
| 1347 |
|
|
| 1348 |
|
/* pass the whole sendq to servlink */ |
| 1355 |
|
memcpy(buf, &block->data[0], block->size); |
| 1356 |
|
buf += block->size; |
| 1357 |
|
} |
| 1358 |
+ |
|
| 1359 |
|
dbuf_clear(&lserver->buf_sendq); |
| 1360 |
|
|
| 1361 |
|
/* start io */ |
| 1495 |
|
static void |
| 1496 |
|
burst_all(struct Client *client_p) |
| 1497 |
|
{ |
| 1498 |
< |
struct Client *target_p; |
| 1494 |
< |
struct Channel *chptr; |
| 1495 |
< |
dlink_node *gptr; |
| 1496 |
< |
dlink_node *ptr; |
| 1498 |
> |
dlink_node *ptr = NULL; |
| 1499 |
|
|
| 1500 |
< |
DLINK_FOREACH(gptr, global_channel_list.head) |
| 1500 |
> |
DLINK_FOREACH(ptr, global_channel_list.head) |
| 1501 |
|
{ |
| 1502 |
< |
chptr = gptr->data; |
| 1502 |
> |
struct Channel *chptr = ptr->data; |
| 1503 |
|
|
| 1504 |
|
if (dlink_list_length(&chptr->members) != 0) |
| 1505 |
|
{ |
| 1506 |
|
burst_members(client_p, chptr); |
| 1507 |
|
send_channel_modes(client_p, chptr); |
| 1508 |
< |
if (IsCapable(client_p, CAP_TB)) |
| 1508 |
> |
|
| 1509 |
> |
if (IsCapable(client_p, CAP_TBURST) || |
| 1510 |
> |
IsCapable(client_p, CAP_TB)) |
| 1511 |
|
send_tb(client_p, chptr); |
| 1512 |
|
} |
| 1513 |
|
} |
| 1516 |
|
*/ |
| 1517 |
|
DLINK_FOREACH(ptr, global_client_list.head) |
| 1518 |
|
{ |
| 1519 |
< |
target_p = ptr->data; |
| 1519 |
> |
struct Client *target_p = ptr->data; |
| 1520 |
|
|
| 1521 |
|
if (!IsBursted(target_p) && target_p->from != client_p) |
| 1522 |
|
sendnick_TS(client_p, target_p); |
| 1535 |
|
/* |
| 1536 |
|
* send_tb |
| 1537 |
|
* |
| 1538 |
< |
* inputs - pointer to Client |
| 1539 |
< |
* - pointer to channel |
| 1540 |
< |
* output - NONE |
| 1541 |
< |
* side effects - Called on a server burst when |
| 1542 |
< |
* server is CAP_TB capable |
| 1538 |
> |
* inputs - pointer to Client |
| 1539 |
> |
* - pointer to channel |
| 1540 |
> |
* output - NONE |
| 1541 |
> |
* side effects - Called on a server burst when |
| 1542 |
> |
* server is CAP_TB|CAP_TBURST capable |
| 1543 |
|
*/ |
| 1544 |
|
static void |
| 1545 |
|
send_tb(struct Client *client_p, struct Channel *chptr) |
| 1546 |
|
{ |
| 1547 |
< |
if (chptr->topic != NULL && IsCapable(client_p, CAP_TB)) |
| 1547 |
> |
/* |
| 1548 |
> |
* We may also send an empty topic here, but only if topic_time isn't 0, |
| 1549 |
> |
* i.e. if we had a topic that got unset. This is required for syncing |
| 1550 |
> |
* topics properly. |
| 1551 |
> |
* |
| 1552 |
> |
* Imagine the following scenario: Our downlink introduces a channel |
| 1553 |
> |
* to us with a TS that is equal to ours, but the channel topic on |
| 1554 |
> |
* their side got unset while the servers were in splitmode, which means |
| 1555 |
> |
* their 'topic' is newer. They simply wanted to unset it, so we have to |
| 1556 |
> |
* deal with it in a more sophisticated fashion instead of just resetting |
| 1557 |
> |
* it to their old topic they had before. Read m_tburst.c:ms_tburst |
| 1558 |
> |
* for further information -Michael |
| 1559 |
> |
*/ |
| 1560 |
> |
if (chptr->topic_time != 0) |
| 1561 |
|
{ |
| 1562 |
< |
if (ConfigChannel.burst_topicwho) |
| 1562 |
> |
if (IsCapable(client_p, CAP_TBURST)) |
| 1563 |
> |
sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s", |
| 1564 |
> |
me.name, (unsigned long)chptr->channelts, chptr->chname, |
| 1565 |
> |
(unsigned long)chptr->topic_time, |
| 1566 |
> |
chptr->topic_info ? chptr->topic_info : "", |
| 1567 |
> |
chptr->topic ? chptr->topic : ""); |
| 1568 |
> |
else if (IsCapable(client_p, CAP_TB)) |
| 1569 |
|
{ |
| 1570 |
< |
sendto_one(client_p, ":%s TB %s %lu %s :%s", |
| 1571 |
< |
me.name, chptr->chname, |
| 1572 |
< |
(unsigned long)chptr->topic_time, |
| 1573 |
< |
chptr->topic_info, chptr->topic); |
| 1574 |
< |
} |
| 1575 |
< |
else |
| 1576 |
< |
{ |
| 1577 |
< |
sendto_one(client_p, ":%s TB %s %lu :%s", |
| 1578 |
< |
me.name, chptr->chname, |
| 1579 |
< |
(unsigned long)chptr->topic_time, chptr->topic); |
| 1570 |
> |
if (ConfigChannel.burst_topicwho) |
| 1571 |
> |
{ |
| 1572 |
> |
sendto_one(client_p, ":%s TB %s %lu %s :%s", |
| 1573 |
> |
me.name, chptr->chname, |
| 1574 |
> |
(unsigned long)chptr->topic_time, |
| 1575 |
> |
chptr->topic_info, chptr->topic ? chptr->topic : ""); |
| 1576 |
> |
} |
| 1577 |
> |
else |
| 1578 |
> |
{ |
| 1579 |
> |
sendto_one(client_p, ":%s TB %s %lu :%s", |
| 1580 |
> |
me.name, chptr->chname, |
| 1581 |
> |
(unsigned long)chptr->topic_time, |
| 1582 |
> |
chptr->topic ? chptr->topic : ""); |
| 1583 |
> |
} |
| 1584 |
|
} |
| 1585 |
|
} |
| 1586 |
|
} |
| 2165 |
|
* Pass on TB if supported. |
| 2166 |
|
* - Dianora |
| 2167 |
|
*/ |
| 2168 |
< |
send_capabilities(client_p, aconf, |
| 2169 |
< |
(IsConfLazyLink(aconf) ? find_capability("LL") : 0) |
| 2170 |
< |
| (IsConfCompressed(aconf) ? find_capability("ZIP") : 0) |
| 2171 |
< |
| (IsConfTopicBurst(aconf) ? find_capability("TB") : 0) |
| 2145 |
< |
, 0); |
| 2168 |
> |
send_capabilities(client_p, aconf, (ServerInfo.hub ? CAP_HUB : 0) |
| 2169 |
> |
| (IsConfLazyLink(aconf) ? CAP_LL : 0) |
| 2170 |
> |
| (IsConfCompressed(aconf) ? CAP_ZIP : 0) |
| 2171 |
> |
| (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0), 0); |
| 2172 |
|
|
| 2173 |
|
sendto_one(client_p, "SERVER %s 1 :%s%s", |
| 2174 |
|
my_name_for_link(conf), |
| 2276 |
|
return; |
| 2277 |
|
} |
| 2278 |
|
|
| 2279 |
< |
send_capabilities(client_p, aconf, |
| 2280 |
< |
(IsConfLazyLink(aconf) ? find_capability("LL") : 0) |
| 2281 |
< |
| (IsConfCompressed(aconf) ? find_capability("ZIP") : 0) |
| 2282 |
< |
| (IsConfTopicBurst(aconf) ? find_capability("TB") : 0) |
| 2257 |
< |
, CAP_ENC_MASK); |
| 2279 |
> |
send_capabilities(client_p, aconf, (ServerInfo.hub ? CAP_HUB : 0) |
| 2280 |
> |
| (IsConfLazyLink(aconf) ? CAP_LL : 0) |
| 2281 |
> |
| (IsConfCompressed(aconf) ? CAP_ZIP : 0) |
| 2282 |
> |
| (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0), CAP_ENC_MASK); |
| 2283 |
|
|
| 2284 |
|
if (me.id[0]) |
| 2285 |
|
sendto_one(client_p, "PASS . TS %d %s", TS_CURRENT, me.id); |