summaryrefslogtreecommitdiff
path: root/src/users.c
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 /src/users.c
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
Diffstat (limited to 'src/users.c')
-rw-r--r--src/users.c16
1 files changed, 14 insertions, 2 deletions
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);