summaryrefslogtreecommitdiff
path: root/src/users.c
diff options
context:
space:
mode:
authordrstein drstein@31f1291d-b8d6-0310-a050-a5561fc1590b <drstein drstein@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2007-08-31 20:40:36 +0000
committerdrstein drstein@31f1291d-b8d6-0310-a050-a5561fc1590b <drstein drstein@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2007-08-31 20:40:36 +0000
commit317b3e0c4efa277c29e77f8acd3e8b4b000bdc36 (patch)
tree8fb8df7ed5b7f5912ee2fbfc0e4956c5ed152a88 /src/users.c
parentd5a2079085b739a0eb31d1074822a2ecedc0e4fa (diff)
BUILD : 1.7.19 (1295) BUGS : N/A NOTES : We now have hostip in user_ struct so we can use it where needed. We wont do host_resolve() unless it is extremely necessary, coz we dont want to flood the nameserver.
git-svn-id: svn://svn.anope.org/anope/trunk@1295 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1013 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/users.c')
-rw-r--r--src/users.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/users.c b/src/users.c
index e46c07d5a..fa747acd0 100644
--- a/src/users.c
+++ b/src/users.c
@@ -232,6 +232,7 @@ void delete_user(User * user)
free(user->uid);
}
Anope_Free(user->realname);
+ Anope_Free(user->hostip);
if (debug >= 2) {
alog("debug: delete_user(): remove from channels");
}
@@ -607,10 +608,9 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
return NULL;
}
/* Now check for session limits */
- if (LimitSessions && !add_session(nick, host))
+ if (LimitSessions && !add_session(nick, host, ipbuf))
return NULL;
-
/* Allocate User structure and fill it in. */
user = new_user(nick);
user->username = sstrdup(username);
@@ -626,6 +626,13 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
user->uid = NULL;
}
user->vident = sstrdup(username);
+ /* We now store the user's ip in the user_ struct,
+ * because we will use it in serveral places -- DrStein */
+ if (ircd->nickip) {
+ user->hostip = sstrdup(ipbuf);
+ } else {
+ user->hostip = NULL;
+ }
if (svid == 0) {
display_news(user, NEWS_LOGON);
@@ -915,7 +922,6 @@ int is_excepted(ChannelInfo * ci, User * user)
int count, i;
int isexcepted = 0;
char **excepts;
- char *hostip = NULL;
if (!ci->c)
return 0;
@@ -928,16 +934,13 @@ int is_excepted(ChannelInfo * ci, User * user)
excepts = scalloc(sizeof(char *) * count, 1);
memcpy(excepts, ci->c->excepts, sizeof(char *) * count);
- hostip = host_resolve(user->host);
-
for (i = 0; i < count; i++) {
if (match_usermask(excepts[i], user)
- || (hostip && match_userip(excepts[i], user, hostip))) {
+ || match_userip(excepts[i], user, user->hostip)) {
isexcepted = 1;
break;
}
}
- Anope_Free(hostip);
free(excepts);
return isexcepted;
}