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 3335 by michael, Thu Apr 17 18:55:31 2014 UTC vs.
ircd-hybrid/branches/8.2.x/src/server.c (file contents), Revision 4112 by michael, Tue Jul 1 16:02:36 2014 UTC

# Line 40 | Line 40
40   #include "numeric.h"
41   #include "packet.h"
42   #include "conf.h"
43 < #include "s_serv.h"
43 > #include "server.h"
44   #include "log.h"
45 < #include "s_user.h"
45 > #include "user.h"
46   #include "send.h"
47   #include "memory.h"
48   #include "channel.h"
# Line 159 | Line 159 | hunt_server(struct Client *source_p, con
159    struct Client *target_p = NULL;
160    struct Client *target_tmp = NULL;
161    dlink_node *ptr;
162  int wilds;
162  
163    /* Assume it's me, if no server */
164    if (parc <= server || EmptyString(parv[server]))
# Line 185 | Line 184 | hunt_server(struct Client *source_p, con
184      if (target_p->from == source_p->from && !MyConnect(target_p))
185        target_p = NULL;
186  
188  wilds = has_wildcards(parv[server]);
189
187    /* Again, if there are no wild cards involved in the server
188     * name, use the hash lookup
189     */
190    if (target_p == NULL)
191    {
192 <    if (!wilds)
192 >    if (!has_wildcards(parv[server]))
193      {
194        if (!(target_p = hash_find_server(parv[server])))
195        {
# Line 285 | Line 282 | try_connections(void *unused)
282      if (conf->until > CurrentTime)
283        continue;
284  
285 <    if (conf->class == NULL)
286 <      confrq = DEFAULT_CONNECTFREQUENCY;
287 <    else
288 <    {
289 <      confrq = conf->class->con_freq;
293 <      if (confrq < MIN_CONN_FREQ)
294 <        confrq = MIN_CONN_FREQ;
295 <    }
285 >    assert(conf->class);
286 >
287 >    confrq = conf->class->con_freq;
288 >    if (confrq < MIN_CONN_FREQ)
289 >      confrq = MIN_CONN_FREQ;
290  
291      conf->until = CurrentTime + confrq;
292  
# Line 343 | Line 337 | try_connections(void *unused)
337   int
338   valid_servname(const char *name)
339   {
340 <  unsigned int length = 0;
347 <  unsigned int dots   = 0;
340 >  unsigned int dots = 0;
341    const char *p = name;
342  
343    for (; *p; ++p)
# Line 352 | Line 345 | valid_servname(const char *name)
345      if (!IsServChar(*p))
346        return 0;
347  
355    ++length;
356
348      if (*p == '.')
349        ++dots;
350    }
351  
352 <  return dots && length <= HOSTLEN;
352 >  return dots && (p - name) <= HOSTLEN;
353   }
354  
355   int
# Line 445 | Line 436 | check_server(const char *name, struct Cl
436   void
437   add_capability(const char *capab_name, int cap_flag, int add_to_default)
438   {
439 <  struct Capability *cap = MyMalloc(sizeof(*cap));
439 >  struct Capability *cap = MyCalloc(sizeof(*cap));
440  
441    cap->name = xstrdup(capab_name);
442    cap->cap = cap_flag;
# Line 519 | Line 510 | find_capability(const char *capab)
510   void
511   send_capabilities(struct Client *client_p, int cap_can_send)
512   {
513 <  char msgbuf[IRCD_BUFSIZE] = "";
514 <  char *t = msgbuf;
524 <  int tl;
525 <  dlink_node *ptr = NULL;
513 >  char buf[IRCD_BUFSIZE] = "";
514 >  const dlink_node *ptr = NULL;
515  
516    DLINK_FOREACH(ptr, cap_list.head)
517    {
518 <    struct Capability *cap = ptr->data;
518 >    const struct Capability *cap = ptr->data;
519  
520      if (cap->cap & (cap_can_send|default_server_capabs))
521      {
522 <      tl = sprintf(t, "%s ", cap->name);
523 <      t += tl;
522 >      strlcat(buf, cap->name, sizeof(buf));
523 >      if (ptr->next)
524 >        strlcat(buf, " ", sizeof(buf));
525      }
526    }
527  
528 <  *(t - 1) = '\0';
539 <  sendto_one(client_p, "CAPAB :%s", msgbuf);
528 >  sendto_one(client_p, "CAPAB :%s", buf);
529   }
530  
531   /*
# Line 579 | Line 568 | struct Server *
568   make_server(struct Client *client_p)
569   {
570    if (client_p->serv == NULL)
571 <    client_p->serv = MyMalloc(sizeof(struct Server));
571 >    client_p->serv = MyCalloc(sizeof(struct Server));
572  
573    return client_p->serv;
574   }
# Line 874 | Line 863 | ssl_server_handshake(fde_t *fd, struct C
863    if ((cert = SSL_get_peer_certificate(client_p->localClient->fd.ssl)))
864    {
865      int res = SSL_get_verify_result(client_p->localClient->fd.ssl);
866 <    char buf[EVP_MAX_MD_SIZE * 2 + 1] = { '\0' };
867 <    unsigned char md[EVP_MAX_MD_SIZE] = { '\0' };
866 >    char buf[EVP_MAX_MD_SIZE * 2 + 1] = "";
867 >    unsigned char md[EVP_MAX_MD_SIZE] = "";
868  
869      if (res == X509_V_OK || res == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN ||
870          res == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE ||
871          res == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT)
872      {
873 <      unsigned int i = 0, n = 0;
873 >      unsigned int n = 0;
874  
875        if (X509_digest(cert, EVP_sha256(), md, &n))
876        {
877 <        for (; i < n; ++i)
889 <          snprintf(buf + 2 * i, 3, "%02X", md[i]);
877 >        binary_to_hex(md, buf, n);
878          client_p->certfp = xstrdup(buf);
879        }
880      }

Diff Legend

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