ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/include/conf.h
(Generate patch)

Comparing:
ircd-hybrid-8/include/conf.h (file contents), Revision 1389 by michael, Tue May 1 13:08:29 2012 UTC vs.
ircd-hybrid/trunk/include/conf.h (file contents), Revision 1646 by michael, Wed Nov 7 21:02:43 2012 UTC

# Line 25 | Line 25
25   #ifndef INCLUDED_s_conf_h
26   #define INCLUDED_s_conf_h
27   #include "config.h"
28 – #ifdef HAVE_LIBCRYPTO
29 – #include <openssl/rsa.h>
30 – #endif
28   #include "ircd_defs.h"
29   #include "motd.h"               /* MessageFile */
30   #include "client.h"
31   #include "hook.h"
32 + #include "conf_class.h"
33  
34  
35 < struct Client;
38 <
39 < extern struct Callback *client_check_cb;
35 > #define CONF_NOREASON "<No reason supplied>"
36  
37   struct conf_parser_context
38   {
# Line 47 | Line 43 | struct conf_parser_context
43  
44   extern struct conf_parser_context conf_parser_ctx;
45  
46 < typedef enum
47 < {  
48 <  CONF_TYPE,
49 <  CLASS_TYPE,
50 <  OPER_TYPE,
51 <  CLIENT_TYPE,
52 <  SERVER_TYPE,
53 <  HUB_TYPE,
54 <  LEAF_TYPE,
55 <  KLINE_TYPE,
56 <  DLINE_TYPE,
57 <  EXEMPTDLINE_TYPE,
58 <  CLUSTER_TYPE,
59 <  RKLINE_TYPE,
60 <  RXLINE_TYPE,
61 <  XLINE_TYPE,    
62 <  ULINE_TYPE,
63 <  GLINE_TYPE,
64 <  CRESV_TYPE,    
65 <  NRESV_TYPE,
66 <  GDENY_TYPE,
71 <  SERVICE_TYPE
72 < } ConfType;
46 > enum maskitem_type
47 > {
48 >  CONF_RESERVED = 1 <<  0, /* XXX */
49 >  CONF_CLIENT   = 1 <<  1,
50 >  CONF_SERVER   = 1 <<  2,
51 >  CONF_KLINE    = 1 <<  3,
52 >  CONF_DLINE    = 1 <<  4,
53 >  CONF_EXEMPT   = 1 <<  5,
54 >  CONF_CLUSTER  = 1 <<  6,
55 >  CONF_RKLINE   = 1 <<  7,
56 >  CONF_RXLINE   = 1 <<  8,
57 >  CONF_XLINE    = 1 <<  9,
58 >  CONF_ULINE    = 1 << 10,
59 >  CONF_GLINE    = 1 << 11,
60 >  CONF_CRESV    = 1 << 12,
61 >  CONF_NRESV    = 1 << 13,
62 >  CONF_SERVICE  = 1 << 14,
63 >  CONF_OPER     = 1 << 15,
64 >  CONF_HUB      = 1 << 16, /* XXX There are no separate hub/leaf configs anymore. This is just for /stats h */
65 >  CONF_CLASS    = 1 << 17  /* XXX Same here; just for /stats Y|y */
66 > };
67  
68   struct split_nuh_item
69   {
# Line 85 | Line 79 | struct split_nuh_item
79    size_t hostsize;
80   };
81  
82 < struct ConfItem
89 < {
90 <  dlink_node node;      /* link into known ConfItems of this type */
91 <
92 <  char *name;           /* Primary key */
93 <  void *regexpname;
94 <  unsigned int flags;
95 <  ConfType type;
96 < };
97 <
98 < /*
99 < * MatchItem - used for XLINE and ULINE types
100 < */
101 < struct MatchItem
102 < {
103 <  char *user;           /* Used for ULINE only */
104 <  char *host;           /* Used for ULINE only */
105 <  char *reason;
106 <  char *oper_reason;
107 <  int action;           /* used for uline */
108 <  int count;            /* How many times this matchitem has been matched */
109 <  int ref_count;        /* How many times is this matchitem in use */
110 <  int illegal;          /* Should it be deleted when possible? */
111 <  time_t           hold;     /* Hold action until this time (calendar time) */
112 < };
113 <
114 < struct AccessItem
82 > struct MaskItem
83   {
84 <  dlink_node node;
85 <  unsigned int     dns_failed;
86 <  unsigned int     dns_pending;
87 <  unsigned int     status;   /* If CONF_ILLEGAL, delete when no clients */
88 <  unsigned int     flags;
89 <  unsigned int     modes;
90 <  unsigned int     port;
91 <  int              clients;  /* Number of *LOCAL* clients using this */
92 <  int              bits;
93 <  int              type;
94 <  struct irc_ssaddr bind;  /* ip to bind to for outgoing connect */
95 <  struct irc_ssaddr addr;  /* ip to connect to */
96 <  char *           host;     /* host part of user@host */
97 <  char *           passwd;
98 <  char *           spasswd;  /* Password to send. */
99 <  char *           reason;
100 <  char *           oper_reason;
101 <  char *           user;     /* user part of user@host */
102 <  time_t           hold;     /* Hold action until this time (calendar time) */
103 <  struct ConfItem *class_ptr;  /* Class of connection */
104 <  int              aftype;
105 < #ifdef HAVE_LIBCRYPTO
106 <  /* certs */
107 <  char *cipher_list;
108 <  char *           rsa_public_key_file;
109 <  RSA *            rsa_public_key;
110 < #endif
111 <  void *regexuser;
112 <  void *regexhost;
113 <  dlink_list leaf_list;
114 <  dlink_list hub_list;
115 < };
148 <
149 < struct ClassItem
150 < {
151 <  dlink_list list_ipv4;         /* base of per cidr ipv4 client link list */
152 <  dlink_list list_ipv6;         /* base of per cidr ipv6 client link list */
153 <  unsigned int max_sendq;
154 <  int con_freq;
155 <  int ping_freq;
156 <  int ping_warning;
157 <  int max_total;
158 <  int max_local;
159 <  int max_global;
160 <  int max_ident;
161 <  int max_perip;
162 <  int curr_user_count;
163 <  int cidr_bitlen_ipv4;
164 <  int cidr_bitlen_ipv6;
165 <  int number_per_cidr;
166 <  int active;
84 >  struct MaskItem   *hnext;
85 >  dlink_node         node;
86 >  dlink_list         leaf_list;
87 >  dlink_list         hub_list;
88 >  enum maskitem_type type;
89 >  unsigned int       dns_failed;
90 >  unsigned int       dns_pending;
91 >  unsigned int       flags;
92 >  unsigned int       modes;
93 >  unsigned int       port;
94 >  unsigned int       count;
95 >  unsigned int       aftype;
96 >  unsigned int       active;
97 >  unsigned int       htype;
98 >  unsigned int       ref_count;  /* Number of *LOCAL* clients using this */
99 >  int                bits;
100 >  time_t             hold;     /* Hold action until this time (calendar time) */
101 >  time_t             setat;
102 >  struct irc_ssaddr  bind;  /* ip to bind to for outgoing connect */
103 >  struct irc_ssaddr  addr;  /* ip to connect to */
104 >  struct ClassItem  *class;  /* Class of connection */
105 >  char              *name;
106 >  char              *host;     /* host part of user@host */
107 >  char              *passwd;
108 >  char              *spasswd;  /* Password to send. */
109 >  char              *reason;
110 >  char              *user;     /* user part of user@host */
111 >  char              *cipher_list;
112 >  char              *rsa_public_key_file;
113 >  void              *rsa_public_key;
114 >  void              *regexuser;
115 >  void              *regexhost;
116   };
117  
118   struct CidrItem
119   {
120    dlink_node node;
121    struct irc_ssaddr mask;
122 <  int number_on_this_cidr;
122 >  unsigned int number_on_this_cidr;
123   };
124  
125  
126 < #define CONF_ILLEGAL            0x80000000
127 < #define CONF_RESERVED           0x00000001
128 < #define CONF_CLIENT             0x00000002
129 < #define CONF_SERVER             0x00000004
181 < #define CONF_OPERATOR           0x00000008
182 < #define CONF_KLINE              0x00000010
183 < #define CONF_CLASS              0x00000020
184 < #define CONF_LISTEN_PORT        0x00000040
185 < #define CONF_EXEMPTKLINE        0x00000080
186 < #define CONF_DLINE              0x00000100
187 < #define CONF_XLINE              0x00000200
188 < #define CONF_ULINE              0x00000400
189 < #define CONF_EXEMPTDLINE        0x00000800
190 < #define CONF_GLINE              0x00001000
191 < #define CONF_SERVICE            0x00002000
192 <
193 < #define CONF_SERVER_MASK       CONF_SERVER
194 < #define CONF_CLIENT_MASK       (CONF_CLIENT | CONF_OPERATOR | CONF_SERVER_MASK)
195 <
196 < /* XXX temporary hack */
197 < #define CONF_CRESV              0x80000001
198 < #define CONF_NRESV              0x80000002
199 <
200 < #define IsConfIllegal(x)        ((x)->status & CONF_ILLEGAL)
201 < #define SetConfIllegal(x)       ((x)->status |= CONF_ILLEGAL)
202 < #define IsConfServer(x)         ((x)->status == CONF_SERVER)
203 < #define SetConfServer(x)        ((x)->status = CONF_SERVER)
204 < #define IsConfOperator(x)       ((x)->status & CONF_OPERATOR)
205 < #define IsConfKill(x)           ((x)->status == CONF_KLINE)
206 < #define IsConfClient(x)         ((x)->status & CONF_CLIENT)
207 < #define IsConfTypeOfClient(x)   ((x)->status & CONF_CLIENT_MASK)
208 < #define IsConfUline(x)          ((x)->status & CONF_ULINE)
209 < #define IsConfXline(x)          ((x)->status & CONF_XLINE)
210 < #define IsConfGline(x)          ((x)->status == CONF_GLINE)
126 > #define IsConfOperator(x)       ((x)->type == CONF_OPER)
127 > #define IsConfKill(x)           ((x)->type == CONF_KLINE)
128 > #define IsConfClient(x)         ((x)->type == CONF_CLIENT)
129 > #define IsConfGline(x)          ((x)->type == CONF_GLINE)
130  
131 < /* AccessItem->flags */
213 <
214 < /* Generic flags... */
215 < /* access flags... */
131 > /* MaskItem->flags */
132   #define CONF_FLAGS_DO_IDENTD            0x00000001
133   #define CONF_FLAGS_LIMIT_IP             0x00000002
134   #define CONF_FLAGS_NO_TILDE             0x00000004
# Line 226 | Line 142 | struct CidrItem
142   #define CONF_FLAGS_EXEMPTGLINE          0x00000400
143   #define CONF_FLAGS_CAN_FLOOD            0x00000800
144   #define CONF_FLAGS_NEED_PASSWORD        0x00001000
229 – /* server flags */
145   #define CONF_FLAGS_ALLOW_AUTO_CONN      0x00002000
146   #define CONF_FLAGS_ENCRYPTED            0x00004000
147 < #define CONF_FLAGS_TEMPORARY            0x00008000
148 < #define CONF_FLAGS_BURST_AWAY           0x00010000
149 < #define CONF_FLAGS_EXEMPTRESV           0x00020000
150 < #define CONF_FLAGS_TOPICBURST           0x00040000
236 < #define CONF_FLAGS_SSL                  0x00080000
147 > #define CONF_FLAGS_IN_DATABASE          0x00008000
148 > #define CONF_FLAGS_EXEMPTRESV           0x00010000
149 > #define CONF_FLAGS_SSL                  0x00020000
150 > #define CONF_FLAGS_MAINCONF             0x00040000
151  
152 < /* Macros for struct AccessItem */
152 > /* Macros for struct MaskItem */
153   #define IsLimitIp(x)            ((x)->flags & CONF_FLAGS_LIMIT_IP)
154   #define IsNoTilde(x)            ((x)->flags & CONF_FLAGS_NO_TILDE)
155   #define IsConfCanFlood(x)       ((x)->flags & CONF_FLAGS_CAN_FLOOD)
# Line 255 | Line 169 | struct CidrItem
169   #define IsConfAllowAutoConn(x)  ((x)->flags & CONF_FLAGS_ALLOW_AUTO_CONN)
170   #define SetConfAllowAutoConn(x) ((x)->flags |= CONF_FLAGS_ALLOW_AUTO_CONN)
171   #define ClearConfAllowAutoConn(x) ((x)->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN)
258 – #define IsConfTemporary(x)      ((x)->flags & CONF_FLAGS_TEMPORARY)
259 – #define SetConfTemporary(x)     ((x)->flags |= CONF_FLAGS_TEMPORARY)
172   #define IsConfRedir(x)          ((x)->flags & CONF_FLAGS_REDIR)
261 – #define IsConfAwayBurst(x)      ((x)->flags & CONF_FLAGS_BURST_AWAY)
262 – #define SetConfAwayBurst(x)     ((x)->flags |= CONF_FLAGS_BURST_AWAY)
263 – #define ClearConfAwayBurst(x)   ((x)->flags &= ~CONF_FLAGS_BURST_AWAY)
264 – #define IsConfTopicBurst(x)     ((x)->flags & CONF_FLAGS_TOPICBURST)
265 – #define SetConfTopicBurst(x)    ((x)->flags |= CONF_FLAGS_TOPICBURST)
266 – #define ClearConfTopicBurst(x)  ((x)->flags &= ~CONF_FLAGS_TOPICBURST)
173   #define IsConfSSL(x)      ((x)->flags & CONF_FLAGS_SSL)
174   #define SetConfSSL(x)     ((x)->flags |= CONF_FLAGS_SSL)
175   #define ClearConfSSL(x)   ((x)->flags &= ~CONF_FLAGS_SSL)
176 + #define IsConfDatabase(x)      ((x)->flags & CONF_FLAGS_IN_DATABASE)
177 + #define SetConfDatabase(x)     ((x)->flags |= CONF_FLAGS_IN_DATABASE)
178 +
179  
180   /* shared/cluster server entry types
181   * These defines are used for both shared and cluster.
# Line 285 | Line 194 | struct CidrItem
194                                   SHARED_RESV | SHARED_UNRESV |\
195                                   SHARED_LOCOPS | SHARED_DLINE | SHARED_UNDLINE)
196  
288 – /* gline acl entry actions */
289 – #define GDENY_BLOCK             0x1
290 – #define GDENY_REJECT            0x2
291 –
197   struct config_file_entry
198   {
199    const char *dpath;          /* DPATH if set from command line */
200    const char *configfile;
201    const char *klinefile;
202    const char *xlinefile;
298 –  const char *rxlinefile;
299 –  const char *rklinefile;
203    const char *dlinefile;
301 –  const char *glinefile;
204    const char *cresvfile;
205    const char *nresvfile;
206  
# Line 306 | Line 208 | struct config_file_entry
208    char *service_name;
209  
210    MessageFile motd;
309 –  MessageFile opermotd;
211    MessageFile linksfile;
212  
213    int gline_min_cidr;
# Line 321 | Line 222 | struct config_file_entry
222    int ts_max_delta;
223    int ts_warn_delta;
224    int anti_nick_flood;
324 –  int kline_with_reason;
225    int warn_no_nline;
226    int invisible_on_connect;
227    int stats_e_disabled;
# Line 335 | Line 235 | struct config_file_entry
235    int oper_pass_resv;
236    int glines;
237    int hide_spoof_ips;
338 –  int burst_away;
339 –  int use_whois_actually;
238    int tkline_expire_notices;
239    int opers_bypass_callerid;
240    int ignore_bogus_ts;
343 –  char *kline_reason;
241    int pace_wait;
242    int pace_wait_simple;
243    int gline_time;
244 <  int gline_logging;
244 >  int gline_request_time;
245    int oper_only_umodes;
246    int oper_umodes;
247    int max_targets;
# Line 353 | Line 250 | struct config_file_entry
250    int min_nonwildcard_simple;
251    int kill_chase_time_limit;
252    int default_floodcount;
356 –  int client_flood;
253    /* 0 == don't use throttle... */
254    int throttle_time;
255    int use_egd;
# Line 366 | Line 262 | struct config_channel_entry
262   {
263    int disable_fake_channels;
264    int restrict_channels;
369 –  int disable_local_channels;
370 –  int use_except;
371 –  int use_invex;
372 –  int use_knock;
265    int knock_delay;
266    int knock_delay_channel;
267    unsigned int max_bans;
268    unsigned int max_chans_per_user;
269 +  unsigned int max_chans_per_oper;
270    int no_create_on_split;
271    int no_join_on_split;
272    int quiet_on_ban;
380 –  int burst_topicwho;
273    int default_split_server_count;
274    int default_split_user_count;
275   };
# Line 390 | Line 282 | struct config_server_hide
282    int links_delay;
283    int links_disabled;
284    int hidden;
393 –  int disable_hidden;
285    int hide_server_ips;
286   };
287  
# Line 401 | Line 292 | struct server_info
292    char *description;
293    char *network_name;
294    char *network_desc;
404 – #ifdef HAVE_LIBCRYPTO
295    char *rsa_private_key_file;
296 <  RSA *rsa_private_key;
297 <  SSL_CTX *server_ctx;
298 <  SSL_CTX *client_ctx;
409 < #endif
296 >  void *rsa_private_key;
297 >  void *server_ctx;
298 >  void *client_ctx;
299    int hub;
300    struct irc_ssaddr ip;
301    struct irc_ssaddr ip6;
# Line 429 | Line 318 | struct logging_entry
318    unsigned int use_logging;
319   };
320  
432 – extern dlink_list gdeny_items;
433 – extern dlink_list class_items;
321   extern dlink_list server_items;
322   extern dlink_list cluster_items;
323 < extern dlink_list hub_items;
323 > extern dlink_list xconf_items;
324   extern dlink_list rxconf_items;
325   extern dlink_list rkconf_items;
439 – extern dlink_list leaf_items;
326   extern dlink_list service_items;
441 – extern dlink_list temporary_xlines;
327   extern struct logging_entry ConfigLoggingEntry;
328   extern struct config_file_entry ConfigFileEntry;/* defined in ircd.c*/
329   extern struct config_channel_entry ConfigChannel;/* defined in channel.c*/
# Line 448 | Line 333 | extern struct admin_info AdminInfo;
333   extern int valid_wild_card(struct Client *, int, int, ...);
334   /* End GLOBAL section */
335  
336 < extern unsigned int get_sendq(struct Client *);
337 < extern const char *get_client_class(struct Client *);
338 < extern int get_client_ping(struct Client *, int *);
454 < extern void check_class(void);
455 < extern void init_class(void);
456 < extern struct ConfItem *find_class(const char *);
336 >
337 >
338 >
339   extern void init_ip_hash_table(void);
340   extern void count_ip_hash(unsigned int *, uint64_t *);
341   extern void remove_one_ip(struct irc_ssaddr *);
342 < extern struct ConfItem *make_conf_item(ConfType type);
461 < extern void free_access_item(struct AccessItem *);
342 > extern struct MaskItem *conf_make(enum maskitem_type);
343   extern void read_conf_files(int);
344 < extern int attach_conf(struct Client *, struct ConfItem *);
344 > extern int attach_conf(struct Client *, struct MaskItem *);
345   extern int attach_connect_block(struct Client *, const char *, const char *);
346 + extern int check_client(struct Client *);
347  
466 – extern int detach_conf(struct Client *, ConfType);
348  
349 < extern struct ConfItem *find_conf_name(dlink_list *, const char *, ConfType);
350 < extern struct ConfItem *find_conf_exact(ConfType, const char *, const char *, const char *);
351 < extern struct AccessItem *find_kill(struct Client *);
352 < extern struct AccessItem *find_gline(struct Client *);
349 > extern void detach_conf(struct Client *, enum maskitem_type);
350 > extern struct MaskItem *find_conf_name(dlink_list *, const char *, enum maskitem_type);
351 > extern struct MaskItem *find_kill(struct Client *);
352 > extern struct MaskItem *find_gline(struct Client *);
353   extern int conf_connect_allowed(struct irc_ssaddr *, int);
354   extern char *oper_privs_as_string(const unsigned int);
355   extern void split_nuh(struct split_nuh_item *);
356 < extern struct ConfItem *find_matching_name_conf(ConfType, const char *,
357 <                                                const char *, const char *, int);
358 < extern struct ConfItem *find_exact_name_conf(ConfType, const struct Client *, const char *,
356 > extern struct MaskItem *find_matching_name_conf(enum maskitem_type, const char *,
357 >                                                const char *, const char *, unsigned int);
358 > extern struct MaskItem *find_exact_name_conf(enum maskitem_type, const struct Client *, const char *,
359                                               const char *, const char *);
360 < extern void delete_conf_item(struct ConfItem *);
361 < extern void report_confitem_types(struct Client *, ConfType);
360 > extern void conf_free(struct MaskItem *);
361 > extern void report_confitem_types(struct Client *, enum maskitem_type);
362   extern void yyerror(const char *);
482 – extern void write_conf_line(struct Client *, struct ConfItem *,
483 –                            const char *, time_t);
484 – extern int remove_conf_line(ConfType, struct Client *, const char *,
485 –                            const char *);
486 – extern void add_temp_line(struct ConfItem *);
363   extern void cleanup_tklines(void *);
488 – extern const char *get_conf_name(ConfType);
364   extern int rehash(int);
365 < extern int conf_add_server(struct ConfItem *, const char *);
366 < extern void conf_add_class_to_conf(struct ConfItem *, const char *);
365 > extern int conf_add_server(struct MaskItem *, const char *);
366 > extern void conf_add_class_to_conf(struct MaskItem *, const char *);
367  
493 – /* XXX consider moving these into csvlib.h */
494 – extern void parse_csv_file(FILE *, ConfType);
495 – extern int find_and_delete_temporary(const char *, const char *, int);
368   extern const char *get_oper_name(const struct Client *);
369  
498 – extern void *map_to_conf(struct ConfItem *);
499 – extern struct ConfItem *unmap_conf_item(void *);
370   /* XXX should the parse_aline stuff go into another file ?? */
371   #define AWILD 0x1               /* check wild cards */
502 – #define NOUSERLOOKUP 0x2 /* Don't lookup the user@host on /rkline nick */
372   extern int parse_aline(const char *, struct Client *, int, char **,
373                         int, char **, char **, time_t *, char **, char **);
374   extern int valid_comment(struct Client *, char *, int);
# Line 508 | Line 377 | extern int valid_comment(struct Client *
377   #define TK_SECONDS 0
378   #define TK_MINUTES 1
379   extern time_t valid_tkline(const char *, int);
380 < extern int match_conf_password(const char *, const struct AccessItem *);
380 > extern int match_conf_password(const char *, const struct MaskItem *);
381  
382   #define NOT_AUTHORIZED    (-1)
383   #define I_LINE_FULL       (-2)
# Line 520 | Line 389 | extern int match_conf_password(const cha
389  
390   extern void cluster_a_line(struct Client *,
391                             const char *, int, int, const char *,...);
523 – extern void rebuild_cidr_class(struct ConfItem *, struct ClassItem *);
392   #endif /* INCLUDED_s_conf_h */

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)