]> jfr.im git - irc/rqf/shadowircd.git/blame - include/s_newconf.h
Add resv oper priv, enabled by default for compatibility.
[irc/rqf/shadowircd.git] / include / s_newconf.h
CommitLineData
212380e3 1/*
2 * ircd-ratbox: an advanced Internet Relay Chat Daemon(ircd).
3 * s_newconf.h: code for dealing with conf stuff
4 *
5 * Copyright (C) 2004 Lee Hardy <lee@leeh.co.uk>
6 * Copyright (C) 2004 ircd-ratbox development team
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * 1.Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 * 2.Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3.The name of the author may not be used to endorse or promote products
18 * derived from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
24 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 *
32 * $Id: s_newconf.h 1747 2006-07-25 21:22:45Z jilles $
33 */
34
35#ifndef INCLUDED_s_newconf_h
36#define INCLUDED_s_newconf_h
37
38#include "setup.h"
39#include "tools.h"
40
41#ifdef HAVE_LIBCRYPTO
42#include <openssl/rsa.h>
43#endif
44
45struct ConfItem;
46
47extern dlink_list cluster_conf_list;
48extern dlink_list shared_conf_list;
49extern dlink_list oper_conf_list;
50extern dlink_list hubleaf_conf_list;
51extern dlink_list server_conf_list;
52extern dlink_list xline_conf_list;
53extern dlink_list resv_conf_list;
54extern dlink_list nd_list;
55extern dlink_list tgchange_list;
56
57struct _patricia_tree_t *tgchange_tree;
58
59extern void init_s_newconf(void);
60extern void clear_s_newconf(void);
61extern void clear_s_newconf_bans(void);
62
63#define FREE_TARGET(x) ((x)->localClient->targinfo[0])
64#define USED_TARGETS(x) ((x)->localClient->targinfo[1])
65
66typedef struct
67{
68 char *ip;
69 time_t expiry;
70 patricia_node_t *pnode;
71 dlink_node node;
72} tgchange;
73
74void add_tgchange(const char *host);
75tgchange *find_tgchange(const char *host);
76
77/* shared/cluster/hub/leaf confs */
78struct remote_conf
79{
80 char *username;
81 char *host;
82 char *server;
83 int flags;
84 dlink_node node;
85};
86
87/* flags used in shared/cluster */
88#define SHARED_TKLINE 0x0001
89#define SHARED_PKLINE 0x0002
90#define SHARED_UNKLINE 0x0004
91#define SHARED_LOCOPS 0x0008
92#define SHARED_TXLINE 0x0010
93#define SHARED_PXLINE 0x0020
94#define SHARED_UNXLINE 0x0040
95#define SHARED_TRESV 0x0800
96#define SHARED_PRESV 0x0100
97#define SHARED_UNRESV 0x0200
98#define SHARED_REHASH 0x0400
99
100#define SHARED_ALL (SHARED_TKLINE | SHARED_PKLINE | SHARED_UNKLINE |\
101 SHARED_PXLINE | SHARED_TXLINE | SHARED_UNXLINE |\
102 SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV)
103#define CLUSTER_ALL (SHARED_ALL | SHARED_LOCOPS)
104
105/* flags used in hub/leaf */
106#define CONF_HUB 0x0001
107#define CONF_LEAF 0x0002
108
109struct oper_conf
110{
111 char *name;
112 char *username;
113 char *host;
114 char *passwd;
115
116 int flags;
117 int umodes;
118
119 unsigned int snomask;
120
121#ifdef HAVE_LIBCRYPTO
122 char *rsa_pubkey_file;
123 RSA *rsa_pubkey;
124#endif
125};
126
127extern struct remote_conf *make_remote_conf(void);
128extern void free_remote_conf(struct remote_conf *);
129
130extern int find_shared_conf(const char *username, const char *host,
131 const char *server, int flags);
132extern void propagate_generic(struct Client *source_p, const char *command,
133 const char *target, int cap, const char *format, ...);
134extern void cluster_generic(struct Client *, const char *, int cltype,
135 int cap, const char *format, ...);
136
137#define OPER_ENCRYPTED 0x00001
138#define OPER_KLINE 0x00002
139#define OPER_UNKLINE 0x00004
140#define OPER_LOCKILL 0x00008
141#define OPER_GLOBKILL 0x00010
142#define OPER_REMOTE 0x00020
143#define OPER_GLINE 0x00040
144#define OPER_XLINE 0x00080
145#define OPER_RESV 0x00100
146#define OPER_NICKS 0x00200
147#define OPER_REHASH 0x00400
148#define OPER_DIE 0x00800
149#define OPER_ADMIN 0x01000
150#define OPER_HADMIN 0x02000
151#define OPER_OPERWALL 0x04000
152#define OPER_INVIS 0x08000
153#define OPER_SPY 0x10000
154#define OPER_REMOTEBAN 0x20000
155/* 0x40000 */
156/* 0x80000 and above are in client.h */
157
158#define OPER_FLAGS (OPER_KLINE|OPER_UNKLINE|OPER_LOCKILL|OPER_GLOBKILL|\
159 OPER_REMOTE|OPER_GLINE|OPER_XLINE|OPER_RESV|\
160 OPER_NICKS|OPER_REHASH|OPER_DIE|OPER_ADMIN|\
161 OPER_HADMIN|OPER_OPERWALL|OPER_INVIS|OPER_SPY|\
162 OPER_REMOTEBAN)
163
164#define IsOperConfEncrypted(x) ((x)->flags & OPER_ENCRYPTED)
165
166#define IsOperGlobalKill(x) ((x)->flags2 & OPER_GLOBKILL)
167#define IsOperLocalKill(x) ((x)->flags2 & OPER_LOCKILL)
168#define IsOperRemote(x) ((x)->flags2 & OPER_REMOTE)
169#define IsOperUnkline(x) ((x)->flags2 & OPER_UNKLINE)
170#define IsOperGline(x) ((x)->flags2 & OPER_GLINE)
171#define IsOperN(x) ((x)->flags2 & OPER_NICKS)
172#define IsOperK(x) ((x)->flags2 & OPER_KLINE)
173#define IsOperXline(x) ((x)->flags2 & OPER_XLINE)
1ebe6ffc 174#define IsOperResv(x) ((x)->flags2 & OPER_RESV)
212380e3 175#define IsOperDie(x) ((x)->flags2 & OPER_DIE)
176#define IsOperRehash(x) ((x)->flags2 & OPER_REHASH)
177#define IsOperHiddenAdmin(x) ((x)->flags2 & OPER_HADMIN)
178#define IsOperAdmin(x) (((x)->flags2 & OPER_ADMIN) || \
179 ((x)->flags2 & OPER_HADMIN))
180#define IsOperOperwall(x) ((x)->flags2 & OPER_OPERWALL)
181#define IsOperSpy(x) ((x)->flags2 & OPER_SPY)
182#define IsOperInvis(x) ((x)->flags2 & OPER_INVIS)
183#define IsOperRemoteBan(x) ((x)->flags2 & OPER_REMOTEBAN)
184
185extern struct oper_conf *make_oper_conf(void);
186extern void free_oper_conf(struct oper_conf *);
187extern void clear_oper_conf(void);
188
189extern struct oper_conf *find_oper_conf(const char *username, const char *host,
190 const char *locip, const char *oname);
191
192extern const char *get_oper_privs(int flags);
193
194struct server_conf
195{
196 char *name;
197 char *host;
198 char *passwd;
199 char *spasswd;
200 int port;
201 int flags;
202 int servers;
203 time_t hold;
204
205 int aftype;
206 struct irc_sockaddr_storage my_ipnum;
207
208 char *class_name;
209 struct Class *class;
210 dlink_node node;
211};
212
213#define SERVER_ILLEGAL 0x0001
214#define SERVER_VHOSTED 0x0002
215#define SERVER_ENCRYPTED 0x0004
216#define SERVER_COMPRESSED 0x0008
217#define SERVER_TB 0x0010
218#define SERVER_AUTOCONN 0x0020
219
220#define ServerConfIllegal(x) ((x)->flags & SERVER_ILLEGAL)
221#define ServerConfVhosted(x) ((x)->flags & SERVER_VHOSTED)
222#define ServerConfEncrypted(x) ((x)->flags & SERVER_ENCRYPTED)
223#define ServerConfCompressed(x) ((x)->flags & SERVER_COMPRESSED)
224#define ServerConfTb(x) ((x)->flags & SERVER_TB)
225#define ServerConfAutoconn(x) ((x)->flags & SERVER_AUTOCONN)
226
227extern struct server_conf *make_server_conf(void);
228extern void free_server_conf(struct server_conf *);
229extern void clear_server_conf(void);
230extern void add_server_conf(struct server_conf *);
231
232extern struct server_conf *find_server_conf(const char *name);
233
234extern void attach_server_conf(struct Client *, struct server_conf *);
235extern void detach_server_conf(struct Client *);
236extern void set_server_conf_autoconn(struct Client *source_p, char *name,
237 int newval);
238
239
240extern struct ConfItem *find_xline(const char *, int);
0fdb2570 241extern struct ConfItem *find_xline_mask(const char *);
212380e3 242extern struct ConfItem *find_nick_resv(const char *name);
0fdb2570 243extern struct ConfItem *find_nick_resv_mask(const char *name);
212380e3 244
245extern int valid_wild_card_simple(const char *);
246extern int clean_resv_nick(const char *);
247time_t valid_temp_time(const char *p);
248
249struct nd_entry
250{
251 char name[NICKLEN+1];
252 time_t expire;
212380e3 253 dlink_node lnode; /* node in ll */
254};
255
256extern void add_nd_entry(const char *name);
257extern void free_nd_entry(struct nd_entry *);
258extern unsigned long get_nd_count(void);
259
260#endif
261