| 1 |
adx |
30 |
/* |
| 2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
| 3 |
|
|
* ircd_parser.y: Parses the ircd configuration file. |
| 4 |
|
|
* |
| 5 |
|
|
* Copyright (C) 2005 by the past and present ircd coders, and others. |
| 6 |
|
|
* |
| 7 |
|
|
* This program is free software; you can redistribute it and/or modify |
| 8 |
|
|
* it under the terms of the GNU General Public License as published by |
| 9 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
|
|
* (at your option) any later version. |
| 11 |
|
|
* |
| 12 |
|
|
* This program is distributed in the hope that it will be useful, |
| 13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
|
|
* GNU General Public License for more details. |
| 16 |
|
|
* |
| 17 |
|
|
* You should have received a copy of the GNU General Public License |
| 18 |
|
|
* along with this program; if not, write to the Free Software |
| 19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 20 |
|
|
* USA |
| 21 |
|
|
* |
| 22 |
knight |
31 |
* $Id$ |
| 23 |
adx |
30 |
*/ |
| 24 |
|
|
|
| 25 |
|
|
%{ |
| 26 |
|
|
|
| 27 |
|
|
#define YY_NO_UNPUT |
| 28 |
|
|
#include <sys/types.h> |
| 29 |
stu |
909 |
#include <string.h> |
| 30 |
adx |
30 |
|
| 31 |
|
|
#include "stdinc.h" |
| 32 |
|
|
#include "ircd.h" |
| 33 |
|
|
#include "tools.h" |
| 34 |
|
|
#include "list.h" |
| 35 |
|
|
#include "s_conf.h" |
| 36 |
|
|
#include "event.h" |
| 37 |
|
|
#include "s_log.h" |
| 38 |
|
|
#include "client.h" /* for UMODE_ALL only */ |
| 39 |
|
|
#include "pcre.h" |
| 40 |
|
|
#include "irc_string.h" |
| 41 |
|
|
#include "irc_getaddrinfo.h" |
| 42 |
|
|
#include "sprintf_irc.h" |
| 43 |
|
|
#include "memory.h" |
| 44 |
|
|
#include "modules.h" |
| 45 |
michael |
885 |
#include "s_serv.h" |
| 46 |
adx |
30 |
#include "hostmask.h" |
| 47 |
|
|
#include "send.h" |
| 48 |
|
|
#include "listener.h" |
| 49 |
|
|
#include "resv.h" |
| 50 |
|
|
#include "numeric.h" |
| 51 |
|
|
#include "s_user.h" |
| 52 |
|
|
|
| 53 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 54 |
|
|
#include <openssl/rsa.h> |
| 55 |
|
|
#include <openssl/bio.h> |
| 56 |
|
|
#include <openssl/pem.h> |
| 57 |
|
|
#endif |
| 58 |
|
|
|
| 59 |
|
|
static char *class_name = NULL; |
| 60 |
|
|
static struct ConfItem *yy_conf = NULL; |
| 61 |
|
|
static struct AccessItem *yy_aconf = NULL; |
| 62 |
|
|
static struct MatchItem *yy_match_item = NULL; |
| 63 |
|
|
static struct ClassItem *yy_class = NULL; |
| 64 |
|
|
static char *yy_class_name = NULL; |
| 65 |
|
|
|
| 66 |
|
|
static dlink_list col_conf_list = { NULL, NULL, 0 }; |
| 67 |
|
|
static dlink_list hub_conf_list = { NULL, NULL, 0 }; |
| 68 |
|
|
static dlink_list leaf_conf_list = { NULL, NULL, 0 }; |
| 69 |
|
|
static unsigned int listener_flags = 0; |
| 70 |
|
|
static unsigned int regex_ban = 0; |
| 71 |
|
|
static char userbuf[IRCD_BUFSIZE]; |
| 72 |
|
|
static char hostbuf[IRCD_BUFSIZE]; |
| 73 |
|
|
static char reasonbuf[REASONLEN + 1]; |
| 74 |
|
|
static char gecos_name[REALLEN * 4]; |
| 75 |
|
|
|
| 76 |
|
|
extern dlink_list gdeny_items; /* XXX */ |
| 77 |
|
|
|
| 78 |
|
|
static char *resv_reason = NULL; |
| 79 |
|
|
static char *listener_address = NULL; |
| 80 |
|
|
static int not_atom = 0; |
| 81 |
|
|
|
| 82 |
michael |
593 |
struct CollectItem |
| 83 |
|
|
{ |
| 84 |
adx |
30 |
dlink_node node; |
| 85 |
|
|
char *name; |
| 86 |
|
|
char *user; |
| 87 |
|
|
char *host; |
| 88 |
|
|
char *passwd; |
| 89 |
|
|
int port; |
| 90 |
|
|
int flags; |
| 91 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 92 |
|
|
char *rsa_public_key_file; |
| 93 |
|
|
RSA *rsa_public_key; |
| 94 |
|
|
#endif |
| 95 |
|
|
}; |
| 96 |
|
|
|
| 97 |
|
|
static void |
| 98 |
|
|
free_collect_item(struct CollectItem *item) |
| 99 |
|
|
{ |
| 100 |
|
|
MyFree(item->name); |
| 101 |
|
|
MyFree(item->user); |
| 102 |
|
|
MyFree(item->host); |
| 103 |
|
|
MyFree(item->passwd); |
| 104 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 105 |
|
|
MyFree(item->rsa_public_key_file); |
| 106 |
|
|
#endif |
| 107 |
|
|
MyFree(item); |
| 108 |
|
|
} |
| 109 |
|
|
|
| 110 |
|
|
static void |
| 111 |
|
|
unhook_hub_leaf_confs(void) |
| 112 |
|
|
{ |
| 113 |
|
|
dlink_node *ptr; |
| 114 |
|
|
dlink_node *next_ptr; |
| 115 |
|
|
struct CollectItem *yy_hconf; |
| 116 |
|
|
struct CollectItem *yy_lconf; |
| 117 |
|
|
|
| 118 |
|
|
DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head) |
| 119 |
|
|
{ |
| 120 |
|
|
yy_hconf = ptr->data; |
| 121 |
|
|
dlinkDelete(&yy_hconf->node, &hub_conf_list); |
| 122 |
|
|
free_collect_item(yy_hconf); |
| 123 |
|
|
} |
| 124 |
|
|
|
| 125 |
|
|
DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head) |
| 126 |
|
|
{ |
| 127 |
|
|
yy_lconf = ptr->data; |
| 128 |
|
|
dlinkDelete(&yy_lconf->node, &leaf_conf_list); |
| 129 |
|
|
free_collect_item(yy_lconf); |
| 130 |
|
|
} |
| 131 |
|
|
} |
| 132 |
|
|
|
| 133 |
|
|
%} |
| 134 |
|
|
|
| 135 |
|
|
%union { |
| 136 |
|
|
int number; |
| 137 |
|
|
char *string; |
| 138 |
|
|
} |
| 139 |
|
|
|
| 140 |
|
|
%token ACCEPT_PASSWORD |
| 141 |
|
|
%token ACTION |
| 142 |
|
|
%token ADMIN |
| 143 |
|
|
%token AFTYPE |
| 144 |
|
|
%token T_ALLOW |
| 145 |
|
|
%token ANTI_NICK_FLOOD |
| 146 |
|
|
%token ANTI_SPAM_EXIT_MESSAGE_TIME |
| 147 |
|
|
%token AUTOCONN |
| 148 |
|
|
%token T_BLOCK |
| 149 |
|
|
%token BURST_AWAY |
| 150 |
|
|
%token BURST_TOPICWHO |
| 151 |
|
|
%token BYTES KBYTES MBYTES GBYTES TBYTES |
| 152 |
|
|
%token CALLER_ID_WAIT |
| 153 |
|
|
%token CAN_FLOOD |
| 154 |
|
|
%token CAN_IDLE |
| 155 |
|
|
%token CHANNEL |
| 156 |
|
|
%token CIDR_BITLEN_IPV4 |
| 157 |
|
|
%token CIDR_BITLEN_IPV6 |
| 158 |
|
|
%token CIPHER_PREFERENCE |
| 159 |
|
|
%token CLASS |
| 160 |
|
|
%token COMPRESSED |
| 161 |
|
|
%token COMPRESSION_LEVEL |
| 162 |
|
|
%token CONNECT |
| 163 |
|
|
%token CONNECTFREQ |
| 164 |
|
|
%token CRYPTLINK |
| 165 |
|
|
%token DEFAULT_CIPHER_PREFERENCE |
| 166 |
|
|
%token DEFAULT_FLOODCOUNT |
| 167 |
|
|
%token DEFAULT_SPLIT_SERVER_COUNT |
| 168 |
|
|
%token DEFAULT_SPLIT_USER_COUNT |
| 169 |
|
|
%token DENY |
| 170 |
|
|
%token DESCRIPTION |
| 171 |
|
|
%token DIE |
| 172 |
|
|
%token DISABLE_AUTH |
| 173 |
michael |
632 |
%token DISABLE_FAKE_CHANNELS |
| 174 |
adx |
30 |
%token DISABLE_HIDDEN |
| 175 |
|
|
%token DISABLE_LOCAL_CHANNELS |
| 176 |
|
|
%token DISABLE_REMOTE_COMMANDS |
| 177 |
|
|
%token DOT_IN_IP6_ADDR |
| 178 |
|
|
%token DOTS_IN_IDENT |
| 179 |
|
|
%token DURATION |
| 180 |
|
|
%token EGDPOOL_PATH |
| 181 |
|
|
%token EMAIL |
| 182 |
|
|
%token ENABLE |
| 183 |
|
|
%token ENCRYPTED |
| 184 |
|
|
%token EXCEED_LIMIT |
| 185 |
|
|
%token EXEMPT |
| 186 |
|
|
%token FAILED_OPER_NOTICE |
| 187 |
|
|
%token FAKENAME |
| 188 |
|
|
%token IRCD_FLAGS |
| 189 |
|
|
%token FLATTEN_LINKS |
| 190 |
|
|
%token FFAILED_OPERLOG |
| 191 |
|
|
%token FKILLLOG |
| 192 |
|
|
%token FKLINELOG |
| 193 |
|
|
%token FGLINELOG |
| 194 |
|
|
%token FIOERRLOG |
| 195 |
|
|
%token FOPERLOG |
| 196 |
|
|
%token FOPERSPYLOG |
| 197 |
|
|
%token FUSERLOG |
| 198 |
|
|
%token GECOS |
| 199 |
|
|
%token GENERAL |
| 200 |
|
|
%token GLINE |
| 201 |
|
|
%token GLINES |
| 202 |
|
|
%token GLINE_EXEMPT |
| 203 |
|
|
%token GLINE_LOG |
| 204 |
|
|
%token GLINE_TIME |
| 205 |
|
|
%token GLINE_MIN_CIDR |
| 206 |
|
|
%token GLINE_MIN_CIDR6 |
| 207 |
|
|
%token GLOBAL_KILL |
| 208 |
|
|
%token IRCD_AUTH |
| 209 |
|
|
%token NEED_IDENT |
| 210 |
|
|
%token HAVENT_READ_CONF |
| 211 |
|
|
%token HIDDEN |
| 212 |
|
|
%token HIDDEN_ADMIN |
| 213 |
|
|
%token HIDDEN_NAME |
| 214 |
|
|
%token HIDDEN_OPER |
| 215 |
|
|
%token HIDE_SERVER_IPS |
| 216 |
|
|
%token HIDE_SERVERS |
| 217 |
|
|
%token HIDE_SPOOF_IPS |
| 218 |
|
|
%token HOST |
| 219 |
|
|
%token HUB |
| 220 |
|
|
%token HUB_MASK |
| 221 |
|
|
%token IDLETIME |
| 222 |
|
|
%token IGNORE_BOGUS_TS |
| 223 |
|
|
%token INVISIBLE_ON_CONNECT |
| 224 |
|
|
%token IP |
| 225 |
|
|
%token KILL |
| 226 |
|
|
%token KILL_CHASE_TIME_LIMIT |
| 227 |
|
|
%token KLINE |
| 228 |
|
|
%token KLINE_EXEMPT |
| 229 |
|
|
%token KLINE_REASON |
| 230 |
|
|
%token KLINE_WITH_REASON |
| 231 |
|
|
%token KNOCK_DELAY |
| 232 |
|
|
%token KNOCK_DELAY_CHANNEL |
| 233 |
|
|
%token LEAF_MASK |
| 234 |
|
|
%token LINKS_DELAY |
| 235 |
|
|
%token LISTEN |
| 236 |
|
|
%token T_LOG |
| 237 |
|
|
%token LOGGING |
| 238 |
|
|
%token LOG_LEVEL |
| 239 |
|
|
%token MAX_ACCEPT |
| 240 |
|
|
%token MAX_BANS |
| 241 |
|
|
%token MAX_CHANS_PER_USER |
| 242 |
|
|
%token MAX_GLOBAL |
| 243 |
|
|
%token MAX_IDENT |
| 244 |
|
|
%token MAX_LOCAL |
| 245 |
|
|
%token MAX_NICK_CHANGES |
| 246 |
|
|
%token MAX_NICK_TIME |
| 247 |
|
|
%token MAX_NUMBER |
| 248 |
|
|
%token MAX_TARGETS |
| 249 |
michael |
876 |
%token MAX_WATCH |
| 250 |
adx |
30 |
%token MESSAGE_LOCALE |
| 251 |
|
|
%token MIN_NONWILDCARD |
| 252 |
|
|
%token MIN_NONWILDCARD_SIMPLE |
| 253 |
|
|
%token MODULE |
| 254 |
|
|
%token MODULES |
| 255 |
|
|
%token NAME |
| 256 |
|
|
%token NEED_PASSWORD |
| 257 |
|
|
%token NETWORK_DESC |
| 258 |
|
|
%token NETWORK_NAME |
| 259 |
|
|
%token NICK |
| 260 |
|
|
%token NICK_CHANGES |
| 261 |
|
|
%token NO_CREATE_ON_SPLIT |
| 262 |
|
|
%token NO_JOIN_ON_SPLIT |
| 263 |
|
|
%token NO_OPER_FLOOD |
| 264 |
|
|
%token NO_TILDE |
| 265 |
|
|
%token NOT |
| 266 |
|
|
%token NUMBER |
| 267 |
|
|
%token NUMBER_PER_IDENT |
| 268 |
|
|
%token NUMBER_PER_CIDR |
| 269 |
|
|
%token NUMBER_PER_IP |
| 270 |
|
|
%token NUMBER_PER_IP_GLOBAL |
| 271 |
|
|
%token OPERATOR |
| 272 |
|
|
%token OPERS_BYPASS_CALLERID |
| 273 |
|
|
%token OPER_LOG |
| 274 |
|
|
%token OPER_ONLY_UMODES |
| 275 |
|
|
%token OPER_PASS_RESV |
| 276 |
|
|
%token OPER_SPY_T |
| 277 |
|
|
%token OPER_UMODES |
| 278 |
|
|
%token JOIN_FLOOD_COUNT |
| 279 |
|
|
%token JOIN_FLOOD_TIME |
| 280 |
|
|
%token PACE_WAIT |
| 281 |
|
|
%token PACE_WAIT_SIMPLE |
| 282 |
|
|
%token PASSWORD |
| 283 |
|
|
%token PATH |
| 284 |
|
|
%token PING_COOKIE |
| 285 |
|
|
%token PING_TIME |
| 286 |
|
|
%token PING_WARNING |
| 287 |
|
|
%token PORT |
| 288 |
|
|
%token QSTRING |
| 289 |
|
|
%token QUIET_ON_BAN |
| 290 |
|
|
%token REASON |
| 291 |
|
|
%token REDIRPORT |
| 292 |
|
|
%token REDIRSERV |
| 293 |
|
|
%token REGEX_T |
| 294 |
|
|
%token REHASH |
| 295 |
|
|
%token TREJECT_HOLD_TIME |
| 296 |
|
|
%token REMOTE |
| 297 |
|
|
%token REMOTEBAN |
| 298 |
|
|
%token RESTRICT_CHANNELS |
| 299 |
|
|
%token RESTRICTED |
| 300 |
|
|
%token RSA_PRIVATE_KEY_FILE |
| 301 |
|
|
%token RSA_PUBLIC_KEY_FILE |
| 302 |
|
|
%token SSL_CERTIFICATE_FILE |
| 303 |
michael |
967 |
%token T_SSL_CONNECTION_METHOD |
| 304 |
|
|
%token T_SSLV3 |
| 305 |
|
|
%token T_TLSV1 |
| 306 |
adx |
30 |
%token RESV |
| 307 |
|
|
%token RESV_EXEMPT |
| 308 |
|
|
%token SECONDS MINUTES HOURS DAYS WEEKS |
| 309 |
|
|
%token SENDQ |
| 310 |
|
|
%token SEND_PASSWORD |
| 311 |
|
|
%token SERVERHIDE |
| 312 |
|
|
%token SERVERINFO |
| 313 |
|
|
%token SERVLINK_PATH |
| 314 |
|
|
%token IRCD_SID |
| 315 |
|
|
%token TKLINE_EXPIRE_NOTICES |
| 316 |
|
|
%token T_SHARED |
| 317 |
|
|
%token T_CLUSTER |
| 318 |
|
|
%token TYPE |
| 319 |
|
|
%token SHORT_MOTD |
| 320 |
|
|
%token SILENT |
| 321 |
|
|
%token SPOOF |
| 322 |
|
|
%token SPOOF_NOTICE |
| 323 |
michael |
584 |
%token STATS_E_DISABLED |
| 324 |
adx |
30 |
%token STATS_I_OPER_ONLY |
| 325 |
|
|
%token STATS_K_OPER_ONLY |
| 326 |
|
|
%token STATS_O_OPER_ONLY |
| 327 |
|
|
%token STATS_P_OPER_ONLY |
| 328 |
|
|
%token TBOOL |
| 329 |
|
|
%token TMASKED |
| 330 |
|
|
%token T_REJECT |
| 331 |
|
|
%token TS_MAX_DELTA |
| 332 |
|
|
%token TS_WARN_DELTA |
| 333 |
|
|
%token TWODOTS |
| 334 |
|
|
%token T_ALL |
| 335 |
|
|
%token T_BOTS |
| 336 |
|
|
%token T_SOFTCALLERID |
| 337 |
|
|
%token T_CALLERID |
| 338 |
|
|
%token T_CCONN |
| 339 |
db |
849 |
%token T_CCONN_FULL |
| 340 |
adx |
30 |
%token T_CLIENT_FLOOD |
| 341 |
|
|
%token T_DEAF |
| 342 |
|
|
%token T_DEBUG |
| 343 |
|
|
%token T_DRONE |
| 344 |
|
|
%token T_EXTERNAL |
| 345 |
|
|
%token T_FULL |
| 346 |
|
|
%token T_INVISIBLE |
| 347 |
|
|
%token T_IPV4 |
| 348 |
|
|
%token T_IPV6 |
| 349 |
|
|
%token T_LOCOPS |
| 350 |
|
|
%token T_LOGPATH |
| 351 |
|
|
%token T_L_CRIT |
| 352 |
|
|
%token T_L_DEBUG |
| 353 |
|
|
%token T_L_ERROR |
| 354 |
|
|
%token T_L_INFO |
| 355 |
|
|
%token T_L_NOTICE |
| 356 |
|
|
%token T_L_TRACE |
| 357 |
|
|
%token T_L_WARN |
| 358 |
|
|
%token T_MAX_CLIENTS |
| 359 |
|
|
%token T_NCHANGE |
| 360 |
|
|
%token T_OPERWALL |
| 361 |
|
|
%token T_REJ |
| 362 |
michael |
900 |
%token T_SERVER |
| 363 |
adx |
30 |
%token T_SERVNOTICE |
| 364 |
|
|
%token T_SKILL |
| 365 |
|
|
%token T_SPY |
| 366 |
|
|
%token T_SSL |
| 367 |
michael |
56 |
%token T_UMODES |
| 368 |
adx |
30 |
%token T_UNAUTH |
| 369 |
|
|
%token T_UNRESV |
| 370 |
|
|
%token T_UNXLINE |
| 371 |
|
|
%token T_WALLOP |
| 372 |
|
|
%token THROTTLE_TIME |
| 373 |
|
|
%token TOPICBURST |
| 374 |
|
|
%token TRUE_NO_OPER_FLOOD |
| 375 |
|
|
%token TKLINE |
| 376 |
|
|
%token TXLINE |
| 377 |
|
|
%token TRESV |
| 378 |
|
|
%token UNKLINE |
| 379 |
|
|
%token USER |
| 380 |
|
|
%token USE_EGD |
| 381 |
|
|
%token USE_EXCEPT |
| 382 |
|
|
%token USE_INVEX |
| 383 |
|
|
%token USE_KNOCK |
| 384 |
|
|
%token USE_LOGGING |
| 385 |
|
|
%token USE_WHOIS_ACTUALLY |
| 386 |
|
|
%token VHOST |
| 387 |
|
|
%token VHOST6 |
| 388 |
|
|
%token XLINE |
| 389 |
|
|
%token WARN |
| 390 |
|
|
%token WARN_NO_NLINE |
| 391 |
|
|
|
| 392 |
|
|
%type <string> QSTRING |
| 393 |
|
|
%type <number> NUMBER |
| 394 |
|
|
%type <number> timespec |
| 395 |
|
|
%type <number> timespec_ |
| 396 |
|
|
%type <number> sizespec |
| 397 |
|
|
%type <number> sizespec_ |
| 398 |
|
|
|
| 399 |
|
|
%% |
| 400 |
|
|
conf: |
| 401 |
|
|
| conf conf_item |
| 402 |
|
|
; |
| 403 |
|
|
|
| 404 |
|
|
conf_item: admin_entry |
| 405 |
|
|
| logging_entry |
| 406 |
|
|
| oper_entry |
| 407 |
|
|
| channel_entry |
| 408 |
|
|
| class_entry |
| 409 |
|
|
| listen_entry |
| 410 |
|
|
| auth_entry |
| 411 |
|
|
| serverinfo_entry |
| 412 |
|
|
| serverhide_entry |
| 413 |
|
|
| resv_entry |
| 414 |
|
|
| shared_entry |
| 415 |
|
|
| cluster_entry |
| 416 |
|
|
| connect_entry |
| 417 |
|
|
| kill_entry |
| 418 |
|
|
| deny_entry |
| 419 |
|
|
| exempt_entry |
| 420 |
|
|
| general_entry |
| 421 |
|
|
| gline_entry |
| 422 |
|
|
| gecos_entry |
| 423 |
|
|
| modules_entry |
| 424 |
|
|
| error ';' |
| 425 |
|
|
| error '}' |
| 426 |
|
|
; |
| 427 |
|
|
|
| 428 |
|
|
|
| 429 |
|
|
timespec_: { $$ = 0; } | timespec; |
| 430 |
|
|
timespec: NUMBER timespec_ |
| 431 |
|
|
{ |
| 432 |
|
|
$$ = $1 + $2; |
| 433 |
|
|
} |
| 434 |
|
|
| NUMBER SECONDS timespec_ |
| 435 |
|
|
{ |
| 436 |
|
|
$$ = $1 + $3; |
| 437 |
|
|
} |
| 438 |
|
|
| NUMBER MINUTES timespec_ |
| 439 |
|
|
{ |
| 440 |
|
|
$$ = $1 * 60 + $3; |
| 441 |
|
|
} |
| 442 |
|
|
| NUMBER HOURS timespec_ |
| 443 |
|
|
{ |
| 444 |
|
|
$$ = $1 * 60 * 60 + $3; |
| 445 |
|
|
} |
| 446 |
|
|
| NUMBER DAYS timespec_ |
| 447 |
|
|
{ |
| 448 |
|
|
$$ = $1 * 60 * 60 * 24 + $3; |
| 449 |
|
|
} |
| 450 |
|
|
| NUMBER WEEKS timespec_ |
| 451 |
|
|
{ |
| 452 |
|
|
$$ = $1 * 60 * 60 * 24 * 7 + $3; |
| 453 |
|
|
} |
| 454 |
|
|
; |
| 455 |
|
|
|
| 456 |
|
|
sizespec_: { $$ = 0; } | sizespec; |
| 457 |
|
|
sizespec: NUMBER sizespec_ { $$ = $1 + $2; } |
| 458 |
|
|
| NUMBER BYTES sizespec_ { $$ = $1 + $3; } |
| 459 |
|
|
| NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; } |
| 460 |
|
|
| NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; } |
| 461 |
|
|
; |
| 462 |
|
|
|
| 463 |
|
|
|
| 464 |
|
|
/*************************************************************************** |
| 465 |
|
|
* section modules |
| 466 |
|
|
***************************************************************************/ |
| 467 |
|
|
modules_entry: MODULES |
| 468 |
|
|
'{' modules_items '}' ';'; |
| 469 |
|
|
|
| 470 |
|
|
modules_items: modules_items modules_item | modules_item; |
| 471 |
|
|
modules_item: modules_module | modules_path | error ';' ; |
| 472 |
|
|
|
| 473 |
|
|
modules_module: MODULE '=' QSTRING ';' |
| 474 |
|
|
{ |
| 475 |
|
|
#ifndef STATIC_MODULES /* NOOP in the static case */ |
| 476 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 477 |
michael |
978 |
add_conf_module(libio_basename(yylval.string)); |
| 478 |
adx |
30 |
#endif |
| 479 |
|
|
}; |
| 480 |
|
|
|
| 481 |
|
|
modules_path: PATH '=' QSTRING ';' |
| 482 |
|
|
{ |
| 483 |
|
|
#ifndef STATIC_MODULES |
| 484 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 485 |
adx |
30 |
mod_add_path(yylval.string); |
| 486 |
|
|
#endif |
| 487 |
|
|
}; |
| 488 |
|
|
|
| 489 |
|
|
|
| 490 |
michael |
967 |
serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';'; |
| 491 |
|
|
|
| 492 |
|
|
serverinfo_items: serverinfo_items serverinfo_item | serverinfo_item ; |
| 493 |
adx |
30 |
serverinfo_item: serverinfo_name | serverinfo_vhost | |
| 494 |
|
|
serverinfo_hub | serverinfo_description | |
| 495 |
|
|
serverinfo_network_name | serverinfo_network_desc | |
| 496 |
|
|
serverinfo_max_clients | |
| 497 |
|
|
serverinfo_rsa_private_key_file | serverinfo_vhost6 | |
| 498 |
|
|
serverinfo_sid | serverinfo_ssl_certificate_file | |
| 499 |
michael |
967 |
serverinfo_ssl_connection_method | |
| 500 |
adx |
30 |
error ';' ; |
| 501 |
|
|
|
| 502 |
michael |
967 |
|
| 503 |
|
|
serverinfo_ssl_connection_method: T_SSL_CONNECTION_METHOD |
| 504 |
|
|
{ |
| 505 |
|
|
if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2) |
| 506 |
|
|
ServerInfo.tls_version = 0; |
| 507 |
|
|
} '=' method_types ';' |
| 508 |
|
|
{ |
| 509 |
|
|
if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2) |
| 510 |
|
|
{ |
| 511 |
|
|
if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_SSLV3)) |
| 512 |
|
|
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3); |
| 513 |
|
|
if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_TLSV1)) |
| 514 |
|
|
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1); |
| 515 |
|
|
} |
| 516 |
|
|
}; |
| 517 |
|
|
|
| 518 |
|
|
method_types: method_types ',' method_type_item | method_type_item; |
| 519 |
|
|
method_type_item: T_SSLV3 |
| 520 |
|
|
{ |
| 521 |
|
|
if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2) |
| 522 |
|
|
ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_SSLV3; |
| 523 |
|
|
} | T_TLSV1 |
| 524 |
|
|
{ |
| 525 |
|
|
if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2) |
| 526 |
|
|
ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_TLSV1; |
| 527 |
|
|
}; |
| 528 |
|
|
|
| 529 |
adx |
30 |
serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';' |
| 530 |
|
|
{ |
| 531 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 532 |
michael |
967 |
if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx) |
| 533 |
adx |
30 |
{ |
| 534 |
|
|
if (!ServerInfo.rsa_private_key_file) |
| 535 |
|
|
{ |
| 536 |
|
|
yyerror("No rsa_private_key_file specified, SSL disabled"); |
| 537 |
|
|
break; |
| 538 |
|
|
} |
| 539 |
|
|
|
| 540 |
michael |
967 |
if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string, |
| 541 |
|
|
SSL_FILETYPE_PEM) <= 0) |
| 542 |
adx |
30 |
{ |
| 543 |
|
|
yyerror(ERR_lib_error_string(ERR_get_error())); |
| 544 |
|
|
break; |
| 545 |
|
|
} |
| 546 |
|
|
|
| 547 |
michael |
967 |
if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file, |
| 548 |
|
|
SSL_FILETYPE_PEM) <= 0) |
| 549 |
adx |
30 |
{ |
| 550 |
|
|
yyerror(ERR_lib_error_string(ERR_get_error())); |
| 551 |
|
|
break; |
| 552 |
|
|
} |
| 553 |
|
|
|
| 554 |
michael |
967 |
if (!SSL_CTX_check_private_key(ServerInfo.server_ctx)) |
| 555 |
adx |
30 |
{ |
| 556 |
michael |
967 |
yyerror(ERR_lib_error_string(ERR_get_error())); |
| 557 |
adx |
30 |
break; |
| 558 |
|
|
} |
| 559 |
|
|
} |
| 560 |
|
|
#endif |
| 561 |
|
|
}; |
| 562 |
|
|
|
| 563 |
|
|
serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';' |
| 564 |
|
|
{ |
| 565 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 566 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 567 |
adx |
30 |
{ |
| 568 |
|
|
BIO *file; |
| 569 |
|
|
|
| 570 |
|
|
if (ServerInfo.rsa_private_key) |
| 571 |
|
|
{ |
| 572 |
|
|
RSA_free(ServerInfo.rsa_private_key); |
| 573 |
|
|
ServerInfo.rsa_private_key = NULL; |
| 574 |
|
|
} |
| 575 |
|
|
|
| 576 |
|
|
if (ServerInfo.rsa_private_key_file) |
| 577 |
|
|
{ |
| 578 |
|
|
MyFree(ServerInfo.rsa_private_key_file); |
| 579 |
|
|
ServerInfo.rsa_private_key_file = NULL; |
| 580 |
|
|
} |
| 581 |
|
|
|
| 582 |
|
|
DupString(ServerInfo.rsa_private_key_file, yylval.string); |
| 583 |
|
|
|
| 584 |
|
|
if ((file = BIO_new_file(yylval.string, "r")) == NULL) |
| 585 |
|
|
{ |
| 586 |
|
|
yyerror("File open failed, ignoring"); |
| 587 |
|
|
break; |
| 588 |
|
|
} |
| 589 |
|
|
|
| 590 |
|
|
ServerInfo.rsa_private_key = (RSA *)PEM_read_bio_RSAPrivateKey(file, NULL, |
| 591 |
|
|
0, NULL); |
| 592 |
|
|
|
| 593 |
|
|
BIO_set_close(file, BIO_CLOSE); |
| 594 |
|
|
BIO_free(file); |
| 595 |
|
|
|
| 596 |
|
|
if (ServerInfo.rsa_private_key == NULL) |
| 597 |
|
|
{ |
| 598 |
|
|
yyerror("Couldn't extract key, ignoring"); |
| 599 |
|
|
break; |
| 600 |
|
|
} |
| 601 |
|
|
|
| 602 |
|
|
if (!RSA_check_key(ServerInfo.rsa_private_key)) |
| 603 |
|
|
{ |
| 604 |
|
|
RSA_free(ServerInfo.rsa_private_key); |
| 605 |
|
|
ServerInfo.rsa_private_key = NULL; |
| 606 |
|
|
|
| 607 |
|
|
yyerror("Invalid key, ignoring"); |
| 608 |
|
|
break; |
| 609 |
|
|
} |
| 610 |
|
|
|
| 611 |
|
|
/* require 2048 bit (256 byte) key */ |
| 612 |
|
|
if (RSA_size(ServerInfo.rsa_private_key) != 256) |
| 613 |
|
|
{ |
| 614 |
|
|
RSA_free(ServerInfo.rsa_private_key); |
| 615 |
|
|
ServerInfo.rsa_private_key = NULL; |
| 616 |
|
|
|
| 617 |
|
|
yyerror("Not a 2048 bit key, ignoring"); |
| 618 |
|
|
} |
| 619 |
|
|
} |
| 620 |
|
|
#endif |
| 621 |
|
|
}; |
| 622 |
|
|
|
| 623 |
|
|
serverinfo_name: NAME '=' QSTRING ';' |
| 624 |
|
|
{ |
| 625 |
|
|
/* this isn't rehashable */ |
| 626 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 627 |
adx |
30 |
{ |
| 628 |
|
|
if (ServerInfo.name == NULL) |
| 629 |
|
|
{ |
| 630 |
|
|
/* the ircd will exit() in main() if we dont set one */ |
| 631 |
|
|
if (strlen(yylval.string) <= HOSTLEN) |
| 632 |
|
|
DupString(ServerInfo.name, yylval.string); |
| 633 |
|
|
} |
| 634 |
|
|
} |
| 635 |
|
|
}; |
| 636 |
|
|
|
| 637 |
|
|
serverinfo_sid: IRCD_SID '=' QSTRING ';' |
| 638 |
|
|
{ |
| 639 |
|
|
/* this isn't rehashable */ |
| 640 |
michael |
967 |
if (conf_parser_ctx.pass == 2 && !ServerInfo.sid) |
| 641 |
adx |
30 |
{ |
| 642 |
michael |
573 |
if (valid_sid(yylval.string)) |
| 643 |
adx |
30 |
DupString(ServerInfo.sid, yylval.string); |
| 644 |
|
|
else |
| 645 |
|
|
{ |
| 646 |
|
|
ilog(L_ERROR, "Ignoring config file entry SID -- invalid SID. Aborting."); |
| 647 |
|
|
exit(0); |
| 648 |
|
|
} |
| 649 |
|
|
} |
| 650 |
|
|
}; |
| 651 |
|
|
|
| 652 |
|
|
serverinfo_description: DESCRIPTION '=' QSTRING ';' |
| 653 |
|
|
{ |
| 654 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 655 |
adx |
30 |
{ |
| 656 |
|
|
MyFree(ServerInfo.description); |
| 657 |
|
|
DupString(ServerInfo.description,yylval.string); |
| 658 |
|
|
} |
| 659 |
|
|
}; |
| 660 |
|
|
|
| 661 |
|
|
serverinfo_network_name: NETWORK_NAME '=' QSTRING ';' |
| 662 |
|
|
{ |
| 663 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 664 |
adx |
30 |
{ |
| 665 |
|
|
char *p; |
| 666 |
|
|
|
| 667 |
|
|
if ((p = strchr(yylval.string, ' ')) != NULL) |
| 668 |
|
|
p = '\0'; |
| 669 |
|
|
|
| 670 |
|
|
MyFree(ServerInfo.network_name); |
| 671 |
|
|
DupString(ServerInfo.network_name, yylval.string); |
| 672 |
|
|
} |
| 673 |
|
|
}; |
| 674 |
|
|
|
| 675 |
|
|
serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';' |
| 676 |
|
|
{ |
| 677 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 678 |
adx |
30 |
{ |
| 679 |
|
|
MyFree(ServerInfo.network_desc); |
| 680 |
|
|
DupString(ServerInfo.network_desc, yylval.string); |
| 681 |
|
|
} |
| 682 |
|
|
}; |
| 683 |
|
|
|
| 684 |
|
|
serverinfo_vhost: VHOST '=' QSTRING ';' |
| 685 |
|
|
{ |
| 686 |
michael |
967 |
if (conf_parser_ctx.pass == 2 && *yylval.string != '*') |
| 687 |
adx |
30 |
{ |
| 688 |
|
|
struct addrinfo hints, *res; |
| 689 |
|
|
|
| 690 |
|
|
memset(&hints, 0, sizeof(hints)); |
| 691 |
|
|
|
| 692 |
|
|
hints.ai_family = AF_UNSPEC; |
| 693 |
|
|
hints.ai_socktype = SOCK_STREAM; |
| 694 |
|
|
hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; |
| 695 |
|
|
|
| 696 |
|
|
if (irc_getaddrinfo(yylval.string, NULL, &hints, &res)) |
| 697 |
|
|
ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string); |
| 698 |
|
|
else |
| 699 |
|
|
{ |
| 700 |
|
|
assert(res != NULL); |
| 701 |
|
|
|
| 702 |
|
|
memcpy(&ServerInfo.ip, res->ai_addr, res->ai_addrlen); |
| 703 |
|
|
ServerInfo.ip.ss.ss_family = res->ai_family; |
| 704 |
|
|
ServerInfo.ip.ss_len = res->ai_addrlen; |
| 705 |
|
|
irc_freeaddrinfo(res); |
| 706 |
|
|
|
| 707 |
|
|
ServerInfo.specific_ipv4_vhost = 1; |
| 708 |
|
|
} |
| 709 |
|
|
} |
| 710 |
|
|
}; |
| 711 |
|
|
|
| 712 |
|
|
serverinfo_vhost6: VHOST6 '=' QSTRING ';' |
| 713 |
|
|
{ |
| 714 |
|
|
#ifdef IPV6 |
| 715 |
michael |
967 |
if (conf_parser_ctx.pass == 2 && *yylval.string != '*') |
| 716 |
adx |
30 |
{ |
| 717 |
|
|
struct addrinfo hints, *res; |
| 718 |
|
|
|
| 719 |
|
|
memset(&hints, 0, sizeof(hints)); |
| 720 |
|
|
|
| 721 |
|
|
hints.ai_family = AF_UNSPEC; |
| 722 |
|
|
hints.ai_socktype = SOCK_STREAM; |
| 723 |
|
|
hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; |
| 724 |
|
|
|
| 725 |
|
|
if (irc_getaddrinfo(yylval.string, NULL, &hints, &res)) |
| 726 |
|
|
ilog(L_ERROR, "Invalid netmask for server vhost6(%s)", yylval.string); |
| 727 |
|
|
else |
| 728 |
|
|
{ |
| 729 |
|
|
assert(res != NULL); |
| 730 |
|
|
|
| 731 |
|
|
memcpy(&ServerInfo.ip6, res->ai_addr, res->ai_addrlen); |
| 732 |
|
|
ServerInfo.ip6.ss.ss_family = res->ai_family; |
| 733 |
|
|
ServerInfo.ip6.ss_len = res->ai_addrlen; |
| 734 |
|
|
irc_freeaddrinfo(res); |
| 735 |
|
|
|
| 736 |
|
|
ServerInfo.specific_ipv6_vhost = 1; |
| 737 |
|
|
} |
| 738 |
|
|
} |
| 739 |
|
|
#endif |
| 740 |
|
|
}; |
| 741 |
|
|
|
| 742 |
|
|
serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';' |
| 743 |
|
|
{ |
| 744 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 745 |
adx |
30 |
{ |
| 746 |
|
|
recalc_fdlimit(NULL); |
| 747 |
|
|
|
| 748 |
|
|
if ($3 < MAXCLIENTS_MIN) |
| 749 |
|
|
{ |
| 750 |
|
|
char buf[IRCD_BUFSIZE]; |
| 751 |
|
|
ircsprintf(buf, "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN); |
| 752 |
|
|
yyerror(buf); |
| 753 |
|
|
} |
| 754 |
|
|
else if ($3 > MAXCLIENTS_MAX) |
| 755 |
|
|
{ |
| 756 |
|
|
char buf[IRCD_BUFSIZE]; |
| 757 |
|
|
ircsprintf(buf, "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX); |
| 758 |
|
|
yyerror(buf); |
| 759 |
|
|
} |
| 760 |
|
|
else |
| 761 |
|
|
ServerInfo.max_clients = $3; |
| 762 |
|
|
} |
| 763 |
|
|
}; |
| 764 |
|
|
|
| 765 |
|
|
serverinfo_hub: HUB '=' TBOOL ';' |
| 766 |
|
|
{ |
| 767 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 768 |
adx |
30 |
{ |
| 769 |
|
|
if (yylval.number) |
| 770 |
|
|
{ |
| 771 |
michael |
885 |
ServerInfo.hub = 1; |
| 772 |
|
|
delete_capability("HUB"); |
| 773 |
|
|
add_capability("HUB", CAP_HUB, 1); |
| 774 |
adx |
30 |
} |
| 775 |
|
|
else if (ServerInfo.hub) |
| 776 |
|
|
{ |
| 777 |
|
|
|
| 778 |
|
|
ServerInfo.hub = 0; |
| 779 |
|
|
delete_capability("HUB"); |
| 780 |
|
|
} |
| 781 |
|
|
} |
| 782 |
|
|
}; |
| 783 |
|
|
|
| 784 |
|
|
/*************************************************************************** |
| 785 |
|
|
* admin section |
| 786 |
|
|
***************************************************************************/ |
| 787 |
|
|
admin_entry: ADMIN '{' admin_items '}' ';' ; |
| 788 |
|
|
|
| 789 |
|
|
admin_items: admin_items admin_item | admin_item; |
| 790 |
|
|
admin_item: admin_name | admin_description | |
| 791 |
|
|
admin_email | error ';' ; |
| 792 |
|
|
|
| 793 |
|
|
admin_name: NAME '=' QSTRING ';' |
| 794 |
|
|
{ |
| 795 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 796 |
adx |
30 |
{ |
| 797 |
|
|
MyFree(AdminInfo.name); |
| 798 |
|
|
DupString(AdminInfo.name, yylval.string); |
| 799 |
|
|
} |
| 800 |
|
|
}; |
| 801 |
|
|
|
| 802 |
|
|
admin_email: EMAIL '=' QSTRING ';' |
| 803 |
|
|
{ |
| 804 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 805 |
adx |
30 |
{ |
| 806 |
|
|
MyFree(AdminInfo.email); |
| 807 |
|
|
DupString(AdminInfo.email, yylval.string); |
| 808 |
|
|
} |
| 809 |
|
|
}; |
| 810 |
|
|
|
| 811 |
|
|
admin_description: DESCRIPTION '=' QSTRING ';' |
| 812 |
|
|
{ |
| 813 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 814 |
adx |
30 |
{ |
| 815 |
|
|
MyFree(AdminInfo.description); |
| 816 |
|
|
DupString(AdminInfo.description, yylval.string); |
| 817 |
|
|
} |
| 818 |
|
|
}; |
| 819 |
|
|
|
| 820 |
|
|
/*************************************************************************** |
| 821 |
|
|
* section logging |
| 822 |
|
|
***************************************************************************/ |
| 823 |
|
|
/* XXX */ |
| 824 |
|
|
logging_entry: LOGGING '{' logging_items '}' ';' ; |
| 825 |
|
|
|
| 826 |
|
|
logging_items: logging_items logging_item | |
| 827 |
|
|
logging_item ; |
| 828 |
|
|
|
| 829 |
|
|
logging_item: logging_path | logging_oper_log | |
| 830 |
|
|
logging_log_level | |
| 831 |
|
|
logging_use_logging | logging_fuserlog | |
| 832 |
|
|
logging_foperlog | logging_fglinelog | |
| 833 |
|
|
logging_fklinelog | logging_killlog | |
| 834 |
|
|
logging_foperspylog | logging_ioerrlog | |
| 835 |
|
|
logging_ffailed_operlog | |
| 836 |
|
|
error ';' ; |
| 837 |
|
|
|
| 838 |
|
|
logging_path: T_LOGPATH '=' QSTRING ';' |
| 839 |
|
|
{ |
| 840 |
|
|
}; |
| 841 |
|
|
|
| 842 |
|
|
logging_oper_log: OPER_LOG '=' QSTRING ';' |
| 843 |
|
|
{ |
| 844 |
|
|
}; |
| 845 |
|
|
|
| 846 |
|
|
logging_fuserlog: FUSERLOG '=' QSTRING ';' |
| 847 |
|
|
{ |
| 848 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 849 |
adx |
30 |
strlcpy(ConfigLoggingEntry.userlog, yylval.string, |
| 850 |
|
|
sizeof(ConfigLoggingEntry.userlog)); |
| 851 |
|
|
}; |
| 852 |
|
|
|
| 853 |
|
|
logging_ffailed_operlog: FFAILED_OPERLOG '=' QSTRING ';' |
| 854 |
|
|
{ |
| 855 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 856 |
adx |
30 |
strlcpy(ConfigLoggingEntry.failed_operlog, yylval.string, |
| 857 |
|
|
sizeof(ConfigLoggingEntry.failed_operlog)); |
| 858 |
|
|
}; |
| 859 |
|
|
|
| 860 |
|
|
logging_foperlog: FOPERLOG '=' QSTRING ';' |
| 861 |
|
|
{ |
| 862 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 863 |
adx |
30 |
strlcpy(ConfigLoggingEntry.operlog, yylval.string, |
| 864 |
|
|
sizeof(ConfigLoggingEntry.operlog)); |
| 865 |
|
|
}; |
| 866 |
|
|
|
| 867 |
|
|
logging_foperspylog: FOPERSPYLOG '=' QSTRING ';' |
| 868 |
|
|
{ |
| 869 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 870 |
adx |
30 |
strlcpy(ConfigLoggingEntry.operspylog, yylval.string, |
| 871 |
|
|
sizeof(ConfigLoggingEntry.operspylog)); |
| 872 |
|
|
}; |
| 873 |
|
|
|
| 874 |
|
|
logging_fglinelog: FGLINELOG '=' QSTRING ';' |
| 875 |
|
|
{ |
| 876 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 877 |
adx |
30 |
strlcpy(ConfigLoggingEntry.glinelog, yylval.string, |
| 878 |
|
|
sizeof(ConfigLoggingEntry.glinelog)); |
| 879 |
|
|
}; |
| 880 |
|
|
|
| 881 |
|
|
logging_fklinelog: FKLINELOG '=' QSTRING ';' |
| 882 |
|
|
{ |
| 883 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 884 |
adx |
30 |
strlcpy(ConfigLoggingEntry.klinelog, yylval.string, |
| 885 |
|
|
sizeof(ConfigLoggingEntry.klinelog)); |
| 886 |
|
|
}; |
| 887 |
|
|
|
| 888 |
|
|
logging_ioerrlog: FIOERRLOG '=' QSTRING ';' |
| 889 |
|
|
{ |
| 890 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 891 |
adx |
30 |
strlcpy(ConfigLoggingEntry.ioerrlog, yylval.string, |
| 892 |
|
|
sizeof(ConfigLoggingEntry.ioerrlog)); |
| 893 |
|
|
}; |
| 894 |
|
|
|
| 895 |
|
|
logging_killlog: FKILLLOG '=' QSTRING ';' |
| 896 |
|
|
{ |
| 897 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 898 |
adx |
30 |
strlcpy(ConfigLoggingEntry.killlog, yylval.string, |
| 899 |
|
|
sizeof(ConfigLoggingEntry.killlog)); |
| 900 |
|
|
}; |
| 901 |
|
|
|
| 902 |
|
|
logging_log_level: LOG_LEVEL '=' T_L_CRIT ';' |
| 903 |
|
|
{ |
| 904 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 905 |
adx |
30 |
set_log_level(L_CRIT); |
| 906 |
|
|
} | LOG_LEVEL '=' T_L_ERROR ';' |
| 907 |
|
|
{ |
| 908 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 909 |
adx |
30 |
set_log_level(L_ERROR); |
| 910 |
|
|
} | LOG_LEVEL '=' T_L_WARN ';' |
| 911 |
|
|
{ |
| 912 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 913 |
adx |
30 |
set_log_level(L_WARN); |
| 914 |
|
|
} | LOG_LEVEL '=' T_L_NOTICE ';' |
| 915 |
|
|
{ |
| 916 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 917 |
adx |
30 |
set_log_level(L_NOTICE); |
| 918 |
|
|
} | LOG_LEVEL '=' T_L_TRACE ';' |
| 919 |
|
|
{ |
| 920 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 921 |
adx |
30 |
set_log_level(L_TRACE); |
| 922 |
|
|
} | LOG_LEVEL '=' T_L_INFO ';' |
| 923 |
|
|
{ |
| 924 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 925 |
adx |
30 |
set_log_level(L_INFO); |
| 926 |
|
|
} | LOG_LEVEL '=' T_L_DEBUG ';' |
| 927 |
|
|
{ |
| 928 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 929 |
adx |
30 |
set_log_level(L_DEBUG); |
| 930 |
|
|
}; |
| 931 |
|
|
|
| 932 |
|
|
logging_use_logging: USE_LOGGING '=' TBOOL ';' |
| 933 |
|
|
{ |
| 934 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 935 |
adx |
30 |
ConfigLoggingEntry.use_logging = yylval.number; |
| 936 |
|
|
}; |
| 937 |
|
|
|
| 938 |
|
|
/*************************************************************************** |
| 939 |
|
|
* section oper |
| 940 |
|
|
***************************************************************************/ |
| 941 |
|
|
oper_entry: OPERATOR |
| 942 |
|
|
{ |
| 943 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 944 |
adx |
30 |
{ |
| 945 |
|
|
yy_conf = make_conf_item(OPER_TYPE); |
| 946 |
|
|
yy_aconf = map_to_conf(yy_conf); |
| 947 |
|
|
SetConfEncrypted(yy_aconf); /* Yes, the default is encrypted */ |
| 948 |
|
|
} |
| 949 |
|
|
else |
| 950 |
|
|
{ |
| 951 |
|
|
MyFree(class_name); |
| 952 |
|
|
class_name = NULL; |
| 953 |
|
|
} |
| 954 |
|
|
} oper_name_b '{' oper_items '}' ';' |
| 955 |
|
|
{ |
| 956 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 957 |
adx |
30 |
{ |
| 958 |
|
|
struct CollectItem *yy_tmp; |
| 959 |
|
|
dlink_node *ptr; |
| 960 |
|
|
dlink_node *next_ptr; |
| 961 |
|
|
|
| 962 |
|
|
conf_add_class_to_conf(yy_conf, class_name); |
| 963 |
|
|
|
| 964 |
|
|
/* Now, make sure there is a copy of the "base" given oper |
| 965 |
|
|
* block in each of the collected copies |
| 966 |
|
|
*/ |
| 967 |
|
|
|
| 968 |
|
|
DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head) |
| 969 |
|
|
{ |
| 970 |
|
|
struct AccessItem *new_aconf; |
| 971 |
|
|
struct ConfItem *new_conf; |
| 972 |
|
|
yy_tmp = ptr->data; |
| 973 |
|
|
|
| 974 |
|
|
new_conf = make_conf_item(OPER_TYPE); |
| 975 |
|
|
new_aconf = (struct AccessItem *)map_to_conf(new_conf); |
| 976 |
|
|
|
| 977 |
|
|
new_aconf->flags = yy_aconf->flags; |
| 978 |
|
|
|
| 979 |
|
|
if (yy_conf->name != NULL) |
| 980 |
|
|
DupString(new_conf->name, yy_conf->name); |
| 981 |
|
|
if (yy_tmp->user != NULL) |
| 982 |
|
|
DupString(new_aconf->user, yy_tmp->user); |
| 983 |
|
|
else |
| 984 |
|
|
DupString(new_aconf->user, "*"); |
| 985 |
|
|
if (yy_tmp->host != NULL) |
| 986 |
|
|
DupString(new_aconf->host, yy_tmp->host); |
| 987 |
|
|
else |
| 988 |
|
|
DupString(new_aconf->host, "*"); |
| 989 |
|
|
conf_add_class_to_conf(new_conf, class_name); |
| 990 |
|
|
if (yy_aconf->passwd != NULL) |
| 991 |
|
|
DupString(new_aconf->passwd, yy_aconf->passwd); |
| 992 |
|
|
|
| 993 |
|
|
new_aconf->port = yy_aconf->port; |
| 994 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 995 |
|
|
if (yy_aconf->rsa_public_key_file != NULL) |
| 996 |
|
|
{ |
| 997 |
|
|
BIO *file; |
| 998 |
|
|
|
| 999 |
|
|
DupString(new_aconf->rsa_public_key_file, |
| 1000 |
|
|
yy_aconf->rsa_public_key_file); |
| 1001 |
|
|
|
| 1002 |
|
|
file = BIO_new_file(yy_aconf->rsa_public_key_file, "r"); |
| 1003 |
|
|
new_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, |
| 1004 |
|
|
NULL, 0, NULL); |
| 1005 |
|
|
BIO_set_close(file, BIO_CLOSE); |
| 1006 |
|
|
BIO_free(file); |
| 1007 |
|
|
} |
| 1008 |
|
|
#endif |
| 1009 |
|
|
|
| 1010 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 1011 |
|
|
if (yy_tmp->name && (yy_tmp->passwd || yy_aconf->rsa_public_key) |
| 1012 |
|
|
&& yy_tmp->host) |
| 1013 |
|
|
#else |
| 1014 |
|
|
if (yy_tmp->name && yy_tmp->passwd && yy_tmp->host) |
| 1015 |
|
|
#endif |
| 1016 |
|
|
{ |
| 1017 |
|
|
conf_add_class_to_conf(new_conf, class_name); |
| 1018 |
|
|
if (yy_tmp->name != NULL) |
| 1019 |
|
|
DupString(new_conf->name, yy_tmp->name); |
| 1020 |
|
|
} |
| 1021 |
|
|
|
| 1022 |
|
|
dlinkDelete(&yy_tmp->node, &col_conf_list); |
| 1023 |
|
|
free_collect_item(yy_tmp); |
| 1024 |
|
|
} |
| 1025 |
|
|
|
| 1026 |
|
|
yy_conf = NULL; |
| 1027 |
|
|
yy_aconf = NULL; |
| 1028 |
|
|
|
| 1029 |
|
|
|
| 1030 |
|
|
MyFree(class_name); |
| 1031 |
|
|
class_name = NULL; |
| 1032 |
|
|
} |
| 1033 |
|
|
}; |
| 1034 |
|
|
|
| 1035 |
|
|
oper_name_b: | oper_name_t; |
| 1036 |
|
|
oper_items: oper_items oper_item | oper_item; |
| 1037 |
|
|
oper_item: oper_name | oper_user | oper_password | oper_hidden_admin | |
| 1038 |
michael |
56 |
oper_hidden_oper | oper_umodes | |
| 1039 |
adx |
30 |
oper_class | oper_global_kill | oper_remote | |
| 1040 |
|
|
oper_kline | oper_xline | oper_unkline | |
| 1041 |
|
|
oper_gline | oper_nick_changes | oper_remoteban | |
| 1042 |
|
|
oper_die | oper_rehash | oper_admin | oper_operwall | |
| 1043 |
|
|
oper_encrypted | oper_rsa_public_key_file | |
| 1044 |
|
|
oper_flags | error ';' ; |
| 1045 |
|
|
|
| 1046 |
|
|
oper_name: NAME '=' QSTRING ';' |
| 1047 |
|
|
{ |
| 1048 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1049 |
adx |
30 |
{ |
| 1050 |
|
|
if (strlen(yylval.string) > OPERNICKLEN) |
| 1051 |
|
|
yylval.string[OPERNICKLEN] = '\0'; |
| 1052 |
|
|
|
| 1053 |
|
|
MyFree(yy_conf->name); |
| 1054 |
|
|
DupString(yy_conf->name, yylval.string); |
| 1055 |
|
|
} |
| 1056 |
|
|
}; |
| 1057 |
|
|
|
| 1058 |
|
|
oper_name_t: QSTRING |
| 1059 |
|
|
{ |
| 1060 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1061 |
adx |
30 |
{ |
| 1062 |
|
|
if (strlen(yylval.string) > OPERNICKLEN) |
| 1063 |
|
|
yylval.string[OPERNICKLEN] = '\0'; |
| 1064 |
|
|
|
| 1065 |
|
|
MyFree(yy_conf->name); |
| 1066 |
|
|
DupString(yy_conf->name, yylval.string); |
| 1067 |
|
|
} |
| 1068 |
|
|
}; |
| 1069 |
|
|
|
| 1070 |
|
|
oper_user: USER '=' QSTRING ';' |
| 1071 |
|
|
{ |
| 1072 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1073 |
adx |
30 |
{ |
| 1074 |
michael |
593 |
struct split_nuh_item nuh; |
| 1075 |
adx |
30 |
|
| 1076 |
michael |
593 |
nuh.nuhmask = yylval.string; |
| 1077 |
|
|
nuh.nickptr = NULL; |
| 1078 |
|
|
nuh.userptr = userbuf; |
| 1079 |
|
|
nuh.hostptr = hostbuf; |
| 1080 |
|
|
|
| 1081 |
|
|
nuh.nicksize = 0; |
| 1082 |
|
|
nuh.usersize = sizeof(userbuf); |
| 1083 |
|
|
nuh.hostsize = sizeof(hostbuf); |
| 1084 |
|
|
|
| 1085 |
|
|
split_nuh(&nuh); |
| 1086 |
|
|
|
| 1087 |
adx |
30 |
if (yy_aconf->user == NULL) |
| 1088 |
|
|
{ |
| 1089 |
michael |
593 |
DupString(yy_aconf->user, userbuf); |
| 1090 |
|
|
DupString(yy_aconf->host, hostbuf); |
| 1091 |
adx |
30 |
} |
| 1092 |
|
|
else |
| 1093 |
|
|
{ |
| 1094 |
michael |
593 |
struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem)); |
| 1095 |
|
|
|
| 1096 |
|
|
DupString(yy_tmp->user, userbuf); |
| 1097 |
|
|
DupString(yy_tmp->host, hostbuf); |
| 1098 |
|
|
|
| 1099 |
adx |
30 |
dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list); |
| 1100 |
|
|
} |
| 1101 |
|
|
} |
| 1102 |
|
|
}; |
| 1103 |
|
|
|
| 1104 |
|
|
oper_password: PASSWORD '=' QSTRING ';' |
| 1105 |
|
|
{ |
| 1106 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1107 |
adx |
30 |
{ |
| 1108 |
|
|
if (yy_aconf->passwd != NULL) |
| 1109 |
|
|
memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); |
| 1110 |
|
|
|
| 1111 |
|
|
MyFree(yy_aconf->passwd); |
| 1112 |
|
|
DupString(yy_aconf->passwd, yylval.string); |
| 1113 |
|
|
} |
| 1114 |
|
|
}; |
| 1115 |
|
|
|
| 1116 |
|
|
oper_encrypted: ENCRYPTED '=' TBOOL ';' |
| 1117 |
|
|
{ |
| 1118 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1119 |
adx |
30 |
{ |
| 1120 |
|
|
if (yylval.number) |
| 1121 |
|
|
SetConfEncrypted(yy_aconf); |
| 1122 |
|
|
else |
| 1123 |
|
|
ClearConfEncrypted(yy_aconf); |
| 1124 |
|
|
} |
| 1125 |
|
|
}; |
| 1126 |
|
|
|
| 1127 |
|
|
oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';' |
| 1128 |
|
|
{ |
| 1129 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 1130 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1131 |
adx |
30 |
{ |
| 1132 |
|
|
BIO *file; |
| 1133 |
|
|
|
| 1134 |
|
|
if (yy_aconf->rsa_public_key != NULL) |
| 1135 |
|
|
{ |
| 1136 |
|
|
RSA_free(yy_aconf->rsa_public_key); |
| 1137 |
|
|
yy_aconf->rsa_public_key = NULL; |
| 1138 |
|
|
} |
| 1139 |
|
|
|
| 1140 |
|
|
if (yy_aconf->rsa_public_key_file != NULL) |
| 1141 |
|
|
{ |
| 1142 |
|
|
MyFree(yy_aconf->rsa_public_key_file); |
| 1143 |
|
|
yy_aconf->rsa_public_key_file = NULL; |
| 1144 |
|
|
} |
| 1145 |
|
|
|
| 1146 |
|
|
DupString(yy_aconf->rsa_public_key_file, yylval.string); |
| 1147 |
|
|
file = BIO_new_file(yylval.string, "r"); |
| 1148 |
|
|
|
| 1149 |
|
|
if (file == NULL) |
| 1150 |
|
|
{ |
| 1151 |
|
|
yyerror("Ignoring rsa_public_key_file -- file doesn't exist"); |
| 1152 |
|
|
break; |
| 1153 |
|
|
} |
| 1154 |
|
|
|
| 1155 |
|
|
yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL); |
| 1156 |
|
|
|
| 1157 |
|
|
if (yy_aconf->rsa_public_key == NULL) |
| 1158 |
|
|
{ |
| 1159 |
|
|
yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax."); |
| 1160 |
|
|
break; |
| 1161 |
|
|
} |
| 1162 |
|
|
|
| 1163 |
|
|
BIO_set_close(file, BIO_CLOSE); |
| 1164 |
|
|
BIO_free(file); |
| 1165 |
|
|
} |
| 1166 |
|
|
#endif /* HAVE_LIBCRYPTO */ |
| 1167 |
|
|
}; |
| 1168 |
|
|
|
| 1169 |
|
|
oper_class: CLASS '=' QSTRING ';' |
| 1170 |
|
|
{ |
| 1171 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1172 |
adx |
30 |
{ |
| 1173 |
|
|
MyFree(class_name); |
| 1174 |
|
|
DupString(class_name, yylval.string); |
| 1175 |
|
|
} |
| 1176 |
|
|
}; |
| 1177 |
|
|
|
| 1178 |
michael |
56 |
oper_umodes: T_UMODES |
| 1179 |
|
|
{ |
| 1180 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1181 |
db |
298 |
yy_aconf->modes = 0; |
| 1182 |
michael |
56 |
} '=' oper_umodes_items ';' ; |
| 1183 |
|
|
|
| 1184 |
|
|
oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item; |
| 1185 |
|
|
oper_umodes_item: T_BOTS |
| 1186 |
|
|
{ |
| 1187 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1188 |
db |
298 |
yy_aconf->modes |= UMODE_BOTS; |
| 1189 |
michael |
56 |
} | T_CCONN |
| 1190 |
|
|
{ |
| 1191 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1192 |
db |
298 |
yy_aconf->modes |= UMODE_CCONN; |
| 1193 |
db |
849 |
} | T_CCONN_FULL |
| 1194 |
|
|
{ |
| 1195 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1196 |
db |
849 |
yy_aconf->modes |= UMODE_CCONN_FULL; |
| 1197 |
michael |
56 |
} | T_DEAF |
| 1198 |
|
|
{ |
| 1199 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1200 |
db |
298 |
yy_aconf->modes |= UMODE_DEAF; |
| 1201 |
michael |
56 |
} | T_DEBUG |
| 1202 |
|
|
{ |
| 1203 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1204 |
db |
298 |
yy_aconf->modes |= UMODE_DEBUG; |
| 1205 |
michael |
56 |
} | T_FULL |
| 1206 |
|
|
{ |
| 1207 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1208 |
db |
298 |
yy_aconf->modes |= UMODE_FULL; |
| 1209 |
michael |
56 |
} | T_SKILL |
| 1210 |
|
|
{ |
| 1211 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1212 |
db |
298 |
yy_aconf->modes |= UMODE_SKILL; |
| 1213 |
michael |
56 |
} | T_NCHANGE |
| 1214 |
|
|
{ |
| 1215 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1216 |
db |
298 |
yy_aconf->modes |= UMODE_NCHANGE; |
| 1217 |
michael |
56 |
} | T_REJ |
| 1218 |
|
|
{ |
| 1219 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1220 |
db |
298 |
yy_aconf->modes |= UMODE_REJ; |
| 1221 |
michael |
56 |
} | T_UNAUTH |
| 1222 |
|
|
{ |
| 1223 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1224 |
db |
298 |
yy_aconf->modes |= UMODE_UNAUTH; |
| 1225 |
michael |
56 |
} | T_SPY |
| 1226 |
|
|
{ |
| 1227 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1228 |
db |
298 |
yy_aconf->modes |= UMODE_SPY; |
| 1229 |
michael |
56 |
} | T_EXTERNAL |
| 1230 |
|
|
{ |
| 1231 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1232 |
db |
298 |
yy_aconf->modes |= UMODE_EXTERNAL; |
| 1233 |
michael |
56 |
} | T_OPERWALL |
| 1234 |
|
|
{ |
| 1235 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1236 |
db |
298 |
yy_aconf->modes |= UMODE_OPERWALL; |
| 1237 |
michael |
56 |
} | T_SERVNOTICE |
| 1238 |
|
|
{ |
| 1239 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1240 |
db |
298 |
yy_aconf->modes |= UMODE_SERVNOTICE; |
| 1241 |
michael |
56 |
} | T_INVISIBLE |
| 1242 |
|
|
{ |
| 1243 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1244 |
db |
298 |
yy_aconf->modes |= UMODE_INVISIBLE; |
| 1245 |
michael |
56 |
} | T_WALLOP |
| 1246 |
|
|
{ |
| 1247 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1248 |
db |
298 |
yy_aconf->modes |= UMODE_WALLOP; |
| 1249 |
michael |
56 |
} | T_SOFTCALLERID |
| 1250 |
|
|
{ |
| 1251 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1252 |
db |
298 |
yy_aconf->modes |= UMODE_SOFTCALLERID; |
| 1253 |
michael |
56 |
} | T_CALLERID |
| 1254 |
|
|
{ |
| 1255 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1256 |
db |
298 |
yy_aconf->modes |= UMODE_CALLERID; |
| 1257 |
michael |
56 |
} | T_LOCOPS |
| 1258 |
|
|
{ |
| 1259 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1260 |
db |
298 |
yy_aconf->modes |= UMODE_LOCOPS; |
| 1261 |
michael |
56 |
}; |
| 1262 |
|
|
|
| 1263 |
adx |
30 |
oper_global_kill: GLOBAL_KILL '=' TBOOL ';' |
| 1264 |
|
|
{ |
| 1265 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1266 |
adx |
30 |
{ |
| 1267 |
|
|
if (yylval.number) |
| 1268 |
|
|
yy_aconf->port |= OPER_FLAG_GLOBAL_KILL; |
| 1269 |
|
|
else |
| 1270 |
|
|
yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL; |
| 1271 |
|
|
} |
| 1272 |
|
|
}; |
| 1273 |
|
|
|
| 1274 |
|
|
oper_remote: REMOTE '=' TBOOL ';' |
| 1275 |
|
|
{ |
| 1276 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1277 |
adx |
30 |
{ |
| 1278 |
|
|
if (yylval.number) |
| 1279 |
|
|
yy_aconf->port |= OPER_FLAG_REMOTE; |
| 1280 |
|
|
else |
| 1281 |
|
|
yy_aconf->port &= ~OPER_FLAG_REMOTE; |
| 1282 |
|
|
} |
| 1283 |
|
|
}; |
| 1284 |
|
|
|
| 1285 |
|
|
oper_remoteban: REMOTEBAN '=' TBOOL ';' |
| 1286 |
|
|
{ |
| 1287 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1288 |
adx |
30 |
{ |
| 1289 |
|
|
if (yylval.number) |
| 1290 |
|
|
yy_aconf->port |= OPER_FLAG_REMOTEBAN; |
| 1291 |
|
|
else |
| 1292 |
|
|
yy_aconf->port &= ~OPER_FLAG_REMOTEBAN; |
| 1293 |
|
|
} |
| 1294 |
|
|
}; |
| 1295 |
|
|
|
| 1296 |
|
|
oper_kline: KLINE '=' TBOOL ';' |
| 1297 |
|
|
{ |
| 1298 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1299 |
adx |
30 |
{ |
| 1300 |
|
|
if (yylval.number) |
| 1301 |
|
|
yy_aconf->port |= OPER_FLAG_K; |
| 1302 |
|
|
else |
| 1303 |
|
|
yy_aconf->port &= ~OPER_FLAG_K; |
| 1304 |
|
|
} |
| 1305 |
|
|
}; |
| 1306 |
|
|
|
| 1307 |
|
|
oper_xline: XLINE '=' TBOOL ';' |
| 1308 |
|
|
{ |
| 1309 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1310 |
adx |
30 |
{ |
| 1311 |
|
|
if (yylval.number) |
| 1312 |
|
|
yy_aconf->port |= OPER_FLAG_X; |
| 1313 |
|
|
else |
| 1314 |
|
|
yy_aconf->port &= ~OPER_FLAG_X; |
| 1315 |
|
|
} |
| 1316 |
|
|
}; |
| 1317 |
|
|
|
| 1318 |
|
|
oper_unkline: UNKLINE '=' TBOOL ';' |
| 1319 |
|
|
{ |
| 1320 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1321 |
adx |
30 |
{ |
| 1322 |
|
|
if (yylval.number) |
| 1323 |
|
|
yy_aconf->port |= OPER_FLAG_UNKLINE; |
| 1324 |
|
|
else |
| 1325 |
|
|
yy_aconf->port &= ~OPER_FLAG_UNKLINE; |
| 1326 |
|
|
} |
| 1327 |
|
|
}; |
| 1328 |
|
|
|
| 1329 |
|
|
oper_gline: GLINE '=' TBOOL ';' |
| 1330 |
|
|
{ |
| 1331 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1332 |
adx |
30 |
{ |
| 1333 |
|
|
if (yylval.number) |
| 1334 |
|
|
yy_aconf->port |= OPER_FLAG_GLINE; |
| 1335 |
|
|
else |
| 1336 |
|
|
yy_aconf->port &= ~OPER_FLAG_GLINE; |
| 1337 |
|
|
} |
| 1338 |
|
|
}; |
| 1339 |
|
|
|
| 1340 |
|
|
oper_nick_changes: NICK_CHANGES '=' TBOOL ';' |
| 1341 |
|
|
{ |
| 1342 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1343 |
adx |
30 |
{ |
| 1344 |
|
|
if (yylval.number) |
| 1345 |
|
|
yy_aconf->port |= OPER_FLAG_N; |
| 1346 |
|
|
else |
| 1347 |
|
|
yy_aconf->port &= ~OPER_FLAG_N; |
| 1348 |
|
|
} |
| 1349 |
|
|
}; |
| 1350 |
|
|
|
| 1351 |
|
|
oper_die: DIE '=' TBOOL ';' |
| 1352 |
|
|
{ |
| 1353 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1354 |
adx |
30 |
{ |
| 1355 |
|
|
if (yylval.number) |
| 1356 |
|
|
yy_aconf->port |= OPER_FLAG_DIE; |
| 1357 |
|
|
else |
| 1358 |
|
|
yy_aconf->port &= ~OPER_FLAG_DIE; |
| 1359 |
|
|
} |
| 1360 |
|
|
}; |
| 1361 |
|
|
|
| 1362 |
|
|
oper_rehash: REHASH '=' TBOOL ';' |
| 1363 |
|
|
{ |
| 1364 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1365 |
adx |
30 |
{ |
| 1366 |
|
|
if (yylval.number) |
| 1367 |
|
|
yy_aconf->port |= OPER_FLAG_REHASH; |
| 1368 |
|
|
else |
| 1369 |
|
|
yy_aconf->port &= ~OPER_FLAG_REHASH; |
| 1370 |
|
|
} |
| 1371 |
|
|
}; |
| 1372 |
|
|
|
| 1373 |
|
|
oper_admin: ADMIN '=' TBOOL ';' |
| 1374 |
|
|
{ |
| 1375 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1376 |
adx |
30 |
{ |
| 1377 |
|
|
if (yylval.number) |
| 1378 |
|
|
yy_aconf->port |= OPER_FLAG_ADMIN; |
| 1379 |
|
|
else |
| 1380 |
|
|
yy_aconf->port &= ~OPER_FLAG_ADMIN; |
| 1381 |
|
|
} |
| 1382 |
|
|
}; |
| 1383 |
|
|
|
| 1384 |
|
|
oper_hidden_admin: HIDDEN_ADMIN '=' TBOOL ';' |
| 1385 |
|
|
{ |
| 1386 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1387 |
adx |
30 |
{ |
| 1388 |
|
|
if (yylval.number) |
| 1389 |
|
|
yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN; |
| 1390 |
|
|
else |
| 1391 |
|
|
yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN; |
| 1392 |
|
|
} |
| 1393 |
|
|
}; |
| 1394 |
|
|
|
| 1395 |
|
|
oper_hidden_oper: HIDDEN_OPER '=' TBOOL ';' |
| 1396 |
|
|
{ |
| 1397 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1398 |
adx |
30 |
{ |
| 1399 |
|
|
if (yylval.number) |
| 1400 |
|
|
yy_aconf->port |= OPER_FLAG_HIDDEN_OPER; |
| 1401 |
|
|
else |
| 1402 |
|
|
yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER; |
| 1403 |
|
|
} |
| 1404 |
|
|
}; |
| 1405 |
|
|
|
| 1406 |
|
|
oper_operwall: T_OPERWALL '=' TBOOL ';' |
| 1407 |
|
|
{ |
| 1408 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1409 |
adx |
30 |
{ |
| 1410 |
|
|
if (yylval.number) |
| 1411 |
|
|
yy_aconf->port |= OPER_FLAG_OPERWALL; |
| 1412 |
|
|
else |
| 1413 |
|
|
yy_aconf->port &= ~OPER_FLAG_OPERWALL; |
| 1414 |
|
|
} |
| 1415 |
|
|
}; |
| 1416 |
|
|
|
| 1417 |
|
|
oper_flags: IRCD_FLAGS |
| 1418 |
|
|
{ |
| 1419 |
|
|
} '=' oper_flags_items ';'; |
| 1420 |
|
|
|
| 1421 |
|
|
oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item; |
| 1422 |
db |
136 |
oper_flags_item: NOT { not_atom = 1; } oper_flags_item_atom |
| 1423 |
|
|
| { not_atom = 0; } oper_flags_item_atom; |
| 1424 |
adx |
30 |
|
| 1425 |
|
|
oper_flags_item_atom: GLOBAL_KILL |
| 1426 |
|
|
{ |
| 1427 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1428 |
adx |
30 |
{ |
| 1429 |
|
|
if (not_atom)yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL; |
| 1430 |
|
|
else yy_aconf->port |= OPER_FLAG_GLOBAL_KILL; |
| 1431 |
|
|
} |
| 1432 |
|
|
} | REMOTE |
| 1433 |
|
|
{ |
| 1434 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1435 |
adx |
30 |
{ |
| 1436 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTE; |
| 1437 |
|
|
else yy_aconf->port |= OPER_FLAG_REMOTE; |
| 1438 |
|
|
} |
| 1439 |
|
|
} | KLINE |
| 1440 |
|
|
{ |
| 1441 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1442 |
adx |
30 |
{ |
| 1443 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_K; |
| 1444 |
|
|
else yy_aconf->port |= OPER_FLAG_K; |
| 1445 |
|
|
} |
| 1446 |
|
|
} | UNKLINE |
| 1447 |
|
|
{ |
| 1448 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1449 |
adx |
30 |
{ |
| 1450 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_UNKLINE; |
| 1451 |
|
|
else yy_aconf->port |= OPER_FLAG_UNKLINE; |
| 1452 |
|
|
} |
| 1453 |
|
|
} | XLINE |
| 1454 |
|
|
{ |
| 1455 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1456 |
adx |
30 |
{ |
| 1457 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_X; |
| 1458 |
|
|
else yy_aconf->port |= OPER_FLAG_X; |
| 1459 |
|
|
} |
| 1460 |
|
|
} | GLINE |
| 1461 |
|
|
{ |
| 1462 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1463 |
adx |
30 |
{ |
| 1464 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_GLINE; |
| 1465 |
|
|
else yy_aconf->port |= OPER_FLAG_GLINE; |
| 1466 |
|
|
} |
| 1467 |
|
|
} | DIE |
| 1468 |
|
|
{ |
| 1469 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1470 |
adx |
30 |
{ |
| 1471 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_DIE; |
| 1472 |
|
|
else yy_aconf->port |= OPER_FLAG_DIE; |
| 1473 |
|
|
} |
| 1474 |
|
|
} | REHASH |
| 1475 |
|
|
{ |
| 1476 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1477 |
adx |
30 |
{ |
| 1478 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_REHASH; |
| 1479 |
|
|
else yy_aconf->port |= OPER_FLAG_REHASH; |
| 1480 |
|
|
} |
| 1481 |
|
|
} | ADMIN |
| 1482 |
|
|
{ |
| 1483 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1484 |
adx |
30 |
{ |
| 1485 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_ADMIN; |
| 1486 |
|
|
else yy_aconf->port |= OPER_FLAG_ADMIN; |
| 1487 |
|
|
} |
| 1488 |
|
|
} | HIDDEN_ADMIN |
| 1489 |
|
|
{ |
| 1490 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1491 |
adx |
30 |
{ |
| 1492 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN; |
| 1493 |
|
|
else yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN; |
| 1494 |
|
|
} |
| 1495 |
|
|
} | NICK_CHANGES |
| 1496 |
|
|
{ |
| 1497 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1498 |
adx |
30 |
{ |
| 1499 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_N; |
| 1500 |
|
|
else yy_aconf->port |= OPER_FLAG_N; |
| 1501 |
|
|
} |
| 1502 |
|
|
} | T_OPERWALL |
| 1503 |
|
|
{ |
| 1504 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1505 |
adx |
30 |
{ |
| 1506 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPERWALL; |
| 1507 |
|
|
else yy_aconf->port |= OPER_FLAG_OPERWALL; |
| 1508 |
|
|
} |
| 1509 |
|
|
} | OPER_SPY_T |
| 1510 |
|
|
{ |
| 1511 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1512 |
adx |
30 |
{ |
| 1513 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPER_SPY; |
| 1514 |
|
|
else yy_aconf->port |= OPER_FLAG_OPER_SPY; |
| 1515 |
|
|
} |
| 1516 |
|
|
} | HIDDEN_OPER |
| 1517 |
|
|
{ |
| 1518 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1519 |
adx |
30 |
{ |
| 1520 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER; |
| 1521 |
|
|
else yy_aconf->port |= OPER_FLAG_HIDDEN_OPER; |
| 1522 |
|
|
} |
| 1523 |
|
|
} | REMOTEBAN |
| 1524 |
|
|
{ |
| 1525 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1526 |
adx |
30 |
{ |
| 1527 |
|
|
if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTEBAN; |
| 1528 |
|
|
else yy_aconf->port |= OPER_FLAG_REMOTEBAN; |
| 1529 |
|
|
} |
| 1530 |
|
|
} | ENCRYPTED |
| 1531 |
|
|
{ |
| 1532 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1533 |
adx |
30 |
{ |
| 1534 |
|
|
if (not_atom) ClearConfEncrypted(yy_aconf); |
| 1535 |
|
|
else SetConfEncrypted(yy_aconf); |
| 1536 |
|
|
} |
| 1537 |
|
|
}; |
| 1538 |
|
|
|
| 1539 |
|
|
|
| 1540 |
|
|
/*************************************************************************** |
| 1541 |
|
|
* section class |
| 1542 |
|
|
***************************************************************************/ |
| 1543 |
|
|
class_entry: CLASS |
| 1544 |
|
|
{ |
| 1545 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1546 |
adx |
30 |
{ |
| 1547 |
|
|
yy_conf = make_conf_item(CLASS_TYPE); |
| 1548 |
michael |
671 |
yy_class = map_to_conf(yy_conf); |
| 1549 |
adx |
30 |
} |
| 1550 |
|
|
} class_name_b '{' class_items '}' ';' |
| 1551 |
|
|
{ |
| 1552 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1553 |
adx |
30 |
{ |
| 1554 |
michael |
671 |
struct ConfItem *cconf = NULL; |
| 1555 |
adx |
30 |
struct ClassItem *class = NULL; |
| 1556 |
|
|
|
| 1557 |
|
|
if (yy_class_name == NULL) |
| 1558 |
|
|
delete_conf_item(yy_conf); |
| 1559 |
|
|
else |
| 1560 |
|
|
{ |
| 1561 |
|
|
cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL); |
| 1562 |
|
|
|
| 1563 |
|
|
if (cconf != NULL) /* The class existed already */ |
| 1564 |
|
|
{ |
| 1565 |
michael |
671 |
int user_count = 0; |
| 1566 |
|
|
|
| 1567 |
adx |
30 |
rebuild_cidr_class(cconf, yy_class); |
| 1568 |
michael |
671 |
|
| 1569 |
|
|
class = map_to_conf(cconf); |
| 1570 |
|
|
|
| 1571 |
|
|
user_count = class->curr_user_count; |
| 1572 |
|
|
memcpy(class, yy_class, sizeof(*class)); |
| 1573 |
|
|
class->curr_user_count = user_count; |
| 1574 |
|
|
class->active = 1; |
| 1575 |
|
|
|
| 1576 |
adx |
30 |
delete_conf_item(yy_conf); |
| 1577 |
|
|
|
| 1578 |
|
|
MyFree(cconf->name); /* Allows case change of class name */ |
| 1579 |
|
|
cconf->name = yy_class_name; |
| 1580 |
|
|
} |
| 1581 |
|
|
else /* Brand new class */ |
| 1582 |
|
|
{ |
| 1583 |
|
|
MyFree(yy_conf->name); /* just in case it was allocated */ |
| 1584 |
|
|
yy_conf->name = yy_class_name; |
| 1585 |
michael |
671 |
yy_class->active = 1; |
| 1586 |
adx |
30 |
} |
| 1587 |
|
|
} |
| 1588 |
michael |
671 |
|
| 1589 |
adx |
30 |
yy_class_name = NULL; |
| 1590 |
|
|
} |
| 1591 |
|
|
}; |
| 1592 |
|
|
|
| 1593 |
|
|
class_name_b: | class_name_t; |
| 1594 |
|
|
|
| 1595 |
|
|
class_items: class_items class_item | class_item; |
| 1596 |
|
|
class_item: class_name | |
| 1597 |
|
|
class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 | |
| 1598 |
|
|
class_ping_time | |
| 1599 |
|
|
class_ping_warning | |
| 1600 |
|
|
class_number_per_cidr | |
| 1601 |
|
|
class_number_per_ip | |
| 1602 |
|
|
class_connectfreq | |
| 1603 |
|
|
class_max_number | |
| 1604 |
|
|
class_max_global | |
| 1605 |
|
|
class_max_local | |
| 1606 |
|
|
class_max_ident | |
| 1607 |
|
|
class_sendq | |
| 1608 |
|
|
error ';' ; |
| 1609 |
|
|
|
| 1610 |
|
|
class_name: NAME '=' QSTRING ';' |
| 1611 |
|
|
{ |
| 1612 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1613 |
adx |
30 |
{ |
| 1614 |
|
|
MyFree(yy_class_name); |
| 1615 |
|
|
DupString(yy_class_name, yylval.string); |
| 1616 |
|
|
} |
| 1617 |
|
|
}; |
| 1618 |
|
|
|
| 1619 |
|
|
class_name_t: QSTRING |
| 1620 |
|
|
{ |
| 1621 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1622 |
adx |
30 |
{ |
| 1623 |
|
|
MyFree(yy_class_name); |
| 1624 |
|
|
DupString(yy_class_name, yylval.string); |
| 1625 |
|
|
} |
| 1626 |
|
|
}; |
| 1627 |
|
|
|
| 1628 |
|
|
class_ping_time: PING_TIME '=' timespec ';' |
| 1629 |
|
|
{ |
| 1630 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1631 |
adx |
30 |
PingFreq(yy_class) = $3; |
| 1632 |
|
|
}; |
| 1633 |
|
|
|
| 1634 |
|
|
class_ping_warning: PING_WARNING '=' timespec ';' |
| 1635 |
|
|
{ |
| 1636 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1637 |
adx |
30 |
PingWarning(yy_class) = $3; |
| 1638 |
|
|
}; |
| 1639 |
|
|
|
| 1640 |
|
|
class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';' |
| 1641 |
|
|
{ |
| 1642 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1643 |
adx |
30 |
MaxPerIp(yy_class) = $3; |
| 1644 |
|
|
}; |
| 1645 |
|
|
|
| 1646 |
|
|
class_connectfreq: CONNECTFREQ '=' timespec ';' |
| 1647 |
|
|
{ |
| 1648 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1649 |
adx |
30 |
ConFreq(yy_class) = $3; |
| 1650 |
|
|
}; |
| 1651 |
|
|
|
| 1652 |
|
|
class_max_number: MAX_NUMBER '=' NUMBER ';' |
| 1653 |
|
|
{ |
| 1654 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1655 |
adx |
30 |
MaxTotal(yy_class) = $3; |
| 1656 |
|
|
}; |
| 1657 |
|
|
|
| 1658 |
|
|
class_max_global: MAX_GLOBAL '=' NUMBER ';' |
| 1659 |
|
|
{ |
| 1660 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1661 |
adx |
30 |
MaxGlobal(yy_class) = $3; |
| 1662 |
|
|
}; |
| 1663 |
|
|
|
| 1664 |
|
|
class_max_local: MAX_LOCAL '=' NUMBER ';' |
| 1665 |
|
|
{ |
| 1666 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1667 |
adx |
30 |
MaxLocal(yy_class) = $3; |
| 1668 |
|
|
}; |
| 1669 |
|
|
|
| 1670 |
|
|
class_max_ident: MAX_IDENT '=' NUMBER ';' |
| 1671 |
|
|
{ |
| 1672 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1673 |
adx |
30 |
MaxIdent(yy_class) = $3; |
| 1674 |
|
|
}; |
| 1675 |
|
|
|
| 1676 |
|
|
class_sendq: SENDQ '=' sizespec ';' |
| 1677 |
|
|
{ |
| 1678 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1679 |
adx |
30 |
MaxSendq(yy_class) = $3; |
| 1680 |
|
|
}; |
| 1681 |
|
|
|
| 1682 |
|
|
class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';' |
| 1683 |
|
|
{ |
| 1684 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1685 |
adx |
30 |
CidrBitlenIPV4(yy_class) = $3; |
| 1686 |
|
|
}; |
| 1687 |
|
|
|
| 1688 |
|
|
class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';' |
| 1689 |
|
|
{ |
| 1690 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1691 |
adx |
30 |
CidrBitlenIPV6(yy_class) = $3; |
| 1692 |
|
|
}; |
| 1693 |
|
|
|
| 1694 |
|
|
class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';' |
| 1695 |
|
|
{ |
| 1696 |
michael |
967 |
if (conf_parser_ctx.pass == 1) |
| 1697 |
adx |
30 |
NumberPerCidr(yy_class) = $3; |
| 1698 |
|
|
}; |
| 1699 |
|
|
|
| 1700 |
|
|
/*************************************************************************** |
| 1701 |
|
|
* section listen |
| 1702 |
|
|
***************************************************************************/ |
| 1703 |
|
|
listen_entry: LISTEN |
| 1704 |
|
|
{ |
| 1705 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1706 |
adx |
30 |
{ |
| 1707 |
|
|
listener_address = NULL; |
| 1708 |
|
|
listener_flags = 0; |
| 1709 |
|
|
} |
| 1710 |
|
|
} '{' listen_items '}' ';' |
| 1711 |
|
|
{ |
| 1712 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1713 |
adx |
30 |
{ |
| 1714 |
|
|
MyFree(listener_address); |
| 1715 |
|
|
listener_address = NULL; |
| 1716 |
|
|
} |
| 1717 |
|
|
}; |
| 1718 |
|
|
|
| 1719 |
|
|
listen_flags: IRCD_FLAGS |
| 1720 |
|
|
{ |
| 1721 |
michael |
440 |
listener_flags = 0; |
| 1722 |
adx |
30 |
} '=' listen_flags_items ';'; |
| 1723 |
|
|
|
| 1724 |
|
|
listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item; |
| 1725 |
|
|
listen_flags_item: T_SSL |
| 1726 |
|
|
{ |
| 1727 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1728 |
adx |
30 |
listener_flags |= LISTENER_SSL; |
| 1729 |
|
|
} | HIDDEN |
| 1730 |
|
|
{ |
| 1731 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1732 |
adx |
30 |
listener_flags |= LISTENER_HIDDEN; |
| 1733 |
michael |
900 |
} | T_SERVER |
| 1734 |
|
|
{ |
| 1735 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1736 |
michael |
900 |
listener_flags |= LISTENER_SERVER; |
| 1737 |
adx |
30 |
}; |
| 1738 |
|
|
|
| 1739 |
michael |
900 |
|
| 1740 |
|
|
|
| 1741 |
adx |
30 |
listen_items: listen_items listen_item | listen_item; |
| 1742 |
michael |
440 |
listen_item: listen_port | listen_flags | listen_address | listen_host | error ';'; |
| 1743 |
adx |
30 |
|
| 1744 |
michael |
440 |
listen_port: PORT '=' port_items { listener_flags = 0; } ';'; |
| 1745 |
adx |
30 |
|
| 1746 |
|
|
port_items: port_items ',' port_item | port_item; |
| 1747 |
|
|
|
| 1748 |
|
|
port_item: NUMBER |
| 1749 |
|
|
{ |
| 1750 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1751 |
adx |
30 |
{ |
| 1752 |
|
|
if ((listener_flags & LISTENER_SSL)) |
| 1753 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 1754 |
michael |
967 |
if (!ServerInfo.server_ctx) |
| 1755 |
adx |
30 |
#endif |
| 1756 |
|
|
{ |
| 1757 |
|
|
yyerror("SSL not available - port closed"); |
| 1758 |
|
|
break; |
| 1759 |
|
|
} |
| 1760 |
|
|
add_listener($1, listener_address, listener_flags); |
| 1761 |
|
|
} |
| 1762 |
|
|
} | NUMBER TWODOTS NUMBER |
| 1763 |
|
|
{ |
| 1764 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1765 |
adx |
30 |
{ |
| 1766 |
|
|
int i; |
| 1767 |
|
|
|
| 1768 |
|
|
if ((listener_flags & LISTENER_SSL)) |
| 1769 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 1770 |
michael |
967 |
if (!ServerInfo.server_ctx) |
| 1771 |
adx |
30 |
#endif |
| 1772 |
|
|
{ |
| 1773 |
|
|
yyerror("SSL not available - port closed"); |
| 1774 |
|
|
break; |
| 1775 |
|
|
} |
| 1776 |
|
|
|
| 1777 |
|
|
for (i = $1; i <= $3; ++i) |
| 1778 |
|
|
add_listener(i, listener_address, listener_flags); |
| 1779 |
|
|
} |
| 1780 |
|
|
}; |
| 1781 |
|
|
|
| 1782 |
|
|
listen_address: IP '=' QSTRING ';' |
| 1783 |
|
|
{ |
| 1784 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1785 |
adx |
30 |
{ |
| 1786 |
|
|
MyFree(listener_address); |
| 1787 |
|
|
DupString(listener_address, yylval.string); |
| 1788 |
|
|
} |
| 1789 |
|
|
}; |
| 1790 |
|
|
|
| 1791 |
|
|
listen_host: HOST '=' QSTRING ';' |
| 1792 |
|
|
{ |
| 1793 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1794 |
adx |
30 |
{ |
| 1795 |
|
|
MyFree(listener_address); |
| 1796 |
|
|
DupString(listener_address, yylval.string); |
| 1797 |
|
|
} |
| 1798 |
|
|
}; |
| 1799 |
|
|
|
| 1800 |
|
|
/*************************************************************************** |
| 1801 |
|
|
* section auth |
| 1802 |
|
|
***************************************************************************/ |
| 1803 |
|
|
auth_entry: IRCD_AUTH |
| 1804 |
|
|
{ |
| 1805 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1806 |
adx |
30 |
{ |
| 1807 |
|
|
yy_conf = make_conf_item(CLIENT_TYPE); |
| 1808 |
|
|
yy_aconf = map_to_conf(yy_conf); |
| 1809 |
|
|
} |
| 1810 |
|
|
else |
| 1811 |
|
|
{ |
| 1812 |
|
|
MyFree(class_name); |
| 1813 |
|
|
class_name = NULL; |
| 1814 |
|
|
} |
| 1815 |
|
|
} '{' auth_items '}' ';' |
| 1816 |
|
|
{ |
| 1817 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1818 |
adx |
30 |
{ |
| 1819 |
|
|
struct CollectItem *yy_tmp = NULL; |
| 1820 |
|
|
dlink_node *ptr = NULL, *next_ptr = NULL; |
| 1821 |
|
|
|
| 1822 |
|
|
if (yy_aconf->user && yy_aconf->host) |
| 1823 |
|
|
{ |
| 1824 |
|
|
conf_add_class_to_conf(yy_conf, class_name); |
| 1825 |
|
|
add_conf_by_address(CONF_CLIENT, yy_aconf); |
| 1826 |
|
|
} |
| 1827 |
|
|
else |
| 1828 |
|
|
delete_conf_item(yy_conf); |
| 1829 |
|
|
|
| 1830 |
|
|
/* copy over settings from first struct */ |
| 1831 |
|
|
DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head) |
| 1832 |
|
|
{ |
| 1833 |
|
|
struct AccessItem *new_aconf; |
| 1834 |
|
|
struct ConfItem *new_conf; |
| 1835 |
|
|
|
| 1836 |
|
|
new_conf = make_conf_item(CLIENT_TYPE); |
| 1837 |
|
|
new_aconf = map_to_conf(new_conf); |
| 1838 |
|
|
|
| 1839 |
|
|
yy_tmp = ptr->data; |
| 1840 |
|
|
|
| 1841 |
|
|
assert(yy_tmp->user && yy_tmp->host); |
| 1842 |
|
|
|
| 1843 |
|
|
if (yy_aconf->passwd != NULL) |
| 1844 |
|
|
DupString(new_aconf->passwd, yy_aconf->passwd); |
| 1845 |
|
|
if (yy_conf->name != NULL) |
| 1846 |
|
|
DupString(new_conf->name, yy_conf->name); |
| 1847 |
|
|
if (yy_aconf->passwd != NULL) |
| 1848 |
|
|
DupString(new_aconf->passwd, yy_aconf->passwd); |
| 1849 |
|
|
|
| 1850 |
|
|
new_aconf->flags = yy_aconf->flags; |
| 1851 |
|
|
new_aconf->port = yy_aconf->port; |
| 1852 |
|
|
|
| 1853 |
|
|
DupString(new_aconf->user, yy_tmp->user); |
| 1854 |
|
|
collapse(new_aconf->user); |
| 1855 |
|
|
|
| 1856 |
|
|
DupString(new_aconf->host, yy_tmp->host); |
| 1857 |
|
|
collapse(new_aconf->host); |
| 1858 |
|
|
|
| 1859 |
|
|
conf_add_class_to_conf(new_conf, class_name); |
| 1860 |
|
|
add_conf_by_address(CONF_CLIENT, new_aconf); |
| 1861 |
|
|
dlinkDelete(&yy_tmp->node, &col_conf_list); |
| 1862 |
|
|
free_collect_item(yy_tmp); |
| 1863 |
|
|
} |
| 1864 |
|
|
|
| 1865 |
|
|
MyFree(class_name); |
| 1866 |
|
|
class_name = NULL; |
| 1867 |
|
|
yy_conf = NULL; |
| 1868 |
|
|
yy_aconf = NULL; |
| 1869 |
|
|
} |
| 1870 |
|
|
}; |
| 1871 |
|
|
|
| 1872 |
|
|
auth_items: auth_items auth_item | auth_item; |
| 1873 |
|
|
auth_item: auth_user | auth_passwd | auth_class | auth_flags | |
| 1874 |
|
|
auth_kline_exempt | auth_need_ident | |
| 1875 |
|
|
auth_exceed_limit | auth_no_tilde | auth_gline_exempt | |
| 1876 |
|
|
auth_spoof | auth_spoof_notice | |
| 1877 |
|
|
auth_redir_serv | auth_redir_port | auth_can_flood | |
| 1878 |
|
|
auth_need_password | auth_encrypted | error ';' ; |
| 1879 |
|
|
|
| 1880 |
|
|
auth_user: USER '=' QSTRING ';' |
| 1881 |
|
|
{ |
| 1882 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1883 |
adx |
30 |
{ |
| 1884 |
michael |
593 |
struct CollectItem *yy_tmp = NULL; |
| 1885 |
|
|
struct split_nuh_item nuh; |
| 1886 |
adx |
30 |
|
| 1887 |
michael |
593 |
nuh.nuhmask = yylval.string; |
| 1888 |
|
|
nuh.nickptr = NULL; |
| 1889 |
|
|
nuh.userptr = userbuf; |
| 1890 |
|
|
nuh.hostptr = hostbuf; |
| 1891 |
|
|
|
| 1892 |
|
|
nuh.nicksize = 0; |
| 1893 |
|
|
nuh.usersize = sizeof(userbuf); |
| 1894 |
|
|
nuh.hostsize = sizeof(hostbuf); |
| 1895 |
|
|
|
| 1896 |
|
|
split_nuh(&nuh); |
| 1897 |
|
|
|
| 1898 |
adx |
30 |
if (yy_aconf->user == NULL) |
| 1899 |
michael |
593 |
{ |
| 1900 |
|
|
DupString(yy_aconf->user, userbuf); |
| 1901 |
|
|
DupString(yy_aconf->host, hostbuf); |
| 1902 |
|
|
} |
| 1903 |
adx |
30 |
else |
| 1904 |
|
|
{ |
| 1905 |
|
|
yy_tmp = MyMalloc(sizeof(struct CollectItem)); |
| 1906 |
michael |
593 |
|
| 1907 |
|
|
DupString(yy_tmp->user, userbuf); |
| 1908 |
|
|
DupString(yy_tmp->host, hostbuf); |
| 1909 |
|
|
|
| 1910 |
adx |
30 |
dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list); |
| 1911 |
|
|
} |
| 1912 |
|
|
} |
| 1913 |
|
|
}; |
| 1914 |
|
|
|
| 1915 |
|
|
/* XXX - IP/IPV6 tags don't exist anymore - put IP/IPV6 into user. */ |
| 1916 |
|
|
|
| 1917 |
|
|
auth_passwd: PASSWORD '=' QSTRING ';' |
| 1918 |
|
|
{ |
| 1919 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1920 |
adx |
30 |
{ |
| 1921 |
|
|
/* be paranoid */ |
| 1922 |
|
|
if (yy_aconf->passwd != NULL) |
| 1923 |
|
|
memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); |
| 1924 |
|
|
|
| 1925 |
|
|
MyFree(yy_aconf->passwd); |
| 1926 |
|
|
DupString(yy_aconf->passwd, yylval.string); |
| 1927 |
|
|
} |
| 1928 |
|
|
}; |
| 1929 |
|
|
|
| 1930 |
|
|
auth_spoof_notice: SPOOF_NOTICE '=' TBOOL ';' |
| 1931 |
|
|
{ |
| 1932 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1933 |
adx |
30 |
{ |
| 1934 |
|
|
if (yylval.number) |
| 1935 |
|
|
yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE; |
| 1936 |
|
|
else |
| 1937 |
|
|
yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE; |
| 1938 |
|
|
} |
| 1939 |
|
|
}; |
| 1940 |
|
|
|
| 1941 |
|
|
auth_class: CLASS '=' QSTRING ';' |
| 1942 |
|
|
{ |
| 1943 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1944 |
adx |
30 |
{ |
| 1945 |
|
|
MyFree(class_name); |
| 1946 |
|
|
DupString(class_name, yylval.string); |
| 1947 |
|
|
} |
| 1948 |
|
|
}; |
| 1949 |
|
|
|
| 1950 |
|
|
auth_encrypted: ENCRYPTED '=' TBOOL ';' |
| 1951 |
|
|
{ |
| 1952 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1953 |
adx |
30 |
{ |
| 1954 |
|
|
if (yylval.number) |
| 1955 |
|
|
SetConfEncrypted(yy_aconf); |
| 1956 |
|
|
else |
| 1957 |
|
|
ClearConfEncrypted(yy_aconf); |
| 1958 |
|
|
} |
| 1959 |
|
|
}; |
| 1960 |
|
|
|
| 1961 |
|
|
auth_flags: IRCD_FLAGS |
| 1962 |
|
|
{ |
| 1963 |
|
|
} '=' auth_flags_items ';'; |
| 1964 |
|
|
|
| 1965 |
|
|
auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item; |
| 1966 |
db |
136 |
auth_flags_item: NOT { not_atom = 1; } auth_flags_item_atom |
| 1967 |
|
|
| { not_atom = 0; } auth_flags_item_atom; |
| 1968 |
adx |
30 |
|
| 1969 |
|
|
auth_flags_item_atom: SPOOF_NOTICE |
| 1970 |
|
|
{ |
| 1971 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1972 |
adx |
30 |
{ |
| 1973 |
|
|
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE; |
| 1974 |
|
|
else yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE; |
| 1975 |
|
|
} |
| 1976 |
|
|
|
| 1977 |
|
|
} | EXCEED_LIMIT |
| 1978 |
|
|
{ |
| 1979 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1980 |
adx |
30 |
{ |
| 1981 |
|
|
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT; |
| 1982 |
|
|
else yy_aconf->flags |= CONF_FLAGS_NOLIMIT; |
| 1983 |
|
|
} |
| 1984 |
|
|
} | KLINE_EXEMPT |
| 1985 |
|
|
{ |
| 1986 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1987 |
adx |
30 |
{ |
| 1988 |
|
|
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE; |
| 1989 |
|
|
else yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE; |
| 1990 |
|
|
} |
| 1991 |
|
|
} | NEED_IDENT |
| 1992 |
|
|
{ |
| 1993 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 1994 |
adx |
30 |
{ |
| 1995 |
|
|
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD; |
| 1996 |
|
|
else yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD; |
| 1997 |
|
|
} |
| 1998 |
|
|
} | CAN_FLOOD |
| 1999 |
|
|
{ |
| 2000 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2001 |
adx |
30 |
{ |
| 2002 |
|
|
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD; |
| 2003 |
|
|
else yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD; |
| 2004 |
|
|
} |
| 2005 |
|
|
} | CAN_IDLE |
| 2006 |
|
|
{ |
| 2007 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2008 |
adx |
30 |
{ |
| 2009 |
|
|
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_IDLE_LINED; |
| 2010 |
|
|
else yy_aconf->flags |= CONF_FLAGS_IDLE_LINED; |
| 2011 |
|
|
} |
| 2012 |
|
|
} | NO_TILDE |
| 2013 |
|
|
{ |
| 2014 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2015 |
adx |
30 |
{ |
| 2016 |
|
|
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE; |
| 2017 |
|
|
else yy_aconf->flags |= CONF_FLAGS_NO_TILDE; |
| 2018 |
|
|
} |
| 2019 |
|
|
} | GLINE_EXEMPT |
| 2020 |
|
|
{ |
| 2021 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2022 |
adx |
30 |
{ |
| 2023 |
|
|
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE; |
| 2024 |
|
|
else yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE; |
| 2025 |
|
|
} |
| 2026 |
|
|
} | RESV_EXEMPT |
| 2027 |
|
|
{ |
| 2028 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2029 |
adx |
30 |
{ |
| 2030 |
|
|
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTRESV; |
| 2031 |
|
|
else yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV; |
| 2032 |
|
|
} |
| 2033 |
|
|
} | NEED_PASSWORD |
| 2034 |
|
|
{ |
| 2035 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2036 |
adx |
30 |
{ |
| 2037 |
|
|
if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD; |
| 2038 |
|
|
else yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD; |
| 2039 |
|
|
} |
| 2040 |
|
|
}; |
| 2041 |
|
|
|
| 2042 |
|
|
auth_kline_exempt: KLINE_EXEMPT '=' TBOOL ';' |
| 2043 |
|
|
{ |
| 2044 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2045 |
adx |
30 |
{ |
| 2046 |
|
|
if (yylval.number) |
| 2047 |
|
|
yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE; |
| 2048 |
|
|
else |
| 2049 |
|
|
yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE; |
| 2050 |
|
|
} |
| 2051 |
|
|
}; |
| 2052 |
|
|
|
| 2053 |
|
|
auth_need_ident: NEED_IDENT '=' TBOOL ';' |
| 2054 |
|
|
{ |
| 2055 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2056 |
adx |
30 |
{ |
| 2057 |
|
|
if (yylval.number) |
| 2058 |
|
|
yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD; |
| 2059 |
|
|
else |
| 2060 |
|
|
yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD; |
| 2061 |
|
|
} |
| 2062 |
|
|
}; |
| 2063 |
|
|
|
| 2064 |
|
|
auth_exceed_limit: EXCEED_LIMIT '=' TBOOL ';' |
| 2065 |
|
|
{ |
| 2066 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2067 |
adx |
30 |
{ |
| 2068 |
|
|
if (yylval.number) |
| 2069 |
|
|
yy_aconf->flags |= CONF_FLAGS_NOLIMIT; |
| 2070 |
|
|
else |
| 2071 |
|
|
yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT; |
| 2072 |
|
|
} |
| 2073 |
|
|
}; |
| 2074 |
|
|
|
| 2075 |
|
|
auth_can_flood: CAN_FLOOD '=' TBOOL ';' |
| 2076 |
|
|
{ |
| 2077 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2078 |
adx |
30 |
{ |
| 2079 |
|
|
if (yylval.number) |
| 2080 |
|
|
yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD; |
| 2081 |
|
|
else |
| 2082 |
|
|
yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD; |
| 2083 |
|
|
} |
| 2084 |
|
|
}; |
| 2085 |
|
|
|
| 2086 |
|
|
auth_no_tilde: NO_TILDE '=' TBOOL ';' |
| 2087 |
|
|
{ |
| 2088 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2089 |
adx |
30 |
{ |
| 2090 |
|
|
if (yylval.number) |
| 2091 |
|
|
yy_aconf->flags |= CONF_FLAGS_NO_TILDE; |
| 2092 |
|
|
else |
| 2093 |
|
|
yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE; |
| 2094 |
|
|
} |
| 2095 |
|
|
}; |
| 2096 |
|
|
|
| 2097 |
|
|
auth_gline_exempt: GLINE_EXEMPT '=' TBOOL ';' |
| 2098 |
|
|
{ |
| 2099 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2100 |
adx |
30 |
{ |
| 2101 |
|
|
if (yylval.number) |
| 2102 |
|
|
yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE; |
| 2103 |
|
|
else |
| 2104 |
|
|
yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE; |
| 2105 |
|
|
} |
| 2106 |
|
|
}; |
| 2107 |
|
|
|
| 2108 |
|
|
/* XXX - need check for illegal hostnames here */ |
| 2109 |
|
|
auth_spoof: SPOOF '=' QSTRING ';' |
| 2110 |
|
|
{ |
| 2111 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2112 |
adx |
30 |
{ |
| 2113 |
|
|
MyFree(yy_conf->name); |
| 2114 |
|
|
|
| 2115 |
|
|
if (strlen(yylval.string) < HOSTLEN) |
| 2116 |
|
|
{ |
| 2117 |
|
|
DupString(yy_conf->name, yylval.string); |
| 2118 |
|
|
yy_aconf->flags |= CONF_FLAGS_SPOOF_IP; |
| 2119 |
|
|
} |
| 2120 |
|
|
else |
| 2121 |
|
|
{ |
| 2122 |
|
|
ilog(L_ERROR, "Spoofs must be less than %d..ignoring it", HOSTLEN); |
| 2123 |
|
|
yy_conf->name = NULL; |
| 2124 |
|
|
} |
| 2125 |
|
|
} |
| 2126 |
|
|
}; |
| 2127 |
|
|
|
| 2128 |
|
|
auth_redir_serv: REDIRSERV '=' QSTRING ';' |
| 2129 |
|
|
{ |
| 2130 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2131 |
adx |
30 |
{ |
| 2132 |
|
|
yy_aconf->flags |= CONF_FLAGS_REDIR; |
| 2133 |
|
|
MyFree(yy_conf->name); |
| 2134 |
|
|
DupString(yy_conf->name, yylval.string); |
| 2135 |
|
|
} |
| 2136 |
|
|
}; |
| 2137 |
|
|
|
| 2138 |
|
|
auth_redir_port: REDIRPORT '=' NUMBER ';' |
| 2139 |
|
|
{ |
| 2140 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2141 |
adx |
30 |
{ |
| 2142 |
|
|
yy_aconf->flags |= CONF_FLAGS_REDIR; |
| 2143 |
|
|
yy_aconf->port = $3; |
| 2144 |
|
|
} |
| 2145 |
|
|
}; |
| 2146 |
|
|
|
| 2147 |
|
|
auth_need_password: NEED_PASSWORD '=' TBOOL ';' |
| 2148 |
|
|
{ |
| 2149 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2150 |
adx |
30 |
{ |
| 2151 |
|
|
if (yylval.number) |
| 2152 |
|
|
yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD; |
| 2153 |
|
|
else |
| 2154 |
|
|
yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD; |
| 2155 |
|
|
} |
| 2156 |
|
|
}; |
| 2157 |
|
|
|
| 2158 |
|
|
|
| 2159 |
|
|
/*************************************************************************** |
| 2160 |
|
|
* section resv |
| 2161 |
|
|
***************************************************************************/ |
| 2162 |
|
|
resv_entry: RESV |
| 2163 |
|
|
{ |
| 2164 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2165 |
adx |
30 |
{ |
| 2166 |
|
|
MyFree(resv_reason); |
| 2167 |
|
|
resv_reason = NULL; |
| 2168 |
|
|
} |
| 2169 |
|
|
} '{' resv_items '}' ';' |
| 2170 |
|
|
{ |
| 2171 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2172 |
adx |
30 |
{ |
| 2173 |
|
|
MyFree(resv_reason); |
| 2174 |
|
|
resv_reason = NULL; |
| 2175 |
|
|
} |
| 2176 |
|
|
}; |
| 2177 |
|
|
|
| 2178 |
|
|
resv_items: resv_items resv_item | resv_item; |
| 2179 |
|
|
resv_item: resv_creason | resv_channel | resv_nick | error ';' ; |
| 2180 |
|
|
|
| 2181 |
|
|
resv_creason: REASON '=' QSTRING ';' |
| 2182 |
|
|
{ |
| 2183 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2184 |
adx |
30 |
{ |
| 2185 |
|
|
MyFree(resv_reason); |
| 2186 |
|
|
DupString(resv_reason, yylval.string); |
| 2187 |
|
|
} |
| 2188 |
|
|
}; |
| 2189 |
|
|
|
| 2190 |
|
|
resv_channel: CHANNEL '=' QSTRING ';' |
| 2191 |
|
|
{ |
| 2192 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2193 |
adx |
30 |
{ |
| 2194 |
|
|
if (IsChanPrefix(*yylval.string)) |
| 2195 |
|
|
{ |
| 2196 |
|
|
char def_reason[] = "No reason"; |
| 2197 |
|
|
|
| 2198 |
|
|
create_channel_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1); |
| 2199 |
|
|
} |
| 2200 |
|
|
} |
| 2201 |
|
|
/* ignore it for now.. but we really should make a warning if |
| 2202 |
|
|
* its an erroneous name --fl_ */ |
| 2203 |
|
|
}; |
| 2204 |
|
|
|
| 2205 |
|
|
resv_nick: NICK '=' QSTRING ';' |
| 2206 |
|
|
{ |
| 2207 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2208 |
adx |
30 |
{ |
| 2209 |
|
|
char def_reason[] = "No reason"; |
| 2210 |
|
|
|
| 2211 |
|
|
create_nick_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1); |
| 2212 |
|
|
} |
| 2213 |
|
|
}; |
| 2214 |
|
|
|
| 2215 |
|
|
/*************************************************************************** |
| 2216 |
|
|
* section shared, for sharing remote klines etc. |
| 2217 |
|
|
***************************************************************************/ |
| 2218 |
|
|
shared_entry: T_SHARED |
| 2219 |
|
|
{ |
| 2220 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2221 |
adx |
30 |
{ |
| 2222 |
|
|
yy_conf = make_conf_item(ULINE_TYPE); |
| 2223 |
|
|
yy_match_item = map_to_conf(yy_conf); |
| 2224 |
|
|
yy_match_item->action = SHARED_ALL; |
| 2225 |
|
|
} |
| 2226 |
|
|
} '{' shared_items '}' ';' |
| 2227 |
|
|
{ |
| 2228 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2229 |
adx |
30 |
{ |
| 2230 |
|
|
yy_conf = NULL; |
| 2231 |
|
|
} |
| 2232 |
|
|
}; |
| 2233 |
|
|
|
| 2234 |
|
|
shared_items: shared_items shared_item | shared_item; |
| 2235 |
|
|
shared_item: shared_name | shared_user | shared_type | error ';' ; |
| 2236 |
|
|
|
| 2237 |
|
|
shared_name: NAME '=' QSTRING ';' |
| 2238 |
|
|
{ |
| 2239 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2240 |
adx |
30 |
{ |
| 2241 |
|
|
MyFree(yy_conf->name); |
| 2242 |
|
|
DupString(yy_conf->name, yylval.string); |
| 2243 |
|
|
} |
| 2244 |
|
|
}; |
| 2245 |
|
|
|
| 2246 |
|
|
shared_user: USER '=' QSTRING ';' |
| 2247 |
|
|
{ |
| 2248 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2249 |
adx |
30 |
{ |
| 2250 |
michael |
593 |
struct split_nuh_item nuh; |
| 2251 |
|
|
|
| 2252 |
|
|
nuh.nuhmask = yylval.string; |
| 2253 |
|
|
nuh.nickptr = NULL; |
| 2254 |
|
|
nuh.userptr = userbuf; |
| 2255 |
|
|
nuh.hostptr = hostbuf; |
| 2256 |
|
|
|
| 2257 |
|
|
nuh.nicksize = 0; |
| 2258 |
|
|
nuh.usersize = sizeof(userbuf); |
| 2259 |
|
|
nuh.hostsize = sizeof(hostbuf); |
| 2260 |
|
|
|
| 2261 |
|
|
split_nuh(&nuh); |
| 2262 |
|
|
|
| 2263 |
|
|
DupString(yy_match_item->user, userbuf); |
| 2264 |
|
|
DupString(yy_match_item->host, hostbuf); |
| 2265 |
adx |
30 |
} |
| 2266 |
|
|
}; |
| 2267 |
|
|
|
| 2268 |
|
|
shared_type: TYPE |
| 2269 |
|
|
{ |
| 2270 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2271 |
adx |
30 |
yy_match_item->action = 0; |
| 2272 |
|
|
} '=' shared_types ';' ; |
| 2273 |
|
|
|
| 2274 |
|
|
shared_types: shared_types ',' shared_type_item | shared_type_item; |
| 2275 |
|
|
shared_type_item: KLINE |
| 2276 |
|
|
{ |
| 2277 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2278 |
adx |
30 |
yy_match_item->action |= SHARED_KLINE; |
| 2279 |
|
|
} | TKLINE |
| 2280 |
|
|
{ |
| 2281 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2282 |
adx |
30 |
yy_match_item->action |= SHARED_TKLINE; |
| 2283 |
|
|
} | UNKLINE |
| 2284 |
|
|
{ |
| 2285 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2286 |
adx |
30 |
yy_match_item->action |= SHARED_UNKLINE; |
| 2287 |
|
|
} | XLINE |
| 2288 |
|
|
{ |
| 2289 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2290 |
adx |
30 |
yy_match_item->action |= SHARED_XLINE; |
| 2291 |
|
|
} | TXLINE |
| 2292 |
|
|
{ |
| 2293 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2294 |
adx |
30 |
yy_match_item->action |= SHARED_TXLINE; |
| 2295 |
|
|
} | T_UNXLINE |
| 2296 |
|
|
{ |
| 2297 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2298 |
adx |
30 |
yy_match_item->action |= SHARED_UNXLINE; |
| 2299 |
|
|
} | RESV |
| 2300 |
|
|
{ |
| 2301 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2302 |
adx |
30 |
yy_match_item->action |= SHARED_RESV; |
| 2303 |
|
|
} | TRESV |
| 2304 |
|
|
{ |
| 2305 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2306 |
adx |
30 |
yy_match_item->action |= SHARED_TRESV; |
| 2307 |
|
|
} | T_UNRESV |
| 2308 |
|
|
{ |
| 2309 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2310 |
adx |
30 |
yy_match_item->action |= SHARED_UNRESV; |
| 2311 |
|
|
} | T_LOCOPS |
| 2312 |
|
|
{ |
| 2313 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2314 |
adx |
30 |
yy_match_item->action |= SHARED_LOCOPS; |
| 2315 |
|
|
} | T_ALL |
| 2316 |
|
|
{ |
| 2317 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2318 |
adx |
30 |
yy_match_item->action = SHARED_ALL; |
| 2319 |
|
|
}; |
| 2320 |
|
|
|
| 2321 |
|
|
/*************************************************************************** |
| 2322 |
|
|
* section cluster |
| 2323 |
|
|
***************************************************************************/ |
| 2324 |
|
|
cluster_entry: T_CLUSTER |
| 2325 |
|
|
{ |
| 2326 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2327 |
adx |
30 |
{ |
| 2328 |
|
|
yy_conf = make_conf_item(CLUSTER_TYPE); |
| 2329 |
|
|
yy_conf->flags = SHARED_ALL; |
| 2330 |
|
|
} |
| 2331 |
|
|
} '{' cluster_items '}' ';' |
| 2332 |
|
|
{ |
| 2333 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2334 |
adx |
30 |
{ |
| 2335 |
|
|
if (yy_conf->name == NULL) |
| 2336 |
|
|
DupString(yy_conf->name, "*"); |
| 2337 |
|
|
yy_conf = NULL; |
| 2338 |
|
|
} |
| 2339 |
|
|
}; |
| 2340 |
|
|
|
| 2341 |
|
|
cluster_items: cluster_items cluster_item | cluster_item; |
| 2342 |
|
|
cluster_item: cluster_name | cluster_type | error ';' ; |
| 2343 |
|
|
|
| 2344 |
|
|
cluster_name: NAME '=' QSTRING ';' |
| 2345 |
|
|
{ |
| 2346 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2347 |
adx |
30 |
DupString(yy_conf->name, yylval.string); |
| 2348 |
|
|
}; |
| 2349 |
|
|
|
| 2350 |
|
|
cluster_type: TYPE |
| 2351 |
|
|
{ |
| 2352 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2353 |
adx |
30 |
yy_conf->flags = 0; |
| 2354 |
|
|
} '=' cluster_types ';' ; |
| 2355 |
|
|
|
| 2356 |
|
|
cluster_types: cluster_types ',' cluster_type_item | cluster_type_item; |
| 2357 |
|
|
cluster_type_item: KLINE |
| 2358 |
|
|
{ |
| 2359 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2360 |
adx |
30 |
yy_conf->flags |= SHARED_KLINE; |
| 2361 |
|
|
} | TKLINE |
| 2362 |
|
|
{ |
| 2363 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2364 |
adx |
30 |
yy_conf->flags |= SHARED_TKLINE; |
| 2365 |
|
|
} | UNKLINE |
| 2366 |
|
|
{ |
| 2367 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2368 |
adx |
30 |
yy_conf->flags |= SHARED_UNKLINE; |
| 2369 |
|
|
} | XLINE |
| 2370 |
|
|
{ |
| 2371 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2372 |
adx |
30 |
yy_conf->flags |= SHARED_XLINE; |
| 2373 |
|
|
} | TXLINE |
| 2374 |
|
|
{ |
| 2375 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2376 |
adx |
30 |
yy_conf->flags |= SHARED_TXLINE; |
| 2377 |
|
|
} | T_UNXLINE |
| 2378 |
|
|
{ |
| 2379 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2380 |
adx |
30 |
yy_conf->flags |= SHARED_UNXLINE; |
| 2381 |
|
|
} | RESV |
| 2382 |
|
|
{ |
| 2383 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2384 |
adx |
30 |
yy_conf->flags |= SHARED_RESV; |
| 2385 |
|
|
} | TRESV |
| 2386 |
|
|
{ |
| 2387 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2388 |
adx |
30 |
yy_conf->flags |= SHARED_TRESV; |
| 2389 |
|
|
} | T_UNRESV |
| 2390 |
|
|
{ |
| 2391 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2392 |
adx |
30 |
yy_conf->flags |= SHARED_UNRESV; |
| 2393 |
|
|
} | T_LOCOPS |
| 2394 |
|
|
{ |
| 2395 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2396 |
adx |
30 |
yy_conf->flags |= SHARED_LOCOPS; |
| 2397 |
|
|
} | T_ALL |
| 2398 |
|
|
{ |
| 2399 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2400 |
adx |
30 |
yy_conf->flags = SHARED_ALL; |
| 2401 |
|
|
}; |
| 2402 |
|
|
|
| 2403 |
|
|
/*************************************************************************** |
| 2404 |
|
|
* section connect |
| 2405 |
|
|
***************************************************************************/ |
| 2406 |
|
|
connect_entry: CONNECT |
| 2407 |
|
|
{ |
| 2408 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2409 |
adx |
30 |
{ |
| 2410 |
|
|
yy_conf = make_conf_item(SERVER_TYPE); |
| 2411 |
|
|
yy_aconf = (struct AccessItem *)map_to_conf(yy_conf); |
| 2412 |
|
|
yy_aconf->passwd = NULL; |
| 2413 |
|
|
/* defaults */ |
| 2414 |
|
|
yy_aconf->port = PORTNUM; |
| 2415 |
|
|
|
| 2416 |
|
|
if (ConfigFileEntry.burst_away) |
| 2417 |
|
|
yy_aconf->flags = CONF_FLAGS_BURST_AWAY; |
| 2418 |
|
|
} |
| 2419 |
|
|
else |
| 2420 |
|
|
{ |
| 2421 |
|
|
MyFree(class_name); |
| 2422 |
|
|
class_name = NULL; |
| 2423 |
|
|
} |
| 2424 |
|
|
} connect_name_b '{' connect_items '}' ';' |
| 2425 |
|
|
{ |
| 2426 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2427 |
adx |
30 |
{ |
| 2428 |
|
|
struct CollectItem *yy_hconf=NULL; |
| 2429 |
|
|
struct CollectItem *yy_lconf=NULL; |
| 2430 |
|
|
dlink_node *ptr; |
| 2431 |
|
|
dlink_node *next_ptr; |
| 2432 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 2433 |
|
|
if (yy_aconf->host && |
| 2434 |
|
|
((yy_aconf->passwd && yy_aconf->spasswd) || |
| 2435 |
|
|
(yy_aconf->rsa_public_key && IsConfCryptLink(yy_aconf)))) |
| 2436 |
|
|
#else /* !HAVE_LIBCRYPTO */ |
| 2437 |
|
|
if (yy_aconf->host && !IsConfCryptLink(yy_aconf) && |
| 2438 |
|
|
yy_aconf->passwd && yy_aconf->spasswd) |
| 2439 |
|
|
#endif /* !HAVE_LIBCRYPTO */ |
| 2440 |
|
|
{ |
| 2441 |
michael |
593 |
if (conf_add_server(yy_conf, class_name) == -1) |
| 2442 |
adx |
30 |
{ |
| 2443 |
|
|
delete_conf_item(yy_conf); |
| 2444 |
|
|
yy_conf = NULL; |
| 2445 |
|
|
yy_aconf = NULL; |
| 2446 |
|
|
} |
| 2447 |
|
|
} |
| 2448 |
|
|
else |
| 2449 |
|
|
{ |
| 2450 |
|
|
/* Even if yy_conf ->name is NULL |
| 2451 |
|
|
* should still unhook any hub/leaf confs still pending |
| 2452 |
|
|
*/ |
| 2453 |
|
|
unhook_hub_leaf_confs(); |
| 2454 |
|
|
|
| 2455 |
|
|
if (yy_conf->name != NULL) |
| 2456 |
|
|
{ |
| 2457 |
|
|
#ifndef HAVE_LIBCRYPTO |
| 2458 |
|
|
if (IsConfCryptLink(yy_aconf)) |
| 2459 |
|
|
yyerror("Ignoring connect block -- no OpenSSL support"); |
| 2460 |
|
|
#else |
| 2461 |
|
|
if (IsConfCryptLink(yy_aconf) && !yy_aconf->rsa_public_key) |
| 2462 |
|
|
yyerror("Ignoring connect block -- missing key"); |
| 2463 |
|
|
#endif |
| 2464 |
|
|
if (yy_aconf->host == NULL) |
| 2465 |
|
|
yyerror("Ignoring connect block -- missing host"); |
| 2466 |
|
|
else if (!IsConfCryptLink(yy_aconf) && |
| 2467 |
|
|
(!yy_aconf->passwd || !yy_aconf->spasswd)) |
| 2468 |
|
|
yyerror("Ignoring connect block -- missing password"); |
| 2469 |
|
|
} |
| 2470 |
|
|
|
| 2471 |
|
|
|
| 2472 |
|
|
/* XXX |
| 2473 |
|
|
* This fixes a try_connections() core (caused by invalid class_ptr |
| 2474 |
|
|
* pointers) reported by metalrock. That's an ugly fix, but there |
| 2475 |
|
|
* is currently no better way. The entire config subsystem needs an |
| 2476 |
|
|
* rewrite ASAP. make_conf_item() shouldn't really add things onto |
| 2477 |
|
|
* a doubly linked list immediately without any sanity checks! -Michael |
| 2478 |
|
|
*/ |
| 2479 |
|
|
delete_conf_item(yy_conf); |
| 2480 |
|
|
|
| 2481 |
|
|
yy_aconf = NULL; |
| 2482 |
|
|
yy_conf = NULL; |
| 2483 |
|
|
} |
| 2484 |
|
|
|
| 2485 |
|
|
/* |
| 2486 |
|
|
* yy_conf is still pointing at the server that is having |
| 2487 |
|
|
* a connect block built for it. This means, y_aconf->name |
| 2488 |
|
|
* points to the actual irc name this server will be known as. |
| 2489 |
|
|
* Now this new server has a set or even just one hub_mask (or leaf_mask) |
| 2490 |
|
|
* given in the link list at yy_hconf. Fill in the HUB confs |
| 2491 |
|
|
* from this link list now. |
| 2492 |
|
|
*/ |
| 2493 |
|
|
DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head) |
| 2494 |
|
|
{ |
| 2495 |
|
|
struct ConfItem *new_hub_conf; |
| 2496 |
|
|
struct MatchItem *match_item; |
| 2497 |
|
|
|
| 2498 |
|
|
yy_hconf = ptr->data; |
| 2499 |
|
|
|
| 2500 |
|
|
/* yy_conf == NULL is a fatal error for this connect block! */ |
| 2501 |
|
|
if ((yy_conf != NULL) && (yy_conf->name != NULL)) |
| 2502 |
|
|
{ |
| 2503 |
|
|
new_hub_conf = make_conf_item(HUB_TYPE); |
| 2504 |
|
|
match_item = (struct MatchItem *)map_to_conf(new_hub_conf); |
| 2505 |
|
|
DupString(new_hub_conf->name, yy_conf->name); |
| 2506 |
|
|
if (yy_hconf->user != NULL) |
| 2507 |
|
|
DupString(match_item->user, yy_hconf->user); |
| 2508 |
|
|
else |
| 2509 |
|
|
DupString(match_item->user, "*"); |
| 2510 |
|
|
if (yy_hconf->host != NULL) |
| 2511 |
|
|
DupString(match_item->host, yy_hconf->host); |
| 2512 |
|
|
else |
| 2513 |
|
|
DupString(match_item->host, "*"); |
| 2514 |
|
|
} |
| 2515 |
|
|
dlinkDelete(&yy_hconf->node, &hub_conf_list); |
| 2516 |
|
|
free_collect_item(yy_hconf); |
| 2517 |
|
|
} |
| 2518 |
|
|
|
| 2519 |
|
|
/* Ditto for the LEAF confs */ |
| 2520 |
|
|
|
| 2521 |
|
|
DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head) |
| 2522 |
|
|
{ |
| 2523 |
|
|
struct ConfItem *new_leaf_conf; |
| 2524 |
|
|
struct MatchItem *match_item; |
| 2525 |
|
|
|
| 2526 |
|
|
yy_lconf = ptr->data; |
| 2527 |
|
|
|
| 2528 |
|
|
if ((yy_conf != NULL) && (yy_conf->name != NULL)) |
| 2529 |
|
|
{ |
| 2530 |
|
|
new_leaf_conf = make_conf_item(LEAF_TYPE); |
| 2531 |
|
|
match_item = (struct MatchItem *)map_to_conf(new_leaf_conf); |
| 2532 |
|
|
DupString(new_leaf_conf->name, yy_conf->name); |
| 2533 |
|
|
if (yy_lconf->user != NULL) |
| 2534 |
|
|
DupString(match_item->user, yy_lconf->user); |
| 2535 |
|
|
else |
| 2536 |
|
|
DupString(match_item->user, "*"); |
| 2537 |
|
|
if (yy_lconf->host != NULL) |
| 2538 |
|
|
DupString(match_item->host, yy_lconf->host); |
| 2539 |
|
|
else |
| 2540 |
|
|
DupString(match_item->host, "*"); |
| 2541 |
|
|
} |
| 2542 |
|
|
dlinkDelete(&yy_lconf->node, &leaf_conf_list); |
| 2543 |
|
|
free_collect_item(yy_lconf); |
| 2544 |
|
|
} |
| 2545 |
|
|
MyFree(class_name); |
| 2546 |
|
|
class_name = NULL; |
| 2547 |
|
|
yy_conf = NULL; |
| 2548 |
|
|
yy_aconf = NULL; |
| 2549 |
|
|
} |
| 2550 |
|
|
}; |
| 2551 |
|
|
|
| 2552 |
|
|
connect_name_b: | connect_name_t; |
| 2553 |
|
|
connect_items: connect_items connect_item | connect_item; |
| 2554 |
|
|
connect_item: connect_name | connect_host | connect_vhost | |
| 2555 |
|
|
connect_send_password | connect_accept_password | |
| 2556 |
|
|
connect_aftype | connect_port | |
| 2557 |
|
|
connect_fakename | connect_flags | connect_hub_mask | |
| 2558 |
|
|
connect_leaf_mask | connect_class | connect_auto | |
| 2559 |
|
|
connect_encrypted | connect_compressed | connect_cryptlink | |
| 2560 |
|
|
connect_rsa_public_key_file | connect_cipher_preference | |
| 2561 |
michael |
341 |
connect_topicburst | error ';' ; |
| 2562 |
adx |
30 |
|
| 2563 |
|
|
connect_name: NAME '=' QSTRING ';' |
| 2564 |
|
|
{ |
| 2565 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2566 |
adx |
30 |
{ |
| 2567 |
|
|
if (yy_conf->name != NULL) |
| 2568 |
|
|
yyerror("Multiple connect name entry"); |
| 2569 |
|
|
|
| 2570 |
|
|
MyFree(yy_conf->name); |
| 2571 |
|
|
DupString(yy_conf->name, yylval.string); |
| 2572 |
|
|
} |
| 2573 |
|
|
}; |
| 2574 |
|
|
|
| 2575 |
|
|
connect_name_t: QSTRING |
| 2576 |
|
|
{ |
| 2577 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2578 |
adx |
30 |
{ |
| 2579 |
|
|
if (yy_conf->name != NULL) |
| 2580 |
|
|
yyerror("Multiple connect name entry"); |
| 2581 |
|
|
|
| 2582 |
|
|
MyFree(yy_conf->name); |
| 2583 |
|
|
DupString(yy_conf->name, yylval.string); |
| 2584 |
|
|
} |
| 2585 |
|
|
}; |
| 2586 |
|
|
|
| 2587 |
|
|
connect_host: HOST '=' QSTRING ';' |
| 2588 |
|
|
{ |
| 2589 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2590 |
adx |
30 |
{ |
| 2591 |
|
|
MyFree(yy_aconf->host); |
| 2592 |
|
|
DupString(yy_aconf->host, yylval.string); |
| 2593 |
|
|
} |
| 2594 |
|
|
}; |
| 2595 |
|
|
|
| 2596 |
|
|
connect_vhost: VHOST '=' QSTRING ';' |
| 2597 |
|
|
{ |
| 2598 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2599 |
adx |
30 |
{ |
| 2600 |
|
|
struct addrinfo hints, *res; |
| 2601 |
|
|
|
| 2602 |
|
|
memset(&hints, 0, sizeof(hints)); |
| 2603 |
|
|
|
| 2604 |
|
|
hints.ai_family = AF_UNSPEC; |
| 2605 |
|
|
hints.ai_socktype = SOCK_STREAM; |
| 2606 |
|
|
hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; |
| 2607 |
|
|
|
| 2608 |
|
|
if (irc_getaddrinfo(yylval.string, NULL, &hints, &res)) |
| 2609 |
|
|
ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string); |
| 2610 |
|
|
else |
| 2611 |
|
|
{ |
| 2612 |
|
|
assert(res != NULL); |
| 2613 |
|
|
|
| 2614 |
|
|
memcpy(&yy_aconf->my_ipnum, res->ai_addr, res->ai_addrlen); |
| 2615 |
|
|
yy_aconf->my_ipnum.ss.ss_family = res->ai_family; |
| 2616 |
|
|
yy_aconf->my_ipnum.ss_len = res->ai_addrlen; |
| 2617 |
|
|
irc_freeaddrinfo(res); |
| 2618 |
|
|
} |
| 2619 |
|
|
} |
| 2620 |
|
|
}; |
| 2621 |
|
|
|
| 2622 |
|
|
connect_send_password: SEND_PASSWORD '=' QSTRING ';' |
| 2623 |
|
|
{ |
| 2624 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2625 |
adx |
30 |
{ |
| 2626 |
adx |
38 |
if ($3[0] == ':') |
| 2627 |
|
|
yyerror("Server passwords cannot begin with a colon"); |
| 2628 |
|
|
else if (strchr($3, ' ') != NULL) |
| 2629 |
|
|
yyerror("Server passwords cannot contain spaces"); |
| 2630 |
|
|
else { |
| 2631 |
|
|
if (yy_aconf->spasswd != NULL) |
| 2632 |
|
|
memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd)); |
| 2633 |
adx |
30 |
|
| 2634 |
adx |
38 |
MyFree(yy_aconf->spasswd); |
| 2635 |
|
|
DupString(yy_aconf->spasswd, yylval.string); |
| 2636 |
|
|
} |
| 2637 |
adx |
30 |
} |
| 2638 |
|
|
}; |
| 2639 |
|
|
|
| 2640 |
|
|
connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';' |
| 2641 |
|
|
{ |
| 2642 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2643 |
adx |
30 |
{ |
| 2644 |
adx |
38 |
if ($3[0] == ':') |
| 2645 |
|
|
yyerror("Server passwords cannot begin with a colon"); |
| 2646 |
|
|
else if (strchr($3, ' ') != NULL) |
| 2647 |
|
|
yyerror("Server passwords cannot contain spaces"); |
| 2648 |
|
|
else { |
| 2649 |
|
|
if (yy_aconf->passwd != NULL) |
| 2650 |
|
|
memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); |
| 2651 |
adx |
30 |
|
| 2652 |
adx |
38 |
MyFree(yy_aconf->passwd); |
| 2653 |
|
|
DupString(yy_aconf->passwd, yylval.string); |
| 2654 |
|
|
} |
| 2655 |
adx |
30 |
} |
| 2656 |
|
|
}; |
| 2657 |
|
|
|
| 2658 |
|
|
connect_port: PORT '=' NUMBER ';' |
| 2659 |
|
|
{ |
| 2660 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2661 |
adx |
30 |
yy_aconf->port = $3; |
| 2662 |
|
|
}; |
| 2663 |
|
|
|
| 2664 |
|
|
connect_aftype: AFTYPE '=' T_IPV4 ';' |
| 2665 |
|
|
{ |
| 2666 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2667 |
adx |
30 |
yy_aconf->aftype = AF_INET; |
| 2668 |
|
|
} | AFTYPE '=' T_IPV6 ';' |
| 2669 |
|
|
{ |
| 2670 |
|
|
#ifdef IPV6 |
| 2671 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2672 |
adx |
30 |
yy_aconf->aftype = AF_INET6; |
| 2673 |
|
|
#endif |
| 2674 |
|
|
}; |
| 2675 |
|
|
|
| 2676 |
|
|
connect_fakename: FAKENAME '=' QSTRING ';' |
| 2677 |
|
|
{ |
| 2678 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2679 |
adx |
30 |
{ |
| 2680 |
|
|
MyFree(yy_aconf->fakename); |
| 2681 |
|
|
DupString(yy_aconf->fakename, yylval.string); |
| 2682 |
|
|
} |
| 2683 |
|
|
}; |
| 2684 |
|
|
|
| 2685 |
|
|
connect_flags: IRCD_FLAGS |
| 2686 |
|
|
{ |
| 2687 |
|
|
} '=' connect_flags_items ';'; |
| 2688 |
|
|
|
| 2689 |
|
|
connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item; |
| 2690 |
db |
136 |
connect_flags_item: NOT { not_atom = 1; } connect_flags_item_atom |
| 2691 |
|
|
| { not_atom = 0; } connect_flags_item_atom; |
| 2692 |
adx |
30 |
|
| 2693 |
michael |
885 |
connect_flags_item_atom: COMPRESSED |
| 2694 |
adx |
30 |
{ |
| 2695 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2696 |
adx |
30 |
#ifndef HAVE_LIBZ |
| 2697 |
|
|
yyerror("Ignoring flags = compressed; -- no zlib support"); |
| 2698 |
|
|
#else |
| 2699 |
|
|
{ |
| 2700 |
|
|
if (not_atom)ClearConfCompressed(yy_aconf); |
| 2701 |
|
|
else SetConfCompressed(yy_aconf); |
| 2702 |
|
|
} |
| 2703 |
|
|
#endif |
| 2704 |
|
|
} | CRYPTLINK |
| 2705 |
|
|
{ |
| 2706 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2707 |
adx |
30 |
{ |
| 2708 |
|
|
if (not_atom)ClearConfCryptLink(yy_aconf); |
| 2709 |
|
|
else SetConfCryptLink(yy_aconf); |
| 2710 |
|
|
} |
| 2711 |
|
|
} | AUTOCONN |
| 2712 |
|
|
{ |
| 2713 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2714 |
adx |
30 |
{ |
| 2715 |
|
|
if (not_atom)ClearConfAllowAutoConn(yy_aconf); |
| 2716 |
|
|
else SetConfAllowAutoConn(yy_aconf); |
| 2717 |
|
|
} |
| 2718 |
|
|
} | BURST_AWAY |
| 2719 |
|
|
{ |
| 2720 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2721 |
adx |
30 |
{ |
| 2722 |
|
|
if (not_atom)ClearConfAwayBurst(yy_aconf); |
| 2723 |
|
|
else SetConfAwayBurst(yy_aconf); |
| 2724 |
|
|
} |
| 2725 |
|
|
} | TOPICBURST |
| 2726 |
|
|
{ |
| 2727 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2728 |
adx |
30 |
{ |
| 2729 |
|
|
if (not_atom)ClearConfTopicBurst(yy_aconf); |
| 2730 |
|
|
else SetConfTopicBurst(yy_aconf); |
| 2731 |
|
|
} |
| 2732 |
|
|
} |
| 2733 |
|
|
; |
| 2734 |
|
|
|
| 2735 |
|
|
connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';' |
| 2736 |
|
|
{ |
| 2737 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 2738 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2739 |
adx |
30 |
{ |
| 2740 |
|
|
BIO *file; |
| 2741 |
|
|
|
| 2742 |
|
|
if (yy_aconf->rsa_public_key != NULL) |
| 2743 |
|
|
{ |
| 2744 |
|
|
RSA_free(yy_aconf->rsa_public_key); |
| 2745 |
|
|
yy_aconf->rsa_public_key = NULL; |
| 2746 |
|
|
} |
| 2747 |
|
|
|
| 2748 |
|
|
if (yy_aconf->rsa_public_key_file != NULL) |
| 2749 |
|
|
{ |
| 2750 |
|
|
MyFree(yy_aconf->rsa_public_key_file); |
| 2751 |
|
|
yy_aconf->rsa_public_key_file = NULL; |
| 2752 |
|
|
} |
| 2753 |
|
|
|
| 2754 |
|
|
DupString(yy_aconf->rsa_public_key_file, yylval.string); |
| 2755 |
|
|
|
| 2756 |
|
|
if ((file = BIO_new_file(yylval.string, "r")) == NULL) |
| 2757 |
|
|
{ |
| 2758 |
|
|
yyerror("Ignoring rsa_public_key_file -- file doesn't exist"); |
| 2759 |
|
|
break; |
| 2760 |
|
|
} |
| 2761 |
|
|
|
| 2762 |
|
|
yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL); |
| 2763 |
|
|
|
| 2764 |
|
|
if (yy_aconf->rsa_public_key == NULL) |
| 2765 |
|
|
{ |
| 2766 |
|
|
yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax."); |
| 2767 |
|
|
break; |
| 2768 |
|
|
} |
| 2769 |
|
|
|
| 2770 |
|
|
BIO_set_close(file, BIO_CLOSE); |
| 2771 |
|
|
BIO_free(file); |
| 2772 |
|
|
} |
| 2773 |
|
|
#endif /* HAVE_LIBCRYPTO */ |
| 2774 |
|
|
}; |
| 2775 |
|
|
|
| 2776 |
|
|
connect_encrypted: ENCRYPTED '=' TBOOL ';' |
| 2777 |
|
|
{ |
| 2778 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2779 |
adx |
30 |
{ |
| 2780 |
|
|
if (yylval.number) |
| 2781 |
|
|
yy_aconf->flags |= CONF_FLAGS_ENCRYPTED; |
| 2782 |
|
|
else |
| 2783 |
|
|
yy_aconf->flags &= ~CONF_FLAGS_ENCRYPTED; |
| 2784 |
|
|
} |
| 2785 |
|
|
}; |
| 2786 |
|
|
|
| 2787 |
|
|
connect_cryptlink: CRYPTLINK '=' TBOOL ';' |
| 2788 |
|
|
{ |
| 2789 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2790 |
adx |
30 |
{ |
| 2791 |
|
|
if (yylval.number) |
| 2792 |
|
|
yy_aconf->flags |= CONF_FLAGS_CRYPTLINK; |
| 2793 |
|
|
else |
| 2794 |
|
|
yy_aconf->flags &= ~CONF_FLAGS_CRYPTLINK; |
| 2795 |
|
|
} |
| 2796 |
|
|
}; |
| 2797 |
|
|
|
| 2798 |
|
|
connect_compressed: COMPRESSED '=' TBOOL ';' |
| 2799 |
|
|
{ |
| 2800 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2801 |
adx |
30 |
{ |
| 2802 |
|
|
if (yylval.number) |
| 2803 |
|
|
#ifndef HAVE_LIBZ |
| 2804 |
|
|
yyerror("Ignoring compressed=yes; -- no zlib support"); |
| 2805 |
|
|
#else |
| 2806 |
|
|
yy_aconf->flags |= CONF_FLAGS_COMPRESSED; |
| 2807 |
|
|
#endif |
| 2808 |
|
|
else |
| 2809 |
|
|
yy_aconf->flags &= ~CONF_FLAGS_COMPRESSED; |
| 2810 |
|
|
} |
| 2811 |
|
|
}; |
| 2812 |
|
|
|
| 2813 |
|
|
connect_auto: AUTOCONN '=' TBOOL ';' |
| 2814 |
|
|
{ |
| 2815 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2816 |
adx |
30 |
{ |
| 2817 |
|
|
if (yylval.number) |
| 2818 |
|
|
yy_aconf->flags |= CONF_FLAGS_ALLOW_AUTO_CONN; |
| 2819 |
|
|
else |
| 2820 |
|
|
yy_aconf->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN; |
| 2821 |
|
|
} |
| 2822 |
|
|
}; |
| 2823 |
|
|
|
| 2824 |
michael |
341 |
connect_topicburst: TOPICBURST '=' TBOOL ';' |
| 2825 |
|
|
{ |
| 2826 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2827 |
michael |
341 |
{ |
| 2828 |
|
|
if (yylval.number) |
| 2829 |
michael |
342 |
SetConfTopicBurst(yy_aconf); |
| 2830 |
michael |
341 |
else |
| 2831 |
|
|
ClearConfTopicBurst(yy_aconf); |
| 2832 |
|
|
} |
| 2833 |
|
|
}; |
| 2834 |
|
|
|
| 2835 |
adx |
30 |
connect_hub_mask: HUB_MASK '=' QSTRING ';' |
| 2836 |
|
|
{ |
| 2837 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2838 |
adx |
30 |
{ |
| 2839 |
|
|
struct CollectItem *yy_tmp; |
| 2840 |
|
|
|
| 2841 |
|
|
yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem)); |
| 2842 |
|
|
DupString(yy_tmp->host, yylval.string); |
| 2843 |
|
|
DupString(yy_tmp->user, "*"); |
| 2844 |
|
|
dlinkAdd(yy_tmp, &yy_tmp->node, &hub_conf_list); |
| 2845 |
|
|
} |
| 2846 |
|
|
}; |
| 2847 |
|
|
|
| 2848 |
|
|
connect_leaf_mask: LEAF_MASK '=' QSTRING ';' |
| 2849 |
|
|
{ |
| 2850 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2851 |
adx |
30 |
{ |
| 2852 |
|
|
struct CollectItem *yy_tmp; |
| 2853 |
|
|
|
| 2854 |
|
|
yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem)); |
| 2855 |
|
|
DupString(yy_tmp->host, yylval.string); |
| 2856 |
|
|
DupString(yy_tmp->user, "*"); |
| 2857 |
|
|
dlinkAdd(yy_tmp, &yy_tmp->node, &leaf_conf_list); |
| 2858 |
|
|
} |
| 2859 |
|
|
}; |
| 2860 |
|
|
|
| 2861 |
|
|
connect_class: CLASS '=' QSTRING ';' |
| 2862 |
|
|
{ |
| 2863 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2864 |
adx |
30 |
{ |
| 2865 |
|
|
MyFree(class_name); |
| 2866 |
|
|
DupString(class_name, yylval.string); |
| 2867 |
|
|
} |
| 2868 |
|
|
}; |
| 2869 |
|
|
|
| 2870 |
|
|
connect_cipher_preference: CIPHER_PREFERENCE '=' QSTRING ';' |
| 2871 |
|
|
{ |
| 2872 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 2873 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2874 |
adx |
30 |
{ |
| 2875 |
|
|
struct EncCapability *ecap; |
| 2876 |
|
|
const char *cipher_name; |
| 2877 |
|
|
int found = 0; |
| 2878 |
|
|
|
| 2879 |
|
|
yy_aconf->cipher_preference = NULL; |
| 2880 |
|
|
cipher_name = yylval.string; |
| 2881 |
|
|
|
| 2882 |
|
|
for (ecap = CipherTable; ecap->name; ecap++) |
| 2883 |
|
|
{ |
| 2884 |
|
|
if ((irccmp(ecap->name, cipher_name) == 0) && |
| 2885 |
|
|
(ecap->cap & CAP_ENC_MASK)) |
| 2886 |
|
|
{ |
| 2887 |
|
|
yy_aconf->cipher_preference = ecap; |
| 2888 |
|
|
found = 1; |
| 2889 |
|
|
break; |
| 2890 |
|
|
} |
| 2891 |
|
|
} |
| 2892 |
|
|
|
| 2893 |
|
|
if (!found) |
| 2894 |
|
|
yyerror("Invalid cipher"); |
| 2895 |
|
|
} |
| 2896 |
|
|
#else |
| 2897 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2898 |
adx |
30 |
yyerror("Ignoring cipher_preference -- no OpenSSL support"); |
| 2899 |
|
|
#endif |
| 2900 |
|
|
}; |
| 2901 |
|
|
|
| 2902 |
|
|
/*************************************************************************** |
| 2903 |
|
|
* section kill |
| 2904 |
|
|
***************************************************************************/ |
| 2905 |
|
|
kill_entry: KILL |
| 2906 |
|
|
{ |
| 2907 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2908 |
adx |
30 |
{ |
| 2909 |
|
|
userbuf[0] = hostbuf[0] = reasonbuf[0] = '\0'; |
| 2910 |
|
|
regex_ban = 0; |
| 2911 |
|
|
} |
| 2912 |
|
|
} '{' kill_items '}' ';' |
| 2913 |
|
|
{ |
| 2914 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2915 |
adx |
30 |
{ |
| 2916 |
|
|
if (userbuf[0] && hostbuf[0]) |
| 2917 |
|
|
{ |
| 2918 |
|
|
if (regex_ban) |
| 2919 |
|
|
{ |
| 2920 |
|
|
pcre *exp_user = NULL; |
| 2921 |
|
|
pcre *exp_host = NULL; |
| 2922 |
|
|
const char *errptr = NULL; |
| 2923 |
|
|
|
| 2924 |
|
|
if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) || |
| 2925 |
|
|
!(exp_host = ircd_pcre_compile(hostbuf, &errptr))) |
| 2926 |
|
|
{ |
| 2927 |
michael |
595 |
ilog(L_ERROR, "Failed to add regular expression based K-Line: %s", |
| 2928 |
|
|
errptr); |
| 2929 |
adx |
30 |
break; |
| 2930 |
|
|
} |
| 2931 |
|
|
|
| 2932 |
michael |
1005 |
yy_aconf = map_to_conf(make_conf_item(RKLINE_TYPE)); |
| 2933 |
adx |
30 |
yy_aconf->regexuser = exp_user; |
| 2934 |
|
|
yy_aconf->regexhost = exp_host; |
| 2935 |
|
|
|
| 2936 |
|
|
DupString(yy_aconf->user, userbuf); |
| 2937 |
|
|
DupString(yy_aconf->host, hostbuf); |
| 2938 |
|
|
|
| 2939 |
|
|
if (reasonbuf[0]) |
| 2940 |
|
|
DupString(yy_aconf->reason, reasonbuf); |
| 2941 |
|
|
else |
| 2942 |
|
|
DupString(yy_aconf->reason, "No reason"); |
| 2943 |
|
|
} |
| 2944 |
|
|
else |
| 2945 |
|
|
{ |
| 2946 |
michael |
1005 |
yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE)); |
| 2947 |
adx |
30 |
|
| 2948 |
|
|
DupString(yy_aconf->user, userbuf); |
| 2949 |
|
|
DupString(yy_aconf->host, hostbuf); |
| 2950 |
|
|
|
| 2951 |
|
|
if (reasonbuf[0]) |
| 2952 |
|
|
DupString(yy_aconf->reason, reasonbuf); |
| 2953 |
|
|
else |
| 2954 |
|
|
DupString(yy_aconf->reason, "No reason"); |
| 2955 |
|
|
add_conf_by_address(CONF_KILL, yy_aconf); |
| 2956 |
|
|
} |
| 2957 |
|
|
} |
| 2958 |
|
|
|
| 2959 |
|
|
yy_aconf = NULL; |
| 2960 |
|
|
} |
| 2961 |
|
|
}; |
| 2962 |
|
|
|
| 2963 |
|
|
kill_type: TYPE |
| 2964 |
|
|
{ |
| 2965 |
|
|
} '=' kill_type_items ';'; |
| 2966 |
|
|
|
| 2967 |
|
|
kill_type_items: kill_type_items ',' kill_type_item | kill_type_item; |
| 2968 |
|
|
kill_type_item: REGEX_T |
| 2969 |
|
|
{ |
| 2970 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2971 |
adx |
30 |
regex_ban = 1; |
| 2972 |
|
|
}; |
| 2973 |
|
|
|
| 2974 |
|
|
kill_items: kill_items kill_item | kill_item; |
| 2975 |
|
|
kill_item: kill_user | kill_reason | kill_type | error; |
| 2976 |
|
|
|
| 2977 |
|
|
kill_user: USER '=' QSTRING ';' |
| 2978 |
|
|
{ |
| 2979 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2980 |
adx |
30 |
{ |
| 2981 |
michael |
593 |
struct split_nuh_item nuh; |
| 2982 |
adx |
30 |
|
| 2983 |
michael |
593 |
nuh.nuhmask = yylval.string; |
| 2984 |
|
|
nuh.nickptr = NULL; |
| 2985 |
|
|
nuh.userptr = userbuf; |
| 2986 |
|
|
nuh.hostptr = hostbuf; |
| 2987 |
adx |
30 |
|
| 2988 |
michael |
593 |
nuh.nicksize = 0; |
| 2989 |
|
|
nuh.usersize = sizeof(userbuf); |
| 2990 |
|
|
nuh.hostsize = sizeof(hostbuf); |
| 2991 |
adx |
30 |
|
| 2992 |
michael |
593 |
split_nuh(&nuh); |
| 2993 |
adx |
30 |
} |
| 2994 |
|
|
}; |
| 2995 |
|
|
|
| 2996 |
|
|
kill_reason: REASON '=' QSTRING ';' |
| 2997 |
|
|
{ |
| 2998 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 2999 |
adx |
30 |
strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf)); |
| 3000 |
|
|
}; |
| 3001 |
|
|
|
| 3002 |
|
|
/*************************************************************************** |
| 3003 |
|
|
* section deny |
| 3004 |
|
|
***************************************************************************/ |
| 3005 |
|
|
deny_entry: DENY |
| 3006 |
|
|
{ |
| 3007 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3008 |
michael |
1005 |
hostbuf[0] = reasonbuf[0] = '\0'; |
| 3009 |
adx |
30 |
} '{' deny_items '}' ';' |
| 3010 |
|
|
{ |
| 3011 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3012 |
adx |
30 |
{ |
| 3013 |
michael |
1005 |
if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST) |
| 3014 |
|
|
{ |
| 3015 |
|
|
yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE)); |
| 3016 |
|
|
DupString(yy_aconf->host, hostbuf); |
| 3017 |
|
|
|
| 3018 |
|
|
if (reasonbuf[0]) |
| 3019 |
|
|
DupString(yy_aconf->reason, reasonbuf); |
| 3020 |
|
|
else |
| 3021 |
|
|
DupString(yy_aconf->reason, "No reason"); |
| 3022 |
adx |
30 |
add_conf_by_address(CONF_DLINE, yy_aconf); |
| 3023 |
michael |
1005 |
yy_aconf = NULL; |
| 3024 |
|
|
} |
| 3025 |
adx |
30 |
} |
| 3026 |
|
|
}; |
| 3027 |
|
|
|
| 3028 |
|
|
deny_items: deny_items deny_item | deny_item; |
| 3029 |
|
|
deny_item: deny_ip | deny_reason | error; |
| 3030 |
|
|
|
| 3031 |
|
|
deny_ip: IP '=' QSTRING ';' |
| 3032 |
|
|
{ |
| 3033 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3034 |
michael |
1005 |
strlcpy(hostbuf, yylval.string, sizeof(hostbuf)); |
| 3035 |
adx |
30 |
}; |
| 3036 |
|
|
|
| 3037 |
|
|
deny_reason: REASON '=' QSTRING ';' |
| 3038 |
|
|
{ |
| 3039 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3040 |
michael |
1005 |
strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf)); |
| 3041 |
adx |
30 |
}; |
| 3042 |
|
|
|
| 3043 |
|
|
/*************************************************************************** |
| 3044 |
|
|
* section exempt |
| 3045 |
|
|
***************************************************************************/ |
| 3046 |
|
|
exempt_entry: EXEMPT '{' exempt_items '}' ';'; |
| 3047 |
|
|
|
| 3048 |
|
|
exempt_items: exempt_items exempt_item | exempt_item; |
| 3049 |
|
|
exempt_item: exempt_ip | error; |
| 3050 |
|
|
|
| 3051 |
|
|
exempt_ip: IP '=' QSTRING ';' |
| 3052 |
|
|
{ |
| 3053 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3054 |
adx |
30 |
{ |
| 3055 |
|
|
if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST) |
| 3056 |
|
|
{ |
| 3057 |
michael |
1005 |
yy_aconf = map_to_conf(make_conf_item(EXEMPTDLINE_TYPE)); |
| 3058 |
adx |
30 |
DupString(yy_aconf->host, yylval.string); |
| 3059 |
|
|
|
| 3060 |
|
|
add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf); |
| 3061 |
|
|
yy_aconf = NULL; |
| 3062 |
|
|
} |
| 3063 |
|
|
} |
| 3064 |
|
|
}; |
| 3065 |
|
|
|
| 3066 |
|
|
/*************************************************************************** |
| 3067 |
|
|
* section gecos |
| 3068 |
|
|
***************************************************************************/ |
| 3069 |
|
|
gecos_entry: GECOS |
| 3070 |
|
|
{ |
| 3071 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3072 |
adx |
30 |
{ |
| 3073 |
|
|
regex_ban = 0; |
| 3074 |
|
|
reasonbuf[0] = gecos_name[0] = '\0'; |
| 3075 |
|
|
} |
| 3076 |
|
|
} '{' gecos_items '}' ';' |
| 3077 |
|
|
{ |
| 3078 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3079 |
adx |
30 |
{ |
| 3080 |
|
|
if (gecos_name[0]) |
| 3081 |
|
|
{ |
| 3082 |
|
|
if (regex_ban) |
| 3083 |
|
|
{ |
| 3084 |
|
|
pcre *exp_p = NULL; |
| 3085 |
|
|
const char *errptr = NULL; |
| 3086 |
|
|
|
| 3087 |
|
|
if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr))) |
| 3088 |
|
|
{ |
| 3089 |
michael |
595 |
ilog(L_ERROR, "Failed to add regular expression based X-Line: %s", |
| 3090 |
|
|
errptr); |
| 3091 |
adx |
30 |
break; |
| 3092 |
|
|
} |
| 3093 |
|
|
|
| 3094 |
|
|
yy_conf = make_conf_item(RXLINE_TYPE); |
| 3095 |
|
|
yy_conf->regexpname = exp_p; |
| 3096 |
|
|
} |
| 3097 |
|
|
else |
| 3098 |
|
|
yy_conf = make_conf_item(XLINE_TYPE); |
| 3099 |
|
|
|
| 3100 |
|
|
yy_match_item = map_to_conf(yy_conf); |
| 3101 |
|
|
DupString(yy_conf->name, gecos_name); |
| 3102 |
|
|
|
| 3103 |
|
|
if (reasonbuf[0]) |
| 3104 |
|
|
DupString(yy_match_item->reason, reasonbuf); |
| 3105 |
|
|
else |
| 3106 |
|
|
DupString(yy_match_item->reason, "No reason"); |
| 3107 |
|
|
} |
| 3108 |
|
|
} |
| 3109 |
|
|
}; |
| 3110 |
|
|
|
| 3111 |
|
|
gecos_flags: TYPE |
| 3112 |
|
|
{ |
| 3113 |
|
|
} '=' gecos_flags_items ';'; |
| 3114 |
|
|
|
| 3115 |
|
|
gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item; |
| 3116 |
|
|
gecos_flags_item: REGEX_T |
| 3117 |
|
|
{ |
| 3118 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3119 |
adx |
30 |
regex_ban = 1; |
| 3120 |
|
|
}; |
| 3121 |
|
|
|
| 3122 |
|
|
gecos_items: gecos_items gecos_item | gecos_item; |
| 3123 |
|
|
gecos_item: gecos_name | gecos_reason | gecos_flags | error; |
| 3124 |
|
|
|
| 3125 |
|
|
gecos_name: NAME '=' QSTRING ';' |
| 3126 |
|
|
{ |
| 3127 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3128 |
adx |
30 |
strlcpy(gecos_name, yylval.string, sizeof(gecos_name)); |
| 3129 |
|
|
}; |
| 3130 |
|
|
|
| 3131 |
|
|
gecos_reason: REASON '=' QSTRING ';' |
| 3132 |
|
|
{ |
| 3133 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3134 |
adx |
30 |
strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf)); |
| 3135 |
|
|
}; |
| 3136 |
|
|
|
| 3137 |
|
|
/*************************************************************************** |
| 3138 |
|
|
* section general |
| 3139 |
|
|
***************************************************************************/ |
| 3140 |
|
|
general_entry: GENERAL |
| 3141 |
|
|
'{' general_items '}' ';'; |
| 3142 |
|
|
|
| 3143 |
|
|
general_items: general_items general_item | general_item; |
| 3144 |
|
|
general_item: general_hide_spoof_ips | general_ignore_bogus_ts | |
| 3145 |
|
|
general_failed_oper_notice | general_anti_nick_flood | |
| 3146 |
|
|
general_max_nick_time | general_max_nick_changes | |
| 3147 |
|
|
general_max_accept | general_anti_spam_exit_message_time | |
| 3148 |
|
|
general_ts_warn_delta | general_ts_max_delta | |
| 3149 |
|
|
general_kill_chase_time_limit | general_kline_with_reason | |
| 3150 |
|
|
general_kline_reason | general_invisible_on_connect | |
| 3151 |
|
|
general_warn_no_nline | general_dots_in_ident | |
| 3152 |
|
|
general_stats_o_oper_only | general_stats_k_oper_only | |
| 3153 |
|
|
general_pace_wait | general_stats_i_oper_only | |
| 3154 |
|
|
general_pace_wait_simple | general_stats_P_oper_only | |
| 3155 |
|
|
general_short_motd | general_no_oper_flood | |
| 3156 |
|
|
general_true_no_oper_flood | general_oper_pass_resv | |
| 3157 |
|
|
general_idletime | general_message_locale | |
| 3158 |
|
|
general_oper_only_umodes | general_max_targets | |
| 3159 |
|
|
general_use_egd | general_egdpool_path | |
| 3160 |
|
|
general_oper_umodes | general_caller_id_wait | |
| 3161 |
|
|
general_opers_bypass_callerid | general_default_floodcount | |
| 3162 |
|
|
general_min_nonwildcard | general_min_nonwildcard_simple | |
| 3163 |
|
|
general_servlink_path | general_disable_remote_commands | |
| 3164 |
|
|
general_default_cipher_preference | |
| 3165 |
|
|
general_compression_level | general_client_flood | |
| 3166 |
|
|
general_throttle_time | general_havent_read_conf | |
| 3167 |
|
|
general_dot_in_ip6_addr | general_ping_cookie | |
| 3168 |
|
|
general_disable_auth | general_burst_away | |
| 3169 |
|
|
general_tkline_expire_notices | general_gline_min_cidr | |
| 3170 |
|
|
general_gline_min_cidr6 | general_use_whois_actually | |
| 3171 |
michael |
584 |
general_reject_hold_time | general_stats_e_disabled | |
| 3172 |
michael |
876 |
general_max_watch | |
| 3173 |
adx |
30 |
error; |
| 3174 |
|
|
|
| 3175 |
|
|
|
| 3176 |
michael |
876 |
general_max_watch: MAX_WATCH '=' NUMBER ';' |
| 3177 |
|
|
{ |
| 3178 |
|
|
ConfigFileEntry.max_watch = $3; |
| 3179 |
|
|
}; |
| 3180 |
adx |
30 |
|
| 3181 |
|
|
general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';' |
| 3182 |
|
|
{ |
| 3183 |
|
|
ConfigFileEntry.gline_min_cidr = $3; |
| 3184 |
|
|
}; |
| 3185 |
|
|
|
| 3186 |
|
|
general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';' |
| 3187 |
|
|
{ |
| 3188 |
|
|
ConfigFileEntry.gline_min_cidr6 = $3; |
| 3189 |
|
|
}; |
| 3190 |
|
|
|
| 3191 |
|
|
general_burst_away: BURST_AWAY '=' TBOOL ';' |
| 3192 |
|
|
{ |
| 3193 |
|
|
ConfigFileEntry.burst_away = yylval.number; |
| 3194 |
|
|
}; |
| 3195 |
|
|
|
| 3196 |
|
|
general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';' |
| 3197 |
|
|
{ |
| 3198 |
|
|
ConfigFileEntry.use_whois_actually = yylval.number; |
| 3199 |
|
|
}; |
| 3200 |
|
|
|
| 3201 |
|
|
general_reject_hold_time: TREJECT_HOLD_TIME '=' timespec ';' |
| 3202 |
|
|
{ |
| 3203 |
|
|
GlobalSetOptions.rejecttime = yylval.number; |
| 3204 |
|
|
}; |
| 3205 |
|
|
|
| 3206 |
|
|
general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';' |
| 3207 |
|
|
{ |
| 3208 |
|
|
ConfigFileEntry.tkline_expire_notices = yylval.number; |
| 3209 |
|
|
}; |
| 3210 |
|
|
|
| 3211 |
|
|
general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' NUMBER ';' |
| 3212 |
|
|
{ |
| 3213 |
|
|
ConfigFileEntry.kill_chase_time_limit = $3; |
| 3214 |
|
|
}; |
| 3215 |
|
|
|
| 3216 |
|
|
general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';' |
| 3217 |
|
|
{ |
| 3218 |
|
|
ConfigFileEntry.hide_spoof_ips = yylval.number; |
| 3219 |
|
|
}; |
| 3220 |
|
|
|
| 3221 |
|
|
general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';' |
| 3222 |
|
|
{ |
| 3223 |
|
|
ConfigFileEntry.ignore_bogus_ts = yylval.number; |
| 3224 |
|
|
}; |
| 3225 |
|
|
|
| 3226 |
|
|
general_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';' |
| 3227 |
|
|
{ |
| 3228 |
|
|
ConfigFileEntry.disable_remote = yylval.number; |
| 3229 |
|
|
}; |
| 3230 |
|
|
|
| 3231 |
|
|
general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';' |
| 3232 |
|
|
{ |
| 3233 |
|
|
ConfigFileEntry.failed_oper_notice = yylval.number; |
| 3234 |
|
|
}; |
| 3235 |
|
|
|
| 3236 |
|
|
general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';' |
| 3237 |
|
|
{ |
| 3238 |
|
|
ConfigFileEntry.anti_nick_flood = yylval.number; |
| 3239 |
|
|
}; |
| 3240 |
|
|
|
| 3241 |
|
|
general_max_nick_time: MAX_NICK_TIME '=' timespec ';' |
| 3242 |
|
|
{ |
| 3243 |
|
|
ConfigFileEntry.max_nick_time = $3; |
| 3244 |
|
|
}; |
| 3245 |
|
|
|
| 3246 |
|
|
general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';' |
| 3247 |
|
|
{ |
| 3248 |
|
|
ConfigFileEntry.max_nick_changes = $3; |
| 3249 |
|
|
}; |
| 3250 |
|
|
|
| 3251 |
|
|
general_max_accept: MAX_ACCEPT '=' NUMBER ';' |
| 3252 |
|
|
{ |
| 3253 |
|
|
ConfigFileEntry.max_accept = $3; |
| 3254 |
|
|
}; |
| 3255 |
|
|
|
| 3256 |
|
|
general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';' |
| 3257 |
|
|
{ |
| 3258 |
|
|
ConfigFileEntry.anti_spam_exit_message_time = $3; |
| 3259 |
|
|
}; |
| 3260 |
|
|
|
| 3261 |
|
|
general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';' |
| 3262 |
|
|
{ |
| 3263 |
|
|
ConfigFileEntry.ts_warn_delta = $3; |
| 3264 |
|
|
}; |
| 3265 |
|
|
|
| 3266 |
|
|
general_ts_max_delta: TS_MAX_DELTA '=' timespec ';' |
| 3267 |
|
|
{ |
| 3268 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3269 |
adx |
30 |
ConfigFileEntry.ts_max_delta = $3; |
| 3270 |
|
|
}; |
| 3271 |
|
|
|
| 3272 |
|
|
general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';' |
| 3273 |
|
|
{ |
| 3274 |
michael |
967 |
if (($3 > 0) && conf_parser_ctx.pass == 1) |
| 3275 |
adx |
30 |
{ |
| 3276 |
|
|
ilog(L_CRIT, "You haven't read your config file properly."); |
| 3277 |
|
|
ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed."); |
| 3278 |
|
|
ilog(L_CRIT, "Consider actually reading/editing the conf file, and removing this line."); |
| 3279 |
|
|
exit(0); |
| 3280 |
|
|
} |
| 3281 |
|
|
}; |
| 3282 |
|
|
|
| 3283 |
|
|
general_kline_with_reason: KLINE_WITH_REASON '=' TBOOL ';' |
| 3284 |
|
|
{ |
| 3285 |
|
|
ConfigFileEntry.kline_with_reason = yylval.number; |
| 3286 |
|
|
}; |
| 3287 |
|
|
|
| 3288 |
|
|
general_kline_reason: KLINE_REASON '=' QSTRING ';' |
| 3289 |
|
|
{ |
| 3290 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3291 |
adx |
30 |
{ |
| 3292 |
|
|
MyFree(ConfigFileEntry.kline_reason); |
| 3293 |
|
|
DupString(ConfigFileEntry.kline_reason, yylval.string); |
| 3294 |
|
|
} |
| 3295 |
|
|
}; |
| 3296 |
|
|
|
| 3297 |
|
|
general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';' |
| 3298 |
|
|
{ |
| 3299 |
|
|
ConfigFileEntry.invisible_on_connect = yylval.number; |
| 3300 |
|
|
}; |
| 3301 |
|
|
|
| 3302 |
|
|
general_warn_no_nline: WARN_NO_NLINE '=' TBOOL ';' |
| 3303 |
|
|
{ |
| 3304 |
|
|
ConfigFileEntry.warn_no_nline = yylval.number; |
| 3305 |
|
|
}; |
| 3306 |
|
|
|
| 3307 |
michael |
584 |
general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';' |
| 3308 |
|
|
{ |
| 3309 |
|
|
ConfigFileEntry.stats_e_disabled = yylval.number; |
| 3310 |
|
|
}; |
| 3311 |
|
|
|
| 3312 |
adx |
30 |
general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';' |
| 3313 |
|
|
{ |
| 3314 |
|
|
ConfigFileEntry.stats_o_oper_only = yylval.number; |
| 3315 |
|
|
}; |
| 3316 |
|
|
|
| 3317 |
|
|
general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';' |
| 3318 |
|
|
{ |
| 3319 |
|
|
ConfigFileEntry.stats_P_oper_only = yylval.number; |
| 3320 |
|
|
}; |
| 3321 |
|
|
|
| 3322 |
|
|
general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';' |
| 3323 |
|
|
{ |
| 3324 |
|
|
ConfigFileEntry.stats_k_oper_only = 2 * yylval.number; |
| 3325 |
|
|
} | STATS_K_OPER_ONLY '=' TMASKED ';' |
| 3326 |
|
|
{ |
| 3327 |
|
|
ConfigFileEntry.stats_k_oper_only = 1; |
| 3328 |
|
|
}; |
| 3329 |
|
|
|
| 3330 |
|
|
general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';' |
| 3331 |
|
|
{ |
| 3332 |
|
|
ConfigFileEntry.stats_i_oper_only = 2 * yylval.number; |
| 3333 |
|
|
} | STATS_I_OPER_ONLY '=' TMASKED ';' |
| 3334 |
|
|
{ |
| 3335 |
|
|
ConfigFileEntry.stats_i_oper_only = 1; |
| 3336 |
|
|
}; |
| 3337 |
|
|
|
| 3338 |
|
|
general_pace_wait: PACE_WAIT '=' timespec ';' |
| 3339 |
|
|
{ |
| 3340 |
|
|
ConfigFileEntry.pace_wait = $3; |
| 3341 |
|
|
}; |
| 3342 |
|
|
|
| 3343 |
|
|
general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';' |
| 3344 |
|
|
{ |
| 3345 |
|
|
ConfigFileEntry.caller_id_wait = $3; |
| 3346 |
|
|
}; |
| 3347 |
|
|
|
| 3348 |
|
|
general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';' |
| 3349 |
|
|
{ |
| 3350 |
|
|
ConfigFileEntry.opers_bypass_callerid = yylval.number; |
| 3351 |
|
|
}; |
| 3352 |
|
|
|
| 3353 |
|
|
general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';' |
| 3354 |
|
|
{ |
| 3355 |
|
|
ConfigFileEntry.pace_wait_simple = $3; |
| 3356 |
|
|
}; |
| 3357 |
|
|
|
| 3358 |
|
|
general_short_motd: SHORT_MOTD '=' TBOOL ';' |
| 3359 |
|
|
{ |
| 3360 |
|
|
ConfigFileEntry.short_motd = yylval.number; |
| 3361 |
|
|
}; |
| 3362 |
|
|
|
| 3363 |
|
|
general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';' |
| 3364 |
|
|
{ |
| 3365 |
|
|
ConfigFileEntry.no_oper_flood = yylval.number; |
| 3366 |
|
|
}; |
| 3367 |
|
|
|
| 3368 |
|
|
general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';' |
| 3369 |
|
|
{ |
| 3370 |
|
|
ConfigFileEntry.true_no_oper_flood = yylval.number; |
| 3371 |
|
|
}; |
| 3372 |
|
|
|
| 3373 |
|
|
general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';' |
| 3374 |
|
|
{ |
| 3375 |
|
|
ConfigFileEntry.oper_pass_resv = yylval.number; |
| 3376 |
|
|
}; |
| 3377 |
|
|
|
| 3378 |
|
|
general_message_locale: MESSAGE_LOCALE '=' QSTRING ';' |
| 3379 |
|
|
{ |
| 3380 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3381 |
adx |
30 |
{ |
| 3382 |
|
|
if (strlen(yylval.string) > LOCALE_LENGTH-2) |
| 3383 |
|
|
yylval.string[LOCALE_LENGTH-1] = '\0'; |
| 3384 |
|
|
|
| 3385 |
|
|
set_locale(yylval.string); |
| 3386 |
|
|
} |
| 3387 |
|
|
}; |
| 3388 |
|
|
|
| 3389 |
|
|
general_idletime: IDLETIME '=' timespec ';' |
| 3390 |
|
|
{ |
| 3391 |
|
|
ConfigFileEntry.idletime = $3; |
| 3392 |
|
|
}; |
| 3393 |
|
|
|
| 3394 |
|
|
general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';' |
| 3395 |
|
|
{ |
| 3396 |
|
|
ConfigFileEntry.dots_in_ident = $3; |
| 3397 |
|
|
}; |
| 3398 |
|
|
|
| 3399 |
|
|
general_max_targets: MAX_TARGETS '=' NUMBER ';' |
| 3400 |
|
|
{ |
| 3401 |
|
|
ConfigFileEntry.max_targets = $3; |
| 3402 |
|
|
}; |
| 3403 |
|
|
|
| 3404 |
|
|
general_servlink_path: SERVLINK_PATH '=' QSTRING ';' |
| 3405 |
|
|
{ |
| 3406 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3407 |
adx |
30 |
{ |
| 3408 |
|
|
MyFree(ConfigFileEntry.servlink_path); |
| 3409 |
|
|
DupString(ConfigFileEntry.servlink_path, yylval.string); |
| 3410 |
|
|
} |
| 3411 |
|
|
}; |
| 3412 |
|
|
|
| 3413 |
|
|
general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';' |
| 3414 |
|
|
{ |
| 3415 |
|
|
#ifdef HAVE_LIBCRYPTO |
| 3416 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3417 |
adx |
30 |
{ |
| 3418 |
|
|
struct EncCapability *ecap; |
| 3419 |
|
|
const char *cipher_name; |
| 3420 |
|
|
int found = 0; |
| 3421 |
|
|
|
| 3422 |
|
|
ConfigFileEntry.default_cipher_preference = NULL; |
| 3423 |
|
|
cipher_name = yylval.string; |
| 3424 |
|
|
|
| 3425 |
|
|
for (ecap = CipherTable; ecap->name; ecap++) |
| 3426 |
|
|
{ |
| 3427 |
|
|
if ((irccmp(ecap->name, cipher_name) == 0) && |
| 3428 |
|
|
(ecap->cap & CAP_ENC_MASK)) |
| 3429 |
|
|
{ |
| 3430 |
|
|
ConfigFileEntry.default_cipher_preference = ecap; |
| 3431 |
|
|
found = 1; |
| 3432 |
|
|
break; |
| 3433 |
|
|
} |
| 3434 |
|
|
} |
| 3435 |
|
|
|
| 3436 |
|
|
if (!found) |
| 3437 |
|
|
yyerror("Invalid cipher"); |
| 3438 |
|
|
} |
| 3439 |
|
|
#else |
| 3440 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3441 |
adx |
30 |
yyerror("Ignoring default_cipher_preference -- no OpenSSL support"); |
| 3442 |
|
|
#endif |
| 3443 |
|
|
}; |
| 3444 |
|
|
|
| 3445 |
|
|
general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';' |
| 3446 |
|
|
{ |
| 3447 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3448 |
adx |
30 |
{ |
| 3449 |
|
|
ConfigFileEntry.compression_level = $3; |
| 3450 |
|
|
#ifndef HAVE_LIBZ |
| 3451 |
|
|
yyerror("Ignoring compression_level -- no zlib support"); |
| 3452 |
|
|
#else |
| 3453 |
|
|
if ((ConfigFileEntry.compression_level < 1) || |
| 3454 |
|
|
(ConfigFileEntry.compression_level > 9)) |
| 3455 |
|
|
{ |
| 3456 |
|
|
yyerror("Ignoring invalid compression_level, using default"); |
| 3457 |
|
|
ConfigFileEntry.compression_level = 0; |
| 3458 |
|
|
} |
| 3459 |
|
|
#endif |
| 3460 |
|
|
} |
| 3461 |
|
|
}; |
| 3462 |
|
|
|
| 3463 |
|
|
general_use_egd: USE_EGD '=' TBOOL ';' |
| 3464 |
|
|
{ |
| 3465 |
|
|
ConfigFileEntry.use_egd = yylval.number; |
| 3466 |
|
|
}; |
| 3467 |
|
|
|
| 3468 |
|
|
general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';' |
| 3469 |
|
|
{ |
| 3470 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3471 |
adx |
30 |
{ |
| 3472 |
|
|
MyFree(ConfigFileEntry.egdpool_path); |
| 3473 |
|
|
DupString(ConfigFileEntry.egdpool_path, yylval.string); |
| 3474 |
|
|
} |
| 3475 |
|
|
}; |
| 3476 |
|
|
|
| 3477 |
|
|
general_ping_cookie: PING_COOKIE '=' TBOOL ';' |
| 3478 |
|
|
{ |
| 3479 |
|
|
ConfigFileEntry.ping_cookie = yylval.number; |
| 3480 |
|
|
}; |
| 3481 |
|
|
|
| 3482 |
|
|
general_disable_auth: DISABLE_AUTH '=' TBOOL ';' |
| 3483 |
|
|
{ |
| 3484 |
|
|
ConfigFileEntry.disable_auth = yylval.number; |
| 3485 |
|
|
}; |
| 3486 |
|
|
|
| 3487 |
|
|
general_throttle_time: THROTTLE_TIME '=' timespec ';' |
| 3488 |
|
|
{ |
| 3489 |
|
|
ConfigFileEntry.throttle_time = yylval.number; |
| 3490 |
|
|
}; |
| 3491 |
|
|
|
| 3492 |
|
|
general_oper_umodes: OPER_UMODES |
| 3493 |
|
|
{ |
| 3494 |
|
|
ConfigFileEntry.oper_umodes = 0; |
| 3495 |
|
|
} '=' umode_oitems ';' ; |
| 3496 |
|
|
|
| 3497 |
|
|
umode_oitems: umode_oitems ',' umode_oitem | umode_oitem; |
| 3498 |
|
|
umode_oitem: T_BOTS |
| 3499 |
|
|
{ |
| 3500 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_BOTS; |
| 3501 |
|
|
} | T_CCONN |
| 3502 |
|
|
{ |
| 3503 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_CCONN; |
| 3504 |
db |
849 |
} | T_CCONN_FULL |
| 3505 |
|
|
{ |
| 3506 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL; |
| 3507 |
adx |
30 |
} | T_DEAF |
| 3508 |
|
|
{ |
| 3509 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_DEAF; |
| 3510 |
|
|
} | T_DEBUG |
| 3511 |
|
|
{ |
| 3512 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_DEBUG; |
| 3513 |
|
|
} | T_FULL |
| 3514 |
|
|
{ |
| 3515 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_FULL; |
| 3516 |
|
|
} | T_SKILL |
| 3517 |
|
|
{ |
| 3518 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_SKILL; |
| 3519 |
|
|
} | T_NCHANGE |
| 3520 |
|
|
{ |
| 3521 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_NCHANGE; |
| 3522 |
|
|
} | T_REJ |
| 3523 |
|
|
{ |
| 3524 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_REJ; |
| 3525 |
|
|
} | T_UNAUTH |
| 3526 |
|
|
{ |
| 3527 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_UNAUTH; |
| 3528 |
|
|
} | T_SPY |
| 3529 |
|
|
{ |
| 3530 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_SPY; |
| 3531 |
|
|
} | T_EXTERNAL |
| 3532 |
|
|
{ |
| 3533 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL; |
| 3534 |
|
|
} | T_OPERWALL |
| 3535 |
|
|
{ |
| 3536 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_OPERWALL; |
| 3537 |
|
|
} | T_SERVNOTICE |
| 3538 |
|
|
{ |
| 3539 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE; |
| 3540 |
|
|
} | T_INVISIBLE |
| 3541 |
|
|
{ |
| 3542 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE; |
| 3543 |
|
|
} | T_WALLOP |
| 3544 |
|
|
{ |
| 3545 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_WALLOP; |
| 3546 |
|
|
} | T_SOFTCALLERID |
| 3547 |
|
|
{ |
| 3548 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID; |
| 3549 |
|
|
} | T_CALLERID |
| 3550 |
|
|
{ |
| 3551 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_CALLERID; |
| 3552 |
|
|
} | T_LOCOPS |
| 3553 |
|
|
{ |
| 3554 |
|
|
ConfigFileEntry.oper_umodes |= UMODE_LOCOPS; |
| 3555 |
|
|
}; |
| 3556 |
|
|
|
| 3557 |
|
|
general_oper_only_umodes: OPER_ONLY_UMODES |
| 3558 |
|
|
{ |
| 3559 |
|
|
ConfigFileEntry.oper_only_umodes = 0; |
| 3560 |
|
|
} '=' umode_items ';' ; |
| 3561 |
|
|
|
| 3562 |
|
|
umode_items: umode_items ',' umode_item | umode_item; |
| 3563 |
|
|
umode_item: T_BOTS |
| 3564 |
|
|
{ |
| 3565 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_BOTS; |
| 3566 |
|
|
} | T_CCONN |
| 3567 |
|
|
{ |
| 3568 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_CCONN; |
| 3569 |
db |
853 |
} | T_CCONN_FULL |
| 3570 |
|
|
{ |
| 3571 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL; |
| 3572 |
adx |
30 |
} | T_DEAF |
| 3573 |
|
|
{ |
| 3574 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_DEAF; |
| 3575 |
|
|
} | T_DEBUG |
| 3576 |
|
|
{ |
| 3577 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG; |
| 3578 |
|
|
} | T_FULL |
| 3579 |
|
|
{ |
| 3580 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_FULL; |
| 3581 |
|
|
} | T_SKILL |
| 3582 |
|
|
{ |
| 3583 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_SKILL; |
| 3584 |
|
|
} | T_NCHANGE |
| 3585 |
|
|
{ |
| 3586 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE; |
| 3587 |
|
|
} | T_REJ |
| 3588 |
|
|
{ |
| 3589 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_REJ; |
| 3590 |
|
|
} | T_UNAUTH |
| 3591 |
|
|
{ |
| 3592 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH; |
| 3593 |
|
|
} | T_SPY |
| 3594 |
|
|
{ |
| 3595 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_SPY; |
| 3596 |
|
|
} | T_EXTERNAL |
| 3597 |
|
|
{ |
| 3598 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL; |
| 3599 |
|
|
} | T_OPERWALL |
| 3600 |
|
|
{ |
| 3601 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_OPERWALL; |
| 3602 |
|
|
} | T_SERVNOTICE |
| 3603 |
|
|
{ |
| 3604 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE; |
| 3605 |
|
|
} | T_INVISIBLE |
| 3606 |
|
|
{ |
| 3607 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE; |
| 3608 |
|
|
} | T_WALLOP |
| 3609 |
|
|
{ |
| 3610 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP; |
| 3611 |
|
|
} | T_SOFTCALLERID |
| 3612 |
|
|
{ |
| 3613 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID; |
| 3614 |
|
|
} | T_CALLERID |
| 3615 |
|
|
{ |
| 3616 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID; |
| 3617 |
|
|
} | T_LOCOPS |
| 3618 |
|
|
{ |
| 3619 |
|
|
ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS; |
| 3620 |
|
|
}; |
| 3621 |
|
|
|
| 3622 |
|
|
general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';' |
| 3623 |
|
|
{ |
| 3624 |
|
|
ConfigFileEntry.min_nonwildcard = $3; |
| 3625 |
|
|
}; |
| 3626 |
|
|
|
| 3627 |
|
|
general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';' |
| 3628 |
|
|
{ |
| 3629 |
|
|
ConfigFileEntry.min_nonwildcard_simple = $3; |
| 3630 |
|
|
}; |
| 3631 |
|
|
|
| 3632 |
|
|
general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';' |
| 3633 |
|
|
{ |
| 3634 |
|
|
ConfigFileEntry.default_floodcount = $3; |
| 3635 |
|
|
}; |
| 3636 |
|
|
|
| 3637 |
|
|
general_client_flood: T_CLIENT_FLOOD '=' sizespec ';' |
| 3638 |
|
|
{ |
| 3639 |
|
|
ConfigFileEntry.client_flood = $3; |
| 3640 |
|
|
}; |
| 3641 |
|
|
|
| 3642 |
|
|
general_dot_in_ip6_addr: DOT_IN_IP6_ADDR '=' TBOOL ';' |
| 3643 |
|
|
{ |
| 3644 |
|
|
ConfigFileEntry.dot_in_ip6_addr = yylval.number; |
| 3645 |
|
|
}; |
| 3646 |
|
|
|
| 3647 |
|
|
/*************************************************************************** |
| 3648 |
|
|
* section glines |
| 3649 |
|
|
***************************************************************************/ |
| 3650 |
|
|
gline_entry: GLINES |
| 3651 |
|
|
{ |
| 3652 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3653 |
adx |
30 |
{ |
| 3654 |
|
|
yy_conf = make_conf_item(GDENY_TYPE); |
| 3655 |
michael |
102 |
yy_aconf = map_to_conf(yy_conf); |
| 3656 |
adx |
30 |
} |
| 3657 |
|
|
} '{' gline_items '}' ';' |
| 3658 |
|
|
{ |
| 3659 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3660 |
adx |
30 |
{ |
| 3661 |
|
|
/* |
| 3662 |
|
|
* since we re-allocate yy_conf/yy_aconf after the end of action=, at the |
| 3663 |
|
|
* end we will have one extra, so we should free it. |
| 3664 |
|
|
*/ |
| 3665 |
michael |
102 |
if (yy_conf->name == NULL || yy_aconf->user == NULL) |
| 3666 |
adx |
30 |
{ |
| 3667 |
michael |
102 |
delete_conf_item(yy_conf); |
| 3668 |
adx |
30 |
yy_conf = NULL; |
| 3669 |
|
|
yy_aconf = NULL; |
| 3670 |
|
|
} |
| 3671 |
|
|
} |
| 3672 |
|
|
}; |
| 3673 |
|
|
|
| 3674 |
|
|
gline_items: gline_items gline_item | gline_item; |
| 3675 |
|
|
gline_item: gline_enable | |
| 3676 |
|
|
gline_duration | |
| 3677 |
|
|
gline_logging | |
| 3678 |
|
|
gline_user | |
| 3679 |
|
|
gline_server | |
| 3680 |
|
|
gline_action | |
| 3681 |
|
|
error; |
| 3682 |
|
|
|
| 3683 |
|
|
gline_enable: ENABLE '=' TBOOL ';' |
| 3684 |
|
|
{ |
| 3685 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3686 |
adx |
30 |
ConfigFileEntry.glines = yylval.number; |
| 3687 |
|
|
}; |
| 3688 |
|
|
|
| 3689 |
|
|
gline_duration: DURATION '=' timespec ';' |
| 3690 |
|
|
{ |
| 3691 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3692 |
adx |
30 |
ConfigFileEntry.gline_time = $3; |
| 3693 |
|
|
}; |
| 3694 |
|
|
|
| 3695 |
|
|
gline_logging: LOGGING |
| 3696 |
|
|
{ |
| 3697 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3698 |
adx |
30 |
ConfigFileEntry.gline_logging = 0; |
| 3699 |
|
|
} '=' gline_logging_types ';'; |
| 3700 |
|
|
gline_logging_types: gline_logging_types ',' gline_logging_type_item | gline_logging_type_item; |
| 3701 |
|
|
gline_logging_type_item: T_REJECT |
| 3702 |
|
|
{ |
| 3703 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3704 |
adx |
30 |
ConfigFileEntry.gline_logging |= GDENY_REJECT; |
| 3705 |
|
|
} | T_BLOCK |
| 3706 |
|
|
{ |
| 3707 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3708 |
adx |
30 |
ConfigFileEntry.gline_logging |= GDENY_BLOCK; |
| 3709 |
|
|
}; |
| 3710 |
|
|
|
| 3711 |
|
|
gline_user: USER '=' QSTRING ';' |
| 3712 |
|
|
{ |
| 3713 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3714 |
adx |
30 |
{ |
| 3715 |
michael |
593 |
struct split_nuh_item nuh; |
| 3716 |
adx |
30 |
|
| 3717 |
michael |
593 |
nuh.nuhmask = yylval.string; |
| 3718 |
|
|
nuh.nickptr = NULL; |
| 3719 |
|
|
nuh.userptr = userbuf; |
| 3720 |
|
|
nuh.hostptr = hostbuf; |
| 3721 |
|
|
|
| 3722 |
|
|
nuh.nicksize = 0; |
| 3723 |
|
|
nuh.usersize = sizeof(userbuf); |
| 3724 |
|
|
nuh.hostsize = sizeof(hostbuf); |
| 3725 |
|
|
|
| 3726 |
|
|
split_nuh(&nuh); |
| 3727 |
|
|
|
| 3728 |
adx |
30 |
if (yy_aconf->user == NULL) |
| 3729 |
|
|
{ |
| 3730 |
michael |
593 |
DupString(yy_aconf->user, userbuf); |
| 3731 |
|
|
DupString(yy_aconf->host, hostbuf); |
| 3732 |
adx |
30 |
} |
| 3733 |
|
|
else |
| 3734 |
|
|
{ |
| 3735 |
michael |
593 |
struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem)); |
| 3736 |
|
|
|
| 3737 |
|
|
DupString(yy_tmp->user, userbuf); |
| 3738 |
|
|
DupString(yy_tmp->host, hostbuf); |
| 3739 |
|
|
|
| 3740 |
adx |
30 |
dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list); |
| 3741 |
|
|
} |
| 3742 |
|
|
} |
| 3743 |
|
|
}; |
| 3744 |
|
|
|
| 3745 |
|
|
gline_server: NAME '=' QSTRING ';' |
| 3746 |
|
|
{ |
| 3747 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3748 |
adx |
30 |
{ |
| 3749 |
|
|
MyFree(yy_conf->name); |
| 3750 |
|
|
DupString(yy_conf->name, yylval.string); |
| 3751 |
|
|
} |
| 3752 |
|
|
}; |
| 3753 |
|
|
|
| 3754 |
|
|
gline_action: ACTION |
| 3755 |
|
|
{ |
| 3756 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3757 |
adx |
30 |
yy_aconf->flags = 0; |
| 3758 |
|
|
} '=' gdeny_types ';' |
| 3759 |
|
|
{ |
| 3760 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3761 |
adx |
30 |
{ |
| 3762 |
michael |
102 |
struct CollectItem *yy_tmp = NULL; |
| 3763 |
adx |
30 |
dlink_node *ptr, *next_ptr; |
| 3764 |
|
|
|
| 3765 |
|
|
DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head) |
| 3766 |
|
|
{ |
| 3767 |
|
|
struct AccessItem *new_aconf; |
| 3768 |
|
|
struct ConfItem *new_conf; |
| 3769 |
|
|
|
| 3770 |
|
|
yy_tmp = ptr->data; |
| 3771 |
|
|
new_conf = make_conf_item(GDENY_TYPE); |
| 3772 |
michael |
102 |
new_aconf = map_to_conf(new_conf); |
| 3773 |
adx |
30 |
|
| 3774 |
|
|
new_aconf->flags = yy_aconf->flags; |
| 3775 |
|
|
|
| 3776 |
|
|
if (yy_conf->name != NULL) |
| 3777 |
|
|
DupString(new_conf->name, yy_conf->name); |
| 3778 |
|
|
else |
| 3779 |
|
|
DupString(new_conf->name, "*"); |
| 3780 |
|
|
if (yy_aconf->user != NULL) |
| 3781 |
|
|
DupString(new_aconf->user, yy_tmp->user); |
| 3782 |
|
|
else |
| 3783 |
|
|
DupString(new_aconf->user, "*"); |
| 3784 |
|
|
if (yy_aconf->host != NULL) |
| 3785 |
|
|
DupString(new_aconf->host, yy_tmp->host); |
| 3786 |
|
|
else |
| 3787 |
|
|
DupString(new_aconf->host, "*"); |
| 3788 |
|
|
|
| 3789 |
|
|
dlinkDelete(&yy_tmp->node, &col_conf_list); |
| 3790 |
|
|
} |
| 3791 |
michael |
102 |
|
| 3792 |
|
|
/* |
| 3793 |
|
|
* In case someone has fed us with more than one action= after user/name |
| 3794 |
|
|
* which would leak memory -Michael |
| 3795 |
|
|
*/ |
| 3796 |
|
|
if (yy_conf->name == NULL || yy_aconf->user == NULL) |
| 3797 |
|
|
delete_conf_item(yy_conf); |
| 3798 |
|
|
|
| 3799 |
|
|
yy_conf = make_conf_item(GDENY_TYPE); |
| 3800 |
|
|
yy_aconf = map_to_conf(yy_conf); |
| 3801 |
adx |
30 |
} |
| 3802 |
|
|
}; |
| 3803 |
|
|
|
| 3804 |
|
|
gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item; |
| 3805 |
|
|
gdeny_type_item: T_REJECT |
| 3806 |
|
|
{ |
| 3807 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3808 |
adx |
30 |
yy_aconf->flags |= GDENY_REJECT; |
| 3809 |
|
|
} | T_BLOCK |
| 3810 |
|
|
{ |
| 3811 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3812 |
adx |
30 |
yy_aconf->flags |= GDENY_BLOCK; |
| 3813 |
|
|
}; |
| 3814 |
|
|
|
| 3815 |
|
|
/*************************************************************************** |
| 3816 |
|
|
* section channel |
| 3817 |
|
|
***************************************************************************/ |
| 3818 |
|
|
channel_entry: CHANNEL |
| 3819 |
|
|
'{' channel_items '}' ';'; |
| 3820 |
|
|
|
| 3821 |
|
|
channel_items: channel_items channel_item | channel_item; |
| 3822 |
|
|
channel_item: channel_disable_local_channels | channel_use_except | |
| 3823 |
|
|
channel_use_invex | channel_use_knock | |
| 3824 |
|
|
channel_max_bans | channel_knock_delay | |
| 3825 |
adx |
201 |
channel_knock_delay_channel | channel_max_chans_per_user | |
| 3826 |
|
|
channel_quiet_on_ban | channel_default_split_user_count | |
| 3827 |
|
|
channel_default_split_server_count | |
| 3828 |
|
|
channel_no_create_on_split | channel_restrict_channels | |
| 3829 |
|
|
channel_no_join_on_split | channel_burst_topicwho | |
| 3830 |
|
|
channel_jflood_count | channel_jflood_time | |
| 3831 |
michael |
632 |
channel_disable_fake_channels | error; |
| 3832 |
adx |
30 |
|
| 3833 |
michael |
632 |
channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';' |
| 3834 |
|
|
{ |
| 3835 |
|
|
ConfigChannel.disable_fake_channels = yylval.number; |
| 3836 |
|
|
}; |
| 3837 |
|
|
|
| 3838 |
adx |
30 |
channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';' |
| 3839 |
|
|
{ |
| 3840 |
|
|
ConfigChannel.restrict_channels = yylval.number; |
| 3841 |
|
|
}; |
| 3842 |
|
|
|
| 3843 |
|
|
channel_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';' |
| 3844 |
|
|
{ |
| 3845 |
|
|
ConfigChannel.disable_local_channels = yylval.number; |
| 3846 |
|
|
}; |
| 3847 |
|
|
|
| 3848 |
|
|
channel_use_except: USE_EXCEPT '=' TBOOL ';' |
| 3849 |
|
|
{ |
| 3850 |
|
|
ConfigChannel.use_except = yylval.number; |
| 3851 |
|
|
}; |
| 3852 |
|
|
|
| 3853 |
|
|
channel_use_invex: USE_INVEX '=' TBOOL ';' |
| 3854 |
|
|
{ |
| 3855 |
|
|
ConfigChannel.use_invex = yylval.number; |
| 3856 |
|
|
}; |
| 3857 |
|
|
|
| 3858 |
|
|
channel_use_knock: USE_KNOCK '=' TBOOL ';' |
| 3859 |
|
|
{ |
| 3860 |
|
|
ConfigChannel.use_knock = yylval.number; |
| 3861 |
|
|
}; |
| 3862 |
|
|
|
| 3863 |
|
|
channel_knock_delay: KNOCK_DELAY '=' timespec ';' |
| 3864 |
|
|
{ |
| 3865 |
|
|
ConfigChannel.knock_delay = $3; |
| 3866 |
|
|
}; |
| 3867 |
|
|
|
| 3868 |
|
|
channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';' |
| 3869 |
|
|
{ |
| 3870 |
|
|
ConfigChannel.knock_delay_channel = $3; |
| 3871 |
|
|
}; |
| 3872 |
|
|
|
| 3873 |
|
|
channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';' |
| 3874 |
|
|
{ |
| 3875 |
|
|
ConfigChannel.max_chans_per_user = $3; |
| 3876 |
|
|
}; |
| 3877 |
|
|
|
| 3878 |
|
|
channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';' |
| 3879 |
|
|
{ |
| 3880 |
|
|
ConfigChannel.quiet_on_ban = yylval.number; |
| 3881 |
|
|
}; |
| 3882 |
|
|
|
| 3883 |
|
|
channel_max_bans: MAX_BANS '=' NUMBER ';' |
| 3884 |
|
|
{ |
| 3885 |
|
|
ConfigChannel.max_bans = $3; |
| 3886 |
|
|
}; |
| 3887 |
|
|
|
| 3888 |
|
|
channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';' |
| 3889 |
|
|
{ |
| 3890 |
|
|
ConfigChannel.default_split_user_count = $3; |
| 3891 |
|
|
}; |
| 3892 |
|
|
|
| 3893 |
|
|
channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';' |
| 3894 |
|
|
{ |
| 3895 |
|
|
ConfigChannel.default_split_server_count = $3; |
| 3896 |
|
|
}; |
| 3897 |
|
|
|
| 3898 |
|
|
channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';' |
| 3899 |
|
|
{ |
| 3900 |
|
|
ConfigChannel.no_create_on_split = yylval.number; |
| 3901 |
|
|
}; |
| 3902 |
|
|
|
| 3903 |
|
|
channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';' |
| 3904 |
|
|
{ |
| 3905 |
|
|
ConfigChannel.no_join_on_split = yylval.number; |
| 3906 |
|
|
}; |
| 3907 |
|
|
|
| 3908 |
|
|
channel_burst_topicwho: BURST_TOPICWHO '=' TBOOL ';' |
| 3909 |
|
|
{ |
| 3910 |
|
|
ConfigChannel.burst_topicwho = yylval.number; |
| 3911 |
|
|
}; |
| 3912 |
|
|
|
| 3913 |
|
|
channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';' |
| 3914 |
|
|
{ |
| 3915 |
|
|
GlobalSetOptions.joinfloodcount = yylval.number; |
| 3916 |
|
|
}; |
| 3917 |
|
|
|
| 3918 |
|
|
channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';' |
| 3919 |
|
|
{ |
| 3920 |
|
|
GlobalSetOptions.joinfloodtime = yylval.number; |
| 3921 |
|
|
}; |
| 3922 |
|
|
|
| 3923 |
|
|
/*************************************************************************** |
| 3924 |
|
|
* section serverhide |
| 3925 |
|
|
***************************************************************************/ |
| 3926 |
|
|
serverhide_entry: SERVERHIDE |
| 3927 |
|
|
'{' serverhide_items '}' ';'; |
| 3928 |
|
|
|
| 3929 |
|
|
serverhide_items: serverhide_items serverhide_item | serverhide_item; |
| 3930 |
|
|
serverhide_item: serverhide_flatten_links | serverhide_hide_servers | |
| 3931 |
|
|
serverhide_links_delay | |
| 3932 |
|
|
serverhide_disable_hidden | |
| 3933 |
|
|
serverhide_hidden | serverhide_hidden_name | |
| 3934 |
|
|
serverhide_hide_server_ips | |
| 3935 |
|
|
error; |
| 3936 |
|
|
|
| 3937 |
|
|
serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';' |
| 3938 |
|
|
{ |
| 3939 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3940 |
adx |
30 |
ConfigServerHide.flatten_links = yylval.number; |
| 3941 |
|
|
}; |
| 3942 |
|
|
|
| 3943 |
|
|
serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';' |
| 3944 |
|
|
{ |
| 3945 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3946 |
adx |
30 |
ConfigServerHide.hide_servers = yylval.number; |
| 3947 |
|
|
}; |
| 3948 |
|
|
|
| 3949 |
|
|
serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';' |
| 3950 |
|
|
{ |
| 3951 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3952 |
adx |
30 |
{ |
| 3953 |
|
|
MyFree(ConfigServerHide.hidden_name); |
| 3954 |
|
|
DupString(ConfigServerHide.hidden_name, yylval.string); |
| 3955 |
|
|
} |
| 3956 |
|
|
}; |
| 3957 |
|
|
|
| 3958 |
|
|
serverhide_links_delay: LINKS_DELAY '=' timespec ';' |
| 3959 |
|
|
{ |
| 3960 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3961 |
adx |
30 |
{ |
| 3962 |
|
|
if (($3 > 0) && ConfigServerHide.links_disabled == 1) |
| 3963 |
|
|
{ |
| 3964 |
|
|
eventAddIsh("write_links_file", write_links_file, NULL, $3); |
| 3965 |
|
|
ConfigServerHide.links_disabled = 0; |
| 3966 |
|
|
} |
| 3967 |
|
|
|
| 3968 |
|
|
ConfigServerHide.links_delay = $3; |
| 3969 |
|
|
} |
| 3970 |
|
|
}; |
| 3971 |
|
|
|
| 3972 |
|
|
serverhide_hidden: HIDDEN '=' TBOOL ';' |
| 3973 |
|
|
{ |
| 3974 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3975 |
adx |
30 |
ConfigServerHide.hidden = yylval.number; |
| 3976 |
|
|
}; |
| 3977 |
|
|
|
| 3978 |
|
|
serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';' |
| 3979 |
|
|
{ |
| 3980 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3981 |
adx |
30 |
ConfigServerHide.disable_hidden = yylval.number; |
| 3982 |
|
|
}; |
| 3983 |
|
|
|
| 3984 |
|
|
serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';' |
| 3985 |
|
|
{ |
| 3986 |
michael |
967 |
if (conf_parser_ctx.pass == 2) |
| 3987 |
adx |
30 |
ConfigServerHide.hide_server_ips = yylval.number; |
| 3988 |
|
|
}; |