diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2014-02-18 21:16:29 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2014-02-18 21:16:29 +0000 |
commit | fdeb045add7198e20baf78c9dd8c3969ed0028f2 (patch) | |
tree | 02d410bcba912e0d1486fa4b9cd8c459a2f69d03 | |
parent | c678dd256fefdf4d60330540ffd13104290009a7 (diff) |
- hostmask.c: get rid of this (type & ~0x1) hack
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2996 82007160-df01-0410-b94d-b575c5fd34c7
-rw-r--r-- | include/conf.h | 27 | ||||
-rw-r--r-- | src/hostmask.c | 21 |
2 files changed, 23 insertions, 25 deletions
diff --git a/include/conf.h b/include/conf.h index b28d640..b9af053 100644 --- a/include/conf.h +++ b/include/conf.h @@ -110,20 +110,19 @@ enum maskitem_type { - CONF_RESERVED = 1 << 0, /* XXX */ - CONF_CLIENT = 1 << 1, - CONF_SERVER = 1 << 2, - CONF_KLINE = 1 << 3, - CONF_DLINE = 1 << 4, - CONF_EXEMPT = 1 << 5, - CONF_CLUSTER = 1 << 6, - CONF_XLINE = 1 << 7, - CONF_ULINE = 1 << 8, - CONF_GLINE = 1 << 9, - CONF_CRESV = 1 << 10, - CONF_NRESV = 1 << 11, - CONF_SERVICE = 1 << 12, - CONF_OPER = 1 << 13, + CONF_CLIENT = 1 << 0, + CONF_SERVER = 1 << 1, + CONF_KLINE = 1 << 2, + CONF_DLINE = 1 << 3, + CONF_EXEMPT = 1 << 4, + CONF_CLUSTER = 1 << 5, + CONF_XLINE = 1 << 6, + CONF_ULINE = 1 << 7, + CONF_GLINE = 1 << 8, + CONF_CRESV = 1 << 9, + CONF_NRESV = 1 << 10, + CONF_SERVICE = 1 << 11, + CONF_OPER = 1 << 12, }; struct conf_parser_context diff --git a/src/hostmask.c b/src/hostmask.c index d830929..a58cb29 100644 --- a/src/hostmask.c +++ b/src/hostmask.c @@ -481,12 +481,12 @@ find_conf_by_address(const char *name, struct irc_ssaddr *addr, unsigned int typ { arec = ptr->data; - if (arec->type == (type & ~0x1) && + if ((arec->type == type) && arec->precedence > hprecv && arec->masktype == HM_IPV6 && match_ipv6(addr, &arec->Mask.ipa.addr, arec->Mask.ipa.bits) && - (type & 0x1 || !cmpfunc(arec->username, username)) && + (!username || !cmpfunc(arec->username, username)) && (IsNeedPassword(arec->conf) || arec->conf->passwd == NULL || match_conf_password(password, arec->conf))) { @@ -506,12 +506,12 @@ find_conf_by_address(const char *name, struct irc_ssaddr *addr, unsigned int typ { arec = ptr->data; - if (arec->type == (type & ~0x1) && + if ((arec->type == type) && arec->precedence > hprecv && arec->masktype == HM_IPV4 && match_ipv4(addr, &arec->Mask.ipa.addr, arec->Mask.ipa.bits) && - (type & 0x1 || !cmpfunc(arec->username, username)) && + (!username || !cmpfunc(arec->username, username)) && (IsNeedPassword(arec->conf) || arec->conf->passwd == NULL || match_conf_password(password, arec->conf))) { @@ -532,11 +532,11 @@ find_conf_by_address(const char *name, struct irc_ssaddr *addr, unsigned int typ DLINK_FOREACH(ptr, atable[hash_text(p)].head) { arec = ptr->data; - if ((arec->type == (type & ~0x1)) && + if ((arec->type == type) && arec->precedence > hprecv && (arec->masktype == HM_HOST) && !cmpfunc(arec->Mask.hostname, name) && - (type & 0x1 || !cmpfunc(arec->username, username)) && + (!username || !cmpfunc(arec->username, username)) && (IsNeedPassword(arec->conf) || arec->conf->passwd == NULL || match_conf_password(password, arec->conf))) { @@ -554,11 +554,11 @@ find_conf_by_address(const char *name, struct irc_ssaddr *addr, unsigned int typ { arec = ptr->data; - if (arec->type == (type & ~0x1) && + if (arec->type == type && arec->precedence > hprecv && arec->masktype == HM_HOST && !cmpfunc(arec->Mask.hostname, name) && - (type & 0x1 || !cmpfunc(arec->username, username)) && + (!username || !cmpfunc(arec->username, username)) && (IsNeedPassword(arec->conf) || arec->conf->passwd == NULL || match_conf_password(password, arec->conf))) { @@ -623,12 +623,11 @@ find_dline_conf(struct irc_ssaddr *addr, int aftype) { struct MaskItem *eline; - eline = find_conf_by_address(NULL, addr, CONF_EXEMPT | 1, aftype, - NULL, NULL, 1); + eline = find_conf_by_address(NULL, addr, CONF_EXEMPT, aftype, NULL, NULL, 1); if (eline != NULL) return eline; - return find_conf_by_address(NULL, addr, CONF_DLINE | 1, aftype, NULL, NULL, 1); + return find_conf_by_address(NULL, addr, CONF_DLINE, aftype, NULL, NULL, 1); } /* void add_conf_by_address(int, struct MaskItem *aconf) |