1 |
|
/* |
2 |
< |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
< |
* s_conf.h: A header for the configuration functions. |
2 |
> |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
|
* |
4 |
< |
* Copyright (C) 2005 by the past and present ircd coders, and others. |
4 |
> |
* Copyright (c) 1997-2014 ircd-hybrid development team |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
17 |
|
* along with this program; if not, write to the Free Software |
18 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
19 |
|
* USA |
20 |
< |
* |
21 |
< |
* $Id$ |
20 |
> |
*/ |
21 |
> |
|
22 |
> |
/*! \file conf.h |
23 |
> |
* \brief A header for the configuration functions. |
24 |
> |
* \version $Id$ |
25 |
|
*/ |
26 |
|
|
27 |
|
#ifndef INCLUDED_s_conf_h |
28 |
|
#define INCLUDED_s_conf_h |
29 |
< |
#include "setup.h" |
28 |
< |
#ifdef HAVE_LIBCRYPTO |
29 |
< |
#include <openssl/rsa.h> |
30 |
< |
#endif |
31 |
< |
#include "fileio.h" /* FBFILE */ |
29 |
> |
#include "config.h" |
30 |
|
#include "ircd_defs.h" |
33 |
– |
#include "motd.h" /* MessageFile */ |
31 |
|
#include "client.h" |
32 |
< |
#include "hook.h" |
33 |
< |
#include "pcre.h" |
32 |
> |
#include "conf_class.h" |
33 |
> |
|
34 |
> |
|
35 |
> |
#define CONF_NOREASON "<No reason supplied>" |
36 |
|
|
37 |
< |
struct Client; |
38 |
< |
struct DNSReply; |
39 |
< |
struct hostent; |
40 |
< |
|
41 |
< |
extern FBFILE *conf_fbfile_in; |
42 |
< |
extern struct Callback *client_check_cb; |
43 |
< |
|
44 |
< |
typedef enum |
45 |
< |
{ |
46 |
< |
CONF_TYPE, |
47 |
< |
CLASS_TYPE, |
48 |
< |
OPER_TYPE, |
49 |
< |
CLIENT_TYPE, |
50 |
< |
SERVER_TYPE, |
51 |
< |
HUB_TYPE, |
52 |
< |
LEAF_TYPE, |
53 |
< |
KLINE_TYPE, |
54 |
< |
DLINE_TYPE, |
55 |
< |
EXEMPTDLINE_TYPE, |
56 |
< |
CLUSTER_TYPE, |
57 |
< |
RKLINE_TYPE, |
58 |
< |
RXLINE_TYPE, |
59 |
< |
XLINE_TYPE, |
60 |
< |
ULINE_TYPE, |
61 |
< |
GLINE_TYPE, |
62 |
< |
CRESV_TYPE, |
63 |
< |
NRESV_TYPE, |
64 |
< |
GDENY_TYPE |
65 |
< |
} ConfType; |
37 |
> |
#define IsConfOperator(x) ((x)->type == CONF_OPER) |
38 |
> |
#define IsConfKill(x) ((x)->type == CONF_KLINE) |
39 |
> |
#define IsConfClient(x) ((x)->type == CONF_CLIENT) |
40 |
> |
#define IsConfGline(x) ((x)->type == CONF_GLINE) |
41 |
> |
|
42 |
> |
/* MaskItem->flags */ |
43 |
> |
#define CONF_FLAGS_DO_IDENTD 0x00000001 |
44 |
> |
#define CONF_FLAGS_NO_TILDE 0x00000004 |
45 |
> |
#define CONF_FLAGS_NEED_IDENTD 0x00000008 |
46 |
> |
#define CONF_FLAGS_EXEMPTKLINE 0x00000010 |
47 |
> |
#define CONF_FLAGS_NOLIMIT 0x00000020 |
48 |
> |
#define CONF_FLAGS_SPOOF_IP 0x00000040 |
49 |
> |
#define CONF_FLAGS_SPOOF_NOTICE 0x00000080 |
50 |
> |
#define CONF_FLAGS_REDIR 0x00000100 |
51 |
> |
#define CONF_FLAGS_EXEMPTGLINE 0x00000200 |
52 |
> |
#define CONF_FLAGS_CAN_FLOOD 0x00000400 |
53 |
> |
#define CONF_FLAGS_NEED_PASSWORD 0x00000800 |
54 |
> |
#define CONF_FLAGS_ALLOW_AUTO_CONN 0x00001000 |
55 |
> |
#define CONF_FLAGS_ENCRYPTED 0x00002000 |
56 |
> |
#define CONF_FLAGS_IN_DATABASE 0x00004000 |
57 |
> |
#define CONF_FLAGS_EXEMPTRESV 0x00008000 |
58 |
> |
#define CONF_FLAGS_SSL 0x00010000 |
59 |
> |
#define CONF_FLAGS_WEBIRC 0x00020000 |
60 |
> |
|
61 |
> |
/* Macros for struct MaskItem */ |
62 |
> |
#define IsConfWebIRC(x) ((x)->flags & CONF_FLAGS_WEBIRC) |
63 |
> |
#define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE) |
64 |
> |
#define IsConfCanFlood(x) ((x)->flags & CONF_FLAGS_CAN_FLOOD) |
65 |
> |
#define IsNeedPassword(x) ((x)->flags & CONF_FLAGS_NEED_PASSWORD) |
66 |
> |
#define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD) |
67 |
> |
#define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE) |
68 |
> |
#define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT) |
69 |
> |
#define IsConfExemptGline(x) ((x)->flags & CONF_FLAGS_EXEMPTGLINE) |
70 |
> |
#define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV) |
71 |
> |
#define IsConfDoIdentd(x) ((x)->flags & CONF_FLAGS_DO_IDENTD) |
72 |
> |
#define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP) |
73 |
> |
#define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE) |
74 |
> |
#define IsConfEncrypted(x) ((x)->flags & CONF_FLAGS_ENCRYPTED) |
75 |
> |
#define SetConfEncrypted(x) ((x)->flags |= CONF_FLAGS_ENCRYPTED) |
76 |
> |
#define ClearConfEncrypted(x) ((x)->flags &= ~CONF_FLAGS_ENCRYPTED) |
77 |
> |
#define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN) |
78 |
> |
#define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN) |
79 |
> |
#define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN) |
80 |
> |
#define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR) |
81 |
> |
#define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL) |
82 |
> |
#define SetConfSSL(x) ((x)->flags |= CONF_FLAGS_SSL) |
83 |
> |
#define ClearConfSSL(x) ((x)->flags &= ~CONF_FLAGS_SSL) |
84 |
> |
#define IsConfDatabase(x) ((x)->flags & CONF_FLAGS_IN_DATABASE) |
85 |
> |
#define SetConfDatabase(x) ((x)->flags |= CONF_FLAGS_IN_DATABASE) |
86 |
> |
|
87 |
> |
|
88 |
> |
/* shared/cluster server entry types |
89 |
> |
* These defines are used for both shared and cluster. |
90 |
> |
*/ |
91 |
> |
#define SHARED_KLINE 0x0001 |
92 |
> |
#define SHARED_UNKLINE 0x0002 |
93 |
> |
#define SHARED_XLINE 0x0004 |
94 |
> |
#define SHARED_UNXLINE 0x0008 |
95 |
> |
#define SHARED_RESV 0x0010 |
96 |
> |
#define SHARED_UNRESV 0x0020 |
97 |
> |
#define SHARED_LOCOPS 0x0040 |
98 |
> |
#define SHARED_DLINE 0x0080 |
99 |
> |
#define SHARED_UNDLINE 0x0100 |
100 |
> |
#define SHARED_ALL (SHARED_KLINE | SHARED_UNKLINE |\ |
101 |
> |
SHARED_XLINE | SHARED_UNXLINE |\ |
102 |
> |
SHARED_RESV | SHARED_UNRESV |\ |
103 |
> |
SHARED_LOCOPS | SHARED_DLINE | SHARED_UNDLINE) |
104 |
> |
|
105 |
> |
|
106 |
> |
enum maskitem_type |
107 |
> |
{ |
108 |
> |
CONF_CLIENT = 1 << 0, |
109 |
> |
CONF_SERVER = 1 << 1, |
110 |
> |
CONF_KLINE = 1 << 2, |
111 |
> |
CONF_DLINE = 1 << 3, |
112 |
> |
CONF_EXEMPT = 1 << 4, |
113 |
> |
CONF_CLUSTER = 1 << 5, |
114 |
> |
CONF_XLINE = 1 << 6, |
115 |
> |
CONF_ULINE = 1 << 7, |
116 |
> |
CONF_GLINE = 1 << 8, |
117 |
> |
CONF_CRESV = 1 << 9, |
118 |
> |
CONF_NRESV = 1 << 10, |
119 |
> |
CONF_SERVICE = 1 << 11, |
120 |
> |
CONF_OPER = 1 << 12, |
121 |
> |
}; |
122 |
> |
|
123 |
> |
enum |
124 |
> |
{ |
125 |
> |
NOT_AUTHORIZED = -1, |
126 |
> |
I_LINE_FULL = -2, |
127 |
> |
TOO_MANY = -3, |
128 |
> |
BANNED_CLIENT = -4, |
129 |
> |
TOO_FAST = -5 |
130 |
> |
}; |
131 |
> |
|
132 |
> |
struct conf_parser_context |
133 |
> |
{ |
134 |
> |
unsigned int boot; |
135 |
> |
unsigned int pass; |
136 |
> |
FILE *conf_file; |
137 |
> |
}; |
138 |
|
|
139 |
|
struct split_nuh_item |
140 |
|
{ |
150 |
|
size_t hostsize; |
151 |
|
}; |
152 |
|
|
153 |
< |
struct ConfItem |
153 |
> |
struct MaskItem |
154 |
|
{ |
155 |
< |
char *name; /* Primary key */ |
156 |
< |
pcre *regexpname; |
157 |
< |
dlink_node node; /* link into known ConfItems of this type */ |
158 |
< |
unsigned int flags; |
159 |
< |
ConfType type; |
155 |
> |
dlink_node node; |
156 |
> |
dlink_list leaf_list; |
157 |
> |
dlink_list hub_list; |
158 |
> |
dlink_list exempt_list; |
159 |
> |
enum maskitem_type type; |
160 |
> |
unsigned int dns_failed; |
161 |
> |
unsigned int dns_pending; |
162 |
> |
unsigned int flags; |
163 |
> |
unsigned int modes; |
164 |
> |
unsigned int port; |
165 |
> |
unsigned int count; |
166 |
> |
unsigned int aftype; |
167 |
> |
unsigned int active; |
168 |
> |
unsigned int htype; |
169 |
> |
unsigned int ref_count; /* Number of *LOCAL* clients using this */ |
170 |
> |
int bits; |
171 |
> |
time_t until; /* Hold action until this time (calendar time) */ |
172 |
> |
time_t setat; |
173 |
> |
struct irc_ssaddr bind; /* ip to bind to for outgoing connect */ |
174 |
> |
struct irc_ssaddr addr; /* ip to connect to */ |
175 |
> |
struct ClassItem *class; /* Class of connection */ |
176 |
> |
char *name; |
177 |
> |
char *user; /* user part of user@host */ |
178 |
> |
char *host; /* host part of user@host */ |
179 |
> |
char *passwd; |
180 |
> |
char *spasswd; /* Password to send. */ |
181 |
> |
char *reason; |
182 |
> |
char *certfp; |
183 |
> |
char *cipher_list; |
184 |
> |
void *rsa_public_key; |
185 |
|
}; |
186 |
|
|
187 |
< |
/* |
92 |
< |
* MatchItem - used for XLINE and ULINE types |
93 |
< |
*/ |
94 |
< |
struct MatchItem |
95 |
< |
{ |
96 |
< |
char *user; /* Used for ULINE only */ |
97 |
< |
char *host; /* Used for ULINE only */ |
98 |
< |
char *reason; |
99 |
< |
char *oper_reason; |
100 |
< |
int action; /* used for uline */ |
101 |
< |
int count; /* How many times this matchitem has been matched */ |
102 |
< |
int ref_count; /* How many times is this matchitem in use */ |
103 |
< |
int illegal; /* Should it be deleted when possible? */ |
104 |
< |
time_t hold; /* Hold action until this time (calendar time) */ |
105 |
< |
}; |
106 |
< |
|
107 |
< |
struct AccessItem |
187 |
> |
struct exempt |
188 |
|
{ |
189 |
|
dlink_node node; |
190 |
< |
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */ |
191 |
< |
unsigned int flags; |
192 |
< |
unsigned int modes; |
193 |
< |
int clients; /* Number of *LOCAL* clients using this */ |
194 |
< |
struct irc_ssaddr my_ipnum; /* ip to bind to for outgoing connect */ |
195 |
< |
struct irc_ssaddr ipnum; /* ip to connect to */ |
196 |
< |
char * host; /* host part of user@host */ |
197 |
< |
char * passwd; |
198 |
< |
char * spasswd; /* Password to send. */ |
119 |
< |
char * reason; |
120 |
< |
char * oper_reason; |
121 |
< |
char * user; /* user part of user@host */ |
122 |
< |
int port; |
123 |
< |
char * fakename; /* Mask name */ |
124 |
< |
time_t hold; /* Hold action until this time (calendar time) */ |
125 |
< |
struct ConfItem *class_ptr; /* Class of connection */ |
126 |
< |
struct DNSQuery* dns_query; |
127 |
< |
int aftype; |
128 |
< |
#ifdef HAVE_LIBCRYPTO |
129 |
< |
char * rsa_public_key_file; |
130 |
< |
RSA * rsa_public_key; |
131 |
< |
struct EncCapability *cipher_preference; |
132 |
< |
#endif |
133 |
< |
pcre *regexuser; |
134 |
< |
pcre *regexhost; |
135 |
< |
}; |
136 |
< |
|
137 |
< |
struct ClassItem |
138 |
< |
{ |
139 |
< |
long max_sendq; |
140 |
< |
int con_freq; |
141 |
< |
int ping_freq; |
142 |
< |
int ping_warning; |
143 |
< |
int max_total; |
144 |
< |
int max_local; |
145 |
< |
int max_global; |
146 |
< |
int max_ident; |
147 |
< |
int max_perip; |
148 |
< |
int curr_user_count; |
149 |
< |
int cidr_bitlen_ipv4; |
150 |
< |
int cidr_bitlen_ipv6; |
151 |
< |
int number_per_cidr; |
152 |
< |
dlink_list list_ipv4; /* base of per cidr ipv4 client link list */ |
153 |
< |
dlink_list list_ipv6; /* base of per cidr ipv6 client link list */ |
190 |
> |
char *name; |
191 |
> |
char *user; |
192 |
> |
char *host; |
193 |
> |
size_t len; |
194 |
> |
time_t when; |
195 |
> |
struct irc_ssaddr addr; |
196 |
> |
int bits; |
197 |
> |
int type; |
198 |
> |
int coid; |
199 |
|
}; |
200 |
|
|
201 |
|
struct CidrItem |
202 |
|
{ |
158 |
– |
struct irc_ssaddr mask; |
159 |
– |
int number_on_this_cidr; |
203 |
|
dlink_node node; |
204 |
+ |
struct irc_ssaddr mask; |
205 |
+ |
unsigned int number_on_this_cidr; |
206 |
|
}; |
207 |
|
|
163 |
– |
#define ConFreq(x) ((x)->con_freq) |
164 |
– |
#define PingFreq(x) ((x)->ping_freq) |
165 |
– |
#define PingWarning(x) ((x)->ping_warning) |
166 |
– |
#define MaxTotal(x) ((x)->max_total) |
167 |
– |
#define MaxGlobal(x) ((x)->max_global) |
168 |
– |
#define MaxLocal(x) ((x)->max_local) |
169 |
– |
#define MaxIdent(x) ((x)->max_ident) |
170 |
– |
#define MaxPerIp(x) ((x)->max_perip) |
171 |
– |
#define MaxSendq(x) ((x)->max_sendq) |
172 |
– |
#define CurrUserCount(x) ((x)->curr_user_count) |
173 |
– |
#define CidrBitlenIPV4(x) ((x)->cidr_bitlen_ipv4) |
174 |
– |
#define CidrBitlenIPV6(x) ((x)->cidr_bitlen_ipv6) |
175 |
– |
#define NumberPerCidr(x) ((x)->number_per_cidr) |
176 |
– |
|
177 |
– |
#define ClassPtr(x) ((x)->class_ptr) |
178 |
– |
|
179 |
– |
|
180 |
– |
#define CONF_ILLEGAL 0x80000000 |
181 |
– |
#define CONF_RESERVED 0x00000001 |
182 |
– |
#define CONF_CLIENT 0x00000002 |
183 |
– |
#define CONF_SERVER 0x00000004 |
184 |
– |
#define CONF_OPERATOR 0x00000008 |
185 |
– |
#define CONF_KILL 0x00000010 |
186 |
– |
#define CONF_KLINE CONF_KILL |
187 |
– |
#define CONF_CLASS 0x00000020 |
188 |
– |
#define CONF_LEAF 0x00000040 |
189 |
– |
#define CONF_LISTEN_PORT 0x00000080 |
190 |
– |
#define CONF_HUB 0x00000100 |
191 |
– |
#define CONF_EXEMPTKLINE 0x00000200 |
192 |
– |
#define CONF_NOLIMIT 0x00000400 |
193 |
– |
#define CONF_DLINE 0x00000800 |
194 |
– |
#define CONF_XLINE 0x00001000 |
195 |
– |
#define CONF_ULINE 0x00002000 |
196 |
– |
#define CONF_EXEMPTDLINE 0x00004000 |
197 |
– |
#define CONF_GLINE 0x00008000 |
198 |
– |
|
199 |
– |
#define CONF_SERVER_MASK CONF_SERVER |
200 |
– |
#define CONF_CLIENT_MASK (CONF_CLIENT | CONF_OPERATOR | CONF_SERVER_MASK) |
201 |
– |
|
202 |
– |
/* XXX temporary hack */ |
203 |
– |
#define CONF_CRESV 0x80000001 |
204 |
– |
#define CONF_NRESV 0x80000002 |
205 |
– |
|
206 |
– |
#define IsConfIllegal(x) ((x)->status & CONF_ILLEGAL) |
207 |
– |
#define SetConfIllegal(x) ((x)->status |= CONF_ILLEGAL) |
208 |
– |
#define IsConfServer(x) ((x)->status == CONF_SERVER) |
209 |
– |
#define SetConfServer(x) ((x)->status = CONF_SERVER) |
210 |
– |
#define IsConfOperator(x) ((x)->status & CONF_OPERATOR) |
211 |
– |
#define IsConfHub(x) ((x)->status == CONF_HUB) |
212 |
– |
#define SetConfHub(x) ((x)->status = CONF_HUB) |
213 |
– |
#define IsConfLeaf(x) ((x)->status == CONF_LEAF) |
214 |
– |
#define SetConfLeaf(x) ((x)->status = CONF_LEAF) |
215 |
– |
#define IsConfHubOrLeaf(x) ((x)->status & (CONF_HUB|CONF_LEAF)) |
216 |
– |
#define IsConfKill(x) ((x)->status == CONF_KILL) |
217 |
– |
#define IsConfClient(x) ((x)->status & CONF_CLIENT) |
218 |
– |
#define IsConfTypeOfClient(x) ((x)->status & CONF_CLIENT_MASK) |
219 |
– |
#define IsConfUline(x) ((x)->status & CONF_ULINE) |
220 |
– |
#define IsConfXline(x) ((x)->status & CONF_XLINE) |
221 |
– |
#define IsConfGline(x) ((x)->status == CONF_GLINE) |
222 |
– |
|
223 |
– |
/* AccessItem->flags */ |
224 |
– |
|
225 |
– |
/* Generic flags... */ |
226 |
– |
/* access flags... */ |
227 |
– |
#define CONF_FLAGS_DO_IDENTD 0x00000001 |
228 |
– |
#define CONF_FLAGS_LIMIT_IP 0x00000002 |
229 |
– |
#define CONF_FLAGS_NO_TILDE 0x00000004 |
230 |
– |
#define CONF_FLAGS_NEED_IDENTD 0x00000008 |
231 |
– |
/* 0x00000010 */ |
232 |
– |
#define CONF_FLAGS_NOMATCH_IP 0x00000020 |
233 |
– |
#define CONF_FLAGS_EXEMPTKLINE 0x00000040 |
234 |
– |
#define CONF_FLAGS_NOLIMIT 0x00000080 |
235 |
– |
#define CONF_FLAGS_IDLE_LINED 0x00000100 |
236 |
– |
#define CONF_FLAGS_SPOOF_IP 0x00000200 |
237 |
– |
#define CONF_FLAGS_SPOOF_NOTICE 0x00000400 |
238 |
– |
#define CONF_FLAGS_REDIR 0x00000800 |
239 |
– |
#define CONF_FLAGS_EXEMPTGLINE 0x00001000 |
240 |
– |
#define CONF_FLAGS_RESTRICTED 0x00002000 |
241 |
– |
#define CONF_FLAGS_CAN_FLOOD 0x00100000 |
242 |
– |
#define CONF_FLAGS_NEED_PASSWORD 0x00200000 |
243 |
– |
/* server flags */ |
244 |
– |
#define CONF_FLAGS_ALLOW_AUTO_CONN 0x00004000 |
245 |
– |
#define CONF_FLAGS_LAZY_LINK 0x00008000 |
246 |
– |
#define CONF_FLAGS_ENCRYPTED 0x00010000 |
247 |
– |
#define CONF_FLAGS_COMPRESSED 0x00020000 |
248 |
– |
#define CONF_FLAGS_TEMPORARY 0x00040000 |
249 |
– |
#define CONF_FLAGS_CRYPTLINK 0x00080000 |
250 |
– |
#define CONF_FLAGS_BURST_AWAY 0x00400000 |
251 |
– |
#define CONF_FLAGS_EXEMPTRESV 0x00800000 |
252 |
– |
#define CONF_FLAGS_TOPICBURST 0x01000000 |
253 |
– |
|
254 |
– |
/* Macros for struct AccessItem */ |
255 |
– |
#define IsLimitIp(x) ((x)->flags & CONF_FLAGS_LIMIT_IP) |
256 |
– |
#define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE) |
257 |
– |
#define IsConfCanFlood(x) ((x)->flags & CONF_FLAGS_CAN_FLOOD) |
258 |
– |
#define IsNeedPassword(x) ((x)->flags & CONF_FLAGS_NEED_PASSWORD) |
259 |
– |
#define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD) |
260 |
– |
#define IsNoMatchIp(x) ((x)->flags & CONF_FLAGS_NOMATCH_IP) |
261 |
– |
#define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE) |
262 |
– |
#define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT) |
263 |
– |
#define IsConfExemptGline(x) ((x)->flags & CONF_FLAGS_EXEMPTGLINE) |
264 |
– |
#define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV) |
265 |
– |
#define IsConfIdlelined(x) ((x)->flags & CONF_FLAGS_IDLE_LINED) |
266 |
– |
#define IsConfDoIdentd(x) ((x)->flags & CONF_FLAGS_DO_IDENTD) |
267 |
– |
#define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP) |
268 |
– |
#define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE) |
269 |
– |
#define IsConfRestricted(x) ((x)->flags & CONF_FLAGS_RESTRICTED) |
270 |
– |
#define IsConfEncrypted(x) ((x)->flags & CONF_FLAGS_ENCRYPTED) |
271 |
– |
#define SetConfEncrypted(x) ((x)->flags |= CONF_FLAGS_ENCRYPTED) |
272 |
– |
#define ClearConfEncrypted(x) ((x)->flags &= ~CONF_FLAGS_ENCRYPTED) |
273 |
– |
#define IsConfCompressed(x) ((x)->flags & CONF_FLAGS_COMPRESSED) |
274 |
– |
#define SetConfCompressed(x) ((x)->flags |= CONF_FLAGS_COMPRESSED) |
275 |
– |
#define ClearConfCompressed(x) ((x)->flags &= ~CONF_FLAGS_COMPRESSED) |
276 |
– |
#define IsConfCryptLink(x) ((x)->flags & CONF_FLAGS_CRYPTLINK) |
277 |
– |
#define SetConfCryptLink(x) ((x)->flags |= CONF_FLAGS_CRYPTLINK) |
278 |
– |
#define ClearConfCryptLink(x) ((x)->flags &= ~CONF_FLAGS_CRYPTLINK) |
279 |
– |
#define IsConfLazyLink(x) ((x)->flags & CONF_FLAGS_LAZY_LINK) |
280 |
– |
#define SetConfLazyLink(x) ((x)->flags = CONF_FLAGS_LAZY_LINK) |
281 |
– |
#define ClearConfLazyLink(x) ((x)->flags &= ~CONF_FLAGS_LAZY_LINK) |
282 |
– |
#define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN) |
283 |
– |
#define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN) |
284 |
– |
#define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN) |
285 |
– |
#define IsConfTemporary(x) ((x)->flags & CONF_FLAGS_TEMPORARY) |
286 |
– |
#define SetConfTemporary(x) ((x)->flags |= CONF_FLAGS_TEMPORARY) |
287 |
– |
#define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR) |
288 |
– |
#define IsConfAwayBurst(x) ((x)->flags & CONF_FLAGS_BURST_AWAY) |
289 |
– |
#define SetConfAwayBurst(x) ((x)->flags |= CONF_FLAGS_BURST_AWAY) |
290 |
– |
#define ClearConfAwayBurst(x) ((x)->flags &= ~CONF_FLAGS_BURST_AWAY) |
291 |
– |
#define IsConfTopicBurst(x) ((x)->flags & CONF_FLAGS_TOPICBURST) |
292 |
– |
#define SetConfTopicBurst(x) ((x)->flags |= CONF_FLAGS_TOPICBURST) |
293 |
– |
#define ClearConfTopicBurst(x) ((x)->flags &= ~CONF_FLAGS_TOPICBURST) |
294 |
– |
|
295 |
– |
/* shared/cluster server entry types |
296 |
– |
* These defines are used for both shared and cluster. |
297 |
– |
*/ |
298 |
– |
#define SHARED_KLINE 0x0001 |
299 |
– |
#define SHARED_TKLINE 0x0002 |
300 |
– |
#define SHARED_UNKLINE 0x0004 |
301 |
– |
#define SHARED_XLINE 0x0008 |
302 |
– |
#define SHARED_TXLINE 0x0010 |
303 |
– |
#define SHARED_UNXLINE 0x0020 |
304 |
– |
#define SHARED_RESV 0x0040 |
305 |
– |
#define SHARED_TRESV 0x0080 |
306 |
– |
#define SHARED_UNRESV 0x0100 |
307 |
– |
#define SHARED_LOCOPS 0x0200 |
308 |
– |
#define SHARED_ALL (SHARED_KLINE | SHARED_TKLINE | SHARED_UNKLINE | \ |
309 |
– |
SHARED_XLINE | SHARED_TXLINE | SHARED_UNXLINE | \ |
310 |
– |
SHARED_RESV | SHARED_TRESV | SHARED_UNRESV |\ |
311 |
– |
SHARED_LOCOPS) |
312 |
– |
|
313 |
– |
/* gline acl entry actions */ |
314 |
– |
#define GDENY_BLOCK 0x1 |
315 |
– |
#define GDENY_REJECT 0x2 |
316 |
– |
|
208 |
|
struct config_file_entry |
209 |
|
{ |
210 |
|
const char *dpath; /* DPATH if set from command line */ |
211 |
+ |
const char *mpath; |
212 |
+ |
const char *spath; |
213 |
|
const char *configfile; |
214 |
|
const char *klinefile; |
215 |
+ |
const char *glinefile; |
216 |
|
const char *xlinefile; |
323 |
– |
const char *rxlinefile; |
324 |
– |
const char *rklinefile; |
217 |
|
const char *dlinefile; |
218 |
< |
const char *glinefile; |
327 |
< |
const char *cresvfile; |
328 |
< |
const char *nresvfile; |
218 |
> |
const char *resvfile; |
219 |
|
|
330 |
– |
char *logpath; |
331 |
– |
char *operlog; |
332 |
– |
|
333 |
– |
char *servlink_path; |
220 |
|
char *egdpool_path; |
221 |
+ |
char *service_name; |
222 |
|
|
336 |
– |
MessageFile motd; |
337 |
– |
MessageFile opermotd; |
338 |
– |
MessageFile linksfile; |
339 |
– |
|
340 |
– |
unsigned char compression_level; |
223 |
|
int gline_min_cidr; |
224 |
|
int gline_min_cidr6; |
343 |
– |
int dot_in_ip6_addr; |
225 |
|
int dots_in_ident; |
226 |
|
int failed_oper_notice; |
227 |
|
int anti_spam_exit_message_time; |
228 |
< |
int max_accept; |
228 |
> |
unsigned int max_accept; |
229 |
> |
unsigned int max_watch; |
230 |
|
int max_nick_time; |
231 |
< |
int max_nick_changes; |
231 |
> |
unsigned int max_nick_changes; |
232 |
|
int ts_max_delta; |
233 |
|
int ts_warn_delta; |
234 |
|
int anti_nick_flood; |
235 |
< |
int kline_with_reason; |
354 |
< |
int warn_no_nline; |
235 |
> |
int warn_no_connect_block; |
236 |
|
int invisible_on_connect; |
237 |
|
int stats_e_disabled; |
238 |
|
int stats_o_oper_only; |
239 |
|
int stats_k_oper_only; |
240 |
|
int stats_i_oper_only; |
241 |
|
int stats_P_oper_only; |
242 |
+ |
int stats_u_oper_only; |
243 |
|
int short_motd; |
244 |
|
int no_oper_flood; |
245 |
|
int true_no_oper_flood; |
246 |
|
int oper_pass_resv; |
247 |
|
int glines; |
248 |
|
int hide_spoof_ips; |
367 |
– |
int burst_away; |
368 |
– |
int use_whois_actually; |
249 |
|
int tkline_expire_notices; |
250 |
|
int opers_bypass_callerid; |
251 |
|
int ignore_bogus_ts; |
372 |
– |
char *kline_reason; |
252 |
|
int pace_wait; |
253 |
|
int pace_wait_simple; |
254 |
|
int gline_time; |
255 |
< |
int gline_logging; |
377 |
< |
int idletime; |
255 |
> |
int gline_request_time; |
256 |
|
int oper_only_umodes; |
257 |
|
int oper_umodes; |
258 |
< |
int max_targets; |
258 |
> |
unsigned int max_targets; |
259 |
|
int caller_id_wait; |
260 |
|
int min_nonwildcard; |
261 |
|
int min_nonwildcard_simple; |
262 |
|
int kill_chase_time_limit; |
263 |
|
int default_floodcount; |
386 |
– |
int client_flood; |
264 |
|
/* 0 == don't use throttle... */ |
265 |
|
int throttle_time; |
266 |
|
int use_egd; |
267 |
|
int ping_cookie; |
268 |
|
int disable_auth; |
269 |
< |
int disable_remote; |
393 |
< |
#ifdef HAVE_LIBCRYPTO |
394 |
< |
struct EncCapability *default_cipher_preference; |
395 |
< |
#endif |
269 |
> |
int cycle_on_host_change; |
270 |
|
}; |
271 |
|
|
272 |
|
struct config_channel_entry |
273 |
|
{ |
274 |
|
int disable_fake_channels; |
401 |
– |
int restrict_channels; |
402 |
– |
int disable_local_channels; |
403 |
– |
int use_except; |
404 |
– |
int use_invex; |
405 |
– |
int use_knock; |
275 |
|
int knock_delay; |
276 |
|
int knock_delay_channel; |
277 |
|
unsigned int max_bans; |
278 |
|
unsigned int max_chans_per_user; |
279 |
+ |
unsigned int max_chans_per_oper; |
280 |
|
int no_create_on_split; |
281 |
|
int no_join_on_split; |
412 |
– |
int quiet_on_ban; |
413 |
– |
int burst_topicwho; |
282 |
|
int default_split_server_count; |
283 |
|
int default_split_user_count; |
284 |
|
}; |
285 |
|
|
286 |
|
struct config_server_hide |
287 |
|
{ |
288 |
+ |
char *hidden_name; |
289 |
|
int flatten_links; |
290 |
+ |
int disable_remote_commands; |
291 |
|
int hide_servers; |
292 |
< |
char *hidden_name; |
292 |
> |
int hide_services; |
293 |
|
int links_delay; |
294 |
|
int links_disabled; |
295 |
|
int hidden; |
426 |
– |
int disable_hidden; |
296 |
|
int hide_server_ips; |
297 |
|
}; |
298 |
|
|
299 |
|
struct server_info |
300 |
|
{ |
301 |
+ |
char *sid; |
302 |
|
char *name; |
303 |
|
char *description; |
304 |
|
char *network_name; |
305 |
|
char *network_desc; |
436 |
– |
#ifdef HAVE_LIBCRYPTO |
306 |
|
char *rsa_private_key_file; |
307 |
< |
RSA *rsa_private_key; |
308 |
< |
SSL_CTX *ctx; |
309 |
< |
#endif |
441 |
< |
char *sid; |
307 |
> |
void *rsa_private_key; |
308 |
> |
void *server_ctx; |
309 |
> |
void *client_ctx; |
310 |
|
int hub; |
311 |
|
struct irc_ssaddr ip; |
312 |
|
struct irc_ssaddr ip6; |
313 |
< |
int max_clients; |
313 |
> |
unsigned int max_clients; |
314 |
> |
unsigned int max_nick_length; |
315 |
> |
unsigned int max_topic_length; |
316 |
|
int specific_ipv4_vhost; |
317 |
|
int specific_ipv6_vhost; |
318 |
|
struct sockaddr_in dns_host; |
329 |
|
struct logging_entry |
330 |
|
{ |
331 |
|
unsigned int use_logging; |
462 |
– |
char operlog[PATH_MAX + 1]; |
463 |
– |
char userlog[PATH_MAX + 1]; |
464 |
– |
char glinelog[PATH_MAX + 1]; |
465 |
– |
char ioerrlog[PATH_MAX + 1]; |
466 |
– |
char klinelog[PATH_MAX + 1]; |
467 |
– |
char killlog[PATH_MAX + 1]; |
468 |
– |
char operspylog[PATH_MAX + 1]; |
469 |
– |
char failed_operlog[PATH_MAX + 1]; |
332 |
|
}; |
333 |
|
|
334 |
< |
extern int ypass; |
473 |
< |
extern dlink_list class_items; |
334 |
> |
extern dlink_list flatten_links; |
335 |
|
extern dlink_list server_items; |
336 |
|
extern dlink_list cluster_items; |
337 |
< |
extern dlink_list hub_items; |
338 |
< |
extern dlink_list rxconf_items; |
339 |
< |
extern dlink_list rkconf_items; |
340 |
< |
extern dlink_list leaf_items; |
341 |
< |
extern dlink_list temporary_klines; |
342 |
< |
extern dlink_list temporary_dlines; |
343 |
< |
extern dlink_list temporary_glines; |
483 |
< |
extern dlink_list temporary_xlines; |
484 |
< |
extern dlink_list temporary_rxlines; |
485 |
< |
extern dlink_list temporary_rklines; |
337 |
> |
extern dlink_list xconf_items; |
338 |
> |
extern dlink_list uconf_items; |
339 |
> |
extern dlink_list oconf_items; |
340 |
> |
extern dlink_list service_items; |
341 |
> |
extern dlink_list nresv_items; |
342 |
> |
extern dlink_list cresv_items; |
343 |
> |
extern struct conf_parser_context conf_parser_ctx; |
344 |
|
extern struct logging_entry ConfigLoggingEntry; |
345 |
|
extern struct config_file_entry ConfigFileEntry;/* defined in ircd.c*/ |
346 |
|
extern struct config_channel_entry ConfigChannel;/* defined in channel.c*/ |
347 |
|
extern struct config_server_hide ConfigServerHide; /* defined in s_conf.c */ |
348 |
|
extern struct server_info ServerInfo; /* defined in ircd.c */ |
349 |
|
extern struct admin_info AdminInfo; /* defined in ircd.c */ |
350 |
+ |
extern int valid_wild_card_simple(const char *); |
351 |
|
extern int valid_wild_card(struct Client *, int, int, ...); |
352 |
|
/* End GLOBAL section */ |
353 |
|
|
495 |
– |
extern unsigned long get_sendq(struct Client *); |
496 |
– |
extern const char *get_client_class(struct Client *); |
497 |
– |
extern int get_client_ping(struct Client *, int *); |
498 |
– |
extern void check_class(void); |
499 |
– |
extern void init_class(void); |
500 |
– |
extern struct ConfItem *find_class(const char *); |
354 |
|
extern void init_ip_hash_table(void); |
355 |
< |
extern void count_ip_hash(int *, unsigned long *); |
355 |
> |
extern void count_ip_hash(unsigned int *, uint64_t *); |
356 |
|
extern void remove_one_ip(struct irc_ssaddr *); |
357 |
< |
extern struct ConfItem *make_conf_item(ConfType type); |
505 |
< |
extern void free_access_item(struct AccessItem *); |
357 |
> |
extern struct MaskItem *conf_make(enum maskitem_type); |
358 |
|
extern void read_conf_files(int); |
359 |
< |
extern int attach_conf(struct Client *, struct ConfItem *); |
359 |
> |
extern int attach_conf(struct Client *, struct MaskItem *); |
360 |
|
extern int attach_connect_block(struct Client *, const char *, const char *); |
361 |
+ |
extern int check_client(struct Client *); |
362 |
|
|
510 |
– |
extern int detach_conf(struct Client *, ConfType); |
363 |
|
|
364 |
< |
extern struct ConfItem *find_conf_name(dlink_list *, const char *, ConfType); |
365 |
< |
extern struct ConfItem *find_conf_exact(ConfType, const char *, const char *, const char *); |
514 |
< |
extern struct AccessItem *find_kill(struct Client *); |
515 |
< |
extern struct AccessItem *find_gline(struct Client *); |
364 |
> |
extern void detach_conf(struct Client *, enum maskitem_type); |
365 |
> |
extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type); |
366 |
|
extern int conf_connect_allowed(struct irc_ssaddr *, int); |
367 |
|
extern char *oper_privs_as_string(const unsigned int); |
368 |
|
extern void split_nuh(struct split_nuh_item *); |
369 |
< |
extern struct ConfItem *find_matching_name_conf(ConfType, const char *, |
370 |
< |
const char *, const char *, int); |
371 |
< |
extern struct ConfItem *find_exact_name_conf(ConfType, const char *, |
369 |
> |
extern struct MaskItem *find_matching_name_conf(enum maskitem_type, const char *, |
370 |
> |
const char *, const char *, unsigned int); |
371 |
> |
extern struct MaskItem *find_exact_name_conf(enum maskitem_type, const struct Client *, const char *, |
372 |
|
const char *, const char *); |
373 |
< |
extern void delete_conf_item(struct ConfItem *); |
524 |
< |
extern void report_confitem_types(struct Client *, ConfType, int); |
373 |
> |
extern void conf_free(struct MaskItem *); |
374 |
|
extern void yyerror(const char *); |
375 |
< |
extern int conf_yy_fatal_error(const char *); |
527 |
< |
extern int conf_fbgets(char *, unsigned int, FBFILE *); |
528 |
< |
extern void write_conf_line(struct Client *, struct ConfItem *, |
529 |
< |
const char *, time_t); |
530 |
< |
extern int remove_conf_line(ConfType, struct Client *, const char *, |
531 |
< |
const char *); |
532 |
< |
extern void add_temp_line(struct ConfItem *); |
375 |
> |
extern void conf_error_report(const char *); |
376 |
|
extern void cleanup_tklines(void *); |
534 |
– |
extern const char *get_conf_name(ConfType); |
377 |
|
extern int rehash(int); |
378 |
< |
extern int conf_add_server(struct ConfItem *, const char *); |
379 |
< |
extern void conf_add_class_to_conf(struct ConfItem *, const char *); |
538 |
< |
extern void conf_add_d_conf(struct AccessItem *); |
539 |
< |
|
540 |
< |
/* XXX consider moving these into csvlib.h */ |
541 |
< |
extern void parse_csv_file(FBFILE *, ConfType); |
378 |
> |
extern void lookup_confhost(struct MaskItem *); |
379 |
> |
extern void conf_add_class_to_conf(struct MaskItem *, const char *); |
380 |
|
|
381 |
< |
extern char *get_oper_name(const struct Client *); |
381 |
> |
extern const char *get_oper_name(const struct Client *); |
382 |
|
|
545 |
– |
extern void *map_to_conf(struct ConfItem *); |
546 |
– |
extern struct ConfItem *unmap_conf_item(void *); |
383 |
|
/* XXX should the parse_aline stuff go into another file ?? */ |
384 |
< |
#define AWILD 0x1 /* check wild cards */ |
549 |
< |
#define NOUSERLOOKUP 0x2 /* Don't lookup the user@host on /rkline nick */ |
384 |
> |
#define AWILD 0x1 /* check wild cards */ |
385 |
|
extern int parse_aline(const char *, struct Client *, int, char **, |
386 |
< |
int, char **, char **, time_t *, char **, char **); |
386 |
> |
int, char **, char **, time_t *, char **, char **); |
387 |
|
extern int valid_comment(struct Client *, char *, int); |
388 |
|
|
554 |
– |
/* XXX */ |
555 |
– |
extern int yylex(void); |
389 |
|
|
390 |
|
#define TK_SECONDS 0 |
391 |
|
#define TK_MINUTES 1 |
392 |
< |
extern time_t valid_tkline(char *, int); |
393 |
< |
extern int match_conf_password(const char *, const struct AccessItem *); |
561 |
< |
|
562 |
< |
#define NOT_AUTHORIZED (-1) |
563 |
< |
#define I_LINE_FULL (-2) |
564 |
< |
#define TOO_MANY (-3) |
565 |
< |
#define BANNED_CLIENT (-4) |
566 |
< |
#define TOO_FAST (-5) |
392 |
> |
extern time_t valid_tkline(const char *, const int); |
393 |
> |
extern int match_conf_password(const char *, const struct MaskItem *); |
394 |
|
|
395 |
|
#define CLEANUP_TKLINES_TIME 60 |
396 |
|
|
397 |
< |
extern void cluster_a_line(struct Client *, |
571 |
< |
const char *, int, int, const char *,...); |
572 |
< |
extern void rebuild_cidr_class(struct ConfItem *, struct ClassItem *); |
573 |
< |
|
397 |
> |
extern void cluster_a_line(struct Client *, const char *, int, int, const char *,...); |
398 |
|
#endif /* INCLUDED_s_conf_h */ |