| 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 |
| 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" |
| 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 }; |
| 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; |
| 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; |
| 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) |
| 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: |
| 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, |
| 268 |
< |
"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: |
| 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 |
|
|
| 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 |
|
{ |
| 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 : "", |
| 340 |
< |
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 |
|
|
| 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); |
| 365 |
< |
sendto_one(client_p, ":%s NOTICE %s :*** Banned: %s", |
| 366 |
< |
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 |
|
} |
| 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, " |
| 423 |
< |
"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); |
| 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 |
|
} |
| 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 |
| 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 |
|
|
| 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) |
| 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 || |
| 898 |
|
return conf; |
| 899 |
|
} |
| 900 |
|
break; |
| 901 |
< |
|
| 901 |
> |
|
| 902 |
|
default: |
| 903 |
|
break; |
| 904 |
|
} |
| 935 |
|
|
| 936 |
|
if (EmptyString(conf->name)) |
| 937 |
|
continue; |
| 938 |
< |
|
| 938 |
> |
|
| 939 |
|
if (irccmp(conf->name, name) == 0) |
| 940 |
|
{ |
| 941 |
|
if ((user == NULL && (host == NULL))) |
| 1001 |
|
|
| 1002 |
|
if (EmptyString(conf->name)) |
| 1003 |
|
continue; |
| 1004 |
< |
|
| 1004 |
> |
|
| 1005 |
|
if (name == NULL) |
| 1006 |
|
{ |
| 1007 |
|
if (EmptyString(conf->host)) |
| 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 configuration file(s)"); |
| 1037 |
|
|
| 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(); |
| 1122 |
|
ConfigServerHide.hide_server_ips = 0; |
| 1123 |
|
ConfigServerHide.disable_remote_commands = 0; |
| 1124 |
|
|
| 1124 |
– |
|
| 1125 |
|
ConfigFileEntry.service_name = xstrdup(SERVICE_NAME_DEFAULT); |
| 1126 |
|
ConfigFileEntry.max_watch = WATCHSIZE_DEFAULT; |
| 1127 |
|
ConfigFileEntry.cycle_on_host_change = 1; |
| 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 |
| 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; |
| 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); |
| 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 |
|
} |
| 1311 |
|
static void |
| 1312 |
|
expire_tklines(dlink_list *tklist) |
| 1313 |
|
{ |
| 1314 |
< |
dlink_node *ptr; |
| 1315 |
< |
dlink_node *next_ptr; |
| 1316 |
< |
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 |
|
|
| 1372 |
|
{ |
| 1373 |
|
static char privs_out[IRCD_BUFSIZE]; |
| 1374 |
|
char *privs_ptr = privs_out; |
| 1376 |
– |
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; |
| 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 |
|
|
| 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 |
|
{ |
| 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! */ |
| 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 |
|
|
| 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) |
| 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; |
| 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 |
|
|
| 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 |
| 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 / 60; |
| 1717 |
> |
result = result / 60; |
| 1718 |
|
|
| 1719 |
|
if (result > MAX_TDKLINE_TIME) |
| 1720 |
|
result = MAX_TDKLINE_TIME; |
| 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 |
|
} |
| 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 |
|
* |
| 1870 |
|
*tkline_time = found_tkline_time; |
| 1871 |
|
else |
| 1872 |
|
{ |
| 1873 |
< |
sendto_one(source_p, ":%s NOTICE %s :temp_line not supported by %s", |
| 1875 |
< |
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), |
| 1883 |
< |
me.name, source_p->name, cmd); |
| 1880 |
> |
sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, cmd); |
| 1881 |
|
return -1; |
| 1882 |
|
} |
| 1883 |
|
|
| 1891 |
|
*up_p = user; |
| 1892 |
|
*h_p = host; |
| 1893 |
|
} |
| 1894 |
< |
|
| 1894 |
> |
|
| 1895 |
|
parc--; |
| 1896 |
|
parv++; |
| 1897 |
|
|
| 1904 |
|
|
| 1905 |
|
if (target_server == NULL) |
| 1906 |
|
{ |
| 1907 |
< |
sendto_one(source_p, ":%s NOTICE %s :ON server not supported by %s", |
| 1911 |
< |
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), |
| 1918 |
< |
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), |
| 1925 |
< |
me.name, source_p->name, cmd); |
| 1919 |
> |
sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, cmd); |
| 1920 |
|
return -1; |
| 1921 |
|
} |
| 1922 |
|
|
| 1938 |
|
{ |
| 1939 |
|
if (strchr(user, '!') != NULL) |
| 1940 |
|
{ |
| 1941 |
< |
sendto_one(source_p, ":%s NOTICE %s :Invalid character '!' in kline", |
| 1948 |
< |
me.name, source_p->name); |
| 1941 |
> |
sendto_one_notice(source_p, &me, ":Invalid character '!' in kline"); |
| 1942 |
|
return -1; |
| 1943 |
|
} |
| 1944 |
|
|
| 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, 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, |
| 2034 |
< |
":%s NOTICE %s :%s is E-lined", |
| 2035 |
< |
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 |
|
|
| 2084 |
|
else |
| 2085 |
|
encr = password; |
| 2086 |
|
|
| 2087 |
< |
return !strcmp(encr, conf->passwd); |
| 2087 |
> |
return encr && !strcmp(encr, conf->passwd); |
| 2088 |
|
} |
| 2089 |
|
|
| 2090 |
|
/* |
| 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 |