summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-12-01 00:06:21 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-12-01 00:06:21 +0000
commitb5242e3be0801abd0edebf62955b1d1b6cd3fd7d (patch)
tree2aa6d1c88fef3a0cfb12fee3e216a8cdcddc6af6
parent84ac00e953c9d8a03bd7b76bcdf5de26832edcfa (diff)
Fixed bug #1106 - Anope now keeps track of users cloaked hosts as well as virtual host and will use both in matching for things
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/stable@2679 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--Changes27
-rw-r--r--include/services.h1
-rw-r--r--src/actions.c9
-rw-r--r--src/core/hs_off.c6
-rw-r--r--src/nickserv.c22
-rw-r--r--src/protocol/rageircd.c2
-rw-r--r--src/protocol/solidircd.c2
-rw-r--r--src/protocol/ultimate3.c2
-rw-r--r--src/protocol/unreal31.c9
-rw-r--r--src/protocol/unreal32.c19
-rw-r--r--src/protocol/viagra.c2
-rw-r--r--src/users.c16
-rw-r--r--version.log3
13 files changed, 76 insertions, 44 deletions
diff --git a/Changes b/Changes
index cc0e674a6..a39fac8d7 100644
--- a/Changes
+++ b/Changes
@@ -2,24 +2,25 @@ Anope Version 1.8 SVN
-------------------
Provided by Anope Dev. <team@anope.org> - 2009
10/05 A Added InspIRCd 1.2 support. [ #00]
-07/31 F Fixed anope sending umode change using channels' syntax. [ #00]
-07/31 F Fixed TS6 UUID issue while parsing modechanges. [ #00]
-08/01 F Fixed several memory leaks in HostServ. [ #00]
-08/01 F Fixed several memory leaks in HostServ. [ #00]
-08/03 F Fixed TS6 SID issue when introducing new servers. [ #00]
-08/19 F Fixed NS SASET displaying wrong language. [#1094]
-08/24 F Fixed entry_match() failing when given no username. [ #00]
+11/27 F Fixed tracking of users host when they disable their vhost [#1106]
+11/25 F Fixed a bug in CLEAR OPS causing incorrect mode removal. [#1114]
+11/25 F Fixed a number of major XOP related issues. [ #00]
+10/06 F Fixed CS FORBID not clearing excepts & invites. [#1097]
+09/09 F Fixed number of TS6 compatibility issues. [#1096]
+08/30 F Fixed MLOCK superseding DEFCON mode lock. [ #00]
+08/29 F Fixed defcon failing to set and remove modes. [#1101]
08/27 F Fixed NS SUSPEND not being shown to services opers. [#1099]
08/27 F Fixed NS UNSUSPEND not being shown to services opers. [#1100]
08/27 F Fixed services sending no or wrong help to opers. [#1102]
08/27 F Fixed services sending no or wrong help to opers. [#1103]
08/27 F Fixed services sending no or wrong help to opers. [#1104]
-08/29 F Fixed defcon failing to set and remove modes. [#1101]
-08/30 F Fixed MLOCK superseding DEFCON mode lock. [ #00]
-09/09 F Fixed number of TS6 compatibility issues. [#1096]
-10/06 F Fixed CS FORBID not clearing excepts & invites. [#1097]
-11/25 F Fixed a number of major XOP related issues. [ #00]
-11/25 F Fixed a bug in CLEAR OPS causing incorrect mode removal. [#1114]
+08/24 F Fixed entry_match() failing when given no username. [ #00]
+08/19 F Fixed NS SASET displaying wrong language. [#1094]
+08/03 F Fixed TS6 SID issue when introducing new servers. [ #00]
+08/01 F Fixed several memory leaks in HostServ. [ #00]
+08/01 F Fixed several memory leaks in HostServ. [ #00]
+07/31 F Fixed anope sending umode change using channels' syntax. [ #00]
+07/31 F Fixed TS6 UUID issue while parsing modechanges. [ #00]
Provided by Han` <Han@mefalcon.org> - 2009
07/28 F Updated german language file. [ #00]
diff --git a/include/services.h b/include/services.h
index 81754e8be..b6da8a4ec 100644
--- a/include/services.h
+++ b/include/services.h
@@ -870,6 +870,7 @@ struct user_ {
char *host; /* User's real hostname */
char *hostip; /* User's IP number */
char *vhost; /* User's virtual hostname */
+ char *chost; /* User's cloaked hostname */
char *vident; /* User's virtual ident */
char *realname; /* Realname */
Server *server; /* Server user is connected to */
diff --git a/src/actions.c b/src/actions.c
index 31cf2db8f..6be45c112 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -181,7 +181,8 @@ void common_unban(ChannelInfo * ci, char *nick)
for (ban = ci->c->bans->entries; ban; ban = next) {
next = ban->next;
if (entry_match(ban, u->nick, u->username, u->host, ip) ||
- entry_match(ban, u->nick, u->username, u->vhost, ip)) {
+ entry_match(ban, u->nick, u->username, u->vhost, ip) ||
+ entry_match(ban, u->nick, u->username, u->chost, ip)) {
anope_cmd_mode(whosends(ci), ci->name, "-b %s", ban->mask);
if (ircdcap->tsmode)
av[3] = ban->mask;
@@ -240,10 +241,10 @@ char *common_get_vhost(User * u)
if (!u)
return NULL;
- if (ircd->vhostmode && (u->mode & ircd->vhostmode))
- return u->vhost;
- else if (ircd->vhost && u->vhost)
+ if (ircd->vhostmode && (u->mode & ircd->vhostmode) && u->vhost)
return u->vhost;
+ else if (ircd->vhostmode && (u->mode & ircd->vhostmode) && u->chost)
+ return u->chost;
else
return u->host;
}
diff --git a/src/core/hs_off.c b/src/core/hs_off.c
index 54bfeca75..045061657 100644
--- a/src/core/hs_off.c
+++ b/src/core/hs_off.c
@@ -75,8 +75,12 @@ int do_off(User * u)
vident = getvIdent(u->nick);
if (vhost == NULL && vident == NULL)
notice_lang(s_HostServ, u, HOST_NOT_ASSIGNED);
- else
+ else {
anope_cmd_vhost_off(u);
+ if (u->vhost)
+ free(u->vhost);
+ u->vhost = NULL;
+ }
} else {
notice_lang(s_HostServ, u, HOST_ID);
}
diff --git a/src/nickserv.c b/src/nickserv.c
index 5c3b1b72c..770bff060 100644
--- a/src/nickserv.c
+++ b/src/nickserv.c
@@ -1281,8 +1281,7 @@ NickCore *findcore(const char *nick)
int is_on_access(User * u, NickCore * nc)
{
int i;
- char *buf;
- char *buf2 = NULL;
+ char *buf, *buf2 = NULL, *buf3 = NULL;
if (nc->accesscount == 0)
return 0;
@@ -1294,24 +1293,33 @@ int is_on_access(User * u, NickCore * nc)
buf2 = scalloc(strlen(u->username) + strlen(u->vhost) + 2, 1);
sprintf(buf2, "%s@%s", u->username, u->vhost);
}
+ if (u->chost)
+ {
+ buf3 = scalloc(strlen(u->username) + strlen(u->chost) + 2, 1);
+ sprintf(buf2, "%s@%s", u->username, u->chost);
+ }
}
for (i = 0; i < nc->accesscount; i++) {
- if (match_wild_nocase(nc->access[i], buf)
- || (ircd->vhost ? match_wild_nocase(nc->access[i], buf2) : 0)) {
+ if (match_wild_nocase(nc->access[i], buf) || (buf2 && match_wild_nocase(nc->access[i], buf2)) || (buf3 && match_wild_nocase(nc->access[i], buf3)))
+ {
free(buf);
if (ircd->vhost) {
if (u->vhost) {
free(buf2);
}
+ if (u->chost)
+ free(buf3);
}
return 1;
}
}
free(buf);
- if (ircd->vhost) {
- free(buf2);
- }
+ if (buf2)
+ free(buf2);
+ if (buf3)
+ free(buf3);
+
return 0;
}
diff --git a/src/protocol/rageircd.c b/src/protocol/rageircd.c
index 5ad02f5ec..4103fc202 100644
--- a/src/protocol/rageircd.c
+++ b/src/protocol/rageircd.c
@@ -668,7 +668,7 @@ void rageircd_cmd_topic(char *whosets, char *chan, char *whosetit,
void rageircd_cmd_vhost_off(User * u)
{
- send_cmd(s_HostServ, "SVSMODE %s -x", u->nick);
+ common_svsmode(u, "-x", NULL);
notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar);
}
diff --git a/src/protocol/solidircd.c b/src/protocol/solidircd.c
index 52e6c5dd4..dbcff821a 100644
--- a/src/protocol/solidircd.c
+++ b/src/protocol/solidircd.c
@@ -1388,7 +1388,7 @@ void solidircd_cmd_vhost_on(char *nick, char *vIdent, char *vhost)
void solidircd_cmd_vhost_off(User * u)
{
- send_cmd(s_HostServ, "SVSMODE %s -v", u->nick);
+ common_svsmode(u, "-v", NULL);
notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar);
}
diff --git a/src/protocol/ultimate3.c b/src/protocol/ultimate3.c
index 5afde95e0..2a328186d 100644
--- a/src/protocol/ultimate3.c
+++ b/src/protocol/ultimate3.c
@@ -720,7 +720,7 @@ void ultimate3_cmd_remove_akill(char *user, char *host)
void ultimate3_cmd_vhost_off(User * u)
{
- send_cmd(s_HostServ, "SVSMODE %s -x", u->nick);
+ common_svsmode(u, "-x", NULL);
notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar);
}
diff --git a/src/protocol/unreal31.c b/src/protocol/unreal31.c
index 2284a9faf..76a31c4cf 100644
--- a/src/protocol/unreal31.c
+++ b/src/protocol/unreal31.c
@@ -424,6 +424,12 @@ void unreal_set_umode(User * user, int ac, char **av)
}
break;
case 'x':
+ if (!add)
+ {
+ if (user->vhost)
+ free(user->vhost);
+ user->vhost = NULL;
+ }
update_host(user);
break;
}
@@ -518,7 +524,8 @@ void unreal_cmd_topic(char *whosets, char *chan, char *whosetit,
void unreal_cmd_vhost_off(User * u)
{
- send_cmd(s_HostServ, "SVSMODE %s -xt", u->nick);
+ common_svsmode(u, "-xt", NULL);
+ common_svsmode(u, "+x", NULL);
notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar);
}
diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c
index 0919fabbe..f93dc8236 100644
--- a/src/protocol/unreal32.c
+++ b/src/protocol/unreal32.c
@@ -489,6 +489,12 @@ void unreal_set_umode(User * user, int ac, char **av)
}
break;
case 'x':
+ if (!add)
+ {
+ if (user->vhost)
+ free(user->vhost);
+ user->vhost = NULL;
+ }
update_host(user);
break;
}
@@ -532,18 +538,9 @@ void unreal_cmd_topic(char *whosets, char *chan, char *whosetit,
void unreal_cmd_vhost_off(User * u)
{
- if (UseSVS2MODE) {
- send_cmd(s_HostServ, "%s %s -xt", send_token("SVS2MODE", "v"),
- u->nick);
- send_cmd(s_HostServ, "%s %s +x", send_token("SVS2MODE", "v"),
- u->nick);
- } else {
- send_cmd(s_HostServ, "%s %s -xt", send_token("SVSMODE", "n"),
- u->nick);
- send_cmd(s_HostServ, "%s %s +x", send_token("SVSMODE", "n"),
- u->nick);
+ common_svsmode(u, "-xt", NULL);
+ common_svsmode(u, "+x", NULL);
- }
notice_lang(s_HostServ, u, HOST_OFF);
}
diff --git a/src/protocol/viagra.c b/src/protocol/viagra.c
index d53e0a7c3..f8a465fa9 100644
--- a/src/protocol/viagra.c
+++ b/src/protocol/viagra.c
@@ -812,7 +812,7 @@ void viagra_cmd_topic(char *whosets, char *chan, char *whosetit,
void viagra_cmd_vhost_off(User * u)
{
- send_cmd(NULL, "SVSMODE %s -x", u->nick);
+ common_svsmode(u, "-x", NULL);
notice_lang(s_HostServ, u, HOST_OFF_UNREAL, u->nick, ircd->vhostchar);
}
diff --git a/src/users.c b/src/users.c
index e8487be4b..fe098bd2e 100644
--- a/src/users.c
+++ b/src/users.c
@@ -224,6 +224,8 @@ void delete_user(User * user)
alog("debug: delete_user(): free user data");
free(user->username);
free(user->host);
+ if (user->chost)
+ free(user->chost);
if (user->vhost)
free(user->vhost);
if (user->vident)
@@ -633,6 +635,14 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
user->realname = sstrdup(realname);
user->timestamp = ts;
user->my_signon = time(NULL);
+ /* Initially set both the vhost and cloaked host to the users cloaked host, vhost will be changed
+ * later if they get a real vhost, chost however should *never* be changed to anything else.
+ * It is possible that on most IRCds (Unreal) a server splits and then comes back, reintroducing clients
+ * with a vhost (not a cloaked host) and never informing Anope about the real cloaked host. For now I'm
+ * leaving this open (we should prboably request a USERHOST or so) as this won't occur that much, and any
+ * fixes to this problem are ugly. - Adam
+ */
+ user->chost = vhost ? sstrdup(vhost) : sstrdup(host);
user->vhost = vhost ? sstrdup(vhost) : sstrdup(host);
if (uid) {
user->uid = sstrdup(uid); /* p10/ts6 stuff */
@@ -1002,11 +1012,13 @@ int match_usermask(const char *mask, User * user)
result = match_wild_nocase(nick, user->nick)
&& match_wild_nocase(username, user->username)
&& (match_wild_nocase(host, user->host)
- || match_wild_nocase(host, user->vhost));
+ || match_wild_nocase(host, user->vhost)
+ || match_wild_nocase(host, user->chost));
} else {
result = match_wild_nocase(username, user->username)
&& (match_wild_nocase(host, user->host)
- || match_wild_nocase(host, user->vhost));
+ || match_wild_nocase(host, user->vhost)
+ || match_wild_nocase(host, user->chost));
}
free(mask2);
diff --git a/version.log b/version.log
index 7faa614d1..cc9cc5473 100644
--- a/version.log
+++ b/version.log
@@ -9,9 +9,10 @@ VERSION_MAJOR="1"
VERSION_MINOR="8"
VERSION_PATCH="2"
VERSION_EXTRA="-svn"
-VERSION_BUILD="2671"
+VERSION_BUILD="2679"
# $Log$ # Changes since 1.8.2 Release
+#Revision 2679 - Fixed bug #1106 - Anope now keeps track of users cloaked hosts as well as virtual host and will use both in matching for things
#Revision 2671 - Fix bug #1114. Fixed a bug in cs_clear caused by do_cmode() modifying params passed to it. Also fixed some warnings in cs_xop.
#Revision 2668 - Fix a few more XOP related problems.
#Revision 2667 - Cleaned up a lot of the channel access reordering code, properly change users with less than voice access on channels to XOP, and fix a potential crashbug after switching to XOP on IRCds that do not support halfop