diff options
| author | viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b <viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-09-03 20:11:12 +0000 |
|---|---|---|
| committer | viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b <viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-09-03 20:11:12 +0000 |
| commit | 790dc8a4bf326a7598fc41aa8c018e867edee33a (patch) | |
| tree | 281aa0f14877734a92336a21355eb945a8d1517e /include | |
| parent | 482a8aa766c9e1a96ff63b44ed319fe51588c35c (diff) | |
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
Diffstat (limited to 'include')
| -rw-r--r-- | include/extern.h | 21 | ||||
| -rw-r--r-- | include/services.h | 39 |
2 files changed, 53 insertions, 7 deletions
diff --git a/include/extern.h b/include/extern.h index c85600751..4284b09de 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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 ****/ diff --git a/include/services.h b/include/services.h index 48920b201..3d8ee2be1 100644 --- a/include/services.h +++ b/include/services.h @@ -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. */ |
