1 /************************************************************************ 2 * Unreal Internet Relay Chat Daemon, include/dynconf.h 3 * Copyright (C) 1999 Carsten Munk 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 1, or (at your option) 8 * any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 * 19 * $Id$ 20 */ 21 22 23 #define DYNCONF_H 24 /* config level */ 25 #define DYNCONF_CONF_VERSION "1.5" 26 #define DYNCONF_NETWORK_VERSION "2.2" 27 28 typedef struct zNetwork aNetwork; 29 struct zNetwork { 30 unsigned x_inah:1; 31 char *x_ircnetwork; 32 char *x_ircnet005; 33 char *x_defserv; 34 char *x_services_name; 35 char *x_oper_host; 36 char *x_admin_host; 37 char *x_locop_host; 38 char *x_sadmin_host; 39 char *x_netadmin_host; 40 char *x_coadmin_host; 41 char *x_hidden_host; 42 char *x_prefix_quit; 43 char *x_helpchan; 44 char *x_stats_server; 45 char *x_sasl_server; 46 }; 47 48 enum UHAllowed { UHALLOW_ALWAYS, UHALLOW_NOCHANS, UHALLOW_REJOIN, UHALLOW_NEVER }; 49 50 struct ChMode { 51 long mode; 52 #ifdef EXTCMODE 53 long extmodes; 54 char *extparams[EXTCMODETABLESZ]; 55 #endif 56 #ifdef NEWCHFLOODPROT 57 ChanFloodProt floodprot; 58 #else 59 unsigned short msgs; 60 unsigned short per; 61 unsigned char kmode; 62 #endif 63 }; 64 65 typedef struct _OperStat { 66 struct _OperStat *prev, *next; 67 char *flag; 68 } OperStat; 69 70 typedef struct zConfiguration aConfiguration; 71 struct zConfiguration { 72 unsigned som:1; 73 unsigned hide_ulines:1; 74 unsigned flat_map:1; 75 unsigned allow_chatops:1; 76 unsigned webtv_support:1; 77 unsigned no_oper_hiding:1; 78 unsigned ident_check:1; 79 unsigned fail_oper_warn:1; 80 unsigned show_connect_info:1; 81 unsigned dont_resolve:1; 82 unsigned use_ban_version:1; 83 unsigned mkpasswd_for_everyone:1; 84 unsigned allow_insane_bans; 85 unsigned allow_part_if_shunned:1; 86 unsigned disable_cap:1; 87 unsigned check_target_nick_bans:1; 88 unsigned use_egd : 1; 89 long host_timeout; 90 int host_retries; 91 char *name_server; 92 char *dns_bindip; 93 #ifdef THROTTLING 94 long throttle_period; 95 char throttle_count; 96 #endif 97 char *kline_address; 98 char *gline_address; 99 long conn_modes; 100 long oper_modes; 101 char *oper_snomask; 102 char *user_snomask; 103 char *auto_join_chans; 104 char *oper_auto_join_chans; 105 char *oper_only_stats; 106 OperStat *oper_only_stats_ext; 107 int maxchannelsperuser; 108 int maxdccallow; 109 int anti_spam_quit_message_time; 110 char *egd_path; 111 char *static_quit; 112 char *static_part; 113 #ifdef USE_SSL 114 char *x_server_cert_pem; 115 char *x_server_key_pem; 116 char *x_server_cipher_list; 117 char *trusted_ca_file; 118 long ssl_options; 119 int ssl_renegotiate_bytes; 120 int ssl_renegotiate_timeout; 121 122 #elif defined(_WIN32) 123 void *bogus1, *bogus2, *bogus3, *bogus5; 124 long bogus4; 125 int bogus6, bogus7; 126 #endif 127 enum UHAllowed userhost_allowed; 128 char *restrict_usermodes; 129 char *restrict_channelmodes; 130 char *restrict_extendedbans; 131 int new_linking_protocol; 132 char *channel_command_prefix; 133 long unknown_flood_bantime; 134 long unknown_flood_amount; 135 struct ChMode modes_on_join; 136 int level_on_join; 137 #ifdef NO_FLOOD_AWAY 138 unsigned char away_count; 139 long away_period; 140 #endif 141 unsigned char nick_count; 142 long nick_period; 143 int ident_connect_timeout; 144 int ident_read_timeout; 145 long default_bantime; 146 int who_limit; 147 int silence_limit; 148 #ifdef NEWCHFLOODPROT 149 unsigned char modef_default_unsettime; 150 unsigned char modef_max_unsettime; 151 #endif 152 long ban_version_tkl_time; 153 long spamfilter_ban_time; 154 char *spamfilter_ban_reason; 155 char *spamfilter_virus_help_channel; 156 char spamfilter_vchan_deny; 157 SpamExcept *spamexcept; 158 char *spamexcept_line; 159 long spamfilter_detectslow_warn; 160 long spamfilter_detectslow_fatal; 161 int spamfilter_stop_on_first_match; 162 int maxbans; 163 int maxbanlength; 164 int timesynch_enabled; 165 int timesynch_timeout; 166 char *timesynch_server; 167 int pingpong_warning; 168 int watch_away_notification; 169 int uhnames; 170 aNetwork network; 171 #ifdef INET6 172 unsigned short default_ipv6_clone_mask; 173 #endif /* INET6 */ 174 int ping_cookie; 175 }; 176 177 #ifndef DYNCONF_C 178 extern MODVAR aConfiguration iConf; 179 #endif 180 181 #define KLINE_ADDRESS iConf.kline_address 182 #define GLINE_ADDRESS iConf.gline_address 183 #define CONN_MODES iConf.conn_modes 184 #define OPER_MODES iConf.oper_modes 185 #define OPER_SNOMASK iConf.oper_snomask 186 #define CONNECT_SNOMASK iConf.user_snomask 187 #define SHOWOPERMOTD iConf.som 188 #define HIDE_ULINES iConf.hide_ulines 189 #define FLAT_MAP iConf.flat_map 190 #define ALLOW_CHATOPS iConf.allow_chatops 191 #define MAXCHANNELSPERUSER iConf.maxchannelsperuser 192 #define MAXDCCALLOW iConf.maxdccallow 193 #define WEBTV_SUPPORT iConf.webtv_support 194 #define NO_OPER_HIDING iConf.no_oper_hiding 195 #define DONT_RESOLVE iConf.dont_resolve 196 #define AUTO_JOIN_CHANS iConf.auto_join_chans 197 #define OPER_AUTO_JOIN_CHANS iConf.oper_auto_join_chans 198 #define HOST_TIMEOUT iConf.host_timeout 199 #define HOST_RETRIES iConf.host_retries 200 #define NAME_SERVER iConf.name_server 201 #define DNS_BINDIP iConf.dns_bindip 202 #define IDENT_CHECK iConf.ident_check 203 #define FAILOPER_WARN iConf.fail_oper_warn 204 #define SHOWCONNECTINFO iConf.show_connect_info 205 #define OPER_ONLY_STATS iConf.oper_only_stats 206 #define ANTI_SPAM_QUIT_MSG_TIME iConf.anti_spam_quit_message_time 207 #ifdef HAVE_RAND_EGD 208 #define USE_EGD iConf.use_egd 209 #else 210 #define USE_EGD 0 211 #endif 212 #define EGD_PATH iConf.egd_path 213 214 #define ircnetwork iConf.network.x_ircnetwork 215 #define ircnet005 iConf.network.x_ircnet005 216 #define defserv iConf.network.x_defserv 217 #define SERVICES_NAME iConf.network.x_services_name 218 #define oper_host iConf.network.x_oper_host 219 #define admin_host iConf.network.x_admin_host 220 #define locop_host iConf.network.x_locop_host 221 #define sadmin_host iConf.network.x_sadmin_host 222 #define netadmin_host iConf.network.x_netadmin_host 223 #define coadmin_host iConf.network.x_coadmin_host 224 #define techadmin_host iConf.network.x_techadmin_host 225 #define hidden_host iConf.network.x_hidden_host 226 #define helpchan iConf.network.x_helpchan 227 #define STATS_SERVER iConf.network.x_stats_server 228 #define SASL_SERVER iConf.network.x_sasl_server 229 #define iNAH iConf.network.x_inah 230 #define prefix_quit iConf.network.x_prefix_quit 231 #define SSL_SERVER_CERT_PEM (iConf.x_server_cert_pem ? iConf.x_server_cert_pem : "server.cert.pem") 232 #define SSL_SERVER_KEY_PEM (iConf.x_server_key_pem ? iConf.x_server_key_pem : "server.key.pem") 233 234 #define STATIC_QUIT iConf.static_quit 235 #define STATIC_PART iConf.static_part 236 #define UHOST_ALLOWED iConf.userhost_allowed 237 #define RESTRICT_USERMODES iConf.restrict_usermodes 238 #define RESTRICT_CHANNELMODES iConf.restrict_channelmodes 239 #define RESTRICT_EXTENDEDBANS iConf.restrict_extendedbans 240 #define NEW_LINKING_PROTOCOL iConf.new_linking_protocol 241 #ifdef THROTTLING 242 #define THROTTLING_PERIOD iConf.throttle_period 243 #define THROTTLING_COUNT iConf.throttle_count 244 #endif 245 #define USE_BAN_VERSION iConf.use_ban_version 246 #define UNKNOWN_FLOOD_BANTIME iConf.unknown_flood_bantime 247 #define UNKNOWN_FLOOD_AMOUNT iConf.unknown_flood_amount 248 #define MODES_ON_JOIN iConf.modes_on_join.mode 249 #define LEVEL_ON_JOIN iConf.level_on_join 250 251 #ifdef NO_FLOOD_AWAY 252 #define AWAY_PERIOD iConf.away_period 253 #define AWAY_COUNT iConf.away_count 254 #endif 255 #define NICK_PERIOD iConf.nick_period 256 #define NICK_COUNT iConf.nick_count 257 258 #define IDENT_CONNECT_TIMEOUT iConf.ident_connect_timeout 259 #define IDENT_READ_TIMEOUT iConf.ident_read_timeout 260 261 #define MKPASSWD_FOR_EVERYONE iConf.mkpasswd_for_everyone 262 #define ALLOW_INSANE_BANS iConf.allow_insane_bans 263 #define CHANCMDPFX iConf.channel_command_prefix 264 265 #define DEFAULT_BANTIME iConf.default_bantime 266 #define WHOLIMIT iConf.who_limit 267 268 #ifdef NEWCHFLOODPROT 269 #define MODEF_DEFAULT_UNSETTIME iConf.modef_default_unsettime 270 #define MODEF_MAX_UNSETTIME iConf.modef_max_unsettime 271 #endif 272 273 #define ALLOW_PART_IF_SHUNNED iConf.allow_part_if_shunned 274 275 #define DISABLE_CAP iConf.disable_cap 276 277 #define BAN_VERSION_TKL_TIME iConf.ban_version_tkl_time 278 #define SILENCE_LIMIT (iConf.silence_limit ? iConf.silence_limit : 15) 279 280 #define SPAMFILTER_BAN_TIME iConf.spamfilter_ban_time 281 #define SPAMFILTER_BAN_REASON iConf.spamfilter_ban_reason 282 #define SPAMFILTER_VIRUSCHAN iConf.spamfilter_virus_help_channel 283 #define SPAMFILTER_VIRUSCHANDENY iConf.spamfilter_vchan_deny 284 #define SPAMFILTER_EXCEPT iConf.spamexcept_line 285 #define SPAMFILTER_DETECTSLOW_WARN iConf.spamfilter_detectslow_warn 286 #define SPAMFILTER_DETECTSLOW_FATAL iConf.spamfilter_detectslow_fatal 287 #define SPAMFILTER_STOP_ON_FIRST_MATCH iConf.spamfilter_stop_on_first_match 288 289 #define CHECK_TARGET_NICK_BANS iConf.check_target_nick_bans 290 291 #define MAXBANS iConf.maxbans 292 #define MAXBANLENGTH iConf.maxbanlength 293 294 #define TIMESYNCH iConf.timesynch_enabled 295 #define TIMESYNCH_TIMEOUT iConf.timesynch_timeout 296 #define TIMESYNCH_SERVER iConf.timesynch_server 297 298 #define PINGPONG_WARNING iConf.pingpong_warning 299 300 #define WATCH_AWAY_NOTIFICATION iConf.watch_away_notification 301 302 #define UHNAMES_ENABLED iConf.uhnames 303 304 /* Used for "is present?" and duplicate checking */ 305 struct SetCheck { 306 unsigned has_show_opermotd:1; 307 unsigned has_hide_ulines:1; 308 unsigned has_flat_map:1; 309 unsigned has_allow_chatops:1; 310 unsigned has_webtv_support:1; 311 unsigned has_no_oper_hiding:1; 312 unsigned has_ident_check:1; 313 unsigned has_fail_oper_warn:1; 314 unsigned has_show_connect_info:1; 315 unsigned has_dont_resolve:1; 316 unsigned has_mkpasswd_for_everyone:1; 317 unsigned has_allow_part_if_shunned:1; 318 unsigned has_disable_cap:1; 319 unsigned has_ssl_egd:1; 320 unsigned has_ssl_server_cipher_list :1; 321 unsigned has_dns_timeout:1; 322 unsigned has_dns_retries:1; 323 unsigned has_dns_nameserver:1; 324 unsigned has_dns_bind_ip:1; 325 #ifdef THROTTLING 326 unsigned has_throttle_period:1; 327 unsigned has_throttle_connections:1; 328 #endif 329 unsigned has_kline_address:1; 330 unsigned has_gline_address:1; 331 unsigned has_modes_on_connect:1; 332 unsigned has_modes_on_oper:1; 333 unsigned has_snomask_on_connect:1; 334 unsigned has_snomask_on_oper:1; 335 unsigned has_auto_join:1; 336 unsigned has_oper_auto_join:1; 337 unsigned has_check_target_nick_bans:1; 338 unsigned has_pingpong_warning:1; 339 unsigned has_watch_away_notification:1; 340 unsigned has_uhnames:1; 341 unsigned has_oper_only_stats:1; 342 unsigned has_maxchannelsperuser:1; 343 unsigned has_maxdccallow:1; 344 unsigned has_anti_spam_quit_message_time:1; 345 unsigned has_egd_path:1; 346 unsigned has_static_quit:1; 347 unsigned has_static_part:1; 348 #ifdef USE_SSL 349 unsigned has_ssl_certificate:1; 350 unsigned has_ssl_key:1; 351 unsigned has_ssl_trusted_ca_file:1; 352 unsigned has_ssl_options:1; 353 unsigned has_renegotiate_timeout : 1; 354 unsigned has_renegotiate_bytes : 1; 355 #endif 356 unsigned has_allow_userhost_change:1; 357 unsigned has_restrict_usermodes:1; 358 unsigned has_restrict_channelmodes:1; 359 unsigned has_restrict_extendedbans:1; 360 unsigned has_new_linking_protocol:1; 361 unsigned has_channel_command_prefix:1; 362 unsigned has_anti_flood_unknown_flood_bantime:1; 363 unsigned has_anti_flood_unknown_flood_amount:1; 364 unsigned has_modes_on_join:1; 365 unsigned has_level_on_join:1; 366 #ifdef NO_FLOOD_AWAY 367 unsigned has_anti_flood_away_count:1; 368 unsigned has_anti_flood_away_period:1; 369 #endif 370 unsigned has_anti_flood_nick_flood:1; 371 unsigned has_ident_connect_timeout:1; 372 unsigned has_ident_read_timeout:1; 373 unsigned has_default_bantime:1; 374 unsigned has_who_limit:1; 375 unsigned has_maxbans:1; 376 unsigned has_maxbanlength:1; 377 unsigned has_silence_limit:1; 378 #ifdef NEWCHFLOODPROT 379 unsigned has_modef_default_unsettime:1; 380 unsigned has_modef_max_unsettime:1; 381 #endif 382 unsigned has_ban_version_tkl_time:1; 383 unsigned has_spamfilter_ban_time:1; 384 unsigned has_spamfilter_ban_reason:1; 385 unsigned has_spamfilter_virus_help_channel:1; 386 unsigned has_spamfilter_virus_help_channel_deny:1; 387 unsigned has_spamfilter_except:1; 388 unsigned has_hosts_host_on_oper_up:1; 389 unsigned has_network_name:1; 390 unsigned has_default_server:1; 391 unsigned has_services_server:1; 392 unsigned has_sasl_server:1; 393 unsigned has_hosts_global:1; 394 unsigned has_hosts_admin:1; 395 unsigned has_hosts_local:1; 396 unsigned has_hosts_servicesadmin:1; 397 unsigned has_hosts_netadmin:1; 398 unsigned has_hosts_coadmin:1; 399 unsigned has_hiddenhost_prefix:1; 400 unsigned has_prefix_quit:1; 401 unsigned has_help_channel:1; 402 unsigned has_stats_server:1; 403 unsigned has_cloak_keys:1; 404 unsigned has_options_webtv_support:1; 405 unsigned has_options_hide_ulines:1; 406 unsigned has_options_flat_map:1; 407 unsigned has_options_show_opermotd:1; 408 unsigned has_options_identd_check:1; 409 unsigned has_options_fail_oper_warn:1; 410 unsigned has_options_dont_resolve:1; 411 unsigned has_options_show_connect_info:1; 412 unsigned has_options_mkpasswd_for_everyone:1; 413 unsigned has_options_allow_insane_bans:1; 414 unsigned has_options_allow_part_if_shunned:1; 415 unsigned has_options_disable_cap:1; 416 int cgiirc_type; /* cheat :( */ 417 unsigned has_cgiirc_hosts:1; 418 unsigned has_cgiirc_webpass:1; 419 unsigned has_ping_cookie:1; 420 }; 421 422 423