unrealircd

- supernets unrealircd source & configuration
git clone git://git.acid.vegas/unrealircd.git
Log | Files | Refs | Archive | README | LICENSE

dynconf.h (11829B)

      1 /************************************************************************
      2  *   Unreal Internet Relay Chat Daemon, include/dynconf.h
      3  *   Copyright (C) 1999-2003 Carsten Munk
      4  *   Copyright (C) 2003-2021 Bram Matthys
      5  *
      6  *   This program is free software; you can redistribute it and/or modify
      7  *   it under the terms of the GNU General Public License as published by
      8  *   the Free Software Foundation; either version 1, or (at your option)
      9  *   any later version.
     10  *
     11  *   This program is distributed in the hope that it will be useful,
     12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14  *   GNU General Public License for more details.
     15  *
     16  *   You should have received a copy of the GNU General Public License
     17  *   along with this program; if not, write to the Free Software
     18  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     19  *
     20  *   $Id$
     21  */
     22 
     23 
     24 #define DYNCONF_H
     25 
     26 typedef struct FloodSettings FloodSettings;
     27 
     28 struct FloodSettings {
     29 	FloodSettings *prev, *next;
     30 	char *name;
     31 	int limit[MAXFLOODOPTIONS];
     32 	long period[MAXFLOODOPTIONS];
     33 };
     34 
     35 enum UHAllowed { UHALLOW_ALWAYS, UHALLOW_NOCHANS, UHALLOW_REJOIN, UHALLOW_NEVER };
     36 
     37 struct ChMode {
     38 	long mode;
     39 	long extmodes;
     40 	char *extparams[256];
     41 };
     42 
     43 typedef struct OperStat {
     44 	struct OperStat *prev, *next;
     45 	char *flag;
     46 } OperStat;
     47 
     48 typedef enum BroadcastChannelMessagesOption { BROADCAST_CHANNEL_MESSAGES_AUTO=1, BROADCAST_CHANNEL_MESSAGES_ALWAYS=2, BROADCAST_CHANNEL_MESSAGES_NEVER=3 } BroadcastChannelMessagesOption;
     49 
     50 typedef enum AllowedChannelChars { ALLOWED_CHANNELCHARS_ANY=1, ALLOWED_CHANNELCHARS_ASCII=2, ALLOWED_CHANNELCHARS_UTF8=3 } AllowedChannelChars;
     51 
     52 typedef enum BanTarget { BAN_TARGET_IP=1, BAN_TARGET_USERIP=2, BAN_TARGET_HOST=3, BAN_TARGET_USERHOST=4, BAN_TARGET_ACCOUNT=5, BAN_TARGET_CERTFP=6 } BanTarget;
     53 
     54 typedef enum HideIdleTimePolicy { HIDE_IDLE_TIME_NEVER=1, HIDE_IDLE_TIME_ALWAYS=2, HIDE_IDLE_TIME_USERMODE=3, HIDE_IDLE_TIME_OPER_USERMODE=4 } HideIdleTimePolicy;
     55 
     56 typedef enum LimitSVSCMDS { LIMIT_SVSCMDS_SERVERS=0, LIMIT_SVSCMDS_ULINES=1 } LimitSVSCMDS;
     57 
     58 /** The set { } block configuration */
     59 typedef struct Configuration Configuration;
     60 struct Configuration {
     61 	unsigned show_opermotd:1;
     62 	unsigned hide_ulines:1;
     63 	unsigned flat_map:1;
     64 	unsigned ident_check:1;
     65 	unsigned fail_oper_warn:1;
     66 	unsigned show_connect_info:1;
     67 	unsigned no_connect_tls_info:1;
     68 	unsigned dont_resolve:1;
     69 	unsigned use_ban_version:1;
     70 	unsigned mkpasswd_for_everyone:1;
     71 	unsigned hide_ban_reason;
     72 	unsigned allow_insane_bans;
     73 	unsigned allow_part_if_shunned:1;
     74 	unsigned disable_cap:1;
     75 	unsigned check_target_nick_bans:1;
     76 	char *link_bindip;
     77 	long throttle_period;
     78 	char throttle_count;
     79 	char *kline_address;
     80 	char *gline_address;
     81 	long conn_modes;
     82 	long oper_modes;
     83 	char *oper_snomask;
     84 	char *auto_join_chans;
     85 	char *oper_auto_join_chans;
     86 	char *allow_user_stats;
     87 	OperStat *allow_user_stats_ext;
     88 	int ping_warning;
     89 	int maxchannelsperuser;
     90 	int maxdccallow;
     91 	int anti_spam_quit_message_time;
     92 	char *static_quit;
     93 	char *static_part;
     94 	TLSOptions *tls_options;
     95 	Policy plaintext_policy_user;
     96 	MultiLine *plaintext_policy_user_message;
     97 	Policy plaintext_policy_oper;
     98 	MultiLine *plaintext_policy_oper_message;
     99 	Policy plaintext_policy_server;
    100 	Policy outdated_tls_policy_user;
    101 	char *outdated_tls_policy_user_message;
    102 	Policy outdated_tls_policy_oper;
    103 	char *outdated_tls_policy_oper_message;
    104 	Policy outdated_tls_policy_server;
    105 	enum UHAllowed userhost_allowed;
    106 	char *restrict_usermodes;
    107 	char *restrict_channelmodes;
    108 	char *restrict_extendedbans;
    109 	int named_extended_bans;
    110 	char *channel_command_prefix;
    111 	long handshake_data_flood_amount;
    112 	long handshake_data_flood_ban_time;
    113 	int handshake_data_flood_ban_action;
    114 	struct ChMode modes_on_join;
    115 	int modes_on_join_set;
    116 	char *level_on_join;
    117 	FloodSettings *floodsettings;
    118 	int ident_connect_timeout;
    119 	int ident_read_timeout;
    120 	long default_bantime;
    121 	int who_limit;
    122 	int silence_limit;
    123 	long ban_version_tkl_time;
    124 	long spamfilter_ban_time;
    125 	char *spamfilter_ban_reason;
    126 	char *spamfilter_virus_help_channel;
    127 	char spamfilter_vchan_deny;
    128 	SpamExcept *spamexcept;
    129 	char *spamexcept_line;
    130 	long spamfilter_detectslow_warn;
    131 	long spamfilter_detectslow_fatal;
    132 	int spamfilter_stop_on_first_match;
    133 	int spamfilter_utf8;
    134 	int maxbans;
    135 	int maxbanlength;
    136 	int watch_away_notification;
    137 	int uhnames;
    138 	unsigned short default_ipv6_clone_mask;
    139 	int ping_cookie;
    140 	int min_nick_length;
    141 	int nick_length;
    142 	int topic_length;
    143 	int kick_length;
    144 	int quit_length;
    145 	int away_length;
    146 	int hide_list;
    147 	int max_unknown_connections_per_ip;
    148 	long handshake_timeout;
    149 	long sasl_timeout;
    150 	long handshake_delay;
    151 	BanTarget automatic_ban_target;
    152 	BanTarget manual_ban_target;
    153 	char *reject_message_too_many_connections;
    154 	char *reject_message_server_full;
    155 	char *reject_message_unauthorized;
    156 	char *reject_message_kline;
    157 	char *reject_message_gline;
    158 	int topic_setter;
    159 	int ban_setter;
    160 	int ban_setter_sync;
    161 	int part_instead_of_quit_on_comment_change;
    162 	BroadcastChannelMessagesOption broadcast_channel_messages;
    163 	AllowedChannelChars allowed_channelchars;
    164 	HideIdleTimePolicy hide_idle_time;
    165 	unsigned inah:1;
    166 	char *network_name;
    167 	char *network_name_005;
    168 	char *default_server;
    169 	char *services_name;
    170 	char *cloak_prefix;
    171 	char *prefix_quit;
    172 	char *helpchan;
    173 	char *stats_server;
    174 	char *sasl_server;
    175 	int server_notice_colors;
    176 	int server_notice_show_event;
    177 	LimitSVSCMDS limit_svscmds;
    178 };
    179 
    180 extern MODVAR Configuration iConf;
    181 extern MODVAR Configuration tempiConf;
    182 extern MODVAR int ipv6_disabled;
    183 
    184 #define KLINE_ADDRESS			iConf.kline_address
    185 #define GLINE_ADDRESS			iConf.gline_address
    186 #define CONN_MODES			iConf.conn_modes
    187 #define OPER_MODES			iConf.oper_modes
    188 #define OPER_SNOMASK			iConf.oper_snomask
    189 #define SHOWOPERMOTD			iConf.show_opermotd
    190 #define HIDE_ULINES			iConf.hide_ulines
    191 #define FLAT_MAP			iConf.flat_map
    192 #define ALLOW_CHATOPS			iConf.allow_chatops
    193 #define PINGWARNING			iConf.ping_warning
    194 #define MAXCHANNELSPERUSER		iConf.maxchannelsperuser
    195 #define MAXDCCALLOW			iConf.maxdccallow
    196 #define DONT_RESOLVE			iConf.dont_resolve
    197 #define AUTO_JOIN_CHANS			iConf.auto_join_chans
    198 #define OPER_AUTO_JOIN_CHANS		iConf.oper_auto_join_chans
    199 #define LINK_BINDIP			iConf.link_bindip
    200 #define IDENT_CHECK			iConf.ident_check
    201 #define FAILOPER_WARN			iConf.fail_oper_warn
    202 #define SHOWCONNECTINFO			iConf.show_connect_info
    203 #define NOCONNECTTLSLINFO		iConf.no_connect_tls_info
    204 #define ALLOW_USER_STATS			iConf.allow_user_stats
    205 #define ANTI_SPAM_QUIT_MSG_TIME		iConf.anti_spam_quit_message_time
    206 
    207 #define NETWORK_NAME			iConf.network_name
    208 #define NETWORK_NAME_005		iConf.network_name_005
    209 #define DEFAULT_SERVER			iConf.default_server
    210 #define SERVICES_NAME			iConf.services_name
    211 #define CLOAK_PREFIX			iConf.cloak_prefix
    212 #define HELP_CHANNEL			iConf.helpchan
    213 #define STATS_SERVER			iConf.stats_server
    214 #define SASL_SERVER			iConf.sasl_server
    215 #define iNAH				iConf.inah
    216 #define PREFIX_QUIT			iConf.prefix_quit
    217 
    218 #define STATIC_QUIT			iConf.static_quit
    219 #define STATIC_PART			iConf.static_part
    220 #define UHOST_ALLOWED			iConf.userhost_allowed
    221 #define RESTRICT_USERMODES		iConf.restrict_usermodes
    222 #define RESTRICT_CHANNELMODES		iConf.restrict_channelmodes
    223 #define RESTRICT_EXTENDEDBANS		iConf.restrict_extendedbans
    224 #define THROTTLING_PERIOD		iConf.throttle_period
    225 #define THROTTLING_COUNT		iConf.throttle_count
    226 #define USE_BAN_VERSION			iConf.use_ban_version
    227 #define MODES_ON_JOIN			iConf.modes_on_join.extmodes
    228 #define LEVEL_ON_JOIN			iConf.level_on_join
    229 
    230 #define IDENT_CONNECT_TIMEOUT	iConf.ident_connect_timeout
    231 #define IDENT_READ_TIMEOUT		iConf.ident_read_timeout
    232 
    233 #define MKPASSWD_FOR_EVERYONE	iConf.mkpasswd_for_everyone
    234 #define HIDE_BAN_REASON		iConf.hide_ban_reason
    235 #define ALLOW_INSANE_BANS		iConf.allow_insane_bans
    236 #define CHANCMDPFX iConf.channel_command_prefix
    237 
    238 #define DEFAULT_BANTIME			iConf.default_bantime
    239 #define WHOLIMIT			iConf.who_limit
    240 
    241 #define ALLOW_PART_IF_SHUNNED	iConf.allow_part_if_shunned
    242 
    243 #define DISABLE_CAP	iConf.disable_cap
    244 
    245 #define DISABLE_IPV6	ipv6_disabled
    246 
    247 #define BAN_VERSION_TKL_TIME	iConf.ban_version_tkl_time
    248 #define SILENCE_LIMIT (iConf.silence_limit ? iConf.silence_limit : 15)
    249 
    250 #define SPAMFILTER_BAN_TIME		iConf.spamfilter_ban_time
    251 #define SPAMFILTER_BAN_REASON	iConf.spamfilter_ban_reason
    252 #define SPAMFILTER_VIRUSCHAN	iConf.spamfilter_virus_help_channel
    253 #define SPAMFILTER_VIRUSCHANDENY	iConf.spamfilter_vchan_deny
    254 #define SPAMFILTER_EXCEPT		iConf.spamexcept_line
    255 #define SPAMFILTER_DETECTSLOW_WARN	iConf.spamfilter_detectslow_warn
    256 #define SPAMFILTER_DETECTSLOW_FATAL	iConf.spamfilter_detectslow_fatal
    257 #define SPAMFILTER_STOP_ON_FIRST_MATCH	iConf.spamfilter_stop_on_first_match
    258 
    259 #define CHECK_TARGET_NICK_BANS	iConf.check_target_nick_bans
    260 
    261 #define MAXBANS		iConf.maxbans
    262 #define MAXBANLENGTH	iConf.maxbanlength
    263 
    264 #define WATCH_AWAY_NOTIFICATION	iConf.watch_away_notification
    265 
    266 #define UHNAMES_ENABLED	iConf.uhnames
    267 
    268 /** Used for testing the set { } block configuration.
    269  * It tests if a setting is present and is also used for duplicate checking.
    270  */
    271 struct SetCheck {
    272 	unsigned has_show_opermotd:1;
    273 	unsigned has_hide_ulines:1;
    274 	unsigned has_flat_map:1;
    275 	unsigned has_allow_chatops:1;
    276 	unsigned has_ident_check:1;
    277 	unsigned has_fail_oper_warn:1;
    278 	unsigned has_show_connect_info:1;
    279 	unsigned has_dont_resolve:1;
    280 	unsigned has_mkpasswd_for_everyone:1;
    281 	unsigned has_allow_part_if_shunned:1;
    282 	unsigned has_tls_server_cipher_list :1;
    283 	unsigned has_tls_protocols :1;
    284 	unsigned has_dns_bind_ip:1;
    285 	unsigned has_link_bind_ip:1;
    286 	unsigned has_throttle_period:1;
    287 	unsigned has_throttle_connections:1;
    288 	unsigned has_kline_address:1;
    289 	unsigned has_gline_address:1;
    290 	unsigned has_modes_on_connect:1;
    291 	unsigned has_modes_on_oper:1;
    292 	unsigned has_snomask_on_connect:1;
    293 	unsigned has_snomask_on_oper:1;
    294 	unsigned has_auto_join:1;
    295 	unsigned has_oper_auto_join:1;
    296 	unsigned has_check_target_nick_bans:1;
    297 	unsigned has_watch_away_notification:1;
    298 	unsigned has_uhnames:1;
    299 	unsigned has_allow_user_stats:1;
    300 	unsigned has_ping_warning:1;
    301 	unsigned has_maxchannelsperuser:1;
    302 	unsigned has_maxdccallow:1;
    303 	unsigned has_anti_spam_quit_message_time:1;
    304 	unsigned has_static_quit:1;
    305 	unsigned has_static_part:1;
    306 	unsigned has_allow_userhost_change:1;
    307 	unsigned has_restrict_usermodes:1;
    308 	unsigned has_restrict_channelmodes:1;
    309 	unsigned has_restrict_extendedbans:1;
    310 	unsigned has_channel_command_prefix:1;
    311 	unsigned has_modes_on_join:1;
    312 	unsigned has_level_on_join:1;
    313 	unsigned has_ident_connect_timeout:1;
    314 	unsigned has_ident_read_timeout:1;
    315 	unsigned has_default_bantime:1;
    316 	unsigned has_who_limit:1;
    317 	unsigned has_maxbans:1;
    318 	unsigned has_maxbanlength:1;
    319 	unsigned has_silence_limit:1;
    320 	unsigned has_ban_version_tkl_time:1;
    321 	unsigned has_spamfilter_ban_time:1;
    322 	unsigned has_spamfilter_ban_reason:1;
    323 	unsigned has_spamfilter_virus_help_channel:1;
    324 	unsigned has_spamfilter_virus_help_channel_deny:1;
    325 	unsigned has_spamfilter_except:1;
    326 	unsigned has_network_name:1;
    327 	unsigned has_default_server:1;
    328 	unsigned has_services_server:1;
    329 	unsigned has_sasl_server:1;
    330 	unsigned has_hiddenhost_prefix:1;
    331 	unsigned has_prefix_quit:1;
    332 	unsigned has_help_channel:1;
    333 	unsigned has_stats_server:1;
    334 	unsigned has_cloak_keys:1;
    335 	unsigned has_options_hide_ulines:1;
    336 	unsigned has_options_flat_map:1;
    337 	unsigned has_options_show_opermotd:1;
    338 	unsigned has_options_identd_check:1;
    339 	unsigned has_options_fail_oper_warn:1;
    340 	unsigned has_options_dont_resolve:1;
    341 	unsigned has_options_show_connect_info:1;
    342 	unsigned has_options_no_connect_tls_info:1;
    343 	unsigned has_options_mkpasswd_for_everyone:1;
    344 	unsigned has_options_allow_insane_bans:1;
    345 	unsigned has_options_allow_part_if_shunned:1;
    346 	unsigned has_options_disable_cap:1;
    347 	unsigned has_options_disable_ipv6:1;
    348 	unsigned has_ping_cookie:1;
    349 	unsigned has_min_nick_length:1;
    350 	unsigned has_nick_length:1;
    351 	unsigned has_hide_ban_reason:1;
    352 };