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 2228 by michael, Thu Jun 13 19:46:30 2013 UTC vs.
Revision 3347 by michael, Sun Apr 20 14:03:06 2014 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  conf.c: Configuration file functions.
2 > *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (C) 2002 by the past and present ircd coders, and others.
4 > *  Copyright (c) 1997-2014 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 18 | Line 17
17   *  along with this program; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
19   *  USA
20 < *
21 < *  $Id$
20 > */
21 >
22 > /*! \file conf.c
23 > * \brief Configuration file functions.
24 > * \version $Id$
25   */
26  
27   #include "stdinc.h"
28   #include "list.h"
29   #include "ircd_defs.h"
30   #include "conf.h"
31 < #include "s_serv.h"
31 > #include "server.h"
32   #include "resv.h"
33   #include "channel.h"
34   #include "client.h"
35   #include "event.h"
34 – #include "hook.h"
36   #include "irc_string.h"
37   #include "s_bsd.h"
38   #include "ircd.h"
# Line 42 | Line 43
43   #include "fdlist.h"
44   #include "log.h"
45   #include "send.h"
45 – #include "s_gline.h"
46   #include "memory.h"
47   #include "mempool.h"
48 < #include "irc_res.h"
48 > #include "res.h"
49   #include "userhost.h"
50 < #include "s_user.h"
50 > #include "user.h"
51   #include "channel_mode.h"
52   #include "parse.h"
53 < #include "s_misc.h"
53 > #include "misc.h"
54   #include "conf_db.h"
55   #include "conf_class.h"
56   #include "motd.h"
57  
58 +
59 + struct config_channel_entry ConfigChannel;
60   struct config_server_hide ConfigServerHide;
61 + struct config_file_entry ConfigFileEntry;
62 + struct logging_entry ConfigLoggingEntry = { .use_logging = 1 };
63 + struct server_info ServerInfo;
64 + struct admin_info AdminInfo;
65  
66   /* general conf items link list root, other than k lines etc. */
67   dlink_list service_items = { NULL, NULL, 0 };
# Line 123 | Line 129 | conf_dns_callback(void *vptr, const stru
129  
130    conf->dns_pending = 0;
131  
132 <  if (addr != NULL)
132 >  if (addr)
133      memcpy(&conf->addr, addr, sizeof(conf->addr));
134    else
135      conf->dns_failed = 1;
# Line 174 | Line 180 | conf_free(struct MaskItem *conf)
180  
181    if (conf->dns_pending)
182      delete_resolver_queries(conf);
183 <  if (conf->passwd != NULL)
183 >  if (conf->passwd)
184      memset(conf->passwd, 0, strlen(conf->passwd));
185 <  if (conf->spasswd != NULL)
185 >  if (conf->spasswd)
186      memset(conf->spasswd, 0, strlen(conf->spasswd));
187  
188    conf->class = NULL;
# Line 196 | Line 202 | conf_free(struct MaskItem *conf)
202    DLINK_FOREACH_SAFE(ptr, ptr_next, conf->hub_list.head)
203    {
204      MyFree(ptr->data);
205 +    dlinkDelete(ptr, &conf->hub_list);
206      free_dlink_node(ptr);
207    }
208  
209    DLINK_FOREACH_SAFE(ptr, ptr_next, conf->leaf_list.head)
210    {
211      MyFree(ptr->data);
212 +    dlinkDelete(ptr, &conf->leaf_list);
213      free_dlink_node(ptr);
214    }
215  
# Line 209 | Line 217 | conf_free(struct MaskItem *conf)
217    {
218      struct exempt *exptr = ptr->data;
219  
220 +    dlinkDelete(ptr, &conf->exempt_list);
221      MyFree(exptr->name);
222      MyFree(exptr->user);
223      MyFree(exptr->host);
# Line 235 | Line 244 | int
244   check_client(struct Client *source_p)
245   {
246    int i;
247 <
247 >
248    if ((i = verify_access(source_p)))
249 <    ilog(LOG_TYPE_IRCD, "Access denied: %s[%s]",
249 >    ilog(LOG_TYPE_IRCD, "Access denied: %s[%s]",
250           source_p->name, source_p->sockhost);
251  
252    switch (i)
# Line 250 | Line 259 | check_client(struct Client *source_p)
259        ilog(LOG_TYPE_IRCD, "Too many connections on IP from %s.",
260             get_client_name(source_p, SHOW_IP));
261        ++ServerStats.is_ref;
262 <      exit_client(source_p, &me, "No more connections allowed on that IP");
262 >      exit_client(source_p, "No more connections allowed on that IP");
263        break;
264  
265      case I_LINE_FULL:
# Line 261 | Line 270 | check_client(struct Client *source_p)
270        ilog(LOG_TYPE_IRCD, "Too many connections from %s.",
271             get_client_name(source_p, SHOW_IP));
272        ++ServerStats.is_ref;
273 <      exit_client(source_p, &me,
265 <                  "No more connections allowed in your connection class");
273 >      exit_client(source_p, "No more connections allowed in your connection class");
274        break;
275  
276      case NOT_AUTHORIZED:
# Line 281 | Line 289 | check_client(struct Client *source_p)
289             source_p->localClient->listener->name,
290             source_p->localClient->listener->port);
291  
292 <      exit_client(source_p, &me, "You are not authorized to use this server");
292 >      exit_client(source_p, "You are not authorized to use this server");
293        break;
294  
295     case BANNED_CLIENT:
296 <     exit_client(source_p, &me, "Banned");
296 >     exit_client(source_p, "Banned");
297       ++ServerStats.is_ref;
298       break;
299  
# Line 307 | Line 315 | static int
315   verify_access(struct Client *client_p)
316   {
317    struct MaskItem *conf = NULL;
318 <  char non_ident[USERLEN + 1] = { '~', '\0' };
318 >  char non_ident[USERLEN + 1] = "~";
319  
320    if (IsGotId(client_p))
321    {
# Line 325 | Line 333 | verify_access(struct Client *client_p)
333                               client_p->localClient->passwd);
334    }
335  
336 <  if (conf != NULL)
336 >  if (conf)
337    {
338      if (IsConfClient(conf))
339      {
340        if (IsConfRedir(conf))
341        {
342 <        sendto_one(client_p, form_str(RPL_REDIR),
343 <                   me.name, client_p->name,
344 <                   conf->name ? conf->name : "",
337 <                   conf->port);
342 >        sendto_one_numeric(client_p, &me, RPL_REDIR,
343 >                           conf->name ? conf->name : "",
344 >                           conf->port);
345          return NOT_AUTHORIZED;
346        }
347  
# Line 357 | Line 364 | verify_access(struct Client *client_p)
364      else if (IsConfKill(conf) || (ConfigFileEntry.glines && IsConfGline(conf)))
365      {
366        if (IsConfGline(conf))
367 <        sendto_one(client_p, ":%s NOTICE %s :*** G-lined", me.name,
368 <                   client_p->name);
362 <      sendto_one(client_p, ":%s NOTICE %s :*** Banned: %s",
363 <                 me.name, client_p->name, conf->reason);
367 >        sendto_one_notice(client_p, &me, ":*** G-lined");
368 >      sendto_one_notice(client_p, &me, ":*** Banned: %s", conf->reason);
369        return BANNED_CLIENT;
370      }
371    }
# Line 383 | Line 388 | attach_iline(struct Client *client_p, st
388    int a_limit_reached = 0;
389    unsigned int local = 0, global = 0, ident = 0;
390  
391 +  assert(conf->class);
392 +
393    ip_found = find_or_add_ip(&client_p->localClient->ip);
394    ip_found->count++;
395    SetIpHash(client_p);
396  
390 –  if (conf->class == NULL)
391 –    return NOT_AUTHORIZED;  /* If class is missing, this is best */
392 –
397    class = conf->class;
398  
399    count_user_host(client_p->username, client_p->host,
# Line 416 | Line 420 | attach_iline(struct Client *client_p, st
420      if (!IsConfExemptLimits(conf))
421        return TOO_MANY;   /* Already at maximum allowed */
422  
423 <    sendto_one(client_p,
424 <               ":%s NOTICE %s :*** Your connection class is full, "
421 <               "but you have exceed_limit = yes;", me.name, client_p->name);
423 >    sendto_one_notice(client_p, &me, ":*** Your connection class is full, "
424 >                      "but you have exceed_limit = yes;");
425    }
426  
427    return attach_conf(client_p, conf);
# Line 577 | Line 580 | hash_ip(struct irc_ssaddr *addr)
580      uint32_t *ip = (uint32_t *)&v6->sin6_addr.s6_addr;
581  
582      hash  = ip[0] ^ ip[3];
583 <    hash ^= hash >> 16;  
584 <    hash ^= hash >> 8;  
583 >    hash ^= hash >> 16;
584 >    hash ^= hash >> 8;
585      hash  = hash & (IP_HASH_SIZE - 1);
586      return hash;
587    }
# Line 589 | Line 592 | hash_ip(struct irc_ssaddr *addr)
592  
593   /* count_ip_hash()
594   *
595 < * inputs        - pointer to counter of number of ips hashed
595 > * inputs        - pointer to counter of number of ips hashed
596   *               - pointer to memory used for ip hash
597   * output        - returned via pointers input
598   * side effects  - NONE
# Line 665 | Line 668 | garbage_collect_ip_entries(void)
668   void
669   detach_conf(struct Client *client_p, enum maskitem_type type)
670   {
671 <  dlink_node *ptr = NULL, *next_ptr = NULL;
671 >  dlink_node *ptr = NULL, *ptr_next = NULL;
672  
673 <  DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->localClient->confs.head)
673 >  DLINK_FOREACH_SAFE(ptr, ptr_next, client_p->localClient->confs.head)
674    {
675      struct MaskItem *conf = ptr->data;
676  
# Line 708 | Line 711 | detach_conf(struct Client *client_p, enu
711   int
712   attach_conf(struct Client *client_p, struct MaskItem *conf)
713   {
714 <  if (dlinkFind(&client_p->localClient->confs, conf) != NULL)
714 >  if (dlinkFind(&client_p->localClient->confs, conf))
715      return 1;
716  
717    if (conf->type == CONF_CLIENT)
# Line 777 | Line 780 | find_conf_name(dlink_list *list, const c
780    DLINK_FOREACH(ptr, list->head)
781    {
782      conf = ptr->data;
783 <    
783 >
784      if (conf->type == type)
785      {
786        if (conf->name && (irccmp(conf->name, name) == 0 ||
# Line 895 | Line 898 | find_matching_name_conf(enum maskitem_ty
898          return conf;
899      }
900      break;
901 <  
901 >
902    default:
903      break;
904    }
# Line 932 | Line 935 | find_exact_name_conf(enum maskitem_type
935  
936        if (EmptyString(conf->name))
937          continue;
938 <    
938 >
939        if (irccmp(conf->name, name) == 0)
940        {
941          if ((user == NULL && (host == NULL)))
# Line 998 | Line 1001 | find_exact_name_conf(enum maskitem_type
1001  
1002        if (EmptyString(conf->name))
1003          continue;
1004 <    
1004 >
1005        if (name == NULL)
1006        {
1007          if (EmptyString(conf->host))
# Line 1028 | Line 1031 | find_exact_name_conf(enum maskitem_type
1031   int
1032   rehash(int sig)
1033   {
1034 <  if (sig != 0)
1034 >  if (sig)
1035      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1036 <                         "Got signal SIGHUP, reloading ircd.conf file");
1036 >                         "Got signal SIGHUP, reloading configuration file(s)");
1037  
1038    restart_resolver();
1039  
# Line 1041 | Line 1044 | rehash(int sig)
1044  
1045    read_conf_files(0);
1046  
1047 <  if (ServerInfo.description != NULL)
1047 >  if (ServerInfo.description)
1048      strlcpy(me.info, ServerInfo.description, sizeof(me.info));
1049  
1050    load_conf_modules();
# Line 1119 | Line 1122 | set_default_conf(void)
1122    ConfigServerHide.hide_server_ips = 0;
1123    ConfigServerHide.disable_remote_commands = 0;
1124  
1122 –  
1125    ConfigFileEntry.service_name = xstrdup(SERVICE_NAME_DEFAULT);
1126    ConfigFileEntry.max_watch = WATCHSIZE_DEFAULT;
1127 +  ConfigFileEntry.cycle_on_host_change = 1;
1128    ConfigFileEntry.glines = 0;
1129    ConfigFileEntry.gline_time = 12 * 3600;
1130    ConfigFileEntry.gline_request_time = GLINE_REQUEST_EXPIRE_DEFAULT;
# Line 1150 | Line 1153 | set_default_conf(void)
1153    ConfigFileEntry.stats_k_oper_only = 1;  /* masked */
1154    ConfigFileEntry.stats_i_oper_only = 1;  /* masked */
1155    ConfigFileEntry.stats_P_oper_only = 0;
1156 +  ConfigFileEntry.stats_u_oper_only = 0;
1157    ConfigFileEntry.caller_id_wait = 60;
1158    ConfigFileEntry.opers_bypass_callerid = 0;
1159    ConfigFileEntry.pace_wait = 10;
# Line 1189 | Line 1193 | validate_conf(void)
1193    ConfigFileEntry.max_watch = IRCD_MAX(ConfigFileEntry.max_watch, WATCHSIZE_MIN);
1194   }
1195  
1196 < /* read_conf()
1196 > /* read_conf()
1197   *
1198   * inputs       - file descriptor pointing to config file to use
1199   * output       - None
# Line 1240 | Line 1244 | lookup_confhost(struct MaskItem *conf)
1244      return;
1245    }
1246  
1247 <  assert(res != NULL);
1247 >  assert(res);
1248  
1249    memcpy(&conf->addr, res->ai_addr, res->ai_addrlen);
1250    conf->addr.ss_len = res->ai_addrlen;
# Line 1266 | Line 1270 | conf_connect_allowed(struct irc_ssaddr *
1270    if (conf && (conf->type == CONF_EXEMPT))
1271      return 0;
1272  
1273 <  if (conf != NULL)
1273 >  if (conf)
1274      return BANNED_CLIENT;
1275  
1276    ip_found = find_or_add_ip(addr);
# Line 1282 | Line 1286 | conf_connect_allowed(struct irc_ssaddr *
1286    return 0;
1287   }
1288  
1285 – /* find_kill()
1286 – *
1287 – * inputs       - pointer to client structure
1288 – * output       - pointer to struct MaskItem if found
1289 – * side effects - See if this user is klined already,
1290 – *                and if so, return struct MaskItem pointer
1291 – */
1292 – struct MaskItem *
1293 – find_kill(struct Client *client_p)
1294 – {
1295 –  struct MaskItem *conf = NULL;
1296 –
1297 –  assert(client_p != NULL);
1298 –
1299 –  conf = find_conf_by_address(client_p->host, &client_p->localClient->ip,
1300 –                              CONF_KLINE, client_p->localClient->aftype,
1301 –                              client_p->username, NULL, 1);
1302 –  return conf;
1303 – }
1304 –
1305 – struct MaskItem *
1306 – find_gline(struct Client *client_p)
1307 – {
1308 –  struct MaskItem *conf;
1309 –
1310 –  assert(client_p != NULL);
1311 –
1312 –  conf = find_conf_by_address(client_p->host, &client_p->localClient->ip,
1313 –                              CONF_GLINE, client_p->localClient->aftype,
1314 –                              client_p->username, NULL, 1);
1315 –  return conf;
1316 – }
1317 –
1289   /* cleanup_tklines()
1290   *
1291   * inputs       - NONE
# Line 1326 | Line 1297 | void
1297   cleanup_tklines(void *notused)
1298   {
1299    hostmask_expire_temporary();
1300 <  expire_tklines(&xconf_items);
1300 >  expire_tklines(&xconf_items);
1301    expire_tklines(&nresv_items);
1302    expire_tklines(&cresv_items);
1303   }
# Line 1340 | Line 1311 | cleanup_tklines(void *notused)
1311   static void
1312   expire_tklines(dlink_list *tklist)
1313   {
1314 <  dlink_node *ptr;
1315 <  dlink_node *next_ptr;
1345 <  struct MaskItem *conf;
1314 >  dlink_node *ptr = NULL, *ptr_next = NULL;
1315 >  struct MaskItem *conf = NULL;
1316  
1317 <  DLINK_FOREACH_SAFE(ptr, next_ptr, tklist->head)
1317 >  DLINK_FOREACH_SAFE(ptr, ptr_next, tklist->head)
1318    {
1319      conf = ptr->data;
1320  
# Line 1393 | Line 1363 | static const struct oper_privs
1363    { OPER_FLAG_SQUIT,          'R' },
1364    { OPER_FLAG_SQUIT_REMOTE,   'S' },
1365    { OPER_FLAG_UNKLINE,        'U' },
1366 <  { OPER_FLAG_X,              'X' },
1366 >  { OPER_FLAG_XLINE,          'X' },
1367    { 0, '\0' }
1368   };
1369  
1370   char *
1371   oper_privs_as_string(const unsigned int port)
1372   {
1373 <  static char privs_out[16];
1373 >  static char privs_out[IRCD_BUFSIZE];
1374    char *privs_ptr = privs_out;
1405 –  const struct oper_privs *opriv = flag_list;
1375  
1376 <  for (; opriv->flag; ++opriv)
1376 >  for (const struct oper_privs *opriv = flag_list; opriv->flag; ++opriv)
1377    {
1378      if (port & opriv->flag)
1379        *privs_ptr++ = opriv->c;
# Line 1426 | Line 1395 | oper_privs_as_string(const unsigned int
1395   const char *
1396   get_oper_name(const struct Client *client_p)
1397   {
1398 <  dlink_node *cnode = NULL;
1398 >  const dlink_node *cnode = NULL;
1399    /* +5 for !,@,{,} and null */
1400    static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
1401  
# Line 1434 | Line 1403 | get_oper_name(const struct Client *clien
1403    {
1404      if ((cnode = client_p->localClient->confs.head))
1405      {
1406 <      struct MaskItem *conf = cnode->data;
1406 >      const struct MaskItem *conf = cnode->data;
1407  
1408        if (IsConfOperator(conf))
1409        {
# Line 1444 | Line 1413 | get_oper_name(const struct Client *clien
1413        }
1414      }
1415  
1416 <    /* Probably should assert here for now. If there is an oper out there
1416 >    /* Probably should assert here for now. If there is an oper out there
1417       * with no oper{} conf attached, it would be good for us to know...
1418       */
1419      assert(0); /* Oper without oper conf! */
# Line 1465 | Line 1434 | void
1434   read_conf_files(int cold)
1435   {
1436    const char *filename;
1437 <  char chanmodes[32];
1438 <  char chanlimit[32];
1437 >  char chanmodes[IRCD_BUFSIZE];
1438 >  char chanlimit[IRCD_BUFSIZE];
1439  
1440    conf_parser_ctx.boot = cold;
1441    filename = ConfigFileEntry.configfile;
# Line 1475 | Line 1444 | read_conf_files(int cold)
1444       FIXME: The full path is in conffilenamebuf first time since we
1445               dont know anything else
1446  
1447 <     - Gozem 2002-07-21
1447 >     - Gozem 2002-07-21
1448    */
1449    strlcpy(conffilebuf, filename, sizeof(conffilebuf));
1450  
# Line 1549 | Line 1518 | clear_out_old_conf(void)
1518    /* We only need to free anything allocated by yyparse() here.
1519     * Resetting structs, etc, is taken care of by set_default_conf().
1520     */
1521 <  
1521 >
1522    for (; *iterator != NULL; iterator++)
1523    {
1524      DLINK_FOREACH_SAFE(ptr, next_ptr, (*iterator)->head)
# Line 1597 | Line 1566 | clear_out_old_conf(void)
1566    MyFree(ConfigFileEntry.egdpool_path);
1567    ConfigFileEntry.egdpool_path = NULL;
1568   #ifdef HAVE_LIBCRYPTO
1569 <  if (ServerInfo.rsa_private_key != NULL)
1569 >  if (ServerInfo.rsa_private_key)
1570    {
1571      RSA_free(ServerInfo.rsa_private_key);
1572      ServerInfo.rsa_private_key = NULL;
# Line 1636 | Line 1605 | clear_out_old_conf(void)
1605   *
1606   * inputs       - pointer to config item
1607   * output       - NONE
1608 < * side effects - Add a class pointer to a conf
1608 > * side effects - Add a class pointer to a conf
1609   */
1610   void
1611   conf_add_class_to_conf(struct MaskItem *conf, const char *class_name)
1612   {
1613 <  if (class_name == NULL)
1613 >  if (class_name == NULL)
1614    {
1615      conf->class = class_default;
1616  
# Line 1708 | Line 1677 | conf_error_report(const char *msg)
1677  
1678   /*
1679   * valid_tkline()
1680 < *
1680 > *
1681   * inputs       - pointer to ascii string to check
1682   *              - whether the specified time is in seconds or minutes
1683   * output       - -1 not enough parameters
# Line 1717 | Line 1686 | conf_error_report(const char *msg)
1686   * Originally written by Dianora (Diane, db@db.net)
1687   */
1688   time_t
1689 < valid_tkline(const char *p, int minutes)
1689 > valid_tkline(const char *data, const int minutes)
1690   {
1691 +  const unsigned char *p = (const unsigned char *)data;
1692 +  unsigned char tmpch = '\0';
1693    time_t result = 0;
1694  
1695 <  for (; *p; ++p)
1695 >  while ((tmpch = *p++))
1696    {
1697 <    if (!IsDigit(*p))
1697 >    if (!IsDigit(tmpch))
1698        return 0;
1699  
1700      result *= 10;
1701 <    result += (*p & 0xF);
1701 >    result += (tmpch & 0xF);
1702    }
1703  
1704    /*
1705 <   * In the degenerate case where oper does a /quote kline 0 user@host :reason
1705 >   * In the degenerate case where oper does a /quote kline 0 user@host :reason
1706     * i.e. they specifically use 0, I am going to return 1 instead
1707     * as a return value of non-zero is used to flag it as a temporary kline
1708     */
1709    if (result == 0)
1710      result = 1;
1711  
1712 <  /*
1712 >  /*
1713     * If the incoming time is in seconds convert it to minutes for the purpose
1714     * of this calculation
1715     */
1716    if (!minutes)
1717 <    result = result / (time_t)60;
1717 >    result = result / 60;
1718  
1719    if (result > MAX_TDKLINE_TIME)
1720      result = MAX_TDKLINE_TIME;
1721  
1722 <  result = result * (time_t)60;  /* turn it into seconds */
1722 >  result = result * 60;  /* turn it into seconds */
1723  
1724    return result;
1725   }
# Line 1828 | Line 1799 | valid_wild_card(struct Client *source_p,
1799           * break - no point in searching further.
1800           */
1801          if (++nonwild >= ConfigFileEntry.min_nonwildcard)
1802 +        {
1803 +          va_end(args);
1804            return 1;
1805 +        }
1806        }
1807      }
1808    }
1809  
1810    if (warn)
1811 <    sendto_one(source_p, ":%s NOTICE %s :Please include at least %d non-wildcard characters with the mask",
1812 <               me.name, source_p->name, ConfigFileEntry.min_nonwildcard);
1811 >    sendto_one_notice(source_p, &me,
1812 >                      ":Please include at least %d non-wildcard characters with the mask",
1813 >                      ConfigFileEntry.min_nonwildcard);
1814 >  va_end(args);
1815    return 0;
1816   }
1817  
# Line 1849 | Line 1825 | valid_wild_card(struct Client *source_p,
1825   *              - parse_flags bit map of things to test
1826   *              - pointer to user or string to parse into
1827   *              - pointer to host or NULL to parse into if non NULL
1828 < *              - pointer to optional tkline time or NULL
1828 > *              - pointer to optional tkline time or NULL
1829   *              - pointer to target_server to parse into if non NULL
1830   *              - pointer to reason to parse into
1831   *
# Line 1894 | Line 1870 | parse_aline(const char *cmd, struct Clie
1870        *tkline_time = found_tkline_time;
1871      else
1872      {
1873 <      sendto_one(source_p, ":%s NOTICE %s :temp_line not supported by %s",
1898 <                 me.name, source_p->name, cmd);
1873 >      sendto_one_notice(source_p, &me, ":temp_line not supported by %s", cmd);
1874        return -1;
1875      }
1876    }
1877  
1878    if (parc == 0)
1879    {
1880 <    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
1906 <               me.name, source_p->name, cmd);
1880 >    sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, cmd);
1881      return -1;
1882    }
1883  
# Line 1917 | Line 1891 | parse_aline(const char *cmd, struct Clie
1891      *up_p = user;
1892      *h_p = host;
1893    }
1894 <
1894 >
1895    parc--;
1896    parv++;
1897  
# Line 1930 | Line 1904 | parse_aline(const char *cmd, struct Clie
1904  
1905        if (target_server == NULL)
1906        {
1907 <        sendto_one(source_p, ":%s NOTICE %s :ON server not supported by %s",
1934 <                   me.name, source_p->name, cmd);
1907 >        sendto_one_notice(source_p, &me, ":ON server not supported by %s", cmd);
1908          return -1;
1909        }
1910  
1911        if (!HasOFlag(source_p, OPER_FLAG_REMOTEBAN))
1912        {
1913 <        sendto_one(source_p, form_str(ERR_NOPRIVS),
1941 <                   me.name, source_p->name, "remoteban");
1913 >        sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "remoteban");
1914          return -1;
1915        }
1916  
1917        if (parc == 0 || EmptyString(*parv))
1918        {
1919 <        sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
1948 <                   me.name, source_p->name, cmd);
1919 >        sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, cmd);
1920          return -1;
1921        }
1922  
# Line 1967 | Line 1938 | parse_aline(const char *cmd, struct Clie
1938    {
1939      if (strchr(user, '!') != NULL)
1940      {
1941 <      sendto_one(source_p, ":%s NOTICE %s :Invalid character '!' in kline",
1971 <                 me.name, source_p->name);
1941 >      sendto_one_notice(source_p, &me, ":Invalid character '!' in kline");
1942        return -1;
1943      }
1944  
# Line 2039 | Line 2009 | find_user_host(struct Client *source_p,
2009        luser[1] = '\0';
2010        strlcpy(lhost, user_host_or_nick, HOSTLEN*4 + 1);
2011      }
2012 <    
2012 >
2013      return 1;
2014    }
2015    else
2016    {
2017      /* Try to find user@host mask from nick */
2018      /* Okay to use source_p as the first param, because source_p == client_p */
2019 <    if ((target_p =
2020 <        find_chasing(source_p, source_p, user_host_or_nick, NULL)) == NULL)
2019 >    if ((target_p =
2020 >        find_chasing(source_p, user_host_or_nick)) == NULL)
2021        return 0;
2022  
2023      if (IsExemptKline(target_p))
2024      {
2025        if (!IsServer(source_p))
2026 <        sendto_one(source_p,
2057 <                   ":%s NOTICE %s :%s is E-lined",
2058 <                   me.name, source_p->name, target_p->name);
2026 >        sendto_one_notice(source_p, &me, ":%s is E-lined", target_p->name);
2027        return 0;
2028      }
2029  
# Line 2116 | Line 2084 | match_conf_password(const char *password
2084    else
2085      encr = password;
2086  
2087 <  return !strcmp(encr, conf->passwd);
2087 >  return encr && !strcmp(encr, conf->passwd);
2088   }
2089  
2090   /*
# Line 2124 | Line 2092 | match_conf_password(const char *password
2092   *
2093   * inputs       - client sending the cluster
2094   *              - command name "KLINE" "XLINE" etc.
2095 < *              - capab -- CAP_KLN etc. from s_serv.h
2095 > *              - capab -- CAP_KLN etc. from server.h
2096   *              - cluster type -- CLUSTER_KLINE etc. from conf.h
2097   *              - pattern and args to send along
2098   * output       - none
# Line 2200 | Line 2168 | split_nuh(struct split_nuh_item *const i
2168      if (iptr->nickptr && *iptr->nuhmask != '\0')
2169        strlcpy(iptr->nickptr, iptr->nuhmask, iptr->nicksize);
2170  
2171 <    if ((q = strchr(++p, '@'))) {
2171 >    if ((q = strchr(++p, '@')))
2172 >    {
2173        *q++ = '\0';
2174  
2175        if (*p != '\0')

Diff Legend

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