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 1306 by michael, Sat Mar 24 07:43:04 2012 UTC vs.
ircd-hybrid/trunk/src/s_serv.c (file contents), Revision 1618 by michael, Tue Oct 30 21:04:38 2012 UTC

# Line 43 | Line 43
43   #include "numeric.h"
44   #include "packet.h"
45   #include "irc_res.h"
46 < #include "s_conf.h"
46 > #include "conf.h"
47   #include "s_serv.h"
48 < #include "s_log.h"
48 > #include "log.h"
49   #include "s_misc.h"
50   #include "s_user.h"
51   #include "send.h"
# Line 62 | Line 62 | static void send_tb(struct Client *clien
62  
63   static CNCB serv_connect_callback;
64  
65 static void start_io(struct Client *);
65   static void burst_members(struct Client *, struct Channel *);
66  
67   /*
# Line 76 | Line 75 | static void burst_members(struct Client
75   void
76   write_links_file(void* notused)
77   {
78 <  MessageFileLine *next_mptr = 0;
79 <  MessageFileLine *mptr = 0;
80 <  MessageFileLine *currentMessageLine = 0;
81 <  MessageFileLine *newMessageLine = 0;
82 <  MessageFile *MessageFileptr;
83 <  const char *p;
85 <  FBFILE *file;
78 >  MessageFileLine *next_mptr = NULL;
79 >  MessageFileLine *mptr = NULL;
80 >  MessageFileLine *currentMessageLine = NULL;
81 >  MessageFileLine *newMessageLine = NULL;
82 >  MessageFile *MessageFileptr = &ConfigFileEntry.linksfile;
83 >  FILE *file;
84    char buff[512];
85    dlink_node *ptr;
86  
87 <  MessageFileptr = &ConfigFileEntry.linksfile;
90 <
91 <  if ((file = fbopen(MessageFileptr->fileName, "w")) == NULL)
87 >  if ((file = fopen(MessageFileptr->fileName, "w")) == NULL)
88      return;
89  
90    for (mptr = MessageFileptr->contentsOfFile; mptr; mptr = next_mptr)
# Line 98 | Line 94 | write_links_file(void* notused)
94    }
95  
96    MessageFileptr->contentsOfFile = NULL;
101  currentMessageLine             = NULL;
97  
98    DLINK_FOREACH(ptr, global_serv_list.head)
99    {
100 <    size_t nbytes = 0;
106 <    struct Client *target_p = ptr->data;
100 >    const struct Client *target_p = ptr->data;
101  
102      /* skip ourselves, we send ourselves in /links */
103      if (IsMe(target_p))
104        continue;
105  
106      /* skip hidden servers */
107 <    if (IsHidden(target_p) && !ConfigServerHide.disable_hidden)
107 >    if (IsHidden(target_p))
108        continue;
109  
116    if (target_p->info[0])
117      p = target_p->info;
118    else
119      p = "(Unknown Location)";
120
110      newMessageLine = MyMalloc(sizeof(MessageFileLine));
111  
112 <    /* Attempt to format the file in such a way it follows the usual links output
112 >    /*
113 >     * Attempt to format the file in such a way it follows the usual links output
114       * ie  "servername uplink :hops info"
115       * Mostly for aesthetic reasons - makes it look pretty in mIRC ;)
116       * - madmax
117       */
118 <
119 <    /*
130 <     * For now, check this ircsprintf wont overflow - it shouldnt on a
131 <     * default config but it is configurable..
132 <     * This should be changed to an snprintf at some point, but I'm wanting to
133 <     * know if this is a cause of a bug - cryogen
134 <     */
135 <    assert(strlen(target_p->name) + strlen(me.name) + 6 + strlen(p) <=
136 <            MESSAGELINELEN);
137 <    ircsprintf(newMessageLine->line, "%s %s :1 %s",
138 <               target_p->name, me.name, p);
139 <    newMessageLine->next = NULL;
118 >    snprintf(newMessageLine->line, sizeof(newMessageLine->line), "%s %s :1 %s",
119 >             target_p->name, me.name, target_p->info);
120  
121      if (MessageFileptr->contentsOfFile)
122      {
# Line 150 | Line 130 | write_links_file(void* notused)
130        currentMessageLine = newMessageLine;
131      }
132  
133 <    nbytes = ircsprintf(buff, "%s %s :1 %s\n", target_p->name, me.name, p);
134 <    fbputs(buff, file, nbytes);
133 >    snprintf(buff, sizeof(buff), "%s %s :1 %s\n",
134 >             target_p->name, me.name, target_p->info);
135 >    fputs(buff, file);
136    }
137  
138 <  fbclose(file);
138 >  fclose(file);
139   }
140  
141   /* hunt_server()
# Line 185 | Line 166 | hunt_server(struct Client *client_p, str
166    dlink_node *ptr;
167    int wilds;
168  
169 <  /* Assume it's me, if no server
170 <   */
171 <  if (parc <= server || EmptyString(parv[server]) ||
172 <      match(me.name, parv[server]) ||
173 <      match(parv[server], me.name) ||
174 <      !strcmp(parv[server], me.id))
194 <    return(HUNTED_ISME);
169 >  /* Assume it's me, if no server */
170 >  if (parc <= server || EmptyString(parv[server]))
171 >    return HUNTED_ISME;
172 >
173 >  if (!strcmp(parv[server], me.id) || match(parv[server], me.name))
174 >    return HUNTED_ISME;
175  
176    /* These are to pickup matches that would cause the following
177     * message to go in the wrong direction while doing quick fast
# Line 211 | Line 191 | hunt_server(struct Client *client_p, str
191        target_p = NULL;
192  
193    collapse(parv[server]);
194 <  wilds = (strchr(parv[server], '?') || strchr(parv[server], '*'));
194 >  wilds = has_wildcards(parv[server]);
195  
196    /* Again, if there are no wild cards involved in the server
197     * name, use the hash lookup
# Line 327 | Line 307 | try_connections(void *unused)
307        confrq = DEFAULT_CONNECTFREQUENCY;
308      else
309      {
310 <      confrq = ConFreq(cltmp);
311 <      if (confrq < MIN_CONN_FREQ )
310 >      confrq = cltmp->con_freq;
311 >      if (confrq < MIN_CONN_FREQ)
312          confrq = MIN_CONN_FREQ;
313      }
314  
# Line 340 | Line 320 | try_connections(void *unused)
320      if (hash_find_server(conf->name) != NULL)
321        continue;
322  
323 <    if (CurrUserCount(cltmp) < MaxTotal(cltmp))
323 >    if (cltmp->curr_user_count < cltmp->max_total)
324      {
325        /* Go to the end of the list, if not already last */
326        if (ptr->next != NULL)
# Line 361 | Line 341 | try_connections(void *unused)
341         *   -- adrian
342         */
343        if (ConfigServerHide.hide_server_ips)
344 <        sendto_realops_flags(UMODE_ALL, L_ALL, "Connection to %s activated.",
344 >        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
345 >                             "Connection to %s activated.",
346                               conf->name);
347        else
348 <        sendto_realops_flags(UMODE_ALL, L_ALL, "Connection to %s[%s] activated.",
348 >        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
349 >                             "Connection to %s[%s] activated.",
350                               conf->name, aconf->host);
351  
352        serv_connect(aconf, NULL);
# Line 407 | Line 389 | check_server(const char *name, struct Cl
389  
390    assert(client_p != NULL);
391  
410  if (client_p == NULL)
411    return(error);
412
413  if (strlen(name) > HOSTLEN)
414    return(-4);
415
392    /* loop through looking for all possible connect items that might work */
393    DLINK_FOREACH(ptr, server_items.head)
394    {
# Line 430 | Line 406 | check_server(const char *name, struct Cl
406          match(aconf->host, client_p->sockhost))
407      {
408        error = -2;
433      {
434        /* A NULL password is as good as a bad one */
435        if (EmptyString(client_p->localClient->passwd))
436          return(-2);
437
438        /* code in s_conf.c should not have allowed this to be NULL */
439        if (aconf->passwd == NULL)
440          return(-2);
409  
410 <        if (IsConfEncrypted(aconf))
411 <        {
412 <          if (strcmp(aconf->passwd,
413 <              (const char *)crypt(client_p->localClient->passwd,
446 <                                  aconf->passwd)) == 0)
447 <            server_conf = conf;
448 <        }
449 <        else
450 <        {
451 <          if (strcmp(aconf->passwd, client_p->localClient->passwd) == 0)
452 <            server_conf = conf;
453 <        }
454 <      }
410 >      if (!match_conf_password(client_p->localClient->passwd, aconf))
411 >        return -2;
412 >
413 >      server_conf = conf;
414      }
415    }
416  
# Line 460 | Line 419 | check_server(const char *name, struct Cl
419  
420    attach_conf(client_p, server_conf);
421  
463  /* Now find all leaf or hub config items for this server */
464  DLINK_FOREACH(ptr, hub_items.head)
465  {
466    conf = ptr->data;
467
468    if (!match(name, conf->name))
469      continue;
470    attach_conf(client_p, conf);
471  }
472
473  DLINK_FOREACH(ptr, leaf_items.head)
474  {
475    conf = ptr->data;
476
477    if (!match(name, conf->name))
478      continue;
479    attach_conf(client_p, conf);
480  }
481
422    server_aconf = map_to_conf(server_conf);
423  
484  if (!IsConfTopicBurst(server_aconf))
485  {
486    ClearCap(client_p, CAP_TB);
487    ClearCap(client_p, CAP_TBURST);
488  }
489
424    if (aconf != NULL)
425    {
426      struct sockaddr_in *v4;
# Line 497 | Line 431 | check_server(const char *name, struct Cl
431      {
432   #ifdef IPV6
433        case AF_INET6:
434 <        v6 = (struct sockaddr_in6 *)&aconf->ipnum;
434 >        v6 = (struct sockaddr_in6 *)&aconf->addr;
435  
436          if (IN6_IS_ADDR_UNSPECIFIED(&v6->sin6_addr))
437 <          memcpy(&aconf->ipnum, &client_p->localClient->ip, sizeof(struct irc_ssaddr));
437 >          memcpy(&aconf->addr, &client_p->localClient->ip, sizeof(struct irc_ssaddr));
438          break;
439   #endif
440        case AF_INET:
441 <        v4 = (struct sockaddr_in *)&aconf->ipnum;
441 >        v4 = (struct sockaddr_in *)&aconf->addr;
442  
443          if (v4->sin_addr.s_addr == INADDR_NONE)
444 <          memcpy(&aconf->ipnum, &client_p->localClient->ip, sizeof(struct irc_ssaddr));
444 >          memcpy(&aconf->addr, &client_p->localClient->ip, sizeof(struct irc_ssaddr));
445          break;
446      }
447    }
# Line 652 | Line 586 | sendnick_TS(struct Client *client_p, str
586      ubuf[1] = '\0';
587    }
588  
655  /* XXX Both of these need to have a :me.name or :mySID!?!?! */
589    if (IsCapable(client_p, CAP_SVS))
590    {
591      if (HasID(target_p) && IsCapable(client_p, CAP_TS6))
592 <      sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s %lu :%s",
592 >      sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s %s :%s",
593                   target_p->servptr->id,
594                   target_p->name, target_p->hopcount + 1,
595                   (unsigned long) target_p->tsinfo,
596                   ubuf, target_p->username, target_p->host,
597                   (MyClient(target_p) && IsIPSpoof(target_p)) ?
598                   "0" : target_p->sockhost, target_p->id,
599 <                 (unsigned long)target_p->servicestamp, target_p->info);
599 >                 target_p->svid, target_p->info);
600      else
601 <      sendto_one(client_p, "NICK %s %d %lu %s %s %s %s %lu :%s",
601 >      sendto_one(client_p, "NICK %s %d %lu %s %s %s %s %s :%s",
602                   target_p->name, target_p->hopcount + 1,
603                   (unsigned long) target_p->tsinfo,
604                   ubuf, target_p->username, target_p->host,
605 <                 target_p->servptr->name, (unsigned long)target_p->servicestamp,
605 >                 target_p->servptr->name, target_p->svid,
606                   target_p->info);
607    }
608    else
# Line 690 | Line 623 | sendnick_TS(struct Client *client_p, str
623                   target_p->servptr->name, target_p->info);
624    }
625  
626 <  if (IsConfAwayBurst((struct AccessItem *)map_to_conf(client_p->serv->sconf)))
627 <    if (!EmptyString(target_p->away))
628 <      sendto_one(client_p, ":%s AWAY :%s", target_p->name,
696 <                 target_p->away);
626 >  if (target_p->away[0])
627 >    sendto_one(client_p, ":%s AWAY :%s", ID_or_name(target_p, client_p),
628 >               target_p->away);
629  
630   }
631  
# Line 772 | Line 704 | server_estab(struct Client *client_p)
704        == NULL)
705    {
706      /* This shouldn't happen, better tell the ops... -A1kmm */
707 <    sendto_realops_flags(UMODE_ALL, L_ALL, "Warning: Lost connect{} block "
707 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
708 >                         "Warning: Lost connect{} block "
709                           "for server %s(this shouldn't happen)!", host);
710      exit_client(client_p, &me, "Lost connect{} block!");
711      return;
# Line 816 | Line 749 | server_estab(struct Client *client_p)
749       * - Dianora
750       */
751  
752 <    send_capabilities(client_p, aconf,
820 <      (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0));
752 >    send_capabilities(client_p, aconf, 0);
753  
754      sendto_one(client_p, "SERVER %s 1 :%s%s",
755                 me.name, ConfigServerHide.hidden ? "(H) " : "", me.info);
# Line 883 | Line 815 | server_estab(struct Client *client_p)
815      compression = SSL_get_current_compression(client_p->localClient->fd.ssl);
816      expansion   = SSL_get_current_expansion(client_p->localClient->fd.ssl);
817  
818 <    sendto_realops_flags(UMODE_ALL, L_ADMIN,
818 >    sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
819                           "Link with %s established: [SSL: %s, Compression/Expansion method: %s/%s] (Capabilities: %s)",
820                           inpath_ip, ssl_get_cipher(client_p->localClient->fd.ssl),
821                           compression ? SSL_COMP_get_name(compression) : "NONE",
822                           expansion ? SSL_COMP_get_name(expansion) : "NONE",
823                           show_capabilities(client_p));
824      /* Now show the masked hostname/IP to opers */
825 <    sendto_realops_flags(UMODE_ALL, L_OPER,
825 >    sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
826                           "Link with %s established: [SSL: %s, Compression/Expansion method: %s/%s] (Capabilities: %s)",
827                           inpath, ssl_get_cipher(client_p->localClient->fd.ssl),
828                           compression ? SSL_COMP_get_name(compression) : "NONE",
# Line 905 | Line 837 | server_estab(struct Client *client_p)
837    else
838   #endif
839    {
840 <    sendto_realops_flags(UMODE_ALL, L_ADMIN,
840 >    sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
841                           "Link with %s established: (Capabilities: %s)",
842 <                         inpath_ip,show_capabilities(client_p));
842 >                         inpath_ip, show_capabilities(client_p));
843      /* Now show the masked hostname/IP to opers */
844 <    sendto_realops_flags(UMODE_ALL, L_OPER,
844 >    sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
845                           "Link with %s established: (Capabilities: %s)",
846 <                         inpath,show_capabilities(client_p));
846 >                         inpath, show_capabilities(client_p));
847      ilog(LOG_TYPE_IRCD, "Link with %s established: (Capabilities: %s)",
848           inpath_ip, show_capabilities(client_p));
849    }
850  
919  client_p->serv->sconf = conf;
920
851    fd_note(&client_p->localClient->fd, "Server: %s", client_p->name);
852  
853    /* Old sendto_serv_but_one() call removed because we now
# Line 1038 | Line 968 | burst_all(struct Client *client_p)
968        burst_members(client_p, chptr);
969        send_channel_modes(client_p, chptr);
970  
971 <      if (IsCapable(client_p, CAP_TBURST) ||
1042 <          IsCapable(client_p, CAP_TB))
971 >      if (IsCapable(client_p, CAP_TBURST))
972          send_tb(client_p, chptr);
973      }
974    }
# Line 1071 | Line 1000 | burst_all(struct Client *client_p)
1000   *              - pointer to channel
1001   * output       - NONE
1002   * side effects - Called on a server burst when
1003 < *                server is CAP_TB|CAP_TBURST capable
1003 > *                server is CAP_TBURST capable
1004   */
1005   static void
1006   send_tb(struct Client *client_p, struct Channel *chptr)
# Line 1090 | Line 1019 | send_tb(struct Client *client_p, struct
1019     * for further information   -Michael
1020     */
1021    if (chptr->topic_time != 0)
1022 <  {
1023 <    if (IsCapable(client_p, CAP_TBURST))
1024 <      sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s",
1025 <                 me.name, (unsigned long)chptr->channelts, chptr->chname,
1026 <                 (unsigned long)chptr->topic_time,
1027 <                 chptr->topic_info,
1099 <                 chptr->topic);
1100 <    else if (IsCapable(client_p, CAP_TB))
1101 <    {
1102 <      if (ConfigChannel.burst_topicwho)
1103 <      {
1104 <        sendto_one(client_p, ":%s TB %s %lu %s :%s",
1105 <                   me.name, chptr->chname,
1106 <                   (unsigned long)chptr->topic_time,
1107 <                   chptr->topic_info, chptr->topic);
1108 <      }
1109 <      else
1110 <      {
1111 <        sendto_one(client_p, ":%s TB %s %lu :%s",
1112 <                   me.name, chptr->chname,
1113 <                   (unsigned long)chptr->topic_time,
1114 <                   chptr->topic);
1115 <      }
1116 <    }
1117 <  }
1022 >    sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s",
1023 >               ID_or_name(&me, client_p),
1024 >               (unsigned long)chptr->channelts, chptr->chname,
1025 >               (unsigned long)chptr->topic_time,
1026 >               chptr->topic_info,
1027 >               chptr->topic);
1028   }
1029  
1030   /* burst_members()
# Line 1172 | Line 1082 | serv_connect(struct AccessItem *aconf, s
1082   {
1083    struct ConfItem *conf;
1084    struct Client *client_p;
1085 <  char buf[HOSTIPLEN];
1085 >  char buf[HOSTIPLEN + 1];
1086  
1087    /* conversion structs */
1088    struct sockaddr_in *v4;
1089    /* Make sure aconf is useful */
1090    assert(aconf != NULL);
1091  
1182  if(aconf == NULL)
1183    return (0);
1184
1092    /* XXX should be passing struct ConfItem in the first place */
1093    conf = unmap_conf_item(aconf);
1094  
1095    /* log */
1096 <  getnameinfo((struct sockaddr *)&aconf->ipnum, aconf->ipnum.ss_len,
1096 >  getnameinfo((struct sockaddr *)&aconf->addr, aconf->addr.ss_len,
1097                buf, sizeof(buf), NULL, 0, NI_NUMERICHOST);
1098 <  ilog(LOG_TYPE_IRCD, "Connect to %s[%s] @%s", aconf->user, aconf->host,
1098 >  ilog(LOG_TYPE_IRCD, "Connect to %s[%s] @%s", conf->name, aconf->host,
1099         buf);
1100  
1101    /* Still processing a DNS lookup? -> exit */
1102    if (aconf->dns_pending)
1103    {
1104 <    sendto_realops_flags(UMODE_ALL, L_ALL,
1104 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1105                           "Error connecting to %s: DNS lookup for connect{} in progress.",
1106                           conf->name);
1107      return (0);
# Line 1202 | Line 1109 | serv_connect(struct AccessItem *aconf, s
1109  
1110    if (aconf->dns_failed)
1111    {
1112 <    sendto_realops_flags(UMODE_ALL, L_ALL,
1112 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1113                           "Error connecting to %s: DNS lookup for connect{} failed.",
1114                           conf->name);
1115      return (0);
# Line 1213 | Line 1120 | serv_connect(struct AccessItem *aconf, s
1120     */
1121    if ((client_p = hash_find_server(conf->name)) != NULL)
1122    {
1123 <    sendto_realops_flags(UMODE_ALL, L_ADMIN,
1123 >    sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
1124                           "Server %s already present from %s",
1125                           conf->name, get_client_name(client_p, SHOW_IP));
1126 <    sendto_realops_flags(UMODE_ALL, L_OPER,
1126 >    sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
1127                           "Server %s already present from %s",
1128                           conf->name, get_client_name(client_p, MASK_IP));
1129      if (by && IsClient(by) && !MyClient(by))
# Line 1237 | Line 1144 | serv_connect(struct AccessItem *aconf, s
1144    strlcpy(client_p->sockhost, buf, sizeof(client_p->sockhost));
1145  
1146    /* create a socket for the server connection */
1147 <  if (comm_open(&client_p->localClient->fd, aconf->ipnum.ss.ss_family,
1147 >  if (comm_open(&client_p->localClient->fd, aconf->addr.ss.ss_family,
1148                  SOCK_STREAM, 0, NULL) < 0)
1149    {
1150      /* Eek, failure to create the socket */
# Line 1256 | Line 1163 | serv_connect(struct AccessItem *aconf, s
1163     */
1164    if (!attach_connect_block(client_p, conf->name, aconf->host))
1165    {
1166 <    sendto_realops_flags(UMODE_ALL, L_ALL,
1167 <                         "Host %s is not enabled for connecting:no C/N-line",
1166 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1167 >                         "Host %s is not enabled for connecting: no connect{} block",
1168                           conf->name);
1169      if (by && IsClient(by) && !MyClient(by))  
1170        sendto_one(by, ":%s NOTICE %s :Connect to host %s failed.",
# Line 1292 | Line 1199 | serv_connect(struct AccessItem *aconf, s
1199    switch (aconf->aftype)
1200    {
1201      case AF_INET:
1202 <      v4 = (struct sockaddr_in*)&aconf->my_ipnum;
1202 >      v4 = (struct sockaddr_in*)&aconf->bind;
1203        if (v4->sin_addr.s_addr != 0)
1204        {
1205          struct irc_ssaddr ipn;
1206          memset(&ipn, 0, sizeof(struct irc_ssaddr));
1207          ipn.ss.ss_family = AF_INET;
1208          ipn.ss_port = 0;
1209 <        memcpy(&ipn, &aconf->my_ipnum, sizeof(struct irc_ssaddr));
1209 >        memcpy(&ipn, &aconf->bind, sizeof(struct irc_ssaddr));
1210          comm_connect_tcp(&client_p->localClient->fd, aconf->host, aconf->port,
1211                           (struct sockaddr *)&ipn, ipn.ss_len,
1212                           serv_connect_callback, client_p, aconf->aftype,
# Line 1330 | Line 1237 | serv_connect(struct AccessItem *aconf, s
1237          struct sockaddr_in6 *v6conf;
1238  
1239          memset(&ipn, 0, sizeof(struct irc_ssaddr));
1240 <        v6conf = (struct sockaddr_in6 *)&aconf->my_ipnum;
1240 >        v6conf = (struct sockaddr_in6 *)&aconf->bind;
1241          v6 = (struct sockaddr_in6 *)&ipn;
1242  
1243          if (memcmp(&v6conf->sin6_addr, &v6->sin6_addr,
1244                     sizeof(struct in6_addr)) != 0)
1245          {
1246 <          memcpy(&ipn, &aconf->my_ipnum, sizeof(struct irc_ssaddr));
1246 >          memcpy(&ipn, &aconf->bind, sizeof(struct irc_ssaddr));
1247            ipn.ss.ss_family = AF_INET6;
1248            ipn.ss_port = 0;
1249            comm_connect_tcp(&client_p->localClient->fd,
# Line 1378 | Line 1285 | finish_ssl_server_handshake(struct Clien
1285                          client_p->name, SERVER_TYPE);
1286    if (conf == NULL)
1287    {
1288 <    sendto_realops_flags(UMODE_ALL, L_ADMIN,
1288 >    sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
1289                           "Lost connect{} block for %s", get_client_name(client_p, HIDE_IP));
1290 <    sendto_realops_flags(UMODE_ALL, L_OPER,
1290 >    sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
1291                           "Lost connect{} block for %s", get_client_name(client_p, MASK_IP));
1292  
1293      exit_client(client_p, &me, "Lost connect{} block");
# Line 1394 | Line 1301 | finish_ssl_server_handshake(struct Clien
1301      sendto_one(client_p, "PASS %s TS %d %s",
1302                 aconf->spasswd, TS_CURRENT, me.id);
1303  
1304 <  send_capabilities(client_p, aconf,
1398 <                   (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0));
1304 >  send_capabilities(client_p, aconf, 0);
1305  
1306    sendto_one(client_p, "SERVER %s 1 :%s%s",
1307               me.name, ConfigServerHide.hidden ? "(H) " : "",
# Line 1406 | Line 1312 | finish_ssl_server_handshake(struct Clien
1312     */
1313    if (IsDead(client_p))
1314    {
1315 <      sendto_realops_flags(UMODE_ALL, L_ADMIN,
1315 >      sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
1316                             "%s[%s] went dead during handshake",
1317                             client_p->name,
1318                             client_p->host);
1319 <      sendto_realops_flags(UMODE_ALL, L_OPER,
1319 >      sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
1320                             "%s went dead during handshake", client_p->name);
1321        return;
1322    }
# Line 1434 | Line 1340 | ssl_server_handshake(fde_t *fd, struct C
1340      {
1341        case SSL_ERROR_WANT_WRITE:
1342          comm_setselect(&client_p->localClient->fd, COMM_SELECT_WRITE,
1343 <            (PF *) ssl_server_handshake, client_p, 0);
1343 >                       (PF *)ssl_server_handshake, client_p, 0);
1344          return;
1345        case SSL_ERROR_WANT_READ:
1346          comm_setselect(&client_p->localClient->fd, COMM_SELECT_READ,
1347 <            (PF *) ssl_server_handshake, client_p, 0);
1347 >                       (PF *)ssl_server_handshake, client_p, 0);
1348          return;
1349        default:
1350 +      {
1351 +        const char *sslerr = ERR_error_string(ERR_get_error(), NULL);
1352 +        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1353 +                             "Error connecting to %s: %s", client_p->name,
1354 +                             sslerr ? sslerr : "unknown SSL error");
1355          exit_client(client_p, client_p, "Error during SSL handshake");
1356          return;
1357 +      }
1358      }
1359    }
1360  
# Line 1499 | Line 1411 | serv_connect_callback(fde_t *fd, int sta
1411       * Admins get to see any IP, mere opers don't *sigh*
1412       */
1413       if (ConfigServerHide.hide_server_ips)
1414 <       sendto_realops_flags(UMODE_ALL, L_ADMIN,
1414 >       sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
1415                              "Error connecting to %s: %s",
1416                              client_p->name, comm_errstr(status));
1417       else
1418 <       sendto_realops_flags(UMODE_ALL, L_ADMIN,
1418 >       sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
1419                              "Error connecting to %s[%s]: %s", client_p->name,
1420                              client_p->host, comm_errstr(status));
1421  
1422 <     sendto_realops_flags(UMODE_ALL, L_OPER,
1422 >     sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
1423                            "Error connecting to %s: %s",
1424                            client_p->name, comm_errstr(status));
1425  
# Line 1524 | Line 1436 | serv_connect_callback(fde_t *fd, int sta
1436                          client_p->name, SERVER_TYPE);
1437    if (conf == NULL)
1438    {
1439 <    sendto_realops_flags(UMODE_ALL, L_ADMIN,
1439 >    sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
1440                           "Lost connect{} block for %s", get_client_name(client_p, HIDE_IP));
1441 <    sendto_realops_flags(UMODE_ALL, L_OPER,
1441 >    sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
1442                           "Lost connect{} block for %s", get_client_name(client_p, MASK_IP));
1443  
1444      exit_client(client_p, &me, "Lost connect{} block");
# Line 1550 | Line 1462 | serv_connect_callback(fde_t *fd, int sta
1462      sendto_one(client_p, "PASS %s TS %d %s",
1463                 aconf->spasswd, TS_CURRENT, me.id);
1464  
1465 <  send_capabilities(client_p, aconf,
1554 <                   (IsConfTopicBurst(aconf) ? CAP_TBURST|CAP_TB : 0));
1465 >  send_capabilities(client_p, aconf, 0);
1466  
1467    sendto_one(client_p, "SERVER %s 1 :%s%s",
1468               me.name, ConfigServerHide.hidden ? "(H) " : "",
# Line 1562 | Line 1473 | serv_connect_callback(fde_t *fd, int sta
1473     */
1474    if (IsDead(client_p))
1475    {
1476 <      sendto_realops_flags(UMODE_ALL, L_ADMIN,
1476 >      sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
1477                             "%s[%s] went dead during handshake",
1478                             client_p->name,
1479                             client_p->host);
1480 <      sendto_realops_flags(UMODE_ALL, L_OPER,
1480 >      sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
1481                             "%s went dead during handshake", client_p->name);
1482        return;
1483    }

Diff Legend

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