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 5805 by michael, Tue Apr 21 21:49:58 2015 UTC vs.
Revision 6367 by michael, Wed Aug 19 10:25:00 2015 UTC

# Line 55 | Line 55
55   #include "conf_class.h"
56   #include "motd.h"
57   #include "ipcache.h"
58 + #include "isupport.h"
59  
60  
61   struct config_channel_entry ConfigChannel;
# Line 301 | Line 302 | verify_access(struct Client *client_p)
302   {
303    struct MaskItem *conf = NULL;
304  
305 <  if (IsGotId(client_p))
305 >  if (HasFlag(client_p, FLAGS_GOTID))
306    {
307      conf = find_address_conf(client_p->host, client_p->username,
308                               &client_p->connection->ip,
# Line 337 | Line 338 | verify_access(struct Client *client_p)
338      if (IsConfDoSpoofIp(conf))
339      {
340        if (IsConfSpoofNotice(conf))
341 <        sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, "%s spoofing: %s as %s",
341 >        sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE, "%s spoofing: %s as %s",
342                               client_p->name, client_p->host, conf->name);
343  
344        strlcpy(client_p->host, conf->name, sizeof(client_p->host));
# Line 932 | Line 933 | void
933   conf_rehash(int sig)
934   {
935    if (sig)
936 <    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
936 >    sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
937                           "Got signal SIGHUP, reloading configuration file(s)");
938  
939    restart_resolver();
# Line 1036 | Line 1037 | expire_tklines(dlink_list *list)
1037      if (!conf->until || conf->until > CurrentTime)
1038        continue;
1039  
1040 <    if (conf->type == CONF_XLINE)
1041 <    {
1042 <      if (ConfigGeneral.tkline_expire_notices)
1043 <        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1043 <                             "Temporary X-line for [%s] expired", conf->name);
1044 <      conf_free(conf);
1045 <    }
1046 <    else if (conf->type == CONF_NRESV || conf->type == CONF_CRESV)
1047 <    {
1048 <      if (ConfigGeneral.tkline_expire_notices)
1049 <        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1050 <                             "Temporary RESV for [%s] expired", conf->name);
1051 <      conf_free(conf);
1052 <    }
1040 >    if (ConfigGeneral.tkline_expire_notices)
1041 >      sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE, "Temporary %s for [%s] expired",
1042 >                           (conf->type == CONF_XLINE) ? "X-line" : "RESV", conf->name);
1043 >    conf_free(conf);
1044    }
1045   }
1046  
# Line 1186 | Line 1177 | clear_out_old_conf(void)
1177        struct MaskItem *conf = node->data;
1178  
1179        conf->active = 0;
1189      dlinkDelete(&conf->node, *iterator);
1180  
1181 <      /* XXX This is less than pretty */
1192 <      if (conf->type == CONF_SERVER || conf->type == CONF_OPER)
1181 >      if (!IsConfDatabase(conf))
1182        {
1183 +        dlinkDelete(&conf->node, *iterator);
1184 +
1185          if (!conf->ref_count)
1186            conf_free(conf);
1187        }
1197      else if (conf->type == CONF_XLINE)
1198      {
1199        if (!conf->until)
1200          conf_free(conf);
1201      }
1202      else
1203        conf_free(conf);
1188      }
1189    }
1190  
# Line 1246 | Line 1230 | clear_out_old_conf(void)
1230    ConfigAdminInfo.description = NULL;
1231  
1232    /* Clean out listeners */
1233 <  close_listeners();
1233 >  listener_close_marked();
1234   }
1235  
1236   /* read_conf_files()
# Line 1283 | Line 1267 | read_conf_files(int cold)
1267      }
1268      else
1269      {
1270 <      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1270 >      sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1271                             "Unable to read configuration file '%s': %s",
1272                             filename, strerror(errno));
1273        return;
# Line 1298 | Line 1282 | read_conf_files(int cold)
1282  
1283    log_reopen_all();
1284  
1285 <  add_isupport("NICKLEN", NULL, ConfigServerInfo.max_nick_length);
1286 <  add_isupport("NETWORK", ConfigServerInfo.network_name, -1);
1285 >  isupport_add("NICKLEN", NULL, ConfigServerInfo.max_nick_length);
1286 >  isupport_add("NETWORK", ConfigServerInfo.network_name, -1);
1287  
1288    snprintf(chanmodes, sizeof(chanmodes), "beI:%d", ConfigChannel.max_bans);
1289 <  add_isupport("MAXLIST", chanmodes, -1);
1290 <  add_isupport("MAXTARGETS", NULL, ConfigGeneral.max_targets);
1291 <  add_isupport("CHANTYPES", "#", -1);
1289 >  isupport_add("MAXLIST", chanmodes, -1);
1290 >  isupport_add("MAXTARGETS", NULL, ConfigGeneral.max_targets);
1291 >  isupport_add("CHANTYPES", "#", -1);
1292  
1293    snprintf(chanlimit, sizeof(chanlimit), "#:%d",
1294             ConfigChannel.max_channels);
1295 <  add_isupport("CHANLIMIT", chanlimit, -1);
1295 >  isupport_add("CHANLIMIT", chanlimit, -1);
1296    snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,cimnprstCMORS");
1297 <  add_isupport("CHANNELLEN", NULL, CHANNELLEN);
1298 <  add_isupport("TOPICLEN", NULL, ConfigServerInfo.max_topic_length);
1299 <  add_isupport("CHANMODES", chanmodes, -1);
1297 >  isupport_add("CHANNELLEN", NULL, CHANNELLEN);
1298 >  isupport_add("TOPICLEN", NULL, ConfigServerInfo.max_topic_length);
1299 >  isupport_add("CHANMODES", chanmodes, -1);
1300  
1301    /*
1302     * message_locale may have changed.  rebuild isupport since it relies
1303     * on strlen(form_str(RPL_ISUPPORT))
1304     */
1305 <  rebuild_isupport_message_line();
1305 >  isupport_rebuild();
1306   }
1307  
1308   /* conf_add_class_to_conf()
# Line 1335 | Line 1319 | conf_add_class_to_conf(struct MaskItem *
1319      conf->class = class_default;
1320  
1321      if (conf->type == CONF_CLIENT || conf->type == CONF_OPER)
1322 <      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1322 >      sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1323                             "Warning *** Defaulting to default class for %s@%s",
1324                             conf->user, conf->host);
1325      else
1326 <      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1326 >      sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1327                             "Warning *** Defaulting to default class for %s",
1328                             conf->name);
1329    }
# Line 1360 | Line 1344 | yyerror(const char *msg)
1344      return;
1345  
1346    strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
1347 <  sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1347 >  sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1348                         "\"%s\", line %u: %s: %s",
1349                         conffilebuf, lineno + 1, msg, newlinebuf);
1350    ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
# Line 1373 | Line 1357 | conf_error_report(const char *msg)
1357    char newlinebuf[IRCD_BUFSIZE];
1358  
1359    strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
1360 <  sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1360 >  sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1361                         "\"%s\", line %u: %s: %s",
1362                         conffilebuf, lineno + 1, msg, newlinebuf);
1363    ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
# Line 1440 | Line 1424 | valid_wild_card_simple(const char *data)
1424   {
1425    const unsigned char *p = (const unsigned char *)data;
1426    unsigned char tmpch = '\0';
1427 <  unsigned int nonwild = 0;
1427 >  unsigned int nonwild = 0, wild = 0;
1428  
1429    while ((tmpch = *p++))
1430    {
# Line 1455 | Line 1439 | valid_wild_card_simple(const char *data)
1439        if (++nonwild >= ConfigGeneral.min_nonwildcard_simple)
1440          return 1;
1441      }
1442 +    else
1443 +      ++wild;
1444    }
1445  
1446 <  return 0;
1446 >  return !wild;
1447   }
1448  
1449   /* valid_wild_card()
# Line 1576 | Line 1562 | find_user_host(struct Client *source_p,
1562          find_chasing(source_p, user_host_or_nick)) == NULL)
1563        return 0;  /* find_chasing sends ERR_NOSUCHNICK */
1564  
1565 <    if (IsExemptKline(target_p))
1565 >    if (HasFlag(target_p, FLAGS_EXEMPTKLINE))
1566      {
1567        if (IsClient(source_p))
1568          sendto_one_notice(source_p, &me, ":%s is E-lined", target_p->name);
# Line 1639 | Line 1625 | parse_aline(const char *cmd, struct Clie
1625              char **target_server, char **reason)
1626   {
1627    int found_tkline_time=0;
1628 <  static char def_reason[] = CONF_NOREASON;
1628 >  static char default_reason[] = CONF_NOREASON;
1629    static char user[USERLEN*4+1];
1630    static char host[HOSTLEN*4+1];
1631  
# Line 1689 | Line 1675 | parse_aline(const char *cmd, struct Clie
1675        parc--;
1676        parv++;
1677  
1692      if (target_server == NULL)
1693      {
1694        sendto_one_notice(source_p, &me, ":ON server not supported by %s", cmd);
1695        return 0;
1696      }
1697
1678        if (!HasOFlag(source_p, OPER_FLAG_REMOTEBAN))
1679        {
1680          sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "remoteban");
# Line 1739 | Line 1719 | parse_aline(const char *cmd, struct Clie
1719    if (reason)
1720    {
1721      if (parc && !EmptyString(*parv))
1742    {
1722        *reason = *parv;
1744
1745      if (!valid_comment(source_p, *reason, 1))
1746        return 0;
1747    }
1723      else
1724 <      *reason = def_reason;
1724 >      *reason = default_reason;
1725    }
1726  
1727    return 1;
1728   }
1729  
1755 /* valid_comment()
1756 *
1757 * inputs       - pointer to client
1758 *              - pointer to comment
1759 * output       - 0 if no valid comment,
1760 *              - 1 if valid
1761 * side effects - truncates reason where necessary
1762 */
1763 int
1764 valid_comment(struct Client *source_p, char *comment, int warn)
1765 {
1766  if (strlen(comment) > REASONLEN)
1767    comment[REASONLEN-1] = '\0';
1768
1769  return 1;
1770 }
1771
1730   /* match_conf_password()
1731   *
1732   * inputs       - pointer to given password
# Line 1797 | Line 1755 | match_conf_password(const char *password
1755   *
1756   * inputs       - client sending the cluster
1757   *              - command name "KLINE" "XLINE" etc.
1758 < *              - capab -- CAP_KLN etc. from server.h
1758 > *              - capab -- CAPAB_KLN etc. from server.h
1759   *              - cluster type -- CLUSTER_KLINE etc. from conf.h
1760   *              - pattern and args to send along
1761   * output       - none
# Line 1821 | Line 1779 | cluster_a_line(struct Client *source_p,
1779      const struct MaskItem *conf = node->data;
1780  
1781      if (conf->flags & cluster_type)
1782 <      sendto_match_servs(source_p, conf->name, CAP_CLUSTER | capab,
1782 >      sendto_match_servs(source_p, conf->name, CAPAB_CLUSTER | capab,
1783                           "%s %s %s", command, conf->name, buffer);
1784    }
1785   }

Diff Legend

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