ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/conf.h
Revision: 1715
Committed: Mon Dec 24 15:19:32 2012 UTC (12 years, 8 months ago) by michael
Content type: text/x-chdr
File size: 12592 byte(s)
Log Message:
- Improved WEBIRC authentication; added 'webirc' to auth::flags

File Contents

# User Rev Content
1 adx 30 /*
2     * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 michael 1309 * conf.h: A header for the configuration functions.
4 adx 30 *
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     #ifndef INCLUDED_s_conf_h
26     #define INCLUDED_s_conf_h
27 michael 912 #include "config.h"
28 adx 30 #include "ircd_defs.h"
29     #include "motd.h" /* MessageFile */
30     #include "client.h"
31     #include "hook.h"
32 michael 1632 #include "conf_class.h"
33 adx 30
34 michael 967
35 michael 1646 #define CONF_NOREASON "<No reason supplied>"
36 adx 30
37 michael 967 struct conf_parser_context
38     {
39     unsigned int boot;
40     unsigned int pass;
41 michael 1325 FILE *conf_file;
42 michael 967 };
43    
44     extern struct conf_parser_context conf_parser_ctx;
45    
46 michael 1632 enum maskitem_type
47     {
48     CONF_RESERVED = 1 << 0, /* XXX */
49     CONF_CLIENT = 1 << 1,
50     CONF_SERVER = 1 << 2,
51     CONF_KLINE = 1 << 3,
52     CONF_DLINE = 1 << 4,
53     CONF_EXEMPT = 1 << 5,
54     CONF_CLUSTER = 1 << 6,
55     CONF_RKLINE = 1 << 7,
56     CONF_RXLINE = 1 << 8,
57     CONF_XLINE = 1 << 9,
58     CONF_ULINE = 1 << 10,
59     CONF_GLINE = 1 << 11,
60     CONF_CRESV = 1 << 12,
61     CONF_NRESV = 1 << 13,
62     CONF_SERVICE = 1 << 14,
63     CONF_OPER = 1 << 15,
64     CONF_HUB = 1 << 16, /* XXX There are no separate hub/leaf configs anymore. This is just for /stats h */
65 michael 1644 CONF_CLASS = 1 << 17 /* XXX Same here; just for /stats Y|y */
66 michael 1632 };
67 adx 30
68 michael 593 struct split_nuh_item
69     {
70     dlink_node node;
71    
72     char *nuhmask;
73     char *nickptr;
74     char *userptr;
75     char *hostptr;
76    
77     size_t nicksize;
78     size_t usersize;
79     size_t hostsize;
80     };
81    
82 michael 1632 struct MaskItem
83 adx 30 {
84 michael 1644 struct MaskItem *hnext;
85     dlink_node node;
86     dlink_list leaf_list;
87     dlink_list hub_list;
88 michael 1632 enum maskitem_type type;
89 michael 1644 unsigned int dns_failed;
90     unsigned int dns_pending;
91     unsigned int flags;
92     unsigned int modes;
93     unsigned int port;
94     unsigned int count;
95     unsigned int aftype;
96     unsigned int active;
97     unsigned int htype;
98     unsigned int ref_count; /* Number of *LOCAL* clients using this */
99     int bits;
100 michael 1649 time_t until; /* Hold action until this time (calendar time) */
101 michael 1644 time_t setat;
102     struct irc_ssaddr bind; /* ip to bind to for outgoing connect */
103     struct irc_ssaddr addr; /* ip to connect to */
104     struct ClassItem *class; /* Class of connection */
105     char *name;
106 michael 1649 char *user; /* user part of user@host */
107 michael 1644 char *host; /* host part of user@host */
108     char *passwd;
109     char *spasswd; /* Password to send. */
110     char *reason;
111     char *cipher_list;
112     void *rsa_public_key;
113     void *regexuser;
114     void *regexhost;
115 adx 30 };
116    
117     struct CidrItem
118     {
119 michael 1013 dlink_node node;
120 adx 30 struct irc_ssaddr mask;
121 michael 1644 unsigned int number_on_this_cidr;
122 adx 30 };
123    
124    
125 michael 1636 #define IsConfOperator(x) ((x)->type == CONF_OPER)
126 michael 1632 #define IsConfKill(x) ((x)->type == CONF_KLINE)
127 michael 1636 #define IsConfClient(x) ((x)->type == CONF_CLIENT)
128 michael 1632 #define IsConfGline(x) ((x)->type == CONF_GLINE)
129 adx 30
130 michael 1632 /* MaskItem->flags */
131 adx 30 #define CONF_FLAGS_DO_IDENTD 0x00000001
132     #define CONF_FLAGS_LIMIT_IP 0x00000002
133     #define CONF_FLAGS_NO_TILDE 0x00000004
134     #define CONF_FLAGS_NEED_IDENTD 0x00000008
135 michael 1335 #define CONF_FLAGS_NOMATCH_IP 0x00000010
136     #define CONF_FLAGS_EXEMPTKLINE 0x00000020
137     #define CONF_FLAGS_NOLIMIT 0x00000040
138     #define CONF_FLAGS_SPOOF_IP 0x00000080
139     #define CONF_FLAGS_SPOOF_NOTICE 0x00000100
140     #define CONF_FLAGS_REDIR 0x00000200
141     #define CONF_FLAGS_EXEMPTGLINE 0x00000400
142     #define CONF_FLAGS_CAN_FLOOD 0x00000800
143     #define CONF_FLAGS_NEED_PASSWORD 0x00001000
144     #define CONF_FLAGS_ALLOW_AUTO_CONN 0x00002000
145     #define CONF_FLAGS_ENCRYPTED 0x00004000
146 michael 1628 #define CONF_FLAGS_IN_DATABASE 0x00008000
147 michael 1519 #define CONF_FLAGS_EXEMPTRESV 0x00010000
148     #define CONF_FLAGS_SSL 0x00020000
149 michael 1715 #define CONF_FLAGS_WEBIRC 0x00040000
150 adx 30
151 michael 1632 /* Macros for struct MaskItem */
152 michael 1715 #define IsConfWebIRC(x) ((x)->flags & CONF_FLAGS_WEBIRC)
153 adx 30 #define IsLimitIp(x) ((x)->flags & CONF_FLAGS_LIMIT_IP)
154     #define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE)
155     #define IsConfCanFlood(x) ((x)->flags & CONF_FLAGS_CAN_FLOOD)
156     #define IsNeedPassword(x) ((x)->flags & CONF_FLAGS_NEED_PASSWORD)
157     #define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD)
158     #define IsNoMatchIp(x) ((x)->flags & CONF_FLAGS_NOMATCH_IP)
159     #define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE)
160     #define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT)
161     #define IsConfExemptGline(x) ((x)->flags & CONF_FLAGS_EXEMPTGLINE)
162     #define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV)
163     #define IsConfDoIdentd(x) ((x)->flags & CONF_FLAGS_DO_IDENTD)
164     #define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP)
165     #define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE)
166     #define IsConfEncrypted(x) ((x)->flags & CONF_FLAGS_ENCRYPTED)
167     #define SetConfEncrypted(x) ((x)->flags |= CONF_FLAGS_ENCRYPTED)
168     #define ClearConfEncrypted(x) ((x)->flags &= ~CONF_FLAGS_ENCRYPTED)
169     #define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN)
170     #define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN)
171     #define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN)
172     #define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR)
173 michael 1303 #define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL)
174     #define SetConfSSL(x) ((x)->flags |= CONF_FLAGS_SSL)
175     #define ClearConfSSL(x) ((x)->flags &= ~CONF_FLAGS_SSL)
176 michael 1628 #define IsConfDatabase(x) ((x)->flags & CONF_FLAGS_IN_DATABASE)
177     #define SetConfDatabase(x) ((x)->flags |= CONF_FLAGS_IN_DATABASE)
178 adx 30
179 michael 1628
180 adx 30 /* shared/cluster server entry types
181     * These defines are used for both shared and cluster.
182     */
183     #define SHARED_KLINE 0x0001
184 michael 1301 #define SHARED_UNKLINE 0x0002
185     #define SHARED_XLINE 0x0004
186     #define SHARED_UNXLINE 0x0008
187     #define SHARED_RESV 0x0010
188     #define SHARED_UNRESV 0x0020
189     #define SHARED_LOCOPS 0x0040
190     #define SHARED_DLINE 0x0080
191     #define SHARED_UNDLINE 0x0100
192     #define SHARED_ALL (SHARED_KLINE | SHARED_UNKLINE |\
193     SHARED_XLINE | SHARED_UNXLINE |\
194     SHARED_RESV | SHARED_UNRESV |\
195     SHARED_LOCOPS | SHARED_DLINE | SHARED_UNDLINE)
196 adx 30
197     struct config_file_entry
198     {
199     const char *dpath; /* DPATH if set from command line */
200     const char *configfile;
201     const char *klinefile;
202 michael 1702 const char *glinefile;
203 adx 30 const char *xlinefile;
204     const char *dlinefile;
205 michael 1702 const char *resvfile;
206 adx 30
207     char *egdpool_path;
208 michael 1157 char *service_name;
209 adx 30
210     MessageFile motd;
211     MessageFile linksfile;
212    
213     int gline_min_cidr;
214     int gline_min_cidr6;
215     int dots_in_ident;
216     int failed_oper_notice;
217     int anti_spam_exit_message_time;
218 michael 950 unsigned int max_accept;
219     unsigned int max_watch;
220 adx 30 int max_nick_time;
221 michael 950 unsigned int max_nick_changes;
222 adx 30 int ts_max_delta;
223     int ts_warn_delta;
224     int anti_nick_flood;
225     int warn_no_nline;
226     int invisible_on_connect;
227 michael 584 int stats_e_disabled;
228 adx 30 int stats_o_oper_only;
229     int stats_k_oper_only;
230     int stats_i_oper_only;
231     int stats_P_oper_only;
232     int short_motd;
233     int no_oper_flood;
234     int true_no_oper_flood;
235     int oper_pass_resv;
236     int glines;
237     int hide_spoof_ips;
238     int tkline_expire_notices;
239     int opers_bypass_callerid;
240     int ignore_bogus_ts;
241     int pace_wait;
242     int pace_wait_simple;
243     int gline_time;
244 michael 1459 int gline_request_time;
245 adx 30 int oper_only_umodes;
246     int oper_umodes;
247     int max_targets;
248     int caller_id_wait;
249     int min_nonwildcard;
250     int min_nonwildcard_simple;
251     int kill_chase_time_limit;
252     int default_floodcount;
253     /* 0 == don't use throttle... */
254     int throttle_time;
255     int use_egd;
256     int ping_cookie;
257     int disable_auth;
258     int disable_remote;
259     };
260    
261     struct config_channel_entry
262     {
263 michael 632 int disable_fake_channels;
264 adx 30 int restrict_channels;
265     int knock_delay;
266     int knock_delay_channel;
267     unsigned int max_bans;
268     unsigned int max_chans_per_user;
269 michael 1432 unsigned int max_chans_per_oper;
270 adx 30 int no_create_on_split;
271     int no_join_on_split;
272     int quiet_on_ban;
273     int default_split_server_count;
274     int default_split_user_count;
275     };
276    
277     struct config_server_hide
278     {
279 michael 1013 char *hidden_name;
280 adx 30 int flatten_links;
281     int hide_servers;
282     int links_delay;
283     int links_disabled;
284     int hidden;
285     int hide_server_ips;
286     };
287    
288     struct server_info
289     {
290 michael 1013 char *sid;
291 adx 30 char *name;
292     char *description;
293     char *network_name;
294     char *network_desc;
295     char *rsa_private_key_file;
296 michael 1644 void *rsa_private_key;
297     void *server_ctx;
298     void *client_ctx;
299 adx 30 int hub;
300     struct irc_ssaddr ip;
301     struct irc_ssaddr ip6;
302 michael 1013 unsigned int max_clients;
303 adx 30 int specific_ipv4_vhost;
304     int specific_ipv6_vhost;
305     struct sockaddr_in dns_host;
306     int can_use_v6;
307     };
308    
309     struct admin_info
310     {
311     char *name;
312     char *description;
313     char *email;
314     };
315    
316     struct logging_entry
317     {
318     unsigned int use_logging;
319     };
320    
321     extern dlink_list server_items;
322     extern dlink_list cluster_items;
323 michael 1622 extern dlink_list xconf_items;
324 adx 30 extern dlink_list rxconf_items;
325     extern dlink_list rkconf_items;
326 michael 1157 extern dlink_list service_items;
327 adx 30 extern struct logging_entry ConfigLoggingEntry;
328     extern struct config_file_entry ConfigFileEntry;/* defined in ircd.c*/
329     extern struct config_channel_entry ConfigChannel;/* defined in channel.c*/
330     extern struct config_server_hide ConfigServerHide; /* defined in s_conf.c */
331     extern struct server_info ServerInfo; /* defined in ircd.c */
332     extern struct admin_info AdminInfo; /* defined in ircd.c */
333     extern int valid_wild_card(struct Client *, int, int, ...);
334     /* End GLOBAL section */
335    
336 michael 1632
337    
338    
339 adx 30 extern void init_ip_hash_table(void);
340 michael 948 extern void count_ip_hash(unsigned int *, uint64_t *);
341 adx 30 extern void remove_one_ip(struct irc_ssaddr *);
342 michael 1632 extern struct MaskItem *conf_make(enum maskitem_type);
343 adx 30 extern void read_conf_files(int);
344 michael 1632 extern int attach_conf(struct Client *, struct MaskItem *);
345 adx 30 extern int attach_connect_block(struct Client *, const char *, const char *);
346 michael 1644 extern int check_client(struct Client *);
347 adx 30
348 michael 1644
349 michael 1632 extern void detach_conf(struct Client *, enum maskitem_type);
350     extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type);
351     extern struct MaskItem *find_kill(struct Client *);
352     extern struct MaskItem *find_gline(struct Client *);
353 adx 30 extern int conf_connect_allowed(struct irc_ssaddr *, int);
354     extern char *oper_privs_as_string(const unsigned int);
355 michael 593 extern void split_nuh(struct split_nuh_item *);
356 michael 1632 extern struct MaskItem *find_matching_name_conf(enum maskitem_type, const char *,
357     const char *, const char *, unsigned int);
358     extern struct MaskItem *find_exact_name_conf(enum maskitem_type, const struct Client *, const char *,
359 adx 30 const char *, const char *);
360 michael 1632 extern void conf_free(struct MaskItem *);
361     extern void report_confitem_types(struct Client *, enum maskitem_type);
362 adx 30 extern void yyerror(const char *);
363     extern void cleanup_tklines(void *);
364     extern int rehash(int);
365 michael 1647 extern void lookup_confhost(struct MaskItem *);
366 michael 1632 extern void conf_add_class_to_conf(struct MaskItem *, const char *);
367 adx 30
368 michael 1364 extern const char *get_oper_name(const struct Client *);
369 adx 30
370     /* XXX should the parse_aline stuff go into another file ?? */
371     #define AWILD 0x1 /* check wild cards */
372     extern int parse_aline(const char *, struct Client *, int, char **,
373     int, char **, char **, time_t *, char **, char **);
374     extern int valid_comment(struct Client *, char *, int);
375    
376    
377     #define TK_SECONDS 0
378     #define TK_MINUTES 1
379 michael 1120 extern time_t valid_tkline(const char *, int);
380 michael 1632 extern int match_conf_password(const char *, const struct MaskItem *);
381 adx 30
382     #define NOT_AUTHORIZED (-1)
383 michael 618 #define I_LINE_FULL (-2)
384     #define TOO_MANY (-3)
385     #define BANNED_CLIENT (-4)
386     #define TOO_FAST (-5)
387 adx 30
388 michael 1370 #define CLEANUP_TKLINES_TIME 60
389 adx 30
390     extern void cluster_a_line(struct Client *,
391     const char *, int, int, const char *,...);
392     #endif /* INCLUDED_s_conf_h */

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision