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" |
36 |
< |
#include "pcre.h" |
37 |
< |
|
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 |
< |
}; |
75 |
< |
|
76 |
< |
/* |
77 |
< |
* MatchItem - used for XLINE and ULINE types |
78 |
< |
*/ |
79 |
< |
struct MatchItem |
80 |
< |
{ |
81 |
< |
char *user; /* Used for ULINE only */ |
82 |
< |
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) */ |
90 |
< |
}; |
91 |
< |
|
92 |
< |
struct AccessItem |
93 |
< |
{ |
94 |
< |
dlink_node node; |
95 |
< |
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */ |
96 |
< |
unsigned int flags; |
97 |
< |
int clients; /* Number of *LOCAL* clients using this */ |
98 |
< |
struct irc_ssaddr my_ipnum; /* ip to bind to for outgoing connect */ |
99 |
< |
struct irc_ssaddr ipnum; /* ip to connect to */ |
100 |
< |
char * host; /* host part of user@host */ |
101 |
< |
char * passwd; |
102 |
< |
char * spasswd; /* Password to send. */ |
103 |
< |
char * reason; |
104 |
< |
char * oper_reason; |
105 |
< |
char * user; /* user part of user@host */ |
106 |
< |
int port; |
107 |
< |
char * fakename; /* Mask name */ |
108 |
< |
time_t hold; /* Hold action until this time (calendar time) */ |
109 |
< |
struct ConfItem *class_ptr; /* Class of connection */ |
110 |
< |
struct DNSQuery* dns_query; |
111 |
< |
int aftype; |
112 |
< |
#ifdef HAVE_LIBCRYPTO |
113 |
< |
char * rsa_public_key_file; |
114 |
< |
RSA * rsa_public_key; |
115 |
< |
struct EncCapability *cipher_preference; |
116 |
< |
#endif |
117 |
< |
pcre *regexuser; |
118 |
< |
pcre *regexhost; |
119 |
< |
}; |
32 |
> |
#include "conf_class.h" |
33 |
|
|
121 |
– |
struct ClassItem |
122 |
– |
{ |
123 |
– |
long max_sendq; |
124 |
– |
int con_freq; |
125 |
– |
int ping_freq; |
126 |
– |
int ping_warning; |
127 |
– |
int max_total; |
128 |
– |
int max_local; |
129 |
– |
int max_global; |
130 |
– |
int max_ident; |
131 |
– |
int max_perip; |
132 |
– |
int curr_user_count; |
133 |
– |
int cidr_bitlen_ipv4; |
134 |
– |
int cidr_bitlen_ipv6; |
135 |
– |
int number_per_cidr; |
136 |
– |
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 |
– |
}; |
34 |
|
|
35 |
< |
struct CidrItem |
141 |
< |
{ |
142 |
< |
struct irc_ssaddr mask; |
143 |
< |
int number_on_this_cidr; |
144 |
< |
dlink_node node; |
145 |
< |
}; |
35 |
> |
#define CONF_NOREASON "<No reason supplied>" |
36 |
|
|
37 |
< |
#define ConFreq(x) ((x)->con_freq) |
38 |
< |
#define PingFreq(x) ((x)->ping_freq) |
39 |
< |
#define PingWarning(x) ((x)->ping_warning) |
40 |
< |
#define MaxTotal(x) ((x)->max_total) |
41 |
< |
#define MaxGlobal(x) ((x)->max_global) |
42 |
< |
#define MaxLocal(x) ((x)->max_local) |
43 |
< |
#define MaxIdent(x) ((x)->max_ident) |
44 |
< |
#define MaxPerIp(x) ((x)->max_perip) |
45 |
< |
#define MaxSendq(x) ((x)->max_sendq) |
46 |
< |
#define CurrUserCount(x) ((x)->curr_user_count) |
47 |
< |
#define CidrBitlenIPV4(x) ((x)->cidr_bitlen_ipv4) |
48 |
< |
#define CidrBitlenIPV6(x) ((x)->cidr_bitlen_ipv6) |
49 |
< |
#define NumberPerCidr(x) ((x)->number_per_cidr) |
50 |
< |
|
51 |
< |
#define ClassPtr(x) ((x)->class_ptr) |
52 |
< |
|
53 |
< |
|
54 |
< |
#define CONF_ILLEGAL 0x80000000 |
55 |
< |
#define CONF_RESERVED 0x00000001 |
56 |
< |
#define CONF_CLIENT 0x00000002 |
57 |
< |
#define CONF_SERVER 0x00000004 |
58 |
< |
#define CONF_OPERATOR 0x00000008 |
59 |
< |
#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 |
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 0x00000001U |
44 |
> |
#define CONF_FLAGS_NO_TILDE 0x00000004U |
45 |
> |
#define CONF_FLAGS_NEED_IDENTD 0x00000008U |
46 |
> |
#define CONF_FLAGS_EXEMPTKLINE 0x00000010U |
47 |
> |
#define CONF_FLAGS_NOLIMIT 0x00000020U |
48 |
> |
#define CONF_FLAGS_SPOOF_IP 0x00000040U |
49 |
> |
#define CONF_FLAGS_SPOOF_NOTICE 0x00000080U |
50 |
> |
#define CONF_FLAGS_REDIR 0x00000100U |
51 |
> |
#define CONF_FLAGS_EXEMPTGLINE 0x00000200U |
52 |
> |
#define CONF_FLAGS_CAN_FLOOD 0x00000400U |
53 |
> |
#define CONF_FLAGS_NEED_PASSWORD 0x00000800U |
54 |
> |
#define CONF_FLAGS_ALLOW_AUTO_CONN 0x00001000U |
55 |
> |
#define CONF_FLAGS_ENCRYPTED 0x00002000U |
56 |
> |
#define CONF_FLAGS_IN_DATABASE 0x00004000U |
57 |
> |
#define CONF_FLAGS_EXEMPTRESV 0x00008000U |
58 |
> |
#define CONF_FLAGS_SSL 0x00010000U |
59 |
> |
#define CONF_FLAGS_WEBIRC 0x00020000U |
60 |
|
|
61 |
< |
/* Macros for struct AccessItem */ |
62 |
< |
#define IsLimitIp(x) ((x)->flags & CONF_FLAGS_LIMIT_IP) |
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) |
244 |
– |
#define IsNoMatchIp(x) ((x)->flags & CONF_FLAGS_NOMATCH_IP) |
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) |
249 |
– |
#define IsConfIdlelined(x) ((x)->flags & CONF_FLAGS_IDLE_LINED) |
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) |
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) |
74 |
|
#define IsConfAllowAutoConn(x) ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN) |
75 |
< |
#define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN) |
75 |
> |
#define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN) |
76 |
|
#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) |
77 |
|
#define IsConfRedir(x) ((x)->flags & CONF_FLAGS_REDIR) |
78 |
< |
#define IsConfAwayBurst(x) ((x)->flags & CONF_FLAGS_BURST_AWAY) |
79 |
< |
#define SetConfAwayBurst(x) ((x)->flags |= CONF_FLAGS_BURST_AWAY) |
80 |
< |
#define ClearConfAwayBurst(x) ((x)->flags &= ~CONF_FLAGS_BURST_AWAY) |
81 |
< |
#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) |
78 |
> |
#define IsConfSSL(x) ((x)->flags & CONF_FLAGS_SSL) |
79 |
> |
#define IsConfDatabase(x) ((x)->flags & CONF_FLAGS_IN_DATABASE) |
80 |
> |
#define SetConfDatabase(x) ((x)->flags |= CONF_FLAGS_IN_DATABASE) |
81 |
> |
|
82 |
|
|
83 |
< |
/* shared/cluster server entry types |
83 |
> |
/* shared/cluster server entry types |
84 |
|
* These defines are used for both shared and cluster. |
85 |
|
*/ |
86 |
< |
#define SHARED_KLINE 0x0001 |
87 |
< |
#define SHARED_TKLINE 0x0002 |
88 |
< |
#define SHARED_UNKLINE 0x0004 |
89 |
< |
#define SHARED_XLINE 0x0008 |
90 |
< |
#define SHARED_TXLINE 0x0010 |
91 |
< |
#define SHARED_UNXLINE 0x0020 |
92 |
< |
#define SHARED_RESV 0x0040 |
93 |
< |
#define SHARED_TRESV 0x0080 |
94 |
< |
#define SHARED_UNRESV 0x0100 |
95 |
< |
#define SHARED_LOCOPS 0x0200 |
96 |
< |
#define SHARED_ALL (SHARED_KLINE | SHARED_TKLINE | SHARED_UNKLINE | \ |
97 |
< |
SHARED_XLINE | SHARED_TXLINE | SHARED_UNXLINE | \ |
98 |
< |
SHARED_RESV | SHARED_TRESV | SHARED_UNRESV |\ |
99 |
< |
SHARED_LOCOPS) |
100 |
< |
|
101 |
< |
/* gline acl entry actions */ |
102 |
< |
#define GDENY_BLOCK 0x1 |
103 |
< |
#define GDENY_REJECT 0x2 |
86 |
> |
#define SHARED_KLINE 0x00000001U |
87 |
> |
#define SHARED_UNKLINE 0x00000002U |
88 |
> |
#define SHARED_XLINE 0x00000004U |
89 |
> |
#define SHARED_UNXLINE 0x00000008U |
90 |
> |
#define SHARED_RESV 0x00000010U |
91 |
> |
#define SHARED_UNRESV 0x00000020U |
92 |
> |
#define SHARED_LOCOPS 0x00000040U |
93 |
> |
#define SHARED_DLINE 0x00000080U |
94 |
> |
#define SHARED_UNDLINE 0x00000100U |
95 |
> |
#define SHARED_ALL (SHARED_KLINE | SHARED_UNKLINE |\ |
96 |
> |
SHARED_XLINE | SHARED_UNXLINE |\ |
97 |
> |
SHARED_RESV | SHARED_UNRESV |\ |
98 |
> |
SHARED_LOCOPS | SHARED_DLINE | SHARED_UNDLINE) |
99 |
> |
|
100 |
> |
|
101 |
> |
enum maskitem_type |
102 |
> |
{ |
103 |
> |
CONF_CLIENT = 1 << 0, |
104 |
> |
CONF_SERVER = 1 << 1, |
105 |
> |
CONF_KLINE = 1 << 2, |
106 |
> |
CONF_DLINE = 1 << 3, |
107 |
> |
CONF_EXEMPT = 1 << 4, |
108 |
> |
CONF_CLUSTER = 1 << 5, |
109 |
> |
CONF_XLINE = 1 << 6, |
110 |
> |
CONF_ULINE = 1 << 7, |
111 |
> |
CONF_GLINE = 1 << 8, |
112 |
> |
CONF_CRESV = 1 << 9, |
113 |
> |
CONF_NRESV = 1 << 10, |
114 |
> |
CONF_SERVICE = 1 << 11, |
115 |
> |
CONF_OPER = 1 << 12 |
116 |
> |
}; |
117 |
> |
|
118 |
> |
enum |
119 |
> |
{ |
120 |
> |
NOT_AUTHORIZED = -1, |
121 |
> |
I_LINE_FULL = -2, |
122 |
> |
TOO_MANY = -3, |
123 |
> |
BANNED_CLIENT = -4, |
124 |
> |
TOO_FAST = -5 |
125 |
> |
}; |
126 |
> |
|
127 |
> |
struct split_nuh_item |
128 |
> |
{ |
129 |
> |
dlink_node node; |
130 |
> |
|
131 |
> |
char *nuhmask; |
132 |
> |
char *nickptr; |
133 |
> |
char *userptr; |
134 |
> |
char *hostptr; |
135 |
> |
|
136 |
> |
size_t nicksize; |
137 |
> |
size_t usersize; |
138 |
> |
size_t hostsize; |
139 |
> |
}; |
140 |
> |
|
141 |
> |
struct MaskItem |
142 |
> |
{ |
143 |
> |
dlink_node node; |
144 |
> |
dlink_list leaf_list; |
145 |
> |
dlink_list hub_list; |
146 |
> |
dlink_list exempt_list; |
147 |
> |
enum maskitem_type type; |
148 |
> |
unsigned int dns_failed; |
149 |
> |
unsigned int dns_pending; |
150 |
> |
unsigned int flags; |
151 |
> |
unsigned int modes; |
152 |
> |
unsigned int port; |
153 |
> |
unsigned int count; |
154 |
> |
unsigned int aftype; |
155 |
> |
unsigned int active; |
156 |
> |
unsigned int htype; |
157 |
> |
unsigned int ref_count; /* Number of *LOCAL* clients using this */ |
158 |
> |
int bits; |
159 |
> |
time_t until; /* Hold action until this time (calendar time) */ |
160 |
> |
time_t setat; |
161 |
> |
struct irc_ssaddr bind; /* ip to bind to for outgoing connect */ |
162 |
> |
struct irc_ssaddr addr; /* ip to connect to */ |
163 |
> |
struct ClassItem *class; /* Class of connection */ |
164 |
> |
char *name; |
165 |
> |
char *user; /* user part of user@host */ |
166 |
> |
char *host; /* host part of user@host */ |
167 |
> |
char *passwd; |
168 |
> |
char *spasswd; /* Password to send. */ |
169 |
> |
char *reason; |
170 |
> |
char *certfp; |
171 |
> |
char *cipher_list; |
172 |
> |
void *rsa_public_key; |
173 |
> |
}; |
174 |
> |
|
175 |
> |
struct exempt |
176 |
> |
{ |
177 |
> |
dlink_node node; |
178 |
> |
char *name; |
179 |
> |
char *user; |
180 |
> |
char *host; |
181 |
> |
size_t len; |
182 |
> |
time_t when; |
183 |
> |
struct irc_ssaddr addr; |
184 |
> |
int bits; |
185 |
> |
int type; |
186 |
> |
int coid; |
187 |
> |
}; |
188 |
> |
|
189 |
> |
struct CidrItem |
190 |
> |
{ |
191 |
> |
dlink_node node; |
192 |
> |
struct irc_ssaddr mask; |
193 |
> |
unsigned int number_on_this_cidr; |
194 |
> |
}; |
195 |
|
|
196 |
< |
struct config_file_entry |
196 |
> |
struct |
197 |
> |
{ |
198 |
> |
unsigned int boot; |
199 |
> |
unsigned int pass; |
200 |
> |
FILE *conf_file; |
201 |
> |
} conf_parser_ctx; |
202 |
> |
|
203 |
> |
struct |
204 |
|
{ |
205 |
|
const char *dpath; /* DPATH if set from command line */ |
206 |
+ |
const char *mpath; |
207 |
+ |
const char *spath; |
208 |
|
const char *configfile; |
209 |
|
const char *klinefile; |
210 |
+ |
const char *glinefile; |
211 |
|
const char *xlinefile; |
307 |
– |
const char *rxlinefile; |
308 |
– |
const char *rklinefile; |
212 |
|
const char *dlinefile; |
213 |
< |
const char *glinefile; |
311 |
< |
const char *cresvfile; |
312 |
< |
const char *nresvfile; |
213 |
> |
const char *resvfile; |
214 |
|
|
215 |
< |
char *logpath; |
315 |
< |
char *operlog; |
316 |
< |
|
317 |
< |
char *servlink_path; |
318 |
< |
char *egdpool_path; |
319 |
< |
|
320 |
< |
MessageFile motd; |
321 |
< |
MessageFile opermotd; |
322 |
< |
MessageFile linksfile; |
323 |
< |
|
324 |
< |
unsigned char compression_level; |
325 |
< |
int gline_min_cidr; |
326 |
< |
int gline_min_cidr6; |
327 |
< |
int dot_in_ip6_addr; |
328 |
< |
int dots_in_ident; |
329 |
< |
int failed_oper_notice; |
330 |
< |
int anti_spam_exit_message_time; |
331 |
< |
int max_accept; |
332 |
< |
int max_nick_time; |
333 |
< |
int max_nick_changes; |
334 |
< |
int ts_max_delta; |
335 |
< |
int ts_warn_delta; |
336 |
< |
int anti_nick_flood; |
337 |
< |
int kline_with_reason; |
338 |
< |
int warn_no_nline; |
339 |
< |
int invisible_on_connect; |
340 |
< |
int stats_o_oper_only; |
341 |
< |
int stats_k_oper_only; |
342 |
< |
int stats_i_oper_only; |
343 |
< |
int stats_P_oper_only; |
344 |
< |
int short_motd; |
345 |
< |
int no_oper_flood; |
346 |
< |
int true_no_oper_flood; |
347 |
< |
int oper_pass_resv; |
348 |
< |
int glines; |
349 |
< |
int hide_spoof_ips; |
350 |
< |
int burst_away; |
351 |
< |
int use_whois_actually; |
352 |
< |
int tkline_expire_notices; |
353 |
< |
int opers_bypass_callerid; |
354 |
< |
int ignore_bogus_ts; |
355 |
< |
char *kline_reason; |
356 |
< |
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 |
379 |
< |
}; |
215 |
> |
char *service_name; |
216 |
|
|
217 |
< |
struct config_channel_entry |
218 |
< |
{ |
219 |
< |
int restrict_channels; |
220 |
< |
int disable_local_channels; |
221 |
< |
int use_except; |
222 |
< |
int use_invex; |
223 |
< |
int use_knock; |
224 |
< |
int knock_delay; |
225 |
< |
int knock_delay_channel; |
226 |
< |
int invite_ops_only; |
217 |
> |
unsigned int gline_min_cidr; |
218 |
> |
unsigned int gline_min_cidr6; |
219 |
> |
unsigned int dots_in_ident; |
220 |
> |
unsigned int failed_oper_notice; |
221 |
> |
unsigned int anti_spam_exit_message_time; |
222 |
> |
unsigned int max_accept; |
223 |
> |
unsigned int max_watch; |
224 |
> |
unsigned int away_time; |
225 |
> |
unsigned int away_count; |
226 |
> |
unsigned int max_nick_time; |
227 |
> |
unsigned int max_nick_changes; |
228 |
> |
unsigned int ts_max_delta; |
229 |
> |
unsigned int ts_warn_delta; |
230 |
> |
unsigned int anti_nick_flood; |
231 |
> |
unsigned int warn_no_connect_block; |
232 |
> |
unsigned int invisible_on_connect; |
233 |
> |
unsigned int stats_e_disabled; |
234 |
> |
unsigned int stats_o_oper_only; |
235 |
> |
unsigned int stats_k_oper_only; |
236 |
> |
unsigned int stats_i_oper_only; |
237 |
> |
unsigned int stats_P_oper_only; |
238 |
> |
unsigned int stats_u_oper_only; |
239 |
> |
unsigned int short_motd; |
240 |
> |
unsigned int no_oper_flood; |
241 |
> |
unsigned int true_no_oper_flood; |
242 |
> |
unsigned int oper_pass_resv; |
243 |
> |
unsigned int glines; |
244 |
> |
unsigned int hide_spoof_ips; |
245 |
> |
unsigned int tkline_expire_notices; |
246 |
> |
unsigned int opers_bypass_callerid; |
247 |
> |
unsigned int ignore_bogus_ts; |
248 |
> |
unsigned int pace_wait; |
249 |
> |
unsigned int pace_wait_simple; |
250 |
> |
unsigned int gline_time; |
251 |
> |
unsigned int gline_request_time; |
252 |
> |
unsigned int oper_only_umodes; |
253 |
> |
unsigned int oper_umodes; |
254 |
> |
unsigned int max_targets; |
255 |
> |
unsigned int caller_id_wait; |
256 |
> |
unsigned int min_nonwildcard; |
257 |
> |
unsigned int min_nonwildcard_simple; |
258 |
> |
unsigned int kill_chase_time_limit; |
259 |
> |
unsigned int default_floodcount; |
260 |
> |
unsigned int throttle_count; |
261 |
> |
unsigned int throttle_time; |
262 |
> |
unsigned int ping_cookie; |
263 |
> |
unsigned int disable_auth; |
264 |
> |
unsigned int cycle_on_host_change; |
265 |
> |
} ConfigFileEntry; |
266 |
> |
|
267 |
> |
struct |
268 |
> |
{ |
269 |
> |
unsigned int disable_fake_channels; |
270 |
> |
unsigned int invite_client_count; |
271 |
> |
unsigned int invite_client_time; |
272 |
> |
unsigned int knock_client_count; |
273 |
> |
unsigned int knock_client_time; |
274 |
> |
unsigned int knock_delay_channel; |
275 |
|
unsigned int max_bans; |
276 |
< |
unsigned int max_chans_per_user; |
277 |
< |
int no_create_on_split; |
278 |
< |
int no_join_on_split; |
279 |
< |
int quiet_on_ban; |
280 |
< |
int burst_topicwho; |
281 |
< |
int default_split_server_count; |
398 |
< |
int default_split_user_count; |
399 |
< |
}; |
276 |
> |
unsigned int max_channels; |
277 |
> |
unsigned int no_create_on_split; |
278 |
> |
unsigned int no_join_on_split; |
279 |
> |
unsigned int default_split_server_count; |
280 |
> |
unsigned int default_split_user_count; |
281 |
> |
} ConfigChannel; |
282 |
|
|
283 |
< |
struct config_server_hide |
283 |
> |
struct |
284 |
|
{ |
403 |
– |
int flatten_links; |
404 |
– |
int hide_servers; |
285 |
|
char *hidden_name; |
286 |
< |
int links_delay; |
287 |
< |
int links_disabled; |
288 |
< |
int hidden; |
289 |
< |
int disable_hidden; |
290 |
< |
int hide_server_ips; |
291 |
< |
}; |
286 |
> |
unsigned int flatten_links; |
287 |
> |
unsigned int disable_remote_commands; |
288 |
> |
unsigned int hide_servers; |
289 |
> |
unsigned int hide_services; |
290 |
> |
unsigned int links_delay; |
291 |
> |
unsigned int links_disabled; |
292 |
> |
unsigned int hidden; |
293 |
> |
unsigned int hide_server_ips; |
294 |
> |
} ConfigServerHide; |
295 |
|
|
296 |
< |
struct server_info |
296 |
> |
struct |
297 |
|
{ |
298 |
+ |
#ifdef HAVE_LIBCRYPTO |
299 |
+ |
const EVP_MD *message_digest_algorithm; |
300 |
+ |
#endif |
301 |
+ |
char *sid; |
302 |
|
char *name; |
303 |
|
char *description; |
304 |
|
char *network_name; |
305 |
|
char *network_desc; |
419 |
– |
#ifdef HAVE_LIBCRYPTO |
306 |
|
char *rsa_private_key_file; |
307 |
< |
RSA *rsa_private_key; |
308 |
< |
SSL_CTX *ctx; |
309 |
< |
#endif |
310 |
< |
char *sid; |
425 |
< |
int hub; |
307 |
> |
void *rsa_private_key; |
308 |
> |
void *server_ctx; |
309 |
> |
void *client_ctx; |
310 |
> |
unsigned int hub; |
311 |
|
struct irc_ssaddr ip; |
312 |
|
struct irc_ssaddr ip6; |
313 |
< |
int max_clients; |
314 |
< |
int specific_ipv4_vhost; |
315 |
< |
int specific_ipv6_vhost; |
313 |
> |
unsigned int max_clients; |
314 |
> |
unsigned int max_nick_length; |
315 |
> |
unsigned int max_topic_length; |
316 |
> |
unsigned int specific_ipv4_vhost; |
317 |
> |
unsigned int specific_ipv6_vhost; |
318 |
|
struct sockaddr_in dns_host; |
319 |
< |
int can_use_v6; |
320 |
< |
}; |
319 |
> |
unsigned int can_use_v6; |
320 |
> |
} ServerInfo; |
321 |
|
|
322 |
< |
struct admin_info |
322 |
> |
struct |
323 |
|
{ |
324 |
|
char *name; |
325 |
|
char *description; |
326 |
|
char *email; |
327 |
< |
}; |
327 |
> |
} AdminInfo; |
328 |
|
|
329 |
< |
struct logging_entry |
329 |
> |
struct |
330 |
|
{ |
331 |
|
unsigned int use_logging; |
332 |
< |
char operlog[PATH_MAX + 1]; |
446 |
< |
char userlog[PATH_MAX + 1]; |
447 |
< |
char glinelog[PATH_MAX + 1]; |
448 |
< |
char ioerrlog[PATH_MAX + 1]; |
449 |
< |
char klinelog[PATH_MAX + 1]; |
450 |
< |
char killlog[PATH_MAX + 1]; |
451 |
< |
char operspylog[PATH_MAX + 1]; |
452 |
< |
char failed_operlog[PATH_MAX + 1]; |
453 |
< |
}; |
332 |
> |
} ConfigLoggingEntry; |
333 |
|
|
334 |
< |
extern unsigned int scount; |
456 |
< |
extern int ypass; |
457 |
< |
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; |
344 |
< |
extern dlink_list temporary_xlines; |
468 |
< |
extern dlink_list temporary_rxlines; |
469 |
< |
extern dlink_list temporary_rklines; |
470 |
< |
extern struct logging_entry ConfigLoggingEntry; |
471 |
< |
extern struct config_file_entry ConfigFileEntry;/* defined in ircd.c*/ |
472 |
< |
extern struct config_channel_entry ConfigChannel;/* defined in channel.c*/ |
473 |
< |
extern struct config_server_hide ConfigServerHide; /* defined in s_conf.c */ |
474 |
< |
extern struct server_info ServerInfo; /* defined in ircd.c */ |
475 |
< |
extern struct admin_info AdminInfo; /* defined in ircd.c */ |
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 |
> |
|
344 |
> |
extern int valid_wild_card_simple(const char *); |
345 |
|
extern int valid_wild_card(struct Client *, int, int, ...); |
346 |
|
/* End GLOBAL section */ |
347 |
|
|
479 |
– |
extern unsigned long get_sendq(struct Client *); |
480 |
– |
extern const char *get_client_class(struct Client *); |
481 |
– |
extern int get_client_ping(struct Client *, int *); |
482 |
– |
extern void check_class(void); |
483 |
– |
extern void init_class(void); |
484 |
– |
extern struct ConfItem *find_class(const char *); |
348 |
|
extern void init_ip_hash_table(void); |
349 |
< |
extern void count_ip_hash(int *, unsigned long *); |
349 |
> |
extern void count_ip_hash(unsigned int *, uint64_t *); |
350 |
|
extern void remove_one_ip(struct irc_ssaddr *); |
351 |
< |
extern struct ConfItem *make_conf_item(ConfType type); |
489 |
< |
extern void free_access_item(struct AccessItem *); |
351 |
> |
extern struct MaskItem *conf_make(enum maskitem_type); |
352 |
|
extern void read_conf_files(int); |
353 |
< |
extern int attach_conf(struct Client *, struct ConfItem *); |
353 |
> |
extern int attach_conf(struct Client *, struct MaskItem *); |
354 |
|
extern int attach_connect_block(struct Client *, const char *, const char *); |
355 |
+ |
extern int check_client(struct Client *); |
356 |
|
|
494 |
– |
extern int detach_conf(struct Client *, ConfType); |
357 |
|
|
358 |
< |
extern struct ConfItem *find_conf_name(dlink_list *, const char *, ConfType); |
359 |
< |
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 *); |
358 |
> |
extern void detach_conf(struct Client *, enum maskitem_type); |
359 |
> |
extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type); |
360 |
|
extern int conf_connect_allowed(struct irc_ssaddr *, int); |
361 |
|
extern char *oper_privs_as_string(const unsigned int); |
362 |
< |
extern void split_nuh(char *mask, char **nick, char **user, char **host); |
363 |
< |
extern struct ConfItem *find_matching_name_conf(ConfType, const char *, |
364 |
< |
const char *, const char *, int); |
365 |
< |
extern struct ConfItem *find_exact_name_conf(ConfType, const char *, |
362 |
> |
extern void split_nuh(struct split_nuh_item *); |
363 |
> |
extern struct MaskItem *find_matching_name_conf(enum maskitem_type, const char *, |
364 |
> |
const char *, const char *, unsigned int); |
365 |
> |
extern struct MaskItem *find_exact_name_conf(enum maskitem_type, const struct Client *, const char *, |
366 |
|
const char *, const char *); |
367 |
< |
extern void delete_conf_item(struct ConfItem *); |
508 |
< |
extern void report_confitem_types(struct Client *, ConfType, int); |
367 |
> |
extern void conf_free(struct MaskItem *); |
368 |
|
extern void yyerror(const char *); |
369 |
< |
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 *); |
369 |
> |
extern void conf_error_report(const char *); |
370 |
|
extern void cleanup_tklines(void *); |
518 |
– |
extern const char *get_conf_name(ConfType); |
371 |
|
extern int rehash(int); |
372 |
< |
extern int conf_add_server(struct ConfItem *, unsigned int, const char *); |
373 |
< |
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); |
372 |
> |
extern void lookup_confhost(struct MaskItem *); |
373 |
> |
extern void conf_add_class_to_conf(struct MaskItem *, const char *); |
374 |
|
|
375 |
< |
extern char *get_oper_name(const struct Client *); |
375 |
> |
extern const char *get_oper_name(const struct Client *); |
376 |
|
|
529 |
– |
extern void *map_to_conf(struct ConfItem *); |
530 |
– |
extern struct ConfItem *unmap_conf_item(void *); |
377 |
|
/* XXX should the parse_aline stuff go into another file ?? */ |
378 |
< |
#define AWILD 0x1 /* check wild cards */ |
533 |
< |
#define NOUSERLOOKUP 0x2 /* Don't lookup the user@host on /rkline nick */ |
378 |
> |
#define AWILD 0x1 /* check wild cards */ |
379 |
|
extern int parse_aline(const char *, struct Client *, int, char **, |
380 |
< |
int, char **, char **, time_t *, char **, char **); |
380 |
> |
int, char **, char **, time_t *, char **, char **); |
381 |
|
extern int valid_comment(struct Client *, char *, int); |
382 |
|
|
538 |
– |
/* XXX */ |
539 |
– |
extern int yylex(void); |
383 |
|
|
384 |
|
#define TK_SECONDS 0 |
385 |
|
#define TK_MINUTES 1 |
386 |
< |
extern time_t valid_tkline(char *, int); |
387 |
< |
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) |
386 |
> |
extern time_t valid_tkline(const char *, const int); |
387 |
> |
extern int match_conf_password(const char *, const struct MaskItem *); |
388 |
|
|
389 |
|
#define CLEANUP_TKLINES_TIME 60 |
390 |
|
|
391 |
< |
extern void cluster_a_line(struct Client *, |
556 |
< |
const char *, int, int, const char *,...); |
557 |
< |
extern void rebuild_cidr_class(struct ConfItem *, struct ClassItem *); |
558 |
< |
|
391 |
> |
extern void cluster_a_line(struct Client *, const char *, int, int, const char *,...); |
392 |
|
#endif /* INCLUDED_s_conf_h */ |