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/trunk/src/s_serv.c (file contents):
Revision 3110 by michael, Thu Mar 6 20:33:17 2014 UTC vs.
Revision 3215 by michael, Tue Mar 25 19:23:15 2014 UTC

# Line 78 | Line 78 | write_links_file(void *notused)
78   {
79    FILE *file = NULL;
80    dlink_node *ptr = NULL, *ptr_next = NULL;
81 <  char buff[IRCD_BUFSIZE] = { '\0' };
81 >  char buff[IRCD_BUFSIZE] = "";
82  
83    if ((file = fopen(LIPATH, "w")) == NULL)
84      return;
# Line 127 | Line 127 | read_links_file(void)
127   {
128    FILE *file = NULL;
129    char *p = NULL;
130 <  char buff[IRCD_BUFSIZE] = { '\0' };
130 >  char buff[IRCD_BUFSIZE] = "";
131  
132    if ((file = fopen(LIPATH, "r")) == NULL)
133      return;
# Line 163 | Line 163 | read_links_file(void)
163   *      returns: (see #defines)
164   */
165   int
166 < hunt_server(struct Client *client_p, struct Client *source_p, const char *command,
166 > hunt_server(struct Client *source_p, const char *command,
167              const int server, const int parc, char *parv[])
168   {
169    struct Client *target_p = NULL;
# Line 185 | Line 185 | hunt_server(struct Client *client_p, str
185    if (MyClient(source_p))
186      target_p = hash_find_client(parv[server]);
187    else
188 <    target_p = find_person(client_p, parv[server]);
188 >    target_p = find_person(source_p, parv[server]);
189  
190    if (target_p)
191      if (target_p->from == source_p->from && !MyConnect(target_p))
# Line 222 | Line 222 | hunt_server(struct Client *client_p, str
222              continue;
223            target_p = ptr->data;
224  
225 <          if (IsRegistered(target_p) && (target_p != client_p))
225 >          if (IsRegistered(target_p) && (target_p != source_p->from))
226              break;
227          }
228        }
# Line 243 | Line 243 | hunt_server(struct Client *client_p, str
243      if (match(target_p->name, parv[server]))
244        parv[server] = target_p->name;
245  
246 +    /* This is a little kludgy but should work... */
247      sendto_one(target_p, command, ID_or_name(source_p, target_p),
248                 parv[1], parv[2], parv[3], parv[4],
249                 parv[5], parv[6], parv[7], parv[8]);
# Line 576 | Line 577 | sendnick_TS(struct Client *client_p, str
577    }
578  
579    if (IsCapable(client_p, CAP_SVS))
580 <  {
581 <    if (HasID(target_p) && IsCapable(client_p, CAP_TS6))
582 <      sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s %s :%s",
583 <                 target_p->servptr->id,
584 <                 target_p->name, target_p->hopcount + 1,
585 <                 (unsigned long) target_p->tsinfo,
586 <                 ubuf, target_p->username, target_p->host,
587 <                 (MyClient(target_p) && IsIPSpoof(target_p)) ?
587 <                 "0" : target_p->sockhost, target_p->id,
588 <                 target_p->svid, target_p->info);
589 <    else
590 <      sendto_one(client_p, "NICK %s %d %lu %s %s %s %s %s :%s",
591 <                 target_p->name, target_p->hopcount + 1,
592 <                 (unsigned long) target_p->tsinfo,
593 <                 ubuf, target_p->username, target_p->host,
594 <                 target_p->servptr->name, target_p->svid,
595 <                 target_p->info);
596 <  }
580 >    sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s %s :%s",
581 >               target_p->servptr->id,
582 >               target_p->name, target_p->hopcount + 1,
583 >               (unsigned long) target_p->tsinfo,
584 >               ubuf, target_p->username, target_p->host,
585 >               (MyClient(target_p) && IsIPSpoof(target_p)) ?
586 >               "0" : target_p->sockhost, target_p->id,
587 >               target_p->svid, target_p->info);
588    else
589 <  {
590 <    if (HasID(target_p) && IsCapable(client_p, CAP_TS6))
591 <      sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s :%s",
592 <                 target_p->servptr->id,
593 <                 target_p->name, target_p->hopcount + 1,
594 <                 (unsigned long) target_p->tsinfo,
595 <                 ubuf, target_p->username, target_p->host,
605 <                 (MyClient(target_p) && IsIPSpoof(target_p)) ?
606 <                 "0" : target_p->sockhost, target_p->id, target_p->info);
607 <    else
608 <      sendto_one(client_p, "NICK %s %d %lu %s %s %s %s :%s",
609 <                 target_p->name, target_p->hopcount + 1,
610 <                 (unsigned long) target_p->tsinfo,
611 <                 ubuf, target_p->username, target_p->host,
612 <                 target_p->servptr->name, target_p->info);
613 <  }
589 >    sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s :%s",
590 >               target_p->servptr->id,
591 >               target_p->name, target_p->hopcount + 1,
592 >               (unsigned long) target_p->tsinfo,
593 >               ubuf, target_p->username, target_p->host,
594 >               (MyClient(target_p) && IsIPSpoof(target_p)) ?
595 >               "0" : target_p->sockhost, target_p->id, target_p->info);
596  
597    if (!EmptyString(target_p->certfp))
598 <    sendto_one(client_p, ":%s CERTFP %s",
617 <               ID_or_name(target_p, client_p), target_p->certfp);
598 >    sendto_one(client_p, ":%s CERTFP %s", target_p->id, target_p->certfp);
599  
600    if (target_p->away[0])
601 <    sendto_one(client_p, ":%s AWAY :%s", ID_or_name(target_p, client_p),
621 <               target_p->away);
601 >    sendto_one(client_p, ":%s AWAY :%s", target_p->id, target_p->away);
602  
603   }
604  
# Line 676 | Line 656 | make_server(struct Client *client_p)
656   void
657   server_estab(struct Client *client_p)
658   {
679  struct Client *target_p;
659    struct MaskItem *conf = NULL;
660    char *host;
661    const char *inpath;
# Line 700 | Line 679 | server_estab(struct Client *client_p)
679      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
680                           "Warning: Lost connect{} block "
681                           "for server %s(this shouldn't happen)!", host);
682 <    exit_client(client_p, &me, "Lost connect{} block!");
682 >    exit_client(client_p, "Lost connect{} block!");
683      return;
684    }
685  
# Line 719 | Line 698 | server_estab(struct Client *client_p)
698      {
699        ++ServerStats.is_ref;
700        sendto_one(client_p, "ERROR :I'm a leaf not a hub");
701 <      exit_client(client_p, &me, "I'm a leaf");
701 >      exit_client(client_p, "I'm a leaf");
702        return;
703      }
704    }
# Line 737 | Line 716 | server_estab(struct Client *client_p)
716    sendto_one(client_p, "SVINFO %d %d 0 :%lu", TS_CURRENT, TS_MIN,
717               (unsigned long)CurrentTime);
718  
740  /* assumption here is if they passed the correct TS version, they also passed an SID */
741  if (IsCapable(client_p, CAP_TS6))
742    hash_add_id(client_p);
743
719    /* XXX Does this ever happen? I don't think so -db */
720    detach_conf(client_p, CONF_OPER);
721  
# Line 762 | Line 737 | server_estab(struct Client *client_p)
737  
738    SetServer(client_p);
739  
765  /* Update the capability combination usage counts. -A1kmm */
766  set_chcap_usage_counts(client_p);
767
740    /* Some day, all these lists will be consolidated *sigh* */
741    dlinkAdd(client_p, &client_p->lnode, &me.serv->server_list);
742  
# Line 777 | Line 749 | server_estab(struct Client *client_p)
749  
750    dlinkAdd(client_p, make_dlink_node(), &global_serv_list);
751    hash_add_client(client_p);
752 +  hash_add_id(client_p);
753  
754    /* doesnt duplicate client_p->serv if allocated this struct already */
755    make_server(client_p);
# Line 829 | Line 802 | server_estab(struct Client *client_p)
802  
803    fd_note(&client_p->localClient->fd, "Server: %s", client_p->name);
804  
805 <  /* Old sendto_serv_but_one() call removed because we now
806 <  ** need to send different names to different servers
807 <  ** (domain name matching) Send new server to other servers.
835 <  */
836 <  DLINK_FOREACH(ptr, serv_list.head)
837 <  {
838 <    target_p = ptr->data;
839 <
840 <    if (target_p == client_p)
841 <      continue;
842 <
843 <    if (IsCapable(target_p, CAP_TS6) && HasID(client_p))
844 <      sendto_one(target_p, ":%s SID %s 2 %s :%s%s",
845 <                 me.id, client_p->name, client_p->id,
846 <                 IsHidden(client_p) ? "(H) " : "",
847 <                 client_p->info);
848 <    else
849 <      sendto_one(target_p,":%s SERVER %s 2 :%s%s",
850 <                 me.name, client_p->name,
851 <                 IsHidden(client_p) ? "(H) " : "",
852 <                 client_p->info);
853 <  }
805 >  sendto_server(client_p, NOCAPS, NOCAPS, ":%s SID %s 2 %s :%s%s",
806 >                me.id, client_p->name, client_p->id,
807 >                IsHidden(client_p) ? "(H) " : "", client_p->info);
808  
809    /*
810     * Pass on my client information to the new server
# Line 873 | Line 827 | server_estab(struct Client *client_p)
827  
828    DLINK_FOREACH_PREV(ptr, global_serv_list.tail)
829    {
830 <    target_p = ptr->data;
830 >    struct Client *target_p = ptr->data;
831  
832      /* target_p->from == target_p for target_p == client_p */
833      if (IsMe(target_p) || target_p->from == client_p)
834        continue;
835  
836 <    if (IsCapable(client_p, CAP_TS6))
837 <    {
838 <      if (HasID(target_p))
839 <        sendto_one(client_p, ":%s SID %s %d %s :%s%s",
886 <                   ID(target_p->servptr), target_p->name, target_p->hopcount+1,
887 <                   target_p->id, IsHidden(target_p) ? "(H) " : "",
888 <                   target_p->info);
889 <      else  /* introducing non-ts6 server */
890 <        sendto_one(client_p, ":%s SERVER %s %d :%s%s",
891 <                   ID(target_p->servptr), target_p->name, target_p->hopcount+1,
892 <                   IsHidden(target_p) ? "(H) " : "", target_p->info);
893 <    }
894 <    else
895 <      sendto_one(client_p, ":%s SERVER %s %d :%s%s",
896 <                 target_p->servptr->name, target_p->name, target_p->hopcount+1,
897 <                 IsHidden(target_p) ? "(H) " : "", target_p->info);
836 >    sendto_one(client_p, ":%s SID %s %d %s :%s%s",
837 >               target_p->servptr->id, target_p->name, target_p->hopcount+1,
838 >               target_p->id, IsHidden(target_p) ? "(H) " : "",
839 >               target_p->info);
840  
841      if (HasFlag(target_p, FLAGS_EOB))
842 <      sendto_one(client_p, ":%s EOB", ID_or_name(target_p, client_p));
842 >      sendto_one(client_p, ":%s EOB", target_p->id, client_p);
843    }
844  
845    server_burst(client_p);
# Line 928 | Line 870 | server_burst(struct Client *client_p)
870  
871    /* EOB stuff is now in burst_all */
872    /* Always send a PING after connect burst is done */
873 <  sendto_one(client_p, "PING :%s", ID_or_name(&me, client_p));
873 >  sendto_one(client_p, "PING :%s", me.id);
874   }
875  
876   /* burst_all()
# Line 969 | Line 911 | burst_all(struct Client *client_p)
911    }
912  
913    if (IsCapable(client_p, CAP_EOB))
914 <    sendto_one(client_p, ":%s EOB", ID_or_name(&me, client_p));
914 >    sendto_one(client_p, ":%s EOB", me.id);
915   }
916  
917   /*
# Line 998 | Line 940 | send_tb(struct Client *client_p, struct
940     * for further information   -Michael
941     */
942    if (chptr->topic_time != 0)
943 <    sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s",
1002 <               ID_or_name(&me, client_p),
943 >    sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s", me.id,
944                 (unsigned long)chptr->channelts, chptr->chname,
945                 (unsigned long)chptr->topic_time,
946                 chptr->topic_info,
# Line 1125 | Line 1066 | serv_connect(struct MaskItem *conf, stru
1066      report_error(L_ALL, "opening stream socket to %s: %s",
1067                   conf->name, errno);
1068      SetDead(client_p);
1069 <    exit_client(client_p, &me, "Connection failed");
1069 >    exit_client(client_p, "Connection failed");
1070      return 0;
1071    }
1072  
# Line 1144 | Line 1085 | serv_connect(struct MaskItem *conf, stru
1085        sendto_one_notice(by, &me, ":Connect to host %s failed.", client_p->name);
1086  
1087      SetDead(client_p);
1088 <    exit_client(client_p, client_p, "Connection failed");
1088 >    exit_client(client_p, "Connection failed");
1089      return 0;
1090    }
1091  
# Line 1262 | Line 1203 | finish_ssl_server_handshake(struct Clien
1203      sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
1204                           "Lost connect{} block for %s", get_client_name(client_p, MASK_IP));
1205  
1206 <    exit_client(client_p, &me, "Lost connect{} block");
1206 >    exit_client(client_p, "Lost connect{} block");
1207      return;
1208    }
1209  
# Line 1317 | Line 1258 | ssl_server_handshake(fde_t *fd, struct C
1258          sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1259                               "Error connecting to %s: %s", client_p->name,
1260                               sslerr ? sslerr : "unknown SSL error");
1261 <        exit_client(client_p, client_p, "Error during SSL handshake");
1261 >        exit_client(client_p, "Error during SSL handshake");
1262          return;
1263        }
1264      }
# Line 1359 | Line 1300 | ssl_connect_init(struct Client *client_p
1300      ilog(LOG_TYPE_IRCD, "SSL_new() ERROR! -- %s",
1301           ERR_error_string(ERR_get_error(), NULL));
1302      SetDead(client_p);
1303 <    exit_client(client_p, client_p, "SSL_new failed");
1303 >    exit_client(client_p, "SSL_new failed");
1304      return;
1305    }
1306  
# Line 1430 | Line 1371 | serv_connect_callback(fde_t *fd, int sta
1371      sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE,
1372                           "Lost connect{} block for %s", get_client_name(client_p, MASK_IP));
1373  
1374 <    exit_client(client_p, &me, "Lost connect{} block");
1374 >    exit_client(client_p, "Lost connect{} block");
1375      return;
1376    }
1377  

Diff Legend

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