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

Comparing ircd-hybrid-8/src/s_serv.c (file contents):
Revision 1377 by michael, Mon Apr 30 19:35:16 2012 UTC vs.
Revision 1490 by michael, Sat Jul 28 19:33:23 2012 UTC

# Line 108 | Line 108 | write_links_file(void* notused)
108        continue;
109  
110      /* skip hidden servers */
111 <    if (IsHidden(target_p) && !ConfigServerHide.disable_hidden)
111 >    if (IsHidden(target_p))
112        continue;
113  
114      if (target_p->info[0])
# Line 208 | Line 208 | hunt_server(struct Client *client_p, str
208        target_p = NULL;
209  
210    collapse(parv[server]);
211 <  wilds = (strchr(parv[server], '?') || strchr(parv[server], '*'));
211 >  wilds = has_wildcards(parv[server]);
212  
213    /* Again, if there are no wild cards involved in the server
214     * name, use the hash lookup
# Line 404 | Line 404 | check_server(const char *name, struct Cl
404  
405    assert(client_p != NULL);
406  
407  if (client_p == NULL)
408    return(error);
409
410  if (strlen(name) > HOSTLEN)
411    return(-4);
412
407    /* loop through looking for all possible connect items that might work */
408    DLINK_FOREACH(ptr, server_items.head)
409    {
# Line 427 | Line 421 | check_server(const char *name, struct Cl
421          match(aconf->host, client_p->sockhost))
422      {
423        error = -2;
430      {
431        /* A NULL password is as good as a bad one */
432        if (EmptyString(client_p->localClient->passwd))
433          return(-2);
434
435        /* code in s_conf.c should not have allowed this to be NULL */
436        if (aconf->passwd == NULL)
437          return(-2);
424  
425 <        if (IsConfEncrypted(aconf))
426 <        {
427 <          if (strcmp(aconf->passwd,
428 <              (const char *)crypt(client_p->localClient->passwd,
443 <                                  aconf->passwd)) == 0)
444 <            server_conf = conf;
445 <        }
446 <        else
447 <        {
448 <          if (strcmp(aconf->passwd, client_p->localClient->passwd) == 0)
449 <            server_conf = conf;
450 <        }
451 <      }
425 >      if (!match_conf_password(client_p->localClient->passwd, aconf))
426 >        return -2;
427 >
428 >      server_conf = conf;
429      }
430    }
431  
# Line 457 | Line 434 | check_server(const char *name, struct Cl
434  
435    attach_conf(client_p, server_conf);
436  
460  /* Now find all leaf or hub config items for this server */
461  DLINK_FOREACH(ptr, hub_items.head)
462  {
463    conf = ptr->data;
464
465    if (!match(name, conf->name))
466      continue;
467    attach_conf(client_p, conf);
468  }
469
470  DLINK_FOREACH(ptr, leaf_items.head)
471  {
472    conf = ptr->data;
473
474    if (!match(name, conf->name))
475      continue;
476    attach_conf(client_p, conf);
477  }
478
437    server_aconf = map_to_conf(server_conf);
438  
439    if (!IsConfTopicBurst(server_aconf))
482  {
483    ClearCap(client_p, CAP_TB);
440      ClearCap(client_p, CAP_TBURST);
485  }
441  
442    if (aconf != NULL)
443    {
# Line 494 | Line 449 | check_server(const char *name, struct Cl
449      {
450   #ifdef IPV6
451        case AF_INET6:
452 <        v6 = (struct sockaddr_in6 *)&aconf->ipnum;
452 >        v6 = (struct sockaddr_in6 *)&aconf->addr;
453  
454          if (IN6_IS_ADDR_UNSPECIFIED(&v6->sin6_addr))
455 <          memcpy(&aconf->ipnum, &client_p->localClient->ip, sizeof(struct irc_ssaddr));
455 >          memcpy(&aconf->addr, &client_p->localClient->ip, sizeof(struct irc_ssaddr));
456          break;
457   #endif
458        case AF_INET:
459 <        v4 = (struct sockaddr_in *)&aconf->ipnum;
459 >        v4 = (struct sockaddr_in *)&aconf->addr;
460  
461          if (v4->sin_addr.s_addr == INADDR_NONE)
462 <          memcpy(&aconf->ipnum, &client_p->localClient->ip, sizeof(struct irc_ssaddr));
462 >          memcpy(&aconf->addr, &client_p->localClient->ip, sizeof(struct irc_ssaddr));
463          break;
464      }
465    }
# Line 687 | Line 642 | sendnick_TS(struct Client *client_p, str
642                   target_p->servptr->name, target_p->info);
643    }
644  
645 <  if (IsConfAwayBurst((struct AccessItem *)map_to_conf(client_p->serv->sconf)))
646 <    if (!EmptyString(target_p->away))
647 <      sendto_one(client_p, ":%s AWAY :%s", target_p->name,
645 >  if (IsConfAwayBurst((struct AccessItem *)map_to_conf(client_p->localClient->confs.head->data)))
646 >    if (target_p->away[0])
647 >      sendto_one(client_p, ":%s AWAY :%s", ID_or_name(target_p, client_p),
648                   target_p->away);
649  
650   }
# Line 814 | Line 769 | server_estab(struct Client *client_p)
769       */
770  
771      send_capabilities(client_p, aconf,
772 <      (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0));
772 >      (IsConfTopicBurst(aconf) ? CAP_TBURST : 0));
773  
774      sendto_one(client_p, "SERVER %s 1 :%s%s",
775                 me.name, ConfigServerHide.hidden ? "(H) " : "", me.info);
# Line 913 | Line 868 | server_estab(struct Client *client_p)
868           inpath_ip, show_capabilities(client_p));
869    }
870  
916  client_p->serv->sconf = conf;
917
871    fd_note(&client_p->localClient->fd, "Server: %s", client_p->name);
872  
873    /* Old sendto_serv_but_one() call removed because we now
# Line 1035 | Line 988 | burst_all(struct Client *client_p)
988        burst_members(client_p, chptr);
989        send_channel_modes(client_p, chptr);
990  
991 <      if (IsCapable(client_p, CAP_TBURST) ||
1039 <          IsCapable(client_p, CAP_TB))
991 >      if (IsCapable(client_p, CAP_TBURST))
992          send_tb(client_p, chptr);
993      }
994    }
# Line 1068 | Line 1020 | burst_all(struct Client *client_p)
1020   *              - pointer to channel
1021   * output       - NONE
1022   * side effects - Called on a server burst when
1023 < *                server is CAP_TB|CAP_TBURST capable
1023 > *                server is CAP_TBURST capable
1024   */
1025   static void
1026   send_tb(struct Client *client_p, struct Channel *chptr)
# Line 1087 | Line 1039 | send_tb(struct Client *client_p, struct
1039     * for further information   -Michael
1040     */
1041    if (chptr->topic_time != 0)
1042 <  {
1043 <    if (IsCapable(client_p, CAP_TBURST))
1044 <      sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s",
1045 <                 me.name, (unsigned long)chptr->channelts, chptr->chname,
1046 <                 (unsigned long)chptr->topic_time,
1047 <                 chptr->topic_info,
1096 <                 chptr->topic);
1097 <    else if (IsCapable(client_p, CAP_TB))
1098 <    {
1099 <      if (ConfigChannel.burst_topicwho)
1100 <      {
1101 <        sendto_one(client_p, ":%s TB %s %lu %s :%s",
1102 <                   me.name, chptr->chname,
1103 <                   (unsigned long)chptr->topic_time,
1104 <                   chptr->topic_info, chptr->topic);
1105 <      }
1106 <      else
1107 <      {
1108 <        sendto_one(client_p, ":%s TB %s %lu :%s",
1109 <                   me.name, chptr->chname,
1110 <                   (unsigned long)chptr->topic_time,
1111 <                   chptr->topic);
1112 <      }
1113 <    }
1114 <  }
1042 >    sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s",
1043 >               ID_or_name(&me, client_p),
1044 >               (unsigned long)chptr->channelts, chptr->chname,
1045 >               (unsigned long)chptr->topic_time,
1046 >               chptr->topic_info,
1047 >               chptr->topic);
1048   }
1049  
1050   /* burst_members()
# Line 1169 | Line 1102 | serv_connect(struct AccessItem *aconf, s
1102   {
1103    struct ConfItem *conf;
1104    struct Client *client_p;
1105 <  char buf[HOSTIPLEN];
1105 >  char buf[HOSTIPLEN + 1];
1106  
1107    /* conversion structs */
1108    struct sockaddr_in *v4;
1109    /* Make sure aconf is useful */
1110    assert(aconf != NULL);
1111  
1179  if(aconf == NULL)
1180    return (0);
1181
1112    /* XXX should be passing struct ConfItem in the first place */
1113    conf = unmap_conf_item(aconf);
1114  
1115    /* log */
1116 <  getnameinfo((struct sockaddr *)&aconf->ipnum, aconf->ipnum.ss_len,
1116 >  getnameinfo((struct sockaddr *)&aconf->addr, aconf->addr.ss_len,
1117                buf, sizeof(buf), NULL, 0, NI_NUMERICHOST);
1118 <  ilog(LOG_TYPE_IRCD, "Connect to %s[%s] @%s", aconf->user, aconf->host,
1118 >  ilog(LOG_TYPE_IRCD, "Connect to %s[%s] @%s", conf->name, aconf->host,
1119         buf);
1120  
1121    /* Still processing a DNS lookup? -> exit */
# Line 1234 | Line 1164 | serv_connect(struct AccessItem *aconf, s
1164    strlcpy(client_p->sockhost, buf, sizeof(client_p->sockhost));
1165  
1166    /* create a socket for the server connection */
1167 <  if (comm_open(&client_p->localClient->fd, aconf->ipnum.ss.ss_family,
1167 >  if (comm_open(&client_p->localClient->fd, aconf->addr.ss.ss_family,
1168                  SOCK_STREAM, 0, NULL) < 0)
1169    {
1170      /* Eek, failure to create the socket */
# Line 1289 | Line 1219 | serv_connect(struct AccessItem *aconf, s
1219    switch (aconf->aftype)
1220    {
1221      case AF_INET:
1222 <      v4 = (struct sockaddr_in*)&aconf->my_ipnum;
1222 >      v4 = (struct sockaddr_in*)&aconf->bind;
1223        if (v4->sin_addr.s_addr != 0)
1224        {
1225          struct irc_ssaddr ipn;
1226          memset(&ipn, 0, sizeof(struct irc_ssaddr));
1227          ipn.ss.ss_family = AF_INET;
1228          ipn.ss_port = 0;
1229 <        memcpy(&ipn, &aconf->my_ipnum, sizeof(struct irc_ssaddr));
1229 >        memcpy(&ipn, &aconf->bind, sizeof(struct irc_ssaddr));
1230          comm_connect_tcp(&client_p->localClient->fd, aconf->host, aconf->port,
1231                           (struct sockaddr *)&ipn, ipn.ss_len,
1232                           serv_connect_callback, client_p, aconf->aftype,
# Line 1327 | Line 1257 | serv_connect(struct AccessItem *aconf, s
1257          struct sockaddr_in6 *v6conf;
1258  
1259          memset(&ipn, 0, sizeof(struct irc_ssaddr));
1260 <        v6conf = (struct sockaddr_in6 *)&aconf->my_ipnum;
1260 >        v6conf = (struct sockaddr_in6 *)&aconf->bind;
1261          v6 = (struct sockaddr_in6 *)&ipn;
1262  
1263          if (memcmp(&v6conf->sin6_addr, &v6->sin6_addr,
1264                     sizeof(struct in6_addr)) != 0)
1265          {
1266 <          memcpy(&ipn, &aconf->my_ipnum, sizeof(struct irc_ssaddr));
1266 >          memcpy(&ipn, &aconf->bind, sizeof(struct irc_ssaddr));
1267            ipn.ss.ss_family = AF_INET6;
1268            ipn.ss_port = 0;
1269            comm_connect_tcp(&client_p->localClient->fd,
# Line 1392 | Line 1322 | finish_ssl_server_handshake(struct Clien
1322                 aconf->spasswd, TS_CURRENT, me.id);
1323  
1324    send_capabilities(client_p, aconf,
1325 <                   (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0));
1325 >                   (IsConfTopicBurst(aconf) ? CAP_TBURST : 0));
1326  
1327    sendto_one(client_p, "SERVER %s 1 :%s%s",
1328               me.name, ConfigServerHide.hidden ? "(H) " : "",
# Line 1554 | Line 1484 | serv_connect_callback(fde_t *fd, int sta
1484                 aconf->spasswd, TS_CURRENT, me.id);
1485  
1486    send_capabilities(client_p, aconf,
1487 <                   (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0));
1487 >                   (IsConfTopicBurst(aconf) ? CAP_TBURST : 0));
1488  
1489    sendto_one(client_p, "SERVER %s 1 :%s%s",
1490               me.name, ConfigServerHide.hidden ? "(H) " : "",

Diff Legend

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