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 3215 by michael, Tue Mar 25 19:23:15 2014 UTC vs.
Revision 3246 by michael, Sun Mar 30 17:37:13 2014 UTC

# Line 134 | Line 134 | read_links_file(void)
134  
135    while (fgets(buff, sizeof(buff), file))
136    {
137 <    if ((p = strchr(buff, '\n')) != NULL)
137 >    if ((p = strchr(buff, '\n')))
138        *p = '\0';
139  
140      dlinkAddTail(xstrdup(buff), make_dlink_node(), &flatten_links);
# Line 229 | Line 229 | hunt_server(struct Client *source_p, con
229      }
230    }
231  
232 <  if (target_p != NULL)
232 >  if (target_p)
233    {
234 <    if(!IsRegistered(target_p))
234 >    if (!IsRegistered(target_p))
235      {
236        sendto_one_numeric(source_p, &me, ERR_NOSUCHSERVER, parv[server]);
237        return HUNTED_NOSUCH;
# Line 307 | Line 307 | try_connections(void *unused)
307  
308      conf->until = CurrentTime + confrq;
309  
310 <    /* Found a CONNECT config with port specified, scan clients
310 >    /*
311 >     * Found a CONNECT config with port specified, scan clients
312       * and see if this server is already connected?
313       */
314 <    if (hash_find_server(conf->name) != NULL)
314 >    if (hash_find_server(conf->name))
315        continue;
316  
317      if (conf->class->ref_count < conf->class->max_total)
318      {
319        /* Go to the end of the list, if not already last */
320 <      if (ptr->next != NULL)
320 >      if (ptr->next)
321        {
322          dlinkDelete(ptr, &server_items);
323          dlinkAddTail(conf, &conf->node, &server_items);
# Line 325 | Line 326 | try_connections(void *unused)
326        if (find_servconn_in_progress(conf->name))
327          return;
328  
329 <      /* We used to only print this if serv_connect() actually
329 >      /*
330 >       * We used to only print this if serv_connect() actually
331         * succeeded, but since comm_tcp_connect() can call the callback
332         * immediately if there is an error, we were getting error messages
333         * in the wrong order. SO, we just print out the activated line,
# Line 367 | Line 369 | valid_servname(const char *name)
369        ++dots;
370    }
371  
372 <  return dots != 0 && length <= HOSTLEN;
372 >  return dots && length <= HOSTLEN;
373   }
374  
375   int
# Line 378 | Line 380 | check_server(const char *name, struct Cl
380    struct MaskItem *server_conf = NULL;
381    int error = -1;
382  
383 <  assert(client_p != NULL);
383 >  assert(client_p);
384  
385    /* loop through looking for all possible connect items that might work */
386    DLINK_FOREACH(ptr, server_items.head)
# Line 414 | Line 416 | check_server(const char *name, struct Cl
416    attach_conf(client_p, server_conf);
417  
418  
419 <  if (server_conf != NULL)
419 >  if (server_conf)
420    {
421      struct sockaddr_in *v4;
422   #ifdef IPV6
# Line 530 | Line 532 | find_capability(const char *capab)
532   void
533   send_capabilities(struct Client *client_p, int cap_can_send)
534   {
535 <  struct Capability *cap=NULL;
536 <  char msgbuf[IRCD_BUFSIZE];
535 <  char *t;
535 >  char msgbuf[IRCD_BUFSIZE] = "";
536 >  char *t = msgbuf;
537    int tl;
538 <  dlink_node *ptr;
538 <
539 <  t = msgbuf;
538 >  dlink_node *ptr = NULL;
539  
540    DLINK_FOREACH(ptr, cap_list.head)
541    {
542 <    cap = ptr->data;
542 >    struct Capability *cap = ptr->data;
543  
544      if (cap->cap & (cap_can_send|default_server_capabs))
545      {
# Line 563 | Line 562 | send_capabilities(struct Client *client_
562   void
563   sendnick_TS(struct Client *client_p, struct Client *target_p)
564   {
565 <  char ubuf[IRCD_BUFSIZE];
565 >  char ubuf[IRCD_BUFSIZE] = "";
566  
567    if (!IsClient(target_p))
568      return;
# Line 665 | Line 664 | server_estab(struct Client *client_p)
664    const COMP_METHOD *compression = NULL, *expansion = NULL;
665   #endif
666  
667 <  assert(client_p != NULL);
667 >  assert(client_p);
668  
669    strlcpy(inpath_ip, get_client_name(client_p, SHOW_IP), sizeof(inpath_ip));
670  
# Line 888 | Line 887 | burst_all(struct Client *client_p)
887    {
888      struct Channel *chptr = ptr->data;
889  
890 <    if (dlink_list_length(&chptr->members) != 0)
890 >    if (dlink_list_length(&chptr->members))
891      {
892        burst_members(client_p, chptr);
893        send_channel_modes(client_p, chptr);
# Line 939 | Line 938 | send_tb(struct Client *client_p, struct
938     * it to their old topic they had before.  Read m_tburst.c:ms_tburst
939     * for further information   -Michael
940     */
941 <  if (chptr->topic_time != 0)
941 >  if (chptr->topic_time)
942      sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s", me.id,
943                 (unsigned long)chptr->channelts, chptr->chname,
944                 (unsigned long)chptr->topic_time,
# Line 1000 | Line 999 | burst_members(struct Client *client_p, s
999   int
1000   serv_connect(struct MaskItem *conf, struct Client *by)
1001   {
1002 <  struct Client *client_p;
1003 <  char buf[HOSTIPLEN + 1];
1002 >  struct Client *client_p = NULL;
1003 >  char buf[HOSTIPLEN + 1] = "";
1004  
1005    /* conversion structs */
1006    struct sockaddr_in *v4;
1008  /* Make sure conf is useful */
1009  assert(conf != NULL);
1007  
1008 +  /* Make sure conf is useful */
1009 +  assert(conf);
1010  
1011    getnameinfo((struct sockaddr *)&conf->addr, conf->addr.ss_len,
1012                buf, sizeof(buf), NULL, 0, NI_NUMERICHOST);
# Line 1020 | Line 1019 | serv_connect(struct MaskItem *conf, stru
1019      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1020                           "Error connecting to %s: DNS lookup for connect{} in progress.",
1021                           conf->name);
1022 <    return (0);
1022 >    return 0;
1023    }
1024  
1025    if (conf->dns_failed)
# Line 1028 | Line 1027 | serv_connect(struct MaskItem *conf, stru
1027      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1028                           "Error connecting to %s: DNS lookup for connect{} failed.",
1029                           conf->name);
1030 <    return (0);
1030 >    return 0;
1031    }
1032  
1033    /* Make sure this server isn't already connected
1034     * Note: conf should ALWAYS be a valid C: line
1035     */
1036 <  if ((client_p = hash_find_server(conf->name)) != NULL)
1036 >  if ((client_p = hash_find_server(conf->name)))
1037    {
1038      sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE,
1039                           "Server %s already present from %s",
# Line 1115 | Line 1114 | serv_connect(struct MaskItem *conf, stru
1114    {
1115      case AF_INET:
1116        v4 = (struct sockaddr_in*)&conf->bind;
1117 <      if (v4->sin_addr.s_addr != 0)
1117 >      if (v4->sin_addr.s_addr)
1118        {
1119          struct irc_ssaddr ipn;
1120          memset(&ipn, 0, sizeof(struct irc_ssaddr));
# Line 1155 | Line 1154 | serv_connect(struct MaskItem *conf, stru
1154          v6conf = (struct sockaddr_in6 *)&conf->bind;
1155          v6 = (struct sockaddr_in6 *)&ipn;
1156  
1157 <        if (memcmp(&v6conf->sin6_addr, &v6->sin6_addr, sizeof(struct in6_addr)) != 0)
1157 >        if (memcmp(&v6conf->sin6_addr, &v6->sin6_addr, sizeof(struct in6_addr)))
1158          {
1159            memcpy(&ipn, &conf->bind, sizeof(struct irc_ssaddr));
1160            ipn.ss.ss_family = AF_INET6;
# Line 1328 | Line 1327 | serv_connect_callback(fde_t *fd, int sta
1327    struct MaskItem *conf = NULL;
1328  
1329    /* First, make sure its a real client! */
1330 <  assert(client_p != NULL);
1330 >  assert(client_p);
1331    assert(&client_p->localClient->fd == fd);
1332  
1333    /* Next, for backward purposes, record the ip of the server */
1334    memcpy(&client_p->localClient->ip, &fd->connect.hostaddr,
1335           sizeof(struct irc_ssaddr));
1336 +
1337    /* Check the status */
1338    if (status != COMM_OK)
1339    {

Diff Legend

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