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 5039 by michael, Sat Dec 13 16:08:37 2014 UTC vs.
Revision 6597 by michael, Thu Oct 22 17:23:06 2015 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 1997-2014 ircd-hybrid development team
4 > *  Copyright (c) 1997-2015 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# 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;
62 + struct config_serverhide_entry ConfigServerHide;
63 + struct config_general_entry ConfigGeneral;
64 + struct config_log_entry ConfigLog = { .use_logging = 1 };
65 + struct config_serverinfo_entry ConfigServerInfo;
66 + struct config_admin_entry ConfigAdminInfo;
67 + struct conf_parser_context conf_parser_ctx;
68 +
69   /* general conf items link list root, other than k lines etc. */
70   dlink_list service_items;
71   dlink_list server_items;
# Line 195 | Line 204 | conf_free(struct MaskItem *conf)
204    MyFree(conf->spasswd);
205    MyFree(conf->reason);
206    MyFree(conf->certfp);
207 +  MyFree(conf->whois);
208    MyFree(conf->user);
209    MyFree(conf->host);
210   #ifdef HAVE_LIBCRYPTO
# Line 250 | Line 260 | attach_iline(struct Client *client_p, st
260    ip_found->count++;
261    AddFlag(client_p, FLAGS_IPHASH);
262  
263 <  count_user_host(client_p->username, client_p->host,
264 <                  &global, &local, &ident);
263 >  userhost_count(client_p->username, client_p->host,
264 >                 &global, &local, &ident);
265  
266    /* XXX blah. go down checking the various silly limits
267     * setting a_limit_reached if any limit is reached.
# Line 291 | Line 301 | static int
301   verify_access(struct Client *client_p)
302   {
303    struct MaskItem *conf = NULL;
294  char non_ident[USERLEN + 1] = "~";
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 302 | Line 311 | verify_access(struct Client *client_p)
311    }
312    else
313    {
314 +    char non_ident[USERLEN + 1] = "~";
315 +
316      strlcpy(non_ident + 1, client_p->username, sizeof(non_ident) - 1);
317      conf = find_address_conf(client_p->host, non_ident,
318                               &client_p->connection->ip,
# Line 309 | Line 320 | verify_access(struct Client *client_p)
320                               client_p->connection->password);
321    }
322  
323 <  if (conf)
324 <  {
314 <    if (IsConfClient(conf))
315 <    {
316 <      if (IsConfRedir(conf))
317 <      {
318 <        sendto_one_numeric(client_p, &me, RPL_REDIR,
319 <                           conf->name ? conf->name : "",
320 <                           conf->port);
321 <        return NOT_AUTHORIZED;
322 <      }
323 <
324 <      /* Thanks for spoof idea amm */
325 <      if (IsConfDoSpoofIp(conf))
326 <      {
327 <        if (IsConfSpoofNotice(conf))
328 <          sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, "%s spoofing: %s as %s",
329 <                               client_p->name, client_p->host, conf->name);
323 >  if (!conf)
324 >    return NOT_AUTHORIZED;
325  
326 <        strlcpy(client_p->host, conf->name, sizeof(client_p->host));
332 <      }
326 >  assert(IsConfClient(conf) || IsConfKill(conf));
327  
328 <      return attach_iline(client_p, conf);
328 >  if (IsConfClient(conf))
329 >  {
330 >    if (IsConfRedir(conf))
331 >    {
332 >      sendto_one_numeric(client_p, &me, RPL_REDIR,
333 >                         conf->name ? conf->name : "",
334 >                         conf->port);
335 >      return NOT_AUTHORIZED;
336      }
337 <    else if (IsConfKill(conf) || (ConfigGeneral.glines && IsConfGline(conf)))
337 >
338 >    if (IsConfDoSpoofIp(conf))
339      {
340 <      if (IsConfGline(conf))
341 <        sendto_one_notice(client_p, &me, ":*** G-lined");
340 >      if (IsConfSpoofNotice(conf))
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 <      sendto_one_notice(client_p, &me, ":*** Banned: %s", conf->reason);
342 <      return BANNED_CLIENT;
344 >      strlcpy(client_p->host, conf->name, sizeof(client_p->host));
345      }
346 +
347 +    return attach_iline(client_p, conf);
348    }
349  
350 <  return NOT_AUTHORIZED;
350 >  sendto_one_notice(client_p, &me, ":*** Banned: %s", conf->reason);
351 >  return BANNED_CLIENT;
352   }
353  
354   /* check_client()
# Line 517 | Line 522 | attach_connect_block(struct Client *clie
522        continue;
523  
524      attach_conf(client_p, conf);
525 <    return -1;
525 >    return 1;
526    }
527  
528    return 0;
# Line 789 | Line 794 | set_default_conf(void)
794    memset(&ConfigServerInfo.ip6, 0, sizeof(ConfigServerInfo.ip6));
795    ConfigServerInfo.specific_ipv6_vhost = 0;
796  
797 <  ConfigServerInfo.max_clients = MAXCLIENTS_MAX;
797 >  ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX;
798    ConfigServerInfo.max_nick_length = 9;
799    ConfigServerInfo.max_topic_length = 80;
800    ConfigServerInfo.hub = 0;
# Line 810 | Line 815 | set_default_conf(void)
815    ConfigChannel.knock_delay_channel = 60;
816    ConfigChannel.max_channels = 25;
817    ConfigChannel.max_bans = 25;
818 <  ConfigChannel.default_split_user_count = 0;
819 <  ConfigChannel.default_split_server_count = 0;
815 <  ConfigChannel.no_join_on_split = 0;
816 <  ConfigChannel.no_create_on_split = 0;
818 >  ConfigChannel.default_join_flood_count = 18;
819 >  ConfigChannel.default_join_flood_time = 6;
820  
821    ConfigServerHide.flatten_links = 0;
822 <  ConfigServerHide.links_delay = 300;
822 >  ConfigServerHide.flatten_links_delay = 300;
823    ConfigServerHide.hidden = 0;
824    ConfigServerHide.hide_servers = 0;
825    ConfigServerHide.hide_services = 0;
# Line 828 | Line 831 | set_default_conf(void)
831    ConfigGeneral.away_time = 10;
832    ConfigGeneral.max_watch = WATCHSIZE_DEFAULT;
833    ConfigGeneral.cycle_on_host_change = 1;
834 <  ConfigGeneral.glines = 0;
835 <  ConfigGeneral.gline_time = 12 * 3600;
836 <  ConfigGeneral.gline_request_time = GLINE_REQUEST_EXPIRE_DEFAULT;
837 <  ConfigGeneral.gline_min_cidr = 16;
835 <  ConfigGeneral.gline_min_cidr6 = 48;
834 >  ConfigGeneral.dline_min_cidr = 16;
835 >  ConfigGeneral.dline_min_cidr6 = 48;
836 >  ConfigGeneral.kline_min_cidr = 16;
837 >  ConfigGeneral.kline_min_cidr6 = 48;
838    ConfigGeneral.invisible_on_connect = 1;
839    ConfigGeneral.tkline_expire_notices = 1;
840    ConfigGeneral.ignore_bogus_ts = 0;
# Line 865 | Line 867 | set_default_conf(void)
867    ConfigGeneral.short_motd = 0;
868    ConfigGeneral.ping_cookie = 0;
869    ConfigGeneral.no_oper_flood = 0;
868  ConfigGeneral.oper_pass_resv = 1;
870    ConfigGeneral.max_targets = MAX_TARGETS_DEFAULT;
871 <  ConfigGeneral.oper_only_umodes = UMODE_DEBUG;
871 >  ConfigGeneral.oper_only_umodes = UMODE_DEBUG | UMODE_LOCOPS | UMODE_HIDDEN | UMODE_FARCONNECT |
872 >                                   UMODE_UNAUTH | UMODE_EXTERNAL | UMODE_BOTS | UMODE_NCHANGE |
873 >                                   UMODE_SPY | UMODE_FULL | UMODE_SKILL | UMODE_REJ | UMODE_CCONN;
874    ConfigGeneral.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE | UMODE_WALLOP;
875    ConfigGeneral.throttle_count = 1;
876    ConfigGeneral.throttle_time = 1;
# Line 921 | Line 924 | read_conf(FILE *file)
924   * as a result of an operator issuing this command, else assume it has been
925   * called as a result of the server receiving a HUP signal.
926   */
927 < int
927 > void
928   conf_rehash(int sig)
929   {
930    if (sig)
931 <    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
931 >    sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
932                           "Got signal SIGHUP, reloading configuration file(s)");
933  
934    restart_resolver();
# Line 936 | Line 939 | conf_rehash(int sig)
939  
940    load_conf_modules();
941    check_conf_klines();
939
940  return 0;
942   }
943  
944   /* lookup_confhost()
# Line 988 | Line 989 | int
989   conf_connect_allowed(struct irc_ssaddr *addr, int aftype)
990   {
991    struct ip_entry *ip_found = NULL;
992 <  struct MaskItem *const conf = find_dline_conf(addr, aftype);
992 <
993 <  /* DLINE exempt also gets you out of static limits/pacing... */
994 <  if (conf && (conf->type == CONF_EXEMPT))
995 <    return 0;
992 >  const struct MaskItem *conf = find_dline_conf(addr, aftype);
993  
994    if (conf)
995 +  {
996 +    /* DLINE exempt also gets you out of static limits/pacing... */
997 +    if (conf->type == CONF_EXEMPT)
998 +      return 0;
999      return BANNED_CLIENT;
1000 +  }
1001  
1002    ip_found = ipcache_find_or_add_address(addr);
1003  
# Line 1031 | Line 1033 | expire_tklines(dlink_list *list)
1033      if (!conf->until || conf->until > CurrentTime)
1034        continue;
1035  
1036 <    if (conf->type == CONF_XLINE)
1037 <    {
1038 <      if (ConfigGeneral.tkline_expire_notices)
1039 <        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1038 <                               "Temporary X-line for [%s] expired", conf->name);
1039 <      conf_free(conf);
1040 <    }
1041 <    else if (conf->type == CONF_NRESV || conf->type == CONF_CRESV)
1042 <    {
1043 <      if (ConfigGeneral.tkline_expire_notices)
1044 <        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1045 <                               "Temporary RESV for [%s] expired", conf->name);
1046 <      conf_free(conf);
1047 <    }
1036 >    if (ConfigGeneral.tkline_expire_notices)
1037 >      sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE, "Temporary %s for [%s] expired",
1038 >                           (conf->type == CONF_XLINE) ? "X-line" : "RESV", conf->name);
1039 >    conf_free(conf);
1040    }
1041   }
1042  
# Line 1078 | Line 1070 | static const struct oper_privs
1070    { OPER_FLAG_ADMIN,          'A' },
1071    { OPER_FLAG_REMOTEBAN,      'B' },
1072    { OPER_FLAG_DIE,            'D' },
1081  { OPER_FLAG_GLINE,          'G' },
1073    { OPER_FLAG_REHASH,         'H' },
1074    { OPER_FLAG_KLINE,          'K' },
1075    { OPER_FLAG_KILL,           'N' },
# Line 1092 | Line 1083 | static const struct oper_privs
1083    { 0, '\0' }
1084   };
1085  
1086 < char *
1086 > const char *
1087   oper_privs_as_string(const unsigned int port)
1088   {
1089    static char privs_out[IRCD_BUFSIZE];
# Line 1120 | Line 1111 | oper_privs_as_string(const unsigned int
1111   const char *
1112   get_oper_name(const struct Client *client_p)
1113   {
1114 <  /* +5 for !,@,{,} and null */
1124 <  static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
1114 >  static char buffer[IRCD_BUFSIZE];
1115  
1116    if (IsServer(client_p))
1117      return client_p->name;
# Line 1183 | Line 1173 | clear_out_old_conf(void)
1173        struct MaskItem *conf = node->data;
1174  
1175        conf->active = 0;
1186      dlinkDelete(&conf->node, *iterator);
1176  
1177 <      /* XXX This is less than pretty */
1189 <      if (conf->type == CONF_SERVER || conf->type == CONF_OPER)
1177 >      if (!IsConfDatabase(conf))
1178        {
1179 +        dlinkDelete(&conf->node, *iterator);
1180 +
1181          if (!conf->ref_count)
1182            conf_free(conf);
1183        }
1194      else if (conf->type == CONF_XLINE)
1195      {
1196        if (!conf->until)
1197          conf_free(conf);
1198      }
1199      else
1200        conf_free(conf);
1184      }
1185    }
1186  
1187    motd_clear();
1188  
1189    /*
1190 <   * don't delete the class table, rather mark all entries
1191 <   * for deletion. The table is cleaned up by class_delete_marked. - avalon
1190 >   * Don't delete the class table, rather mark all entries for deletion.
1191 >   * The table is cleaned up by class_delete_marked. - avalon
1192     */
1193    class_mark_for_deletion();
1194  
1195    clear_out_address_conf();
1196  
1197 <  /* clean out module paths */
1197 >  /* Clean out module paths */
1198    mod_clear_paths();
1199  
1200    pseudo_clear();
1201  
1202 <  /* clean out ConfigServerInfo */
1202 >  /* Clean out ConfigServerInfo */
1203    MyFree(ConfigServerInfo.description);
1204    ConfigServerInfo.description = NULL;
1205    MyFree(ConfigServerInfo.network_name);
# Line 1234 | Line 1217 | clear_out_old_conf(void)
1217    ConfigServerInfo.rsa_private_key_file = NULL;
1218   #endif
1219  
1220 <  /* clean out ConfigAdminInfo */
1220 >  /* Clean out ConfigAdminInfo */
1221    MyFree(ConfigAdminInfo.name);
1222    ConfigAdminInfo.name = NULL;
1223    MyFree(ConfigAdminInfo.email);
# Line 1242 | Line 1225 | clear_out_old_conf(void)
1225    MyFree(ConfigAdminInfo.description);
1226    ConfigAdminInfo.description = NULL;
1227  
1228 <  /* clean out listeners */
1229 <  close_listeners();
1228 >  /* Clean out listeners */
1229 >  listener_close_marked();
1230   }
1231  
1232   /* read_conf_files()
# Line 1280 | Line 1263 | read_conf_files(int cold)
1263      }
1264      else
1265      {
1266 <      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1266 >      sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1267                             "Unable to read configuration file '%s': %s",
1268                             filename, strerror(errno));
1269        return;
# Line 1295 | Line 1278 | read_conf_files(int cold)
1278  
1279    log_reopen_all();
1280  
1281 <  add_isupport("NICKLEN", NULL, ConfigServerInfo.max_nick_length);
1282 <  add_isupport("NETWORK", ConfigServerInfo.network_name, -1);
1281 >  isupport_add("NICKLEN", NULL, ConfigServerInfo.max_nick_length);
1282 >  isupport_add("NETWORK", ConfigServerInfo.network_name, -1);
1283  
1284    snprintf(chanmodes, sizeof(chanmodes), "beI:%d", ConfigChannel.max_bans);
1285 <  add_isupport("MAXLIST", chanmodes, -1);
1286 <  add_isupport("MAXTARGETS", NULL, ConfigGeneral.max_targets);
1287 <  add_isupport("CHANTYPES", "#", -1);
1285 >  isupport_add("MAXLIST", chanmodes, -1);
1286 >  isupport_add("MAXTARGETS", NULL, ConfigGeneral.max_targets);
1287 >  isupport_add("CHANTYPES", "#", -1);
1288  
1289    snprintf(chanlimit, sizeof(chanlimit), "#:%d",
1290             ConfigChannel.max_channels);
1291 <  add_isupport("CHANLIMIT", chanlimit, -1);
1292 <  snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,cimnprstMORS");
1293 <  add_isupport("CHANNELLEN", NULL, CHANNELLEN);
1294 <  add_isupport("TOPICLEN", NULL, ConfigServerInfo.max_topic_length);
1295 <  add_isupport("CHANMODES", chanmodes, -1);
1291 >  isupport_add("CHANLIMIT", chanlimit, -1);
1292 >  snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,cimnprstCMORS");
1293 >  isupport_add("CHANNELLEN", NULL, CHANNELLEN);
1294 >  isupport_add("TOPICLEN", NULL, ConfigServerInfo.max_topic_length);
1295 >  isupport_add("CHANMODES", chanmodes, -1);
1296  
1297    /*
1298     * message_locale may have changed.  rebuild isupport since it relies
1299     * on strlen(form_str(RPL_ISUPPORT))
1300     */
1301 <  rebuild_isupport_message_line();
1301 >  isupport_rebuild();
1302   }
1303  
1304   /* conf_add_class_to_conf()
# Line 1325 | Line 1308 | read_conf_files(int cold)
1308   * side effects - Add a class pointer to a conf
1309   */
1310   void
1311 < conf_add_class_to_conf(struct MaskItem *conf, const char *class_name)
1311 > conf_add_class_to_conf(struct MaskItem *conf, const char *name)
1312   {
1313 <  if (class_name == NULL)
1313 >  if (EmptyString(name) || (conf->class = class_find(name, 1)) == NULL)
1314    {
1315      conf->class = class_default;
1316  
1317      if (conf->type == CONF_CLIENT || conf->type == CONF_OPER)
1318 <      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1318 >      sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1319                             "Warning *** Defaulting to default class for %s@%s",
1320                             conf->user, conf->host);
1321      else
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",
1324                             conf->name);
1325    }
1343  else
1344    conf->class = class_find(class_name, 1);
1345
1346  if (conf->class == NULL)
1347  {
1348    if (conf->type == CONF_CLIENT || conf->type == CONF_OPER)
1349      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1350                           "Warning *** Defaulting to default class for %s@%s",
1351                           conf->user, conf->host);
1352    else
1353      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1354                           "Warning *** Defaulting to default class for %s",
1355                           conf->name);
1356    conf->class = class_default;
1357  }
1326   }
1327  
1328   /* yyerror()
# Line 1372 | Line 1340 | yyerror(const char *msg)
1340      return;
1341  
1342    strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
1343 <  sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1343 >  sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1344                         "\"%s\", line %u: %s: %s",
1345                         conffilebuf, lineno + 1, msg, newlinebuf);
1346    ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
# Line 1385 | Line 1353 | conf_error_report(const char *msg)
1353    char newlinebuf[IRCD_BUFSIZE];
1354  
1355    strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
1356 <  sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1356 >  sendto_realops_flags(UMODE_SERVNOTICE, L_ADMIN, SEND_NOTICE,
1357                         "\"%s\", line %u: %s: %s",
1358                         conffilebuf, lineno + 1, msg, newlinebuf);
1359    ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
# Line 1420 | Line 1388 | valid_tkline(const char *data, const int
1388  
1389    /*
1390     * In the degenerate case where oper does a /quote kline 0 user@host :reason
1391 <   * i.e. they specifically use 0, I am going to return 1 instead
1392 <   * as a return value of non-zero is used to flag it as a temporary kline
1391 >   * i.e. they specifically use 0, I am going to return 1 instead as a return
1392 >   * value of non-zero is used to flag it as a temporary kline
1393     */
1394    if (result == 0)
1395      result = 1;
# Line 1436 | Line 1404 | valid_tkline(const char *data, const int
1404    if (result > MAX_TDKLINE_TIME)
1405      result = MAX_TDKLINE_TIME;
1406  
1407 <  result = result * 60;  /* turn it into seconds */
1407 >  result = result * 60;  /* Turn it into seconds */
1408  
1409    return result;
1410   }
# Line 1452 | Line 1420 | valid_wild_card_simple(const char *data)
1420   {
1421    const unsigned char *p = (const unsigned char *)data;
1422    unsigned char tmpch = '\0';
1423 <  unsigned int nonwild = 0;
1423 >  unsigned int nonwild = 0, wild = 0;
1424  
1425    while ((tmpch = *p++))
1426    {
# Line 1467 | Line 1435 | valid_wild_card_simple(const char *data)
1435        if (++nonwild >= ConfigGeneral.min_nonwildcard_simple)
1436          return 1;
1437      }
1438 +    else
1439 +      ++wild;
1440    }
1441  
1442 <  return 0;
1442 >  return !wild;
1443   }
1444  
1445   /* valid_wild_card()
# Line 1481 | Line 1451 | valid_wild_card_simple(const char *data)
1451   * side effects - NOTICE is given to source_p if warn is 1
1452   */
1453   int
1454 < valid_wild_card(struct Client *source_p, int warn, int count, ...)
1454 > valid_wild_card(struct Client *source_p, int count, ...)
1455   {
1456    unsigned char tmpch = '\0';
1457    unsigned int nonwild = 0;
# Line 1524 | Line 1494 | valid_wild_card(struct Client *source_p,
1494      }
1495    }
1496  
1497 <  if (warn)
1497 >  if (IsClient(source_p))
1498      sendto_one_notice(source_p, &me,
1499                        ":Please include at least %u non-wildcard characters with the mask",
1500                        ConfigGeneral.min_nonwildcard);
# Line 1543 | Line 1513 | valid_wild_card(struct Client *source_p,
1513   */
1514   static int
1515   find_user_host(struct Client *source_p, char *user_host_or_nick,
1516 <               char *luser, char *lhost, unsigned int flags)
1516 >               char *luser, char *lhost)
1517   {
1518    struct Client *target_p = NULL;
1519    char *hostp = NULL;
# Line 1588 | Line 1558 | find_user_host(struct Client *source_p,
1558          find_chasing(source_p, user_host_or_nick)) == NULL)
1559        return 0;  /* find_chasing sends ERR_NOSUCHNICK */
1560  
1561 <    if (IsExemptKline(target_p))
1561 >    if (HasFlag(target_p, FLAGS_EXEMPTKLINE))
1562      {
1563        if (IsClient(source_p))
1564          sendto_one_notice(source_p, &me, ":%s is E-lined", target_p->name);
# Line 1596 | Line 1566 | find_user_host(struct Client *source_p,
1566      }
1567  
1568      /*
1569 <     * turn the "user" bit into "*user", blow away '~'
1569 >     * Turn the "user" bit into "*user", blow away '~'
1570       * if found in original user name (non-idented)
1571       */
1572      strlcpy(luser, target_p->username, USERLEN*4 + 1);
# Line 1628 | Line 1598 | find_user_host(struct Client *source_p,
1598   *              - pointer to target_server to parse into if non NULL
1599   *              - pointer to reason to parse into
1600   *
1601 < * output       - 1 if valid, -1 if not valid
1601 > * output       - 1 if valid, 0 if not valid
1602   * side effects - A generalised k/d/x etc. line parser,
1603   *               "ALINE [time] user@host|string [ON] target :reason"
1604   *                will parse returning a parsed user, host if
# Line 1651 | Line 1621 | parse_aline(const char *cmd, struct Clie
1621              char **target_server, char **reason)
1622   {
1623    int found_tkline_time=0;
1624 <  static char def_reason[] = CONF_NOREASON;
1624 >  static char default_reason[] = CONF_NOREASON;
1625    static char user[USERLEN*4+1];
1626    static char host[HOSTLEN*4+1];
1627  
# Line 1670 | Line 1640 | parse_aline(const char *cmd, struct Clie
1640      else
1641      {
1642        sendto_one_notice(source_p, &me, ":temp_line not supported by %s", cmd);
1643 <      return -1;
1643 >      return 0;
1644      }
1645    }
1646  
1647    if (parc == 0)
1648    {
1649      sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, cmd);
1650 <    return -1;
1650 >    return 0;
1651    }
1652  
1653    if (h_p == NULL)
1654      *up_p = *parv;
1655    else
1656    {
1657 <    if (find_user_host(source_p, *parv, user, host, parse_flags) == 0)
1658 <      return -1;
1657 >    if (find_user_host(source_p, *parv, user, host) == 0)
1658 >      return 0;
1659  
1660      *up_p = user;
1661      *h_p = host;
# Line 1701 | Line 1671 | parse_aline(const char *cmd, struct Clie
1671        parc--;
1672        parv++;
1673  
1704      if (target_server == NULL)
1705      {
1706        sendto_one_notice(source_p, &me, ":ON server not supported by %s", cmd);
1707        return -1;
1708      }
1709
1674        if (!HasOFlag(source_p, OPER_FLAG_REMOTEBAN))
1675        {
1676          sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "remoteban");
1677 <        return -1;
1677 >        return 0;
1678        }
1679  
1680        if (parc == 0 || EmptyString(*parv))
1681        {
1682          sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, cmd);
1683 <        return -1;
1683 >        return 0;
1684        }
1685  
1686        *target_server = *parv;
# Line 1738 | Line 1702 | parse_aline(const char *cmd, struct Clie
1702      if (strchr(user, '!'))
1703      {
1704        sendto_one_notice(source_p, &me, ":Invalid character '!' in kline");
1705 <      return -1;
1705 >      return 0;
1706      }
1707  
1708 <    if ((parse_flags & AWILD) && !valid_wild_card(source_p, 1, 2, *up_p, *h_p))
1709 <      return -1;
1708 >    if ((parse_flags & AWILD) && !valid_wild_card(source_p, 2, *up_p, *h_p))
1709 >      return 0;
1710    }
1711    else
1712 <    if ((parse_flags & AWILD) && !valid_wild_card(source_p, 1, 1, *up_p))
1713 <      return -1;
1712 >    if ((parse_flags & AWILD) && !valid_wild_card(source_p, 1, *up_p))
1713 >      return 0;
1714  
1715    if (reason)
1716    {
1717      if (parc && !EmptyString(*parv))
1754    {
1718        *reason = *parv;
1756
1757      if (!valid_comment(source_p, *reason, 1))
1758        return -1;
1759    }
1719      else
1720 <      *reason = def_reason;
1720 >      *reason = default_reason;
1721    }
1722  
1723    return 1;
1724   }
1725  
1767 /* valid_comment()
1768 *
1769 * inputs       - pointer to client
1770 *              - pointer to comment
1771 * output       - 0 if no valid comment,
1772 *              - 1 if valid
1773 * side effects - truncates reason where necessary
1774 */
1775 int
1776 valid_comment(struct Client *source_p, char *comment, int warn)
1777 {
1778  if (strlen(comment) > REASONLEN)
1779    comment[REASONLEN-1] = '\0';
1780
1781  return 1;
1782 }
1783
1726   /* match_conf_password()
1727   *
1728   * inputs       - pointer to given password
# Line 1809 | Line 1751 | match_conf_password(const char *password
1751   *
1752   * inputs       - client sending the cluster
1753   *              - command name "KLINE" "XLINE" etc.
1754 < *              - capab -- CAP_KLN etc. from server.h
1754 > *              - capab -- CAPAB_KLN etc. from server.h
1755   *              - cluster type -- CLUSTER_KLINE etc. from conf.h
1756   *              - pattern and args to send along
1757   * output       - none
# Line 1817 | Line 1759 | match_conf_password(const char *password
1759   *                along to all servers that match capab and cluster type
1760   */
1761   void
1762 < cluster_a_line(struct Client *source_p, const char *command,
1763 <               int capab, int cluster_type, const char *pattern, ...)
1762 > cluster_a_line(struct Client *source_p, const char *command, unsigned int capab,
1763 >               unsigned int cluster_type, const char *pattern, ...)
1764   {
1765    va_list args;
1766    char buffer[IRCD_BUFSIZE] = "";
# Line 1833 | Line 1775 | cluster_a_line(struct Client *source_p,
1775      const struct MaskItem *conf = node->data;
1776  
1777      if (conf->flags & cluster_type)
1778 <      sendto_match_servs(source_p, conf->name, CAP_CLUSTER|capab,
1778 >      sendto_match_servs(source_p, conf->name, CAPAB_CLUSTER | capab,
1779                           "%s %s %s", command, conf->name, buffer);
1780    }
1781   }
# Line 1919 | Line 1861 | split_nuh(struct split_nuh_item *const i
1861      }
1862      else
1863      {
1864 <      /* no @ found */
1864 >      /* No @ found */
1865        if (!iptr->nickptr || strpbrk(iptr->nuhmask, ".:"))
1866          strlcpy(iptr->hostptr, iptr->nuhmask, iptr->hostsize);
1867        else

Diff Legend

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