ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/conf.c (file contents):
Revision 2181 by michael, Mon Jun 3 23:45:39 2013 UTC vs.
Revision 2182 by michael, Tue Jun 4 12:19:04 2013 UTC

# Line 244 | Line 244 | check_client(struct Client *source_p)
244      case TOO_MANY:
245        sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE,
246                             "Too many on IP for %s (%s).",
247 <                           get_client_name(source_p, SHOW_IP),
248 <                           source_p->sockhost);
247 >                           get_client_name(source_p, SHOW_IP),
248 >                           source_p->sockhost);
249        ilog(LOG_TYPE_IRCD, "Too many connections on IP from %s.",
250 <           get_client_name(source_p, SHOW_IP));
250 >           get_client_name(source_p, SHOW_IP));
251        ++ServerStats.is_ref;
252        exit_client(source_p, &me, "No more connections allowed on that IP");
253        break;
# Line 255 | Line 255 | check_client(struct Client *source_p)
255      case I_LINE_FULL:
256        sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE,
257                             "auth{} block is full for %s (%s).",
258 <                           get_client_name(source_p, SHOW_IP),
259 <                           source_p->sockhost);
258 >                           get_client_name(source_p, SHOW_IP),
259 >                           source_p->sockhost);
260        ilog(LOG_TYPE_IRCD, "Too many connections from %s.",
261 <           get_client_name(source_p, SHOW_IP));
261 >           get_client_name(source_p, SHOW_IP));
262        ++ServerStats.is_ref;
263        exit_client(source_p, &me,
264 <                "No more connections allowed in your connection class");
264 >                  "No more connections allowed in your connection class");
265        break;
266  
267      case NOT_AUTHORIZED:
# Line 269 | Line 269 | check_client(struct Client *source_p)
269        /* jdc - lists server name & port connections are on */
270        /*       a purely cosmetical change */
271        sendto_realops_flags(UMODE_UNAUTH, L_ALL, SEND_NOTICE,
272 <                           "Unauthorized client connection from %s [%s] on [%s/%u].",
273 <                           get_client_name(source_p, SHOW_IP),
274 <                           source_p->sockhost,
275 <                           source_p->localClient->listener->name,
276 <                           source_p->localClient->listener->port);
272 >                           "Unauthorized client connection from %s [%s] on [%s/%u].",
273 >                           get_client_name(source_p, SHOW_IP),
274 >                           source_p->sockhost,
275 >                           source_p->localClient->listener->name,
276 >                           source_p->localClient->listener->port);
277        ilog(LOG_TYPE_IRCD,
278 <          "Unauthorized client connection from %s on [%s/%u].",
279 <          get_client_name(source_p, SHOW_IP),
280 <          source_p->localClient->listener->name,
281 <          source_p->localClient->listener->port);
278 >           "Unauthorized client connection from %s on [%s/%u].",
279 >           get_client_name(source_p, SHOW_IP),
280 >           source_p->localClient->listener->name,
281 >           source_p->localClient->listener->port);
282  
283        exit_client(source_p, &me, "You are not authorized to use this server");
284        break;
# Line 311 | Line 311 | verify_access(struct Client *client_p)
311    if (IsGotId(client_p))
312    {
313      conf = find_address_conf(client_p->host, client_p->username,
314 <                             &client_p->localClient->ip,
315 <                             client_p->localClient->aftype,
314 >                             &client_p->localClient->ip,
315 >                             client_p->localClient->aftype,
316                               client_p->localClient->passwd);
317    }
318    else
319    {
320 <    strlcpy(non_ident+1, client_p->username, sizeof(non_ident)-1);
320 >    strlcpy(non_ident + 1, client_p->username, sizeof(non_ident) - 1);
321      conf = find_address_conf(client_p->host,non_ident,
322 <                             &client_p->localClient->ip,
323 <                             client_p->localClient->aftype,
324 <                             client_p->localClient->passwd);
322 >                             &client_p->localClient->ip,
323 >                             client_p->localClient->aftype,
324 >                             client_p->localClient->passwd);
325    }
326  
327    if (conf != NULL)
# Line 334 | Line 334 | verify_access(struct Client *client_p)
334                     me.name, client_p->name,
335                     conf->name ? conf->name : "",
336                     conf->port);
337 <        return(NOT_AUTHORIZED);
337 >        return NOT_AUTHORIZED;
338        }
339  
340        if (IsConfDoIdentd(conf))
341 <        SetNeedId(client_p);
341 >        SetNeedId(client_p);
342  
343        /* Thanks for spoof idea amm */
344        if (IsConfDoSpoofIp(conf))
# Line 351 | Line 351 | verify_access(struct Client *client_p)
351          AddFlag(client_p, FLAGS_IP_SPOOFING | FLAGS_AUTH_SPOOF);
352        }
353  
354 <      return(attach_iline(client_p, conf));
354 >      return attach_iline(client_p, conf);
355      }
356      else if (IsConfKill(conf) || (ConfigFileEntry.glines && IsConfGline(conf)))
357      {
# Line 360 | Line 360 | verify_access(struct Client *client_p)
360                     client_p->name);
361        sendto_one(client_p, ":%s NOTICE %s :*** Banned: %s",
362                   me.name, client_p->name, conf->reason);
363 <      return(BANNED_CLIENT);
363 >      return BANNED_CLIENT;
364      }
365    }
366  
367 <  return(NOT_AUTHORIZED);
367 >  return NOT_AUTHORIZED;
368   }
369  
370   /* attach_iline()
# Line 534 | Line 534 | remove_one_ip(struct irc_ssaddr *ip_in)
534      if (ptr->count > 0)
535        ptr->count--;
536      if (ptr->count == 0 &&
537 <        (CurrentTime-ptr->last_attempt) >= ConfigFileEntry.throttle_time)
537 >        (CurrentTime-ptr->last_attempt) >= ConfigFileEntry.throttle_time)
538      {
539        if (last_ptr != NULL)
540 <        last_ptr->next = ptr->next;
540 >        last_ptr->next = ptr->next;
541        else
542 <        ip_hash_table[hash_index] = ptr->next;
542 >        ip_hash_table[hash_index] = ptr->next;
543  
544        mp_pool_release(ptr);
545        ip_entries_count--;
# Line 868 | Line 868 | find_matching_name_conf(enum maskitem_ty
868        conf = ptr->data;
869  
870        if (EmptyString(conf->name))
871 <        continue;
871 >        continue;
872        if ((name != NULL) && !match(conf->name, name))
873        {
874 <        if ((user == NULL && (host == NULL)))
875 <          return conf;
876 <        if ((conf->flags & flags) != flags)
874 >        if ((user == NULL && (host == NULL)))
875 >          return conf;
876 >        if ((conf->flags & flags) != flags)
877            continue;
878 <        if (EmptyString(conf->user) || EmptyString(conf->host))
879 <          return conf;
880 <        if (!match(conf->user, user) && !match(conf->host, host))
881 <          return conf;
878 >        if (EmptyString(conf->user) || EmptyString(conf->host))
879 >          return conf;
880 >        if (!match(conf->user, user) && !match(conf->host, host))
881 >          return conf;
882        }
883      }
884        break;
# Line 930 | Line 930 | find_exact_name_conf(enum maskitem_type
930        conf = ptr->data;
931  
932        if (EmptyString(conf->name))
933 <        continue;
933 >        continue;
934      
935        if (irccmp(conf->name, name) == 0)
936        {
937 <        if ((user == NULL && (host == NULL)))
938 <          return (conf);
939 <        if (EmptyString(conf->user) || EmptyString(conf->host))
940 <          return (conf);
941 <        if (!match(conf->user, user) && !match(conf->host, host))
942 <          return (conf);
937 >        if ((user == NULL && (host == NULL)))
938 >          return conf;
939 >        if (EmptyString(conf->user) || EmptyString(conf->host))
940 >          return conf;
941 >        if (!match(conf->user, user) && !match(conf->host, host))
942 >          return conf;
943        }
944      }
945      break;
# Line 996 | Line 996 | find_exact_name_conf(enum maskitem_type
996        conf = ptr->data;
997  
998        if (EmptyString(conf->name))
999 <        continue;
999 >        continue;
1000      
1001        if (name == NULL)
1002        {
1003 <        if (EmptyString(conf->host))
1004 <          continue;
1005 <        if (irccmp(conf->host, host) == 0)
1006 <          return(conf);
1003 >        if (EmptyString(conf->host))
1004 >          continue;
1005 >        if (irccmp(conf->host, host) == 0)
1006 >          return conf;
1007        }
1008        else if (irccmp(conf->name, name) == 0)
1009 <      {
1010 <          return (conf);
1011 <      }
1009 >        return conf;
1010      }
1011 +
1012      break;
1013  
1014    default:
1015      break;
1016    }
1017 <  return(NULL);
1017 >
1018 >  return NULL;
1019   }
1020  
1021   /* rehash()
# Line 1201 | Line 1201 | read_conf(FILE *file)
1201  
1202    set_default_conf(); /* Set default values prior to conf parsing */
1203    conf_parser_ctx.pass = 1;
1204 <  yyparse();          /* pick up the classes first */
1204 >  yyparse();          /* pick up the classes first */
1205  
1206    rewind(file);
1207  
# Line 1437 | Line 1437 | get_oper_name(const struct Client *clien
1437  
1438        if (IsConfOperator(conf))
1439        {
1440 <        snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
1440 >        snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
1441                   client_p->username, client_p->host, conf->name);
1442 <        return buffer;
1442 >        return buffer;
1443        }
1444      }
1445  
# Line 1450 | Line 1450 | get_oper_name(const struct Client *clien
1450    }
1451  
1452    snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
1453 <           client_p->username, client_p->host, client_p->servptr->name);
1453 >           client_p->username, client_p->host, client_p->servptr->name);
1454    return buffer;
1455   }
1456  
# Line 1489 | Line 1489 | read_conf_files(int cold)
1489      else
1490      {
1491        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1492 <                           "Unable to read configuration file '%s': %s",
1493 <                           filename, strerror(errno));
1492 >                           "Unable to read configuration file '%s': %s",
1493 >                           filename, strerror(errno));
1494        return;
1495      }
1496    }
# Line 1561 | Line 1561 | clear_out_old_conf(void)
1561        if (conf->type == CONF_SERVER || conf->type == CONF_OPER)
1562        {
1563          if (!conf->ref_count)
1564 <          conf_free(conf);
1564 >          conf_free(conf);
1565        }
1566        else if (conf->type == CONF_XLINE)
1567        {
# Line 1646 | Line 1646 | conf_add_class_to_conf(struct MaskItem *
1646  
1647      if (conf->type == CONF_CLIENT)
1648        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1649 <                           "Warning *** Defaulting to default class for %s@%s",
1650 <                           conf->user, conf->host);
1649 >                           "Warning *** Defaulting to default class for %s@%s",
1650 >                           conf->user, conf->host);
1651      else
1652        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1653 <                           "Warning *** Defaulting to default class for %s",
1654 <                           conf->name);
1653 >                           "Warning *** Defaulting to default class for %s",
1654 >                           conf->name);
1655    }
1656    else
1657      conf->class = class_find(class_name, 1);
# Line 1660 | Line 1660 | conf_add_class_to_conf(struct MaskItem *
1660    {
1661      if (conf->type == CONF_CLIENT)
1662        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1663 <                           "Warning *** Defaulting to default class for %s@%s",
1664 <                           conf->user, conf->host);
1663 >                           "Warning *** Defaulting to default class for %s@%s",
1664 >                           conf->user, conf->host);
1665      else
1666        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1667 <                           "Warning *** Defaulting to default class for %s",
1668 <                           conf->name);
1667 >                           "Warning *** Defaulting to default class for %s",
1668 >                           conf->name);
1669      conf->class = class_default;
1670    }
1671   }
# Line 1726 | Line 1726 | valid_tkline(const char *p, int minutes)
1726        return 0;
1727  
1728      result *= 10;
1729 <    result += ((*p) & 0xF);
1729 >    result += (*p & 0xF);
1730    }
1731  
1732    /*
# Line 1870 | Line 1870 | valid_wild_card(struct Client *source_p,
1870   */
1871   int
1872   parse_aline(const char *cmd, struct Client *source_p,
1873 <            int parc, char **parv,
1874 <            int parse_flags, char **up_p, char **h_p, time_t *tkline_time,
1875 <            char **target_server, char **reason)
1873 >            int parc, char **parv,
1874 >            int parse_flags, char **up_p, char **h_p, time_t *tkline_time,
1875 >            char **target_server, char **reason)
1876   {
1877    int found_tkline_time=0;
1878    static char def_reason[] = "No Reason";
# Line 1894 | Line 1894 | parse_aline(const char *cmd, struct Clie
1894      else
1895      {
1896        sendto_one(source_p, ":%s NOTICE %s :temp_line not supported by %s",
1897 <                 me.name, source_p->name, cmd);
1897 >                 me.name, source_p->name, cmd);
1898        return -1;
1899      }
1900    }
# Line 1929 | Line 1929 | parse_aline(const char *cmd, struct Clie
1929  
1930        if (target_server == NULL)
1931        {
1932 <        sendto_one(source_p, ":%s NOTICE %s :ON server not supported by %s",
1933 <                   me.name, source_p->name, cmd);
1934 <        return -1;
1932 >        sendto_one(source_p, ":%s NOTICE %s :ON server not supported by %s",
1933 >                   me.name, source_p->name, cmd);
1934 >        return -1;
1935        }
1936  
1937        if (!HasOFlag(source_p, OPER_FLAG_REMOTEBAN))
# Line 1943 | Line 1943 | parse_aline(const char *cmd, struct Clie
1943  
1944        if (parc == 0 || EmptyString(*parv))
1945        {
1946 <        sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
1947 <                   me.name, source_p->name, cmd);
1948 <        return -1;
1946 >        sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
1947 >                   me.name, source_p->name, cmd);
1948 >        return -1;
1949        }
1950  
1951        *target_server = *parv;
# Line 1958 | Line 1958 | parse_aline(const char *cmd, struct Clie
1958         * caller probably NULL'd it first, but no harm to do it again -db
1959         */
1960        if (target_server != NULL)
1961 <        *target_server = NULL;
1961 >        *target_server = NULL;
1962      }
1963    }
1964  
# Line 1984 | Line 1984 | parse_aline(const char *cmd, struct Clie
1984      {
1985        *reason = *parv;
1986        if (!valid_comment(source_p, *reason, 1))
1987 <        return -1;
1987 >        return -1;
1988      }
1989      else
1990        *reason = def_reason;
# Line 2023 | Line 2023 | find_user_host(struct Client *source_p,
2023      {
2024        *(hostp++) = '\0';                       /* short and squat */
2025        if (*user_host_or_nick)
2026 <        strlcpy(luser, user_host_or_nick, USERLEN*4 + 1); /* here is my user */
2026 >        strlcpy(luser, user_host_or_nick, USERLEN*4 + 1); /* here is my user */
2027        else
2028 <        strcpy(luser, "*");
2028 >        strcpy(luser, "*");
2029 >
2030        if (*hostp)
2031 <        strlcpy(lhost, hostp, HOSTLEN + 1);    /* here is my host */
2031 >        strlcpy(lhost, hostp, HOSTLEN + 1);    /* here is my host */
2032        else
2033 <        strcpy(lhost, "*");
2033 >        strcpy(lhost, "*");
2034      }
2035      else
2036      {
2037        luser[0] = '*';             /* no @ found, assume its *@somehost */
2038 <      luser[1] = '\0';    
2038 >      luser[1] = '\0';
2039        strlcpy(lhost, user_host_or_nick, HOSTLEN*4 + 1);
2040      }
2041      
# Line 2051 | Line 2052 | find_user_host(struct Client *source_p,
2052      if (IsExemptKline(target_p))
2053      {
2054        if (!IsServer(source_p))
2055 <        sendto_one(source_p,
2056 <                   ":%s NOTICE %s :%s is E-lined",
2057 <                   me.name, source_p->name, target_p->name);
2055 >        sendto_one(source_p,
2056 >                   ":%s NOTICE %s :%s is E-lined",
2057 >                   me.name, source_p->name, target_p->name);
2058        return 0;
2059      }
2060  
# Line 2147 | Line 2148 | cluster_a_line(struct Client *source_p,
2148  
2149      if (conf->flags & cluster_type)
2150        sendto_match_servs(source_p, conf->name, CAP_CLUSTER|capab,
2151 <                         "%s %s %s", command, conf->name, buffer);
2151 >                         "%s %s %s", command, conf->name, buffer);
2152    }
2153   }
2154  

Diff Legend

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