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 1306 by michael, Sat Mar 24 07:43:04 2012 UTC vs.
Revision 1386 by michael, Tue May 1 11:35:46 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 82 | Line 81 | write_links_file(void* notused)
81    MessageFileLine *newMessageLine = 0;
82    MessageFile *MessageFileptr;
83    const char *p;
84 <  FBFILE *file;
84 >  FILE *file;
85    char buff[512];
86    dlink_node *ptr;
87  
88    MessageFileptr = &ConfigFileEntry.linksfile;
89  
90 <  if ((file = fbopen(MessageFileptr->fileName, "w")) == NULL)
90 >  if ((file = fopen(MessageFileptr->fileName, "w")) == NULL)
91      return;
92  
93    for (mptr = MessageFileptr->contentsOfFile; mptr; mptr = next_mptr)
# Line 102 | Line 101 | write_links_file(void* notused)
101  
102    DLINK_FOREACH(ptr, global_serv_list.head)
103    {
104 <    size_t nbytes = 0;
106 <    struct Client *target_p = ptr->data;
104 >    const struct Client *target_p = ptr->data;
105  
106      /* skip ourselves, we send ourselves in /links */
107      if (IsMe(target_p))
# Line 134 | Line 132 | write_links_file(void* notused)
132       */
133      assert(strlen(target_p->name) + strlen(me.name) + 6 + strlen(p) <=
134              MESSAGELINELEN);
135 <    ircsprintf(newMessageLine->line, "%s %s :1 %s",
136 <               target_p->name, me.name, p);
135 >    snprintf(newMessageLine->line, sizeof(newMessageLine->line), "%s %s :1 %s",
136 >             target_p->name, me.name, p);
137      newMessageLine->next = NULL;
138  
139      if (MessageFileptr->contentsOfFile)
# Line 150 | Line 148 | write_links_file(void* notused)
148        currentMessageLine = newMessageLine;
149      }
150  
151 <    nbytes = ircsprintf(buff, "%s %s :1 %s\n", target_p->name, me.name, p);
152 <    fbputs(buff, file, nbytes);
151 >    snprintf(buff, sizeof(buff), "%s %s :1 %s\n", target_p->name, me.name, p);
152 >    fputs(buff, file);
153    }
154  
155 <  fbclose(file);
155 >  fclose(file);
156   }
157  
158   /* hunt_server()
# Line 185 | Line 183 | hunt_server(struct Client *client_p, str
183    dlink_node *ptr;
184    int wilds;
185  
186 <  /* Assume it's me, if no server
187 <   */
188 <  if (parc <= server || EmptyString(parv[server]) ||
189 <      match(me.name, parv[server]) ||
190 <      match(parv[server], me.name) ||
191 <      !strcmp(parv[server], me.id))
194 <    return(HUNTED_ISME);
186 >  /* Assume it's me, if no server */
187 >  if (parc <= server || EmptyString(parv[server]))
188 >    return HUNTED_ISME;
189 >
190 >  if (!strcmp(parv[server], me.id) || match(parv[server], me.name))
191 >    return HUNTED_ISME;
192  
193    /* These are to pickup matches that would cause the following
194     * message to go in the wrong direction while doing quick fast
# Line 327 | Line 324 | try_connections(void *unused)
324        confrq = DEFAULT_CONNECTFREQUENCY;
325      else
326      {
327 <      confrq = ConFreq(cltmp);
328 <      if (confrq < MIN_CONN_FREQ )
327 >      confrq = cltmp->con_freq;
328 >      if (confrq < MIN_CONN_FREQ)
329          confrq = MIN_CONN_FREQ;
330      }
331  
# Line 340 | Line 337 | try_connections(void *unused)
337      if (hash_find_server(conf->name) != NULL)
338        continue;
339  
340 <    if (CurrUserCount(cltmp) < MaxTotal(cltmp))
340 >    if (cltmp->curr_user_count < cltmp->max_total)
341      {
342        /* Go to the end of the list, if not already last */
343        if (ptr->next != NULL)
# Line 460 | Line 457 | check_server(const char *name, struct Cl
457  
458    attach_conf(client_p, server_conf);
459  
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
460    server_aconf = map_to_conf(server_conf);
461  
462    if (!IsConfTopicBurst(server_aconf))
# Line 690 | Line 668 | sendnick_TS(struct Client *client_p, str
668                   target_p->servptr->name, target_p->info);
669    }
670  
671 <  if (IsConfAwayBurst((struct AccessItem *)map_to_conf(client_p->serv->sconf)))
671 >  if (IsConfAwayBurst((struct AccessItem *)map_to_conf(client_p->localClient->confs.head->data)))
672      if (!EmptyString(target_p->away))
673        sendto_one(client_p, ":%s AWAY :%s", target_p->name,
674                   target_p->away);
# Line 916 | Line 894 | server_estab(struct Client *client_p)
894           inpath_ip, show_capabilities(client_p));
895    }
896  
919  client_p->serv->sconf = conf;
920
897    fd_note(&client_p->localClient->fd, "Server: %s", client_p->name);
898  
899    /* Old sendto_serv_but_one() call removed because we now
# Line 1434 | Line 1410 | ssl_server_handshake(fde_t *fd, struct C
1410      {
1411        case SSL_ERROR_WANT_WRITE:
1412          comm_setselect(&client_p->localClient->fd, COMM_SELECT_WRITE,
1413 <            (PF *) ssl_server_handshake, client_p, 0);
1413 >                       (PF *)ssl_server_handshake, client_p, 0);
1414          return;
1415        case SSL_ERROR_WANT_READ:
1416          comm_setselect(&client_p->localClient->fd, COMM_SELECT_READ,
1417 <            (PF *) ssl_server_handshake, client_p, 0);
1417 >                       (PF *)ssl_server_handshake, client_p, 0);
1418          return;
1419        default:
1420 +      {
1421 +        const char *sslerr = ERR_error_string(ERR_get_error(), NULL);
1422 +        sendto_realops_flags(UMODE_ALL, L_ALL,
1423 +                             "Error connecting to %s: %s", client_p->name,
1424 +                             sslerr ? sslerr : "unknown SSL error");
1425          exit_client(client_p, client_p, "Error during SSL handshake");
1426          return;
1427 +      }
1428      }
1429    }
1430  

Diff Legend

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