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-2020 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 |
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
18 |
> |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
19 |
|
* USA |
21 |
– |
* |
22 |
– |
* $Id$ |
20 |
|
*/ |
21 |
|
|
22 |
< |
#ifndef INCLUDED_s_conf_h |
23 |
< |
#define INCLUDED_s_conf_h |
24 |
< |
#include "setup.h" |
25 |
< |
#ifdef HAVE_LIBCRYPTO |
26 |
< |
#include <openssl/rsa.h> |
27 |
< |
#endif |
28 |
< |
#include "fileio.h" /* FBFILE */ |
29 |
< |
#include "ircd_defs.h" |
33 |
< |
#include "motd.h" /* MessageFile */ |
22 |
> |
/*! \file conf.h |
23 |
> |
* \brief A header for the configuration functions. |
24 |
> |
* \version $Id$ |
25 |
> |
*/ |
26 |
> |
|
27 |
> |
#ifndef INCLUDED_conf_h |
28 |
> |
#define INCLUDED_conf_h |
29 |
> |
#include "config.h" |
30 |
|
#include "client.h" |
31 |
< |
#include "hook.h" |
32 |
< |
#include "pcre.h" |
31 |
> |
#include "conf_class.h" |
32 |
> |
#include "tls.h" |
33 |
|
|
38 |
– |
struct Client; |
39 |
– |
struct DNSReply; |
40 |
– |
struct hostent; |
41 |
– |
|
42 |
– |
extern FBFILE *conf_fbfile_in; |
43 |
– |
extern struct Callback *client_check_cb; |
44 |
– |
|
45 |
– |
typedef enum { |
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; |
66 |
– |
|
67 |
– |
struct ConfItem |
68 |
– |
{ |
69 |
– |
char *name; /* Primary key */ |
70 |
– |
pcre *regexpname; |
71 |
– |
dlink_node node; /* link into known ConfItems of this type */ |
72 |
– |
unsigned int flags; |
73 |
– |
ConfType type; |
74 |
– |
}; |
34 |
|
|
35 |
< |
/* |
77 |
< |
* MatchItem - used for XLINE and ULINE types |
78 |
< |
*/ |
79 |
< |
struct MatchItem |
35 |
> |
enum |
36 |
|
{ |
37 |
< |
char *user; /* Used for ULINE only */ |
38 |
< |
char *host; /* Used for ULINE only */ |
83 |
< |
char *reason; |
84 |
< |
char *oper_reason; |
85 |
< |
int action; /* used for uline */ |
86 |
< |
int count; /* How many times this matchitem has been matched */ |
87 |
< |
int ref_count; /* How many times is this matchitem in use */ |
88 |
< |
int illegal; /* Should it be deleted when possible? */ |
89 |
< |
time_t hold; /* Hold action until this time (calendar time) */ |
37 |
> |
TK_SECONDS, |
38 |
> |
TK_MINUTES |
39 |
|
}; |
40 |
|
|
41 |
< |
struct AccessItem |
42 |
< |
{ |
43 |
< |
dlink_node node; |
44 |
< |
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */ |
45 |
< |
unsigned int flags; |
46 |
< |
int clients; /* Number of *LOCAL* clients using this */ |
47 |
< |
struct irc_ssaddr my_ipnum; /* ip to bind to for outgoing connect */ |
48 |
< |
struct irc_ssaddr ipnum; /* ip to connect to */ |
49 |
< |
char * host; /* host part of user@host */ |
50 |
< |
char * passwd; |
51 |
< |
char * spasswd; /* Password to send. */ |
52 |
< |
char * reason; |
53 |
< |
char * oper_reason; |
54 |
< |
char * user; /* user part of user@host */ |
55 |
< |
int port; |
56 |
< |
char * fakename; /* Mask name */ |
57 |
< |
time_t hold; /* Hold action until this time (calendar time) */ |
58 |
< |
struct ConfItem *class_ptr; /* Class of connection */ |
59 |
< |
struct DNSQuery* dns_query; |
60 |
< |
int aftype; |
61 |
< |
#ifdef HAVE_LIBCRYPTO |
62 |
< |
char * rsa_public_key_file; |
63 |
< |
RSA * rsa_public_key; |
64 |
< |
struct EncCapability *cipher_preference; |
65 |
< |
#endif |
66 |
< |
pcre *regexuser; |
67 |
< |
pcre *regexhost; |
68 |
< |
}; |
69 |
< |
|
70 |
< |
struct ClassItem |
71 |
< |
{ |
72 |
< |
long max_sendq; |
73 |
< |
int con_freq; |
74 |
< |
int ping_freq; |
75 |
< |
int ping_warning; |
76 |
< |
int max_total; |
77 |
< |
int max_local; |
78 |
< |
int max_global; |
79 |
< |
int max_ident; |
80 |
< |
int max_perip; |
81 |
< |
int curr_user_count; |
82 |
< |
int cidr_bitlen_ipv4; |
83 |
< |
int cidr_bitlen_ipv6; |
84 |
< |
int number_per_cidr; |
85 |
< |
dlink_list list_ipv4; /* base of per cidr ipv4 client link list */ |
137 |
< |
dlink_list list_ipv6; /* base of per cidr ipv6 client link list */ |
138 |
< |
}; |
41 |
> |
enum { CLEANUP_TKLINES_TIME = 60 }; |
42 |
> |
|
43 |
> |
#define CONF_NOREASON "<No reason supplied>" |
44 |
> |
|
45 |
> |
/* MaskItem->flags */ |
46 |
> |
enum |
47 |
> |
{ |
48 |
> |
CONF_FLAGS_NO_TILDE = 1 << 0, |
49 |
> |
CONF_FLAGS_NEED_IDENTD = 1 << 1, |
50 |
> |
CONF_FLAGS_EXEMPTKLINE = 1 << 2, |
51 |
> |
CONF_FLAGS_NOLIMIT = 1 << 3, |
52 |
> |
CONF_FLAGS_SPOOF_IP = 1 << 4, |
53 |
> |
CONF_FLAGS_SPOOF_NOTICE = 1 << 5, |
54 |
> |
CONF_FLAGS_REDIR = 1 << 6, |
55 |
> |
CONF_FLAGS_CAN_FLOOD = 1 << 7, |
56 |
> |
CONF_FLAGS_NEED_PASSWORD = 1 << 8, |
57 |
> |
CONF_FLAGS_ALLOW_AUTO_CONN = 1 << 9, |
58 |
> |
CONF_FLAGS_ENCRYPTED = 1 << 10, |
59 |
> |
CONF_FLAGS_IN_DATABASE = 1 << 11, |
60 |
> |
CONF_FLAGS_EXEMPTRESV = 1 << 12, |
61 |
> |
CONF_FLAGS_SSL = 1 << 13, |
62 |
> |
CONF_FLAGS_WEBIRC = 1 << 14, |
63 |
> |
CONF_FLAGS_EXEMPTXLINE = 1 << 15 |
64 |
> |
}; |
65 |
> |
|
66 |
> |
/* Macros for struct MaskItem */ |
67 |
> |
#define IsConfWebIRC(x) ((x)->flags & CONF_FLAGS_WEBIRC) |
68 |
> |
#define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE) |
69 |
> |
#define IsConfCanFlood(x) ((x)->flags & CONF_FLAGS_CAN_FLOOD) |
70 |
> |
#define IsNeedPassword(x) ((x)->flags & CONF_FLAGS_NEED_PASSWORD) |
71 |
> |
#define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD) |
72 |
> |
#define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE) |
73 |
> |
#define IsConfExemptXline(x) ((x)->flags & CONF_FLAGS_EXEMPTXLINE) |
74 |
> |
#define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT) |
75 |
> |
#define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV) |
76 |
> |
#define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP) |
77 |
> |
#define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE) |
78 |
> |
#define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN) |
79 |
> |
#define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN) |
80 |
> |
#define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN) |
81 |
> |
#define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR) |
82 |
> |
#define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL) |
83 |
> |
#define IsConfDatabase(x) ((x)->flags & CONF_FLAGS_IN_DATABASE) |
84 |
> |
#define SetConfDatabase(x) ((x)->flags |= CONF_FLAGS_IN_DATABASE) |
85 |
> |
|
86 |
|
|
87 |
< |
struct CidrItem |
87 |
> |
enum maskitem_type |
88 |
|
{ |
89 |
< |
struct irc_ssaddr mask; |
90 |
< |
int number_on_this_cidr; |
91 |
< |
dlink_node node; |
89 |
> |
CONF_CLIENT = 1, |
90 |
> |
CONF_SERVER, |
91 |
> |
CONF_KLINE, |
92 |
> |
CONF_DLINE, |
93 |
> |
CONF_EXEMPT, |
94 |
> |
CONF_OPER |
95 |
|
}; |
96 |
|
|
97 |
< |
#define ConFreq(x) ((x)->con_freq) |
98 |
< |
#define PingFreq(x) ((x)->ping_freq) |
149 |
< |
#define PingWarning(x) ((x)->ping_warning) |
150 |
< |
#define MaxTotal(x) ((x)->max_total) |
151 |
< |
#define MaxGlobal(x) ((x)->max_global) |
152 |
< |
#define MaxLocal(x) ((x)->max_local) |
153 |
< |
#define MaxIdent(x) ((x)->max_ident) |
154 |
< |
#define MaxPerIp(x) ((x)->max_perip) |
155 |
< |
#define MaxSendq(x) ((x)->max_sendq) |
156 |
< |
#define CurrUserCount(x) ((x)->curr_user_count) |
157 |
< |
#define CidrBitlenIPV4(x) ((x)->cidr_bitlen_ipv4) |
158 |
< |
#define CidrBitlenIPV6(x) ((x)->cidr_bitlen_ipv6) |
159 |
< |
#define NumberPerCidr(x) ((x)->number_per_cidr) |
160 |
< |
|
161 |
< |
#define ClassPtr(x) ((x)->class_ptr) |
162 |
< |
|
163 |
< |
|
164 |
< |
#define CONF_ILLEGAL 0x80000000 |
165 |
< |
#define CONF_RESERVED 0x00000001 |
166 |
< |
#define CONF_CLIENT 0x00000002 |
167 |
< |
#define CONF_SERVER 0x00000004 |
168 |
< |
#define CONF_OPERATOR 0x00000008 |
169 |
< |
#define CONF_KILL 0x00000010 |
170 |
< |
#define CONF_KLINE CONF_KILL |
171 |
< |
#define CONF_CLASS 0x00000020 |
172 |
< |
#define CONF_LEAF 0x00000040 |
173 |
< |
#define CONF_LISTEN_PORT 0x00000080 |
174 |
< |
#define CONF_HUB 0x00000100 |
175 |
< |
#define CONF_EXEMPTKLINE 0x00000200 |
176 |
< |
#define CONF_NOLIMIT 0x00000400 |
177 |
< |
#define CONF_DLINE 0x00000800 |
178 |
< |
#define CONF_XLINE 0x00001000 |
179 |
< |
#define CONF_ULINE 0x00002000 |
180 |
< |
#define CONF_EXEMPTDLINE 0x00004000 |
181 |
< |
#define CONF_GLINE 0x00008000 |
182 |
< |
|
183 |
< |
#define CONF_SERVER_MASK CONF_SERVER |
184 |
< |
#define CONF_CLIENT_MASK (CONF_CLIENT | CONF_OPERATOR | CONF_SERVER_MASK) |
185 |
< |
|
186 |
< |
/* XXX temporary hack */ |
187 |
< |
#define CONF_CRESV 0x80000001 |
188 |
< |
#define CONF_NRESV 0x80000002 |
189 |
< |
|
190 |
< |
#define IsConfIllegal(x) ((x)->status & CONF_ILLEGAL) |
191 |
< |
#define SetConfIllegal(x) ((x)->status |= CONF_ILLEGAL) |
192 |
< |
#define IsConfServer(x) ((x)->status == CONF_SERVER) |
193 |
< |
#define SetConfServer(x) ((x)->status = CONF_SERVER) |
194 |
< |
#define IsConfOperator(x) ((x)->status & CONF_OPERATOR) |
195 |
< |
#define IsConfHub(x) ((x)->status == CONF_HUB) |
196 |
< |
#define SetConfHub(x) ((x)->status = CONF_HUB) |
197 |
< |
#define IsConfLeaf(x) ((x)->status == CONF_LEAF) |
198 |
< |
#define SetConfLeaf(x) ((x)->status = CONF_LEAF) |
199 |
< |
#define IsConfHubOrLeaf(x) ((x)->status & (CONF_HUB|CONF_LEAF)) |
200 |
< |
#define IsConfKill(x) ((x)->status == CONF_KILL) |
201 |
< |
#define IsConfClient(x) ((x)->status & CONF_CLIENT) |
202 |
< |
#define IsConfTypeOfClient(x) ((x)->status & CONF_CLIENT_MASK) |
203 |
< |
#define IsConfUline(x) ((x)->status & CONF_ULINE) |
204 |
< |
#define IsConfXline(x) ((x)->status & CONF_XLINE) |
205 |
< |
#define IsConfGline(x) ((x)->status == CONF_GLINE) |
206 |
< |
|
207 |
< |
/* AccessItem->flags */ |
208 |
< |
|
209 |
< |
/* Generic flags... */ |
210 |
< |
/* access flags... */ |
211 |
< |
#define CONF_FLAGS_DO_IDENTD 0x00000001 |
212 |
< |
#define CONF_FLAGS_LIMIT_IP 0x00000002 |
213 |
< |
#define CONF_FLAGS_NO_TILDE 0x00000004 |
214 |
< |
#define CONF_FLAGS_NEED_IDENTD 0x00000008 |
215 |
< |
/* 0x00000010 */ |
216 |
< |
#define CONF_FLAGS_NOMATCH_IP 0x00000020 |
217 |
< |
#define CONF_FLAGS_EXEMPTKLINE 0x00000040 |
218 |
< |
#define CONF_FLAGS_NOLIMIT 0x00000080 |
219 |
< |
#define CONF_FLAGS_IDLE_LINED 0x00000100 |
220 |
< |
#define CONF_FLAGS_SPOOF_IP 0x00000200 |
221 |
< |
#define CONF_FLAGS_SPOOF_NOTICE 0x00000400 |
222 |
< |
#define CONF_FLAGS_REDIR 0x00000800 |
223 |
< |
#define CONF_FLAGS_EXEMPTGLINE 0x00001000 |
224 |
< |
#define CONF_FLAGS_RESTRICTED 0x00002000 |
225 |
< |
#define CONF_FLAGS_CAN_FLOOD 0x00100000 |
226 |
< |
#define CONF_FLAGS_NEED_PASSWORD 0x00200000 |
227 |
< |
/* server flags */ |
228 |
< |
#define CONF_FLAGS_ALLOW_AUTO_CONN 0x00004000 |
229 |
< |
#define CONF_FLAGS_LAZY_LINK 0x00008000 |
230 |
< |
#define CONF_FLAGS_ENCRYPTED 0x00010000 |
231 |
< |
#define CONF_FLAGS_COMPRESSED 0x00020000 |
232 |
< |
#define CONF_FLAGS_TEMPORARY 0x00040000 |
233 |
< |
#define CONF_FLAGS_CRYPTLINK 0x00080000 |
234 |
< |
#define CONF_FLAGS_BURST_AWAY 0x00400000 |
235 |
< |
#define CONF_FLAGS_EXEMPTRESV 0x00800000 |
236 |
< |
#define CONF_FLAGS_TOPICBURST 0x01000000 |
237 |
< |
|
238 |
< |
/* Macros for struct AccessItem */ |
239 |
< |
#define IsLimitIp(x) ((x)->flags & CONF_FLAGS_LIMIT_IP) |
240 |
< |
#define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE) |
241 |
< |
#define IsConfCanFlood(x) ((x)->flags & CONF_FLAGS_CAN_FLOOD) |
242 |
< |
#define IsNeedPassword(x) ((x)->flags & CONF_FLAGS_NEED_PASSWORD) |
243 |
< |
#define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD) |
244 |
< |
#define IsNoMatchIp(x) ((x)->flags & CONF_FLAGS_NOMATCH_IP) |
245 |
< |
#define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE) |
246 |
< |
#define IsConfExemptLimits(x) ((x)->flags & CONF_FLAGS_NOLIMIT) |
247 |
< |
#define IsConfExemptGline(x) ((x)->flags & CONF_FLAGS_EXEMPTGLINE) |
248 |
< |
#define IsConfExemptResv(x) ((x)->flags & CONF_FLAGS_EXEMPTRESV) |
249 |
< |
#define IsConfIdlelined(x) ((x)->flags & CONF_FLAGS_IDLE_LINED) |
250 |
< |
#define IsConfDoIdentd(x) ((x)->flags & CONF_FLAGS_DO_IDENTD) |
251 |
< |
#define IsConfDoSpoofIp(x) ((x)->flags & CONF_FLAGS_SPOOF_IP) |
252 |
< |
#define IsConfSpoofNotice(x) ((x)->flags & CONF_FLAGS_SPOOF_NOTICE) |
253 |
< |
#define IsConfRestricted(x) ((x)->flags & CONF_FLAGS_RESTRICTED) |
254 |
< |
#define IsConfEncrypted(x) ((x)->flags & CONF_FLAGS_ENCRYPTED) |
255 |
< |
#define SetConfEncrypted(x) ((x)->flags |= CONF_FLAGS_ENCRYPTED) |
256 |
< |
#define ClearConfEncrypted(x) ((x)->flags &= ~CONF_FLAGS_ENCRYPTED) |
257 |
< |
#define IsConfCompressed(x) ((x)->flags & CONF_FLAGS_COMPRESSED) |
258 |
< |
#define SetConfCompressed(x) ((x)->flags |= CONF_FLAGS_COMPRESSED) |
259 |
< |
#define ClearConfCompressed(x) ((x)->flags &= ~CONF_FLAGS_COMPRESSED) |
260 |
< |
#define IsConfCryptLink(x) ((x)->flags & CONF_FLAGS_CRYPTLINK) |
261 |
< |
#define SetConfCryptLink(x) ((x)->flags |= CONF_FLAGS_CRYPTLINK) |
262 |
< |
#define ClearConfCryptLink(x) ((x)->flags &= ~CONF_FLAGS_CRYPTLINK) |
263 |
< |
#define IsConfLazyLink(x) ((x)->flags & CONF_FLAGS_LAZY_LINK) |
264 |
< |
#define SetConfLazyLink(x) ((x)->flags = CONF_FLAGS_LAZY_LINK) |
265 |
< |
#define ClearConfLazyLink(x) ((x)->flags &= ~CONF_FLAGS_LAZY_LINK) |
266 |
< |
#define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN) |
267 |
< |
#define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN) |
268 |
< |
#define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN) |
269 |
< |
#define IsConfTemporary(x) ((x)->flags & CONF_FLAGS_TEMPORARY) |
270 |
< |
#define SetConfTemporary(x) ((x)->flags |= CONF_FLAGS_TEMPORARY) |
271 |
< |
#define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR) |
272 |
< |
#define IsConfAwayBurst(x) ((x)->flags & CONF_FLAGS_BURST_AWAY) |
273 |
< |
#define SetConfAwayBurst(x) ((x)->flags |= CONF_FLAGS_BURST_AWAY) |
274 |
< |
#define ClearConfAwayBurst(x) ((x)->flags &= ~CONF_FLAGS_BURST_AWAY) |
275 |
< |
#define IsConfTopicBurst(x) ((x)->flags & CONF_FLAGS_TOPICBURST) |
276 |
< |
#define SetConfTopicBurst(x) ((x)->flags |= CONF_FLAGS_TOPICBURST) |
277 |
< |
#define ClearConfTopicBurst(x) ((x)->flags &= ~CONF_FLAGS_TOPICBURST) |
97 |
> |
#define IsConfKill(x) ((x)->type == CONF_KLINE) |
98 |
> |
#define IsConfClient(x) ((x)->type == CONF_CLIENT) |
99 |
|
|
100 |
< |
/* shared/cluster server entry types |
101 |
< |
* These defines are used for both shared and cluster. |
102 |
< |
*/ |
103 |
< |
#define SHARED_KLINE 0x0001 |
104 |
< |
#define SHARED_TKLINE 0x0002 |
105 |
< |
#define SHARED_UNKLINE 0x0004 |
106 |
< |
#define SHARED_XLINE 0x0008 |
107 |
< |
#define SHARED_TXLINE 0x0010 |
287 |
< |
#define SHARED_UNXLINE 0x0020 |
288 |
< |
#define SHARED_RESV 0x0040 |
289 |
< |
#define SHARED_TRESV 0x0080 |
290 |
< |
#define SHARED_UNRESV 0x0100 |
291 |
< |
#define SHARED_LOCOPS 0x0200 |
292 |
< |
#define SHARED_ALL (SHARED_KLINE | SHARED_TKLINE | SHARED_UNKLINE | \ |
293 |
< |
SHARED_XLINE | SHARED_TXLINE | SHARED_UNXLINE | \ |
294 |
< |
SHARED_RESV | SHARED_TRESV | SHARED_UNRESV |\ |
295 |
< |
SHARED_LOCOPS) |
296 |
< |
|
297 |
< |
/* gline acl entry actions */ |
298 |
< |
#define GDENY_BLOCK 0x1 |
299 |
< |
#define GDENY_REJECT 0x2 |
100 |
> |
enum |
101 |
> |
{ |
102 |
> |
NOT_AUTHORIZED = -1, |
103 |
> |
I_LINE_FULL = -2, |
104 |
> |
TOO_MANY = -3, |
105 |
> |
BANNED_CLIENT = -4, |
106 |
> |
TOO_FAST = -5 |
107 |
> |
}; |
108 |
|
|
109 |
< |
struct config_file_entry |
109 |
> |
struct split_nuh_item |
110 |
|
{ |
111 |
< |
const char *dpath; /* DPATH if set from command line */ |
111 |
> |
dlink_node node; |
112 |
> |
|
113 |
> |
char *nuhmask; |
114 |
> |
char *nickptr; |
115 |
> |
char *userptr; |
116 |
> |
char *hostptr; |
117 |
> |
|
118 |
> |
size_t nicksize; |
119 |
> |
size_t usersize; |
120 |
> |
size_t hostsize; |
121 |
> |
}; |
122 |
> |
|
123 |
> |
struct MaskItem |
124 |
> |
{ |
125 |
> |
dlink_node node; |
126 |
> |
dlink_list leaf_list; |
127 |
> |
dlink_list hub_list; |
128 |
> |
enum maskitem_type type; |
129 |
> |
bool active; |
130 |
> |
bool dns_failed; |
131 |
> |
bool dns_pending; |
132 |
> |
unsigned int flags; |
133 |
> |
unsigned int modes; |
134 |
> |
unsigned int port; |
135 |
> |
unsigned int aftype; |
136 |
> |
unsigned int htype; |
137 |
> |
unsigned int ref_count; /* Number of *LOCAL* clients using this */ |
138 |
> |
int bits; |
139 |
> |
uintmax_t until; /* Hold action until this time (calendar time) */ |
140 |
> |
uintmax_t setat; |
141 |
> |
uintmax_t timeout; |
142 |
> |
struct irc_ssaddr *bind; /* ip to bind to for outgoing connect */ |
143 |
> |
struct irc_ssaddr *addr; /* ip to connect to */ |
144 |
> |
struct ClassItem *class; /* Class of connection */ |
145 |
> |
char *name; |
146 |
> |
char *user; /* user part of user@host */ |
147 |
> |
char *host; /* host part of user@host */ |
148 |
> |
char *passwd; |
149 |
> |
char *spasswd; /* Password to send. */ |
150 |
> |
char *reason; |
151 |
> |
char *certfp; |
152 |
> |
char *whois; |
153 |
> |
char *cipher_list; |
154 |
> |
}; |
155 |
> |
|
156 |
> |
struct conf_parser_context |
157 |
> |
{ |
158 |
> |
unsigned int boot; |
159 |
> |
unsigned int pass; |
160 |
> |
FILE *conf_file; |
161 |
> |
}; |
162 |
> |
|
163 |
> |
struct config_general_entry |
164 |
> |
{ |
165 |
> |
const char *dpath; |
166 |
> |
const char *mpath; |
167 |
> |
const char *spath; |
168 |
|
const char *configfile; |
169 |
|
const char *klinefile; |
170 |
|
const char *xlinefile; |
307 |
– |
const char *rxlinefile; |
308 |
– |
const char *rklinefile; |
171 |
|
const char *dlinefile; |
172 |
< |
const char *glinefile; |
173 |
< |
const char *cresvfile; |
174 |
< |
const char *nresvfile; |
175 |
< |
|
176 |
< |
char *logpath; |
177 |
< |
char *operlog; |
178 |
< |
|
179 |
< |
char *servlink_path; |
180 |
< |
char *egdpool_path; |
181 |
< |
|
182 |
< |
MessageFile motd; |
183 |
< |
MessageFile opermotd; |
184 |
< |
MessageFile linksfile; |
185 |
< |
|
186 |
< |
unsigned char compression_level; |
187 |
< |
int gline_min_cidr; |
188 |
< |
int gline_min_cidr6; |
189 |
< |
int dot_in_ip6_addr; |
190 |
< |
int dots_in_ident; |
191 |
< |
int failed_oper_notice; |
192 |
< |
int anti_spam_exit_message_time; |
193 |
< |
int max_accept; |
194 |
< |
int max_nick_time; |
195 |
< |
int max_nick_changes; |
196 |
< |
int ts_max_delta; |
197 |
< |
int ts_warn_delta; |
198 |
< |
int anti_nick_flood; |
199 |
< |
int kline_with_reason; |
200 |
< |
int warn_no_nline; |
201 |
< |
int invisible_on_connect; |
202 |
< |
int stats_o_oper_only; |
203 |
< |
int stats_k_oper_only; |
204 |
< |
int stats_i_oper_only; |
205 |
< |
int stats_P_oper_only; |
206 |
< |
int short_motd; |
207 |
< |
int no_oper_flood; |
208 |
< |
int true_no_oper_flood; |
209 |
< |
int oper_pass_resv; |
210 |
< |
int glines; |
211 |
< |
int hide_spoof_ips; |
212 |
< |
int burst_away; |
213 |
< |
int use_whois_actually; |
214 |
< |
int tkline_expire_notices; |
215 |
< |
int opers_bypass_callerid; |
216 |
< |
int ignore_bogus_ts; |
217 |
< |
char *kline_reason; |
218 |
< |
int pace_wait; |
357 |
< |
int pace_wait_simple; |
358 |
< |
int gline_time; |
359 |
< |
int gline_logging; |
360 |
< |
int idletime; |
361 |
< |
int oper_only_umodes; |
362 |
< |
int oper_umodes; |
363 |
< |
int max_targets; |
364 |
< |
int caller_id_wait; |
365 |
< |
int min_nonwildcard; |
366 |
< |
int min_nonwildcard_simple; |
367 |
< |
int kill_chase_time_limit; |
368 |
< |
int default_floodcount; |
369 |
< |
int client_flood; |
370 |
< |
/* 0 == don't use throttle... */ |
371 |
< |
int throttle_time; |
372 |
< |
int use_egd; |
373 |
< |
int ping_cookie; |
374 |
< |
int disable_auth; |
375 |
< |
int disable_remote; |
376 |
< |
#ifdef HAVE_LIBCRYPTO |
377 |
< |
struct EncCapability *default_cipher_preference; |
378 |
< |
#endif |
172 |
> |
const char *resvfile; |
173 |
> |
|
174 |
> |
unsigned int dline_min_cidr; |
175 |
> |
unsigned int dline_min_cidr6; |
176 |
> |
unsigned int kline_min_cidr; |
177 |
> |
unsigned int kline_min_cidr6; |
178 |
> |
unsigned int dots_in_ident; |
179 |
> |
unsigned int failed_oper_notice; |
180 |
> |
unsigned int anti_spam_exit_message_time; |
181 |
> |
unsigned int max_accept; |
182 |
> |
unsigned int max_watch; |
183 |
> |
unsigned int whowas_history_length; |
184 |
> |
unsigned int away_time; |
185 |
> |
unsigned int away_count; |
186 |
> |
unsigned int max_nick_time; |
187 |
> |
unsigned int max_nick_changes; |
188 |
> |
unsigned int ts_max_delta; |
189 |
> |
unsigned int ts_warn_delta; |
190 |
> |
unsigned int anti_nick_flood; |
191 |
> |
unsigned int warn_no_connect_block; |
192 |
> |
unsigned int invisible_on_connect; |
193 |
> |
unsigned int stats_e_disabled; |
194 |
> |
unsigned int stats_i_oper_only; |
195 |
> |
unsigned int stats_k_oper_only; |
196 |
> |
unsigned int stats_m_oper_only; |
197 |
> |
unsigned int stats_o_oper_only; |
198 |
> |
unsigned int stats_P_oper_only; |
199 |
> |
unsigned int stats_u_oper_only; |
200 |
> |
unsigned int short_motd; |
201 |
> |
unsigned int no_oper_flood; |
202 |
> |
unsigned int opers_bypass_callerid; |
203 |
> |
unsigned int pace_wait; |
204 |
> |
unsigned int pace_wait_simple; |
205 |
> |
unsigned int oper_only_umodes; |
206 |
> |
unsigned int oper_umodes; |
207 |
> |
unsigned int max_targets; |
208 |
> |
unsigned int caller_id_wait; |
209 |
> |
unsigned int min_nonwildcard; |
210 |
> |
unsigned int min_nonwildcard_simple; |
211 |
> |
unsigned int kill_chase_time_limit; |
212 |
> |
unsigned int default_floodcount; |
213 |
> |
unsigned int default_floodtime; |
214 |
> |
unsigned int throttle_count; |
215 |
> |
unsigned int throttle_time; |
216 |
> |
unsigned int ping_cookie; |
217 |
> |
unsigned int disable_auth; |
218 |
> |
unsigned int cycle_on_host_change; |
219 |
|
}; |
220 |
|
|
221 |
|
struct config_channel_entry |
222 |
|
{ |
223 |
< |
int restrict_channels; |
224 |
< |
int disable_local_channels; |
225 |
< |
int use_except; |
226 |
< |
int use_invex; |
227 |
< |
int use_knock; |
228 |
< |
int knock_delay; |
229 |
< |
int knock_delay_channel; |
230 |
< |
int invite_ops_only; |
223 |
> |
unsigned int disable_fake_channels; |
224 |
> |
unsigned int invite_client_count; |
225 |
> |
unsigned int invite_client_time; |
226 |
> |
unsigned int invite_delay_channel; |
227 |
> |
unsigned int invite_expire_time; |
228 |
> |
unsigned int knock_client_count; |
229 |
> |
unsigned int knock_client_time; |
230 |
> |
unsigned int knock_delay_channel; |
231 |
> |
unsigned int max_invites; |
232 |
|
unsigned int max_bans; |
233 |
< |
unsigned int max_chans_per_user; |
234 |
< |
int no_create_on_split; |
235 |
< |
int no_join_on_split; |
236 |
< |
int quiet_on_ban; |
396 |
< |
int burst_topicwho; |
397 |
< |
int default_split_server_count; |
398 |
< |
int default_split_user_count; |
233 |
> |
unsigned int max_bans_large; |
234 |
> |
unsigned int max_channels; |
235 |
> |
unsigned int default_join_flood_count; |
236 |
> |
unsigned int default_join_flood_time; |
237 |
|
}; |
238 |
|
|
239 |
< |
struct config_server_hide |
239 |
> |
struct config_serverhide_entry |
240 |
|
{ |
403 |
– |
int flatten_links; |
404 |
– |
int hide_servers; |
241 |
|
char *hidden_name; |
242 |
< |
int links_delay; |
243 |
< |
int links_disabled; |
244 |
< |
int hidden; |
245 |
< |
int disable_hidden; |
246 |
< |
int hide_server_ips; |
242 |
> |
char *flatten_links_file; |
243 |
> |
unsigned int flatten_links; |
244 |
> |
unsigned int flatten_links_delay; |
245 |
> |
unsigned int disable_remote_commands; |
246 |
> |
unsigned int hide_servers; |
247 |
> |
unsigned int hide_services; |
248 |
> |
unsigned int hidden; |
249 |
> |
unsigned int hide_server_ips; |
250 |
|
}; |
251 |
|
|
252 |
< |
struct server_info |
252 |
> |
struct config_serverinfo_entry |
253 |
|
{ |
254 |
+ |
char *sid; |
255 |
|
char *name; |
256 |
|
char *description; |
257 |
|
char *network_name; |
258 |
|
char *network_desc; |
419 |
– |
#ifdef HAVE_LIBCRYPTO |
259 |
|
char *rsa_private_key_file; |
260 |
< |
RSA *rsa_private_key; |
261 |
< |
SSL_CTX *ctx; |
262 |
< |
#endif |
263 |
< |
char *sid; |
264 |
< |
int hub; |
265 |
< |
struct irc_ssaddr ip; |
266 |
< |
struct irc_ssaddr ip6; |
267 |
< |
int max_clients; |
268 |
< |
int specific_ipv4_vhost; |
269 |
< |
int specific_ipv6_vhost; |
270 |
< |
struct sockaddr_in dns_host; |
432 |
< |
int can_use_v6; |
260 |
> |
char *ssl_certificate_file; |
261 |
> |
char *ssl_dh_param_file; |
262 |
> |
char *ssl_dh_elliptic_curve; |
263 |
> |
char *ssl_cipher_list; |
264 |
> |
char *ssl_message_digest_algorithm; |
265 |
> |
tls_context_t tls_ctx; |
266 |
> |
tls_md_t message_digest_algorithm; |
267 |
> |
unsigned int hub; |
268 |
> |
unsigned int default_max_clients; |
269 |
> |
unsigned int max_nick_length; |
270 |
> |
unsigned int max_topic_length; |
271 |
|
}; |
272 |
|
|
273 |
< |
struct admin_info |
273 |
> |
struct config_admin_entry |
274 |
|
{ |
275 |
|
char *name; |
276 |
|
char *description; |
277 |
|
char *email; |
278 |
|
}; |
279 |
|
|
280 |
< |
struct logging_entry |
280 |
> |
struct config_log_entry |
281 |
|
{ |
282 |
|
unsigned int use_logging; |
283 |
< |
char operlog[PATH_MAX + 1]; |
284 |
< |
char userlog[PATH_MAX + 1]; |
285 |
< |
char glinelog[PATH_MAX + 1]; |
286 |
< |
char ioerrlog[PATH_MAX + 1]; |
287 |
< |
char klinelog[PATH_MAX + 1]; |
288 |
< |
char killlog[PATH_MAX + 1]; |
289 |
< |
char operspylog[PATH_MAX + 1]; |
290 |
< |
char failed_operlog[PATH_MAX + 1]; |
291 |
< |
}; |
292 |
< |
|
293 |
< |
extern unsigned int scount; |
294 |
< |
extern int ypass; |
295 |
< |
extern dlink_list class_items; |
296 |
< |
extern dlink_list server_items; |
297 |
< |
extern dlink_list cluster_items; |
298 |
< |
extern dlink_list hub_items; |
299 |
< |
extern dlink_list rxconf_items; |
300 |
< |
extern dlink_list rkconf_items; |
301 |
< |
extern dlink_list leaf_items; |
302 |
< |
extern dlink_list temporary_klines; |
303 |
< |
extern dlink_list temporary_dlines; |
304 |
< |
extern dlink_list temporary_glines; |
305 |
< |
extern dlink_list temporary_xlines; |
306 |
< |
extern dlink_list temporary_rxlines; |
307 |
< |
extern dlink_list temporary_rklines; |
308 |
< |
extern struct logging_entry ConfigLoggingEntry; |
309 |
< |
extern struct config_file_entry ConfigFileEntry;/* defined in ircd.c*/ |
310 |
< |
extern struct config_channel_entry ConfigChannel;/* defined in channel.c*/ |
311 |
< |
extern struct config_server_hide ConfigServerHide; /* defined in s_conf.c */ |
312 |
< |
extern struct server_info ServerInfo; /* defined in ircd.c */ |
313 |
< |
extern struct admin_info AdminInfo; /* defined in ircd.c */ |
314 |
< |
extern int valid_wild_card(struct Client *, int, int, ...); |
315 |
< |
/* End GLOBAL section */ |
316 |
< |
|
317 |
< |
extern unsigned long get_sendq(struct Client *); |
318 |
< |
extern const char *get_client_class(struct Client *); |
319 |
< |
extern int get_client_ping(struct Client *, int *); |
320 |
< |
extern void check_class(void); |
321 |
< |
extern void init_class(void); |
322 |
< |
extern struct ConfItem *find_class(const char *); |
323 |
< |
extern void init_ip_hash_table(void); |
486 |
< |
extern void count_ip_hash(int *, unsigned long *); |
487 |
< |
extern void remove_one_ip(struct irc_ssaddr *); |
488 |
< |
extern struct ConfItem *make_conf_item(ConfType type); |
489 |
< |
extern void free_access_item(struct AccessItem *); |
490 |
< |
extern void read_conf_files(int); |
491 |
< |
extern int attach_conf(struct Client *, struct ConfItem *); |
492 |
< |
extern int attach_connect_block(struct Client *, const char *, const char *); |
493 |
< |
|
494 |
< |
extern int detach_conf(struct Client *, ConfType); |
495 |
< |
|
496 |
< |
extern struct ConfItem *find_conf_name(dlink_list *, const char *, ConfType); |
497 |
< |
extern struct ConfItem *find_conf_exact(ConfType, const char *, const char *, const char *); |
498 |
< |
extern struct AccessItem *find_kill(struct Client *); |
499 |
< |
extern struct AccessItem *find_gline(struct Client *); |
500 |
< |
extern int conf_connect_allowed(struct irc_ssaddr *, int); |
501 |
< |
extern char *oper_privs_as_string(const unsigned int); |
502 |
< |
extern void split_nuh(char *mask, char **nick, char **user, char **host); |
503 |
< |
extern struct ConfItem *find_matching_name_conf(ConfType, const char *, |
504 |
< |
const char *, const char *, int); |
505 |
< |
extern struct ConfItem *find_exact_name_conf(ConfType, const char *, |
506 |
< |
const char *, const char *); |
507 |
< |
extern void delete_conf_item(struct ConfItem *); |
508 |
< |
extern void report_confitem_types(struct Client *, ConfType, int); |
283 |
> |
}; |
284 |
> |
|
285 |
> |
struct aline_ctx |
286 |
> |
{ |
287 |
> |
bool add; |
288 |
> |
bool simple_mask; |
289 |
> |
char *mask; |
290 |
> |
char *user; |
291 |
> |
char *host; |
292 |
> |
char *reason; |
293 |
> |
char *server; |
294 |
> |
uintmax_t duration; |
295 |
> |
}; |
296 |
> |
|
297 |
> |
extern dlink_list flatten_links; |
298 |
> |
extern dlink_list connect_items; |
299 |
> |
extern dlink_list operator_items; |
300 |
> |
extern struct conf_parser_context conf_parser_ctx; |
301 |
> |
extern struct config_log_entry ConfigLog; |
302 |
> |
extern struct config_general_entry ConfigGeneral; |
303 |
> |
extern struct config_channel_entry ConfigChannel; |
304 |
> |
extern struct config_serverhide_entry ConfigServerHide; |
305 |
> |
extern struct config_serverinfo_entry ConfigServerInfo; |
306 |
> |
extern struct config_admin_entry ConfigAdminInfo; |
307 |
> |
|
308 |
> |
extern bool valid_wild_card_simple(const char *); |
309 |
> |
extern bool valid_wild_card(int, ...); |
310 |
> |
|
311 |
> |
extern struct MaskItem *conf_make(enum maskitem_type); |
312 |
> |
extern void read_conf_files(bool); |
313 |
> |
extern int conf_attach(struct Client *, struct MaskItem *); |
314 |
> |
extern int check_client(struct Client *); |
315 |
> |
|
316 |
> |
|
317 |
> |
extern void conf_detach(struct Client *, enum maskitem_type); |
318 |
> |
extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type); |
319 |
> |
extern int conf_connect_allowed(struct irc_ssaddr *); |
320 |
> |
extern void split_nuh(struct split_nuh_item *); |
321 |
> |
extern struct MaskItem *operator_find(const struct Client *, const char *); |
322 |
> |
extern struct MaskItem *connect_find(const char *, int (*)(const char *, const char *)); |
323 |
> |
extern void conf_free(struct MaskItem *); |
324 |
|
extern void yyerror(const char *); |
325 |
< |
extern int conf_yy_fatal_error(const char *); |
511 |
< |
extern int conf_fbgets(char *, unsigned int, FBFILE *); |
512 |
< |
extern void write_conf_line(struct Client *, struct ConfItem *, |
513 |
< |
const char *, time_t); |
514 |
< |
extern int remove_conf_line(ConfType, struct Client *, const char *, |
515 |
< |
const char *); |
516 |
< |
extern void add_temp_line(struct ConfItem *); |
325 |
> |
extern void conf_error_report(const char *); |
326 |
|
extern void cleanup_tklines(void *); |
327 |
< |
extern const char *get_conf_name(ConfType); |
328 |
< |
extern int rehash(int); |
329 |
< |
extern int conf_add_server(struct ConfItem *, unsigned int, const char *); |
521 |
< |
extern void conf_add_class_to_conf(struct ConfItem *, const char *); |
522 |
< |
extern void conf_add_d_conf(struct AccessItem *); |
523 |
< |
|
524 |
< |
/* XXX consider moving these into csvlib.h */ |
525 |
< |
extern void parse_csv_file(FBFILE *, ConfType); |
327 |
> |
extern void conf_rehash(bool); |
328 |
> |
extern void lookup_confhost(struct MaskItem *); |
329 |
> |
extern void conf_add_class_to_conf(struct MaskItem *, const char *); |
330 |
|
|
331 |
< |
extern char *get_oper_name(const struct Client *); |
331 |
> |
extern const char *get_oper_name(const struct Client *); |
332 |
|
|
529 |
– |
extern void *map_to_conf(struct ConfItem *); |
530 |
– |
extern struct ConfItem *unmap_conf_item(void *); |
333 |
|
/* XXX should the parse_aline stuff go into another file ?? */ |
334 |
< |
#define AWILD 0x1 /* check wild cards */ |
533 |
< |
#define NOUSERLOOKUP 0x2 /* Don't lookup the user@host on /rkline nick */ |
534 |
< |
extern int parse_aline(const char *, struct Client *, int, char **, |
535 |
< |
int, char **, char **, time_t *, char **, char **); |
536 |
< |
extern int valid_comment(struct Client *, char *, int); |
537 |
< |
|
538 |
< |
/* XXX */ |
539 |
< |
extern int yylex(void); |
540 |
< |
|
541 |
< |
#define TK_SECONDS 0 |
542 |
< |
#define TK_MINUTES 1 |
543 |
< |
extern time_t valid_tkline(char *, int); |
544 |
< |
extern int match_conf_password(const char *, const struct AccessItem *); |
545 |
< |
|
546 |
< |
#define NOT_AUTHORIZED (-1) |
547 |
< |
#define IRCD_SOCKET_ERROR (-2) |
548 |
< |
#define I_LINE_FULL (-3) |
549 |
< |
#define TOO_MANY (-4) |
550 |
< |
#define BANNED_CLIENT (-5) |
551 |
< |
#define TOO_FAST (-6) |
552 |
< |
|
553 |
< |
#define CLEANUP_TKLINES_TIME 60 |
554 |
< |
|
555 |
< |
extern void cluster_a_line(struct Client *, |
556 |
< |
const char *, int, int, const char *,...); |
557 |
< |
extern void rebuild_cidr_class(struct ConfItem *, struct ClassItem *); |
334 |
> |
extern bool parse_aline(const char *, struct Client *, int, char **, struct aline_ctx *); |
335 |
|
|
336 |
< |
#endif /* INCLUDED_s_conf_h */ |
336 |
> |
extern uintmax_t valid_tkline(const char *, const int); |
337 |
> |
extern bool match_conf_password(const char *, const struct MaskItem *); |
338 |
> |
#endif /* INCLUDED_conf_h */ |