ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/server.c
(Generate patch)

Comparing:
ircd-hybrid/src/s_serv.c (file contents), Revision 31 by knight, Sun Oct 2 20:34:05 2005 UTC vs.
ircd-hybrid-7.2/src/s_serv.c (file contents), Revision 391 by michael, Fri Feb 3 09:57:22 2006 UTC

# Line 227 | Line 227 | collect_zipstats(void *unused)
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  
# Line 676 | Line 677 | check_server(const char *name, struct Cl
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
# Line 811 | Line 815 | send_capabilities(struct Client *client_
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
# Line 838 | Line 842 | send_capabilities(struct Client *client_
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);
# Line 853 | Line 857 | send_capabilities(struct Client *client_
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  
864   /* sendnick_TS()
865   *
866   * inputs       - client (server) to send nick towards
867 < *              - client to send nick for
867 > *          - client to send nick for
868   * output       - NONE
869   * side effects - NICK message is sent towards given client_p
870   */
# Line 885 | Line 889 | sendnick_TS(struct Client *client_p, str
889    if (HasID(target_p) && IsCapable(client_p, CAP_TS6))
890      sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s :%s",
891                 target_p->servptr->id,
892 <               target_p->name, target_p->hopcount + 1,
893 <               (unsigned long) target_p->tsinfo,
894 <               ubuf, target_p->username, target_p->host,
895 <           ((MyClient(target_p)&&!IsIPSpoof(target_p))?target_p->sockhost:"0"),
896 <           target_p->id, target_p->info);
892 >               target_p->name, target_p->hopcount + 1,
893 >               (unsigned long) target_p->tsinfo,
894 >               ubuf, target_p->username, target_p->host,
895 >               (MyClient(target_p) && IsIPSpoof(target_p)) ?
896 >               "0" : target_p->sockhost, target_p->id, target_p->info);
897    else
898      sendto_one(client_p, "NICK %s %d %lu %s %s %s %s :%s",
899                 target_p->name, target_p->hopcount + 1,
900                 (unsigned long) target_p->tsinfo,
901                 ubuf, target_p->username, target_p->host,
902                 target_p->servptr->name, target_p->info);
903 +
904    if (IsConfAwayBurst((struct AccessItem *)map_to_conf(client_p->serv->sconf)))
905      if (!EmptyString(target_p->away))
906        sendto_one(client_p, ":%s AWAY :%s", target_p->name,
# Line 1063 | Line 1068 | server_estab(struct Client *client_p)
1068       * - Dianora
1069       */
1070  
1071 <     send_capabilities(client_p, aconf,
1072 <       (IsConfLazyLink(aconf) ? find_capability("LL") : 0)
1073 <       | (IsConfCompressed(aconf) ? find_capability("ZIP") : 0)
1074 <       | (IsConfTopicBurst(aconf) ? find_capability("TB") : 0)
1070 <       , 0);
1071 >    send_capabilities(client_p, aconf, (ServerInfo.hub ? CAP_HUB : 0)
1072 >      | (IsConfLazyLink(aconf) ? CAP_LL : 0)
1073 >      | (IsConfCompressed(aconf) ? CAP_ZIP : 0)
1074 >      | (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0), 0);
1075  
1076      /* SERVER is the last command sent before switching to ziplinks.
1077       * We set TCPNODELAY on the socket to make sure it gets sent out
# Line 1339 | Line 1343 | start_io(struct Client *server)
1343      memcpy(buf, &block->data[0], block->size);
1344      buf += block->size;
1345    }
1346 +
1347    dbuf_clear(&lserver->buf_recvq);
1348  
1349    /* pass the whole sendq to servlink */
# Line 1351 | Line 1356 | start_io(struct Client *server)
1356      memcpy(buf, &block->data[0], block->size);
1357      buf += block->size;
1358    }
1359 +
1360    dbuf_clear(&lserver->buf_sendq);
1361  
1362    /* start io */
# Line 1490 | Line 1496 | server_burst(struct Client *client_p)
1496   static void
1497   burst_all(struct Client *client_p)
1498   {
1499 <  struct Client *target_p;
1494 <  struct Channel *chptr;
1495 <  dlink_node *gptr;
1496 <  dlink_node *ptr;
1499 >  dlink_node *ptr = NULL;
1500  
1501 <  DLINK_FOREACH(gptr, global_channel_list.head)
1501 >  DLINK_FOREACH(ptr, global_channel_list.head)
1502    {
1503 <    chptr = gptr->data;
1503 >    struct Channel *chptr = ptr->data;
1504  
1505      if (dlink_list_length(&chptr->members) != 0)
1506      {
1507        burst_members(client_p, chptr);
1508        send_channel_modes(client_p, chptr);
1509 <      if (IsCapable(client_p, CAP_TB))
1509 >
1510 >      if (IsCapable(client_p, CAP_TBURST) ||
1511 >          IsCapable(client_p, CAP_TB))
1512          send_tb(client_p, chptr);
1513      }
1514    }
# Line 1512 | Line 1517 | burst_all(struct Client *client_p)
1517     */
1518    DLINK_FOREACH(ptr, global_client_list.head)
1519    {
1520 <    target_p = ptr->data;
1520 >    struct Client *target_p = ptr->data;
1521  
1522      if (!IsBursted(target_p) && target_p->from != client_p)
1523        sendnick_TS(client_p, target_p);
# Line 1531 | Line 1536 | burst_all(struct Client *client_p)
1536   /*
1537   * send_tb
1538   *
1539 < * inputs       - pointer to Client
1540 < *              - pointer to channel
1541 < * output       - NONE
1542 < * side effects - Called on a server burst when
1543 < *                server is CAP_TB capable
1539 > * inputs       - pointer to Client
1540 > *              - pointer to channel
1541 > * output       - NONE
1542 > * side effects - Called on a server burst when
1543 > *                server is CAP_TB|CAP_TBURST capable
1544   */
1545   static void
1546   send_tb(struct Client *client_p, struct Channel *chptr)
1547   {
1548 <  if (chptr->topic != NULL && IsCapable(client_p, CAP_TB))
1548 >  /*
1549 >   * We may also send an empty topic here, but only if topic_time isn't 0,
1550 >   * i.e. if we had a topic that got unset.  This is required for syncing
1551 >   * topics properly.
1552 >   *
1553 >   * Imagine the following scenario: Our downlink introduces a channel
1554 >   * to us with a TS that is equal to ours, but the channel topic on
1555 >   * their side got unset while the servers were in splitmode, which means
1556 >   * their 'topic' is newer.  They simply wanted to unset it, so we have to
1557 >   * deal with it in a more sophisticated fashion instead of just resetting
1558 >   * it to their old topic they had before.  Read m_tburst.c:ms_tburst
1559 >   * for further information   -Michael
1560 >   */
1561 >  if (chptr->topic_time != 0)
1562    {
1563 <    if (ConfigChannel.burst_topicwho)
1564 <    {
1565 <      sendto_one(client_p, ":%s TB %s %lu %s :%s",
1566 <                 me.name, chptr->chname,
1567 <                 (unsigned long)chptr->topic_time,
1568 <                 chptr->topic_info, chptr->topic);
1569 <    }
1552 <    else
1563 >    if (IsCapable(client_p, CAP_TBURST))
1564 >      sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s",
1565 >                 me.name, (unsigned long)chptr->channelts, chptr->chname,
1566 >                 (unsigned long)chptr->topic_time,
1567 >                 chptr->topic_info ? chptr->topic_info : "",
1568 >                 chptr->topic ? chptr->topic : "");
1569 >    else if (IsCapable(client_p, CAP_TB))
1570      {
1571 <      sendto_one(client_p, ":%s TB %s %lu :%s",
1572 <                 me.name, chptr->chname,
1573 <                 (unsigned long)chptr->topic_time, chptr->topic);
1571 >      if (ConfigChannel.burst_topicwho)
1572 >      {
1573 >        sendto_one(client_p, ":%s TB %s %lu %s :%s",
1574 >                   me.name, chptr->chname,
1575 >                   (unsigned long)chptr->topic_time,
1576 >                   chptr->topic_info, chptr->topic ? chptr->topic : "");
1577 >      }
1578 >      else
1579 >      {
1580 >        sendto_one(client_p, ":%s TB %s %lu :%s",
1581 >                   me.name, chptr->chname,
1582 >                   (unsigned long)chptr->topic_time,
1583 >                   chptr->topic ? chptr->topic : "");
1584 >      }
1585      }
1586    }
1587   }
# Line 2138 | Line 2166 | serv_connect_callback(fde_t *fd, int sta
2166     * Pass on TB if supported.
2167     * - Dianora
2168     */
2169 <  send_capabilities(client_p, aconf,
2170 <                    (IsConfLazyLink(aconf) ? find_capability("LL") : 0)
2171 <                    | (IsConfCompressed(aconf) ? find_capability("ZIP") : 0)
2172 <                    | (IsConfTopicBurst(aconf) ? find_capability("TB") : 0)
2145 <                    , 0);
2169 >  send_capabilities(client_p, aconf, (ServerInfo.hub ? CAP_HUB : 0)
2170 >                    | (IsConfLazyLink(aconf) ? CAP_LL : 0)
2171 >                    | (IsConfCompressed(aconf) ? CAP_ZIP : 0)
2172 >                    | (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0), 0);
2173  
2174    sendto_one(client_p, "SERVER %s 1 :%s%s",
2175               my_name_for_link(conf),
# Line 2250 | Line 2277 | cryptlink_init(struct Client *client_p,
2277      return;
2278    }
2279  
2280 <  send_capabilities(client_p, aconf,
2281 <                    (IsConfLazyLink(aconf) ? find_capability("LL") : 0)
2282 <                    | (IsConfCompressed(aconf) ? find_capability("ZIP") : 0)
2283 <                    | (IsConfTopicBurst(aconf) ? find_capability("TB") : 0)
2284 <                    , CAP_ENC_MASK);
2280 >  send_capabilities(client_p, aconf, (ServerInfo.hub ? CAP_HUB : 0)
2281 >                    | (IsConfLazyLink(aconf) ? CAP_LL : 0)
2282 >                    | (IsConfCompressed(aconf) ? CAP_ZIP : 0)
2283 >                    | (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0), CAP_ENC_MASK);
2284 >
2285 >  if (me.id[0])
2286 >    sendto_one(client_p, "PASS . TS %d %s", TS_CURRENT, me.id);
2287  
2288    sendto_one(client_p, "CRYPTLINK SERV %s %s :%s%s",
2289               my_name_for_link(conf), key_to_send,

Comparing:
ircd-hybrid/src/s_serv.c (property svn:keywords), Revision 31 by knight, Sun Oct 2 20:34:05 2005 UTC vs.
ircd-hybrid-7.2/src/s_serv.c (property svn:keywords), Revision 391 by michael, Fri Feb 3 09:57:22 2006 UTC

# Line 1 | Line 1
1 < "Id Revision"
1 > Id Revision

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)