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-8/src/s_serv.c (file contents):
Revision 1383 by michael, Tue May 1 11:18:22 2012 UTC vs.
Revision 1514 by michael, Sun Aug 26 09:11:17 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 460 | Line 437 | check_server(const char *name, struct Cl
437    server_aconf = map_to_conf(server_conf);
438  
439    if (!IsConfTopicBurst(server_aconf))
463  {
464    ClearCap(client_p, CAP_TB);
440      ClearCap(client_p, CAP_TBURST);
466  }
441  
442    if (aconf != NULL)
443    {
# Line 475 | 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 630 | Line 604 | sendnick_TS(struct Client *client_p, str
604      ubuf[1] = '\0';
605    }
606  
633  /* XXX Both of these need to have a :me.name or :mySID!?!?! */
607    if (IsCapable(client_p, CAP_SVS))
608    {
609      if (HasID(target_p) && IsCapable(client_p, CAP_TS6))
# Line 668 | Line 641 | sendnick_TS(struct Client *client_p, str
641                   target_p->servptr->name, target_p->info);
642    }
643  
644 <  if (IsConfAwayBurst((struct AccessItem *)map_to_conf(client_p->serv->sconf)))
645 <    if (!EmptyString(target_p->away))
646 <      sendto_one(client_p, ":%s AWAY :%s", target_p->name,
644 >  if (IsConfAwayBurst((struct AccessItem *)map_to_conf(client_p->localClient->confs.head->data)))
645 >    if (target_p->away[0])
646 >      sendto_one(client_p, ":%s AWAY :%s", ID_or_name(target_p, client_p),
647                   target_p->away);
648  
649   }
# Line 795 | Line 768 | server_estab(struct Client *client_p)
768       */
769  
770      send_capabilities(client_p, aconf,
771 <      (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0));
771 >      (IsConfTopicBurst(aconf) ? CAP_TBURST : 0));
772  
773      sendto_one(client_p, "SERVER %s 1 :%s%s",
774                 me.name, ConfigServerHide.hidden ? "(H) " : "", me.info);
# Line 894 | Line 867 | server_estab(struct Client *client_p)
867           inpath_ip, show_capabilities(client_p));
868    }
869  
897  client_p->serv->sconf = conf;
898
870    fd_note(&client_p->localClient->fd, "Server: %s", client_p->name);
871  
872    /* Old sendto_serv_but_one() call removed because we now
# Line 1016 | Line 987 | burst_all(struct Client *client_p)
987        burst_members(client_p, chptr);
988        send_channel_modes(client_p, chptr);
989  
990 <      if (IsCapable(client_p, CAP_TBURST) ||
1020 <          IsCapable(client_p, CAP_TB))
990 >      if (IsCapable(client_p, CAP_TBURST))
991          send_tb(client_p, chptr);
992      }
993    }
# Line 1049 | Line 1019 | burst_all(struct Client *client_p)
1019   *              - pointer to channel
1020   * output       - NONE
1021   * side effects - Called on a server burst when
1022 < *                server is CAP_TB|CAP_TBURST capable
1022 > *                server is CAP_TBURST capable
1023   */
1024   static void
1025   send_tb(struct Client *client_p, struct Channel *chptr)
# Line 1068 | Line 1038 | send_tb(struct Client *client_p, struct
1038     * for further information   -Michael
1039     */
1040    if (chptr->topic_time != 0)
1041 <  {
1042 <    if (IsCapable(client_p, CAP_TBURST))
1043 <      sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s",
1044 <                 me.name, (unsigned long)chptr->channelts, chptr->chname,
1045 <                 (unsigned long)chptr->topic_time,
1046 <                 chptr->topic_info,
1077 <                 chptr->topic);
1078 <    else if (IsCapable(client_p, CAP_TB))
1079 <    {
1080 <      if (ConfigChannel.burst_topicwho)
1081 <      {
1082 <        sendto_one(client_p, ":%s TB %s %lu %s :%s",
1083 <                   me.name, chptr->chname,
1084 <                   (unsigned long)chptr->topic_time,
1085 <                   chptr->topic_info, chptr->topic);
1086 <      }
1087 <      else
1088 <      {
1089 <        sendto_one(client_p, ":%s TB %s %lu :%s",
1090 <                   me.name, chptr->chname,
1091 <                   (unsigned long)chptr->topic_time,
1092 <                   chptr->topic);
1093 <      }
1094 <    }
1095 <  }
1041 >    sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s",
1042 >               ID_or_name(&me, client_p),
1043 >               (unsigned long)chptr->channelts, chptr->chname,
1044 >               (unsigned long)chptr->topic_time,
1045 >               chptr->topic_info,
1046 >               chptr->topic);
1047   }
1048  
1049   /* burst_members()
# Line 1150 | Line 1101 | serv_connect(struct AccessItem *aconf, s
1101   {
1102    struct ConfItem *conf;
1103    struct Client *client_p;
1104 <  char buf[HOSTIPLEN];
1104 >  char buf[HOSTIPLEN + 1];
1105  
1106    /* conversion structs */
1107    struct sockaddr_in *v4;
1108    /* Make sure aconf is useful */
1109    assert(aconf != NULL);
1110  
1160  if(aconf == NULL)
1161    return (0);
1162
1111    /* XXX should be passing struct ConfItem in the first place */
1112    conf = unmap_conf_item(aconf);
1113  
1114    /* log */
1115 <  getnameinfo((struct sockaddr *)&aconf->ipnum, aconf->ipnum.ss_len,
1115 >  getnameinfo((struct sockaddr *)&aconf->addr, aconf->addr.ss_len,
1116                buf, sizeof(buf), NULL, 0, NI_NUMERICHOST);
1117 <  ilog(LOG_TYPE_IRCD, "Connect to %s[%s] @%s", aconf->user, aconf->host,
1117 >  ilog(LOG_TYPE_IRCD, "Connect to %s[%s] @%s", conf->name, aconf->host,
1118         buf);
1119  
1120    /* Still processing a DNS lookup? -> exit */
# Line 1215 | Line 1163 | serv_connect(struct AccessItem *aconf, s
1163    strlcpy(client_p->sockhost, buf, sizeof(client_p->sockhost));
1164  
1165    /* create a socket for the server connection */
1166 <  if (comm_open(&client_p->localClient->fd, aconf->ipnum.ss.ss_family,
1166 >  if (comm_open(&client_p->localClient->fd, aconf->addr.ss.ss_family,
1167                  SOCK_STREAM, 0, NULL) < 0)
1168    {
1169      /* Eek, failure to create the socket */
# Line 1270 | Line 1218 | serv_connect(struct AccessItem *aconf, s
1218    switch (aconf->aftype)
1219    {
1220      case AF_INET:
1221 <      v4 = (struct sockaddr_in*)&aconf->my_ipnum;
1221 >      v4 = (struct sockaddr_in*)&aconf->bind;
1222        if (v4->sin_addr.s_addr != 0)
1223        {
1224          struct irc_ssaddr ipn;
1225          memset(&ipn, 0, sizeof(struct irc_ssaddr));
1226          ipn.ss.ss_family = AF_INET;
1227          ipn.ss_port = 0;
1228 <        memcpy(&ipn, &aconf->my_ipnum, sizeof(struct irc_ssaddr));
1228 >        memcpy(&ipn, &aconf->bind, sizeof(struct irc_ssaddr));
1229          comm_connect_tcp(&client_p->localClient->fd, aconf->host, aconf->port,
1230                           (struct sockaddr *)&ipn, ipn.ss_len,
1231                           serv_connect_callback, client_p, aconf->aftype,
# Line 1308 | Line 1256 | serv_connect(struct AccessItem *aconf, s
1256          struct sockaddr_in6 *v6conf;
1257  
1258          memset(&ipn, 0, sizeof(struct irc_ssaddr));
1259 <        v6conf = (struct sockaddr_in6 *)&aconf->my_ipnum;
1259 >        v6conf = (struct sockaddr_in6 *)&aconf->bind;
1260          v6 = (struct sockaddr_in6 *)&ipn;
1261  
1262          if (memcmp(&v6conf->sin6_addr, &v6->sin6_addr,
1263                     sizeof(struct in6_addr)) != 0)
1264          {
1265 <          memcpy(&ipn, &aconf->my_ipnum, sizeof(struct irc_ssaddr));
1265 >          memcpy(&ipn, &aconf->bind, sizeof(struct irc_ssaddr));
1266            ipn.ss.ss_family = AF_INET6;
1267            ipn.ss_port = 0;
1268            comm_connect_tcp(&client_p->localClient->fd,
# Line 1373 | Line 1321 | finish_ssl_server_handshake(struct Clien
1321                 aconf->spasswd, TS_CURRENT, me.id);
1322  
1323    send_capabilities(client_p, aconf,
1324 <                   (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0));
1324 >                   (IsConfTopicBurst(aconf) ? CAP_TBURST : 0));
1325  
1326    sendto_one(client_p, "SERVER %s 1 :%s%s",
1327               me.name, ConfigServerHide.hidden ? "(H) " : "",
# Line 1535 | Line 1483 | serv_connect_callback(fde_t *fd, int sta
1483                 aconf->spasswd, TS_CURRENT, me.id);
1484  
1485    send_capabilities(client_p, aconf,
1486 <                   (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0));
1486 >                   (IsConfTopicBurst(aconf) ? CAP_TBURST : 0));
1487  
1488    sendto_one(client_p, "SERVER %s 1 :%s%s",
1489               me.name, ConfigServerHide.hidden ? "(H) " : "",

Diff Legend

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