1
0
mirror of https://github.com/anope/anope.git synced 2026-07-05 21:33:14 +02:00

BUILD : 1.7.21 (1426) BUGS : 876 NOTES : We now support CIDR in channel ban/invite/except lists. Introduces new CIDR capable generic lists system.

git-svn-id: svn://svn.anope.org/anope/trunk@1426 31f1291d-b8d6-0310-a050-a5561fc1590b


git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1141 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b
2008-09-03 20:11:12 +00:00
parent 482a8aa766
commit 790dc8a4bf
30 changed files with 861 additions and 353 deletions
+21
View File
@@ -141,6 +141,19 @@ E void do_mass_mode(char *modes);
E void chan_set_correct_modes(User * user, Channel * c, int give_modes);
E void restore_unsynced_topics(void);
E Entry *entry_create(char *mask);
E Entry *entry_add(EList *list, char *mask);
E void entry_delete(EList *list, Entry *e);
E EList *list_create();
E int entry_match(Entry *e, char *nick, char *user, char *host, uint32 ip);
E int entry_match_mask(Entry *e, char *mask, uint32 ip);
E Entry *elist_match(EList *list, char *nick, char *user, char *host, uint32 ip);
E Entry *elist_match_mask(EList *list, char *mask, uint32 ip);
E Entry *elist_match_user(EList *list, User *u);
E Entry *elist_find_mask(EList *list, char *mask);
E long get_memuse(EList *list);
#define whosends(ci) ((!(ci) || !((ci)->botflags & BS_SYMBIOSIS) || !(ci)->bi || !(ci)->c || (ci)->c->usercount < BSMinUsers) ? s_ChanServ : (ci)->bi->nick)
/**** chanserv.c ****/
@@ -862,6 +875,14 @@ E void ntoa(struct in_addr addr, char *ipaddr, int len);
E char **buildStringList(char *src, int *number);
E void binary_to_hex(unsigned char *bin, char *hex, int length);
E uint32 cidr_to_netmask(uint16 cidr);
E uint16 netmask_to_cidr(uint32 mask);
E int str_is_wildcard(const char *str);
E int str_is_pure_wildcard(const char *str);
E uint32 str_is_ip(char *str);
E int str_is_cidr(char *str, uint32 * ip, uint32 * mask, char **host);
/**** modules.c ****/
+32 -7
View File
@@ -217,6 +217,8 @@ extern int shutdown(int, int);
typedef struct server_ Server;
typedef struct user_ User;
typedef struct channel_ Channel;
typedef struct c_elist EList;
typedef struct c_elist_entry Entry;
typedef struct ModuleData_ ModuleData; /* ModuleData struct */
typedef struct memo_ Memo;
typedef struct nickrequest_ NickRequest;
@@ -356,12 +358,15 @@ struct ircdvars_ {
int p10; /* ircd is P10 */
char *nickchars; /* character set */
int sync; /* reports sync state */
int cidrchanbei; /* channel bans/excepts/invites support CIDR (syntax: +b *!*@192.168.0.0/15)
* 0 for no support, 1 for strict cidr support, anything else
* for ircd specific support (nefarious only cares about first /mask) */
};
struct ircdcapab_ {
uint32 noquit;
uint32 tsmode;
uint32 unconnect;
uint32 unconnect;
uint32 nickip;
uint32 nsjoin;
uint32 zip;
@@ -962,6 +967,16 @@ struct userdata_ {
int16 times;
};
/* Channelban type flags */
#define ENTRYTYPE_NONE 0x00000000
#define ENTRYTYPE_CIDR4 0x00000001
#define ENTRYTYPE_NICK_WILD 0x00000004
#define ENTRYTYPE_NICK 0x00000008
#define ENTRYTYPE_USER_WILD 0x00000010
#define ENTRYTYPE_USER 0x00000020
#define ENTRYTYPE_HOST_WILD 0x00000040
#define ENTRYTYPE_HOST 0x00000080
struct channel_ {
Channel *next, *prev;
char name[CHANMAX];
@@ -975,12 +990,9 @@ struct channel_ {
char *key; /* NULL if none */
char *redirect; /* +L; NULL if none */
char *flood; /* +f; NULL if none */
int32 bancount, bansize;
char **bans;
int32 exceptcount, exceptsize;
char **excepts;
int32 invitecount, invitesize;
char **invite;
EList *bans;
EList *excepts;
EList *invites;
struct c_userlist {
struct c_userlist *next, *prev;
User *user;
@@ -998,6 +1010,19 @@ struct channel_ {
int16 topic_sync; /* Is the topic in sync? */
};
struct c_elist {
Entry *entries;
int32 count;
};
struct c_elist_entry {
Entry *next, *prev;
uint32 type;
uint32 cidr_ip; /* IP mask for CIDR matching */
uint32 cidr_mask; /* Netmask for CIDR matching */
char *nick, *user, *host, *mask;
};
/*************************************************************************/
/* Constants for news types. */