summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/base64.c5
-rw-r--r--src/init.c4
-rw-r--r--src/main.c11
-rw-r--r--src/operserv.c26
-rw-r--r--src/servers.c1
-rw-r--r--src/unreal32.c4
-rw-r--r--src/users.c43
7 files changed, 73 insertions, 21 deletions
diff --git a/src/base64.c b/src/base64.c
index 18e010957..6349eebfd 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -393,6 +393,7 @@ static long base64_to_int(char *b64)
long base64dects(char *ts)
{
char *token;
+ long value;
if (!ts) {
return 0;
@@ -402,5 +403,7 @@ long base64dects(char *ts)
if (!token) {
return strtoul(ts, NULL, 10);
}
- return base64dec(token);
+ value = base64dec(token);
+ Anope_Free(token);
+ return value;
}
diff --git a/src/init.c b/src/init.c
index 7a7113591..f8094bc16 100644
--- a/src/init.c
+++ b/src/init.c
@@ -410,10 +410,6 @@ int init(int ac, char **av)
int openlog_failed = 0, openlog_errno = 0;
int started_from_term = isatty(0) && isatty(1) && isatty(2);
- /* Imported from main.c */
- extern void sighandler(int signum);
-
-
/* Set file creation mask and group ID. */
#if defined(DEFUMASK) && HAVE_UMASK
umask(DEFUMASK);
diff --git a/src/main.c b/src/main.c
index f7b4089b7..408cd250e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -85,6 +85,8 @@ const char version_flags[] =
" " VER_DEBUG VER_ENCRYPTION VER_THREAD VER_OS VER_GHBNR VER_MYSQL
VER_MODULE;
+extern char *mod_current_buffer;
+
/******** Local variables! ********/
/* Set to 1 if we are waiting for input */
@@ -254,8 +256,15 @@ static void services_shutdown(void)
if (!quitmsg)
quitmsg = "Terminating, reason unknown";
alog("%s", quitmsg);
- if (started)
+ if (started) {
anope_cmd_squit(ServerName, quitmsg);
+ Anope_Free(uplink);
+ Anope_Free(mod_current_buffer);
+ if (ircd->chanmodes) {
+ Anope_Free(ircd->chanmodes);
+ }
+ shut_clean_user();
+ }
disconn(servsock);
}
diff --git a/src/operserv.c b/src/operserv.c
index 900a828fb..f64aca4f9 100644
--- a/src/operserv.c
+++ b/src/operserv.c
@@ -2075,20 +2075,30 @@ int check_akill(char *nick, const char *username, const char *host,
if (!ak)
continue;
if (match_wild_nocase(ak->user, username)
- && (match_wild_nocase(ak->host, host)
- || (vhost && match_wild_nocase(ak->host, vhost)))) {
+ && match_wild_nocase(ak->host, host)) {
anope_cmd_akill(ak->user, ak->host, ak->by, ak->seton,
ak->expires, ak->reason);
return 1;
}
+ if (ircd->vhost) {
+ if (vhost) {
+ if (match_wild_nocase(ak->user, username)
+ && match_wild_nocase(ak->host, vhost)) {
+ anope_cmd_akill(ak->user, ak->host, ak->by, ak->seton,
+ ak->expires, ak->reason);
+ return 1;
+ }
+ }
+ }
if (ircd->nickip) {
- if (ip)
+ if (ip) {
if (match_wild_nocase(ak->user, username)
&& match_wild_nocase(ak->host, ip)) {
anope_cmd_akill(ak->user, ak->host, ak->by, ak->seton,
ak->expires, ak->reason);
return 1;
}
+ }
}
}
@@ -3497,13 +3507,19 @@ int check_szline(char *nick, char *ip)
int i;
SXLine *sx;
- if (szlines.count == 0)
+ if (szlines.count == 0) {
return 0;
+ }
+
+ if (!ip) {
+ return 0;
+ }
for (i = 0; i < szlines.count; i++) {
sx = szlines.list[i];
- if (!sx)
+ if (!sx) {
continue;
+ }
if (match_wild_nocase(sx->mask, ip)) {
anope_cmd_szline(sx->mask, sx->reason, sx->by);
diff --git a/src/servers.c b/src/servers.c
index 65e67c19d..b9515e12f 100644
--- a/src/servers.c
+++ b/src/servers.c
@@ -17,6 +17,7 @@
Server *servlist = NULL;
Server *me_server = NULL;
uint32 uplink_capab;
+char *uplink;
/* For first_server / next_server */
static Server *server_cur;
diff --git a/src/unreal32.c b/src/unreal32.c
index 471dbf6fe..8ecf6824a 100644
--- a/src/unreal32.c
+++ b/src/unreal32.c
@@ -1853,7 +1853,6 @@ int anope_event_chghost(char *source, int ac, char **av)
/* EVENT: SERVER */
int anope_event_server(char *source, int ac, char **av)
{
- char *uplink;
char *desc;
char *vl;
char *numeric;
@@ -1864,6 +1863,9 @@ int anope_event_server(char *source, int ac, char **av)
numeric = myStrGetToken(vl, '-', 2);
desc = myStrGetTokenRemainder(av[2], ' ', 1);
do_server(source, av[0], av[1], desc, numeric);
+ Anope_Free(vl);
+ Anope_Free(desc);
+ Anope_Free(numeric);
} else {
do_server(source, av[0], av[1], av[2], NULL);
}
diff --git a/src/users.c b/src/users.c
index ad17d40ad..5cb355e8f 100644
--- a/src/users.c
+++ b/src/users.c
@@ -197,17 +197,19 @@ void delete_user(User * user)
{
struct u_chanlist *c, *c2;
struct u_chaninfolist *ci, *ci2;
+ char *realname;
if (LogUsers) {
+ realname = normalizeBuffer(user->realname);
if (ircd->vhost) {
alog("LOGUSERS: %s (%s@%s => %s) (%s) left the network (%s).",
user->nick, user->username, user->host,
(user->vhost ? user->vhost : "(none)"),
- normalizeBuffer(user->realname), user->server->name);
+ realname, user->server->name);
} else {
alog("LOGUSERS: %s (%s@%s) (%s) left the network (%s).",
user->nick, user->username, user->host,
- normalizeBuffer(user->realname), user->server->name);
+ realname, user->server->name);
}
}
@@ -221,12 +223,15 @@ void delete_user(User * user)
free(user->username);
free(user->host);
if (ircd->vhost) {
- if (user->vhost)
+ if (user->vhost) {
free(user->vhost);
+ }
}
- free(user->realname);
- if (debug >= 2)
+ Anope_Free(user->realname);
+ Anope_Free(realname);
+ if (debug >= 2) {
alog("debug: delete_user(): remove from channels");
+ }
c = user->chans;
while (c) {
c2 = c->next;
@@ -331,6 +336,22 @@ User *finduser(const char *nick)
return user;
}
+
+/* On shut down clean out the user struct */
+void shut_clean_user()
+{
+ User *u;
+ int i;
+
+ for (i = 0; i < 1024; i++) {
+ for (u = userlist[i]; u; u = u->next) {
+ delete_user(u);
+ }
+ }
+ return;
+}
+
+
/*************************************************************************/
/* Iterate over all users in the user list. Return NULL at end of list. */
@@ -379,6 +400,7 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
int nc_changed = 1; /* Did nick core change? */
int status = 0; /* Status to apply */
char mask[USERMAX + HOSTMAX + 2];
+ char *logrealname;
if (!*source) {
char ipbuf[16];
@@ -415,23 +437,26 @@ User *do_nick(const char *source, char *nick, char *username, char *host,
tmp = strchr(realname, '%');
}
}
+ logrealname = normalizeBuffer(realname);
+
/**
* End of ugly swap
**/
if (ircd->nickvhost) {
if (ircd->nickip) {
- alog("LOGUSERS: %s (%s@%s => %s) (%s) [%s] connected to the network (%s).", nick, username, host, (vhost ? vhost : "none"), normalizeBuffer(realname), ipbuf, server);
+ alog("LOGUSERS: %s (%s@%s => %s) (%s) [%s] connected to the network (%s).", nick, username, host, (vhost ? vhost : "none"), logrealname, ipbuf, server);
} else {
- alog("LOGUSERS: %s (%s@%s => %s) (%s) connected to the network (%s).", nick, username, host, (vhost ? vhost : "none"), normalizeBuffer(realname), server);
+ alog("LOGUSERS: %s (%s@%s => %s) (%s) connected to the network (%s).", nick, username, host, (vhost ? vhost : "none"), logrealname, server);
}
} else {
if (ircd->nickip) {
- alog("LOGUSERS: %s (%s@%s) (%s) [%s] connected to the network (%s).", nick, username, host, normalizeBuffer(realname), ipbuf, server);
+ alog("LOGUSERS: %s (%s@%s) (%s) [%s] connected to the network (%s).", nick, username, host, logrealname, ipbuf, server);
} else {
- alog("LOGUSERS: %s (%s@%s) (%s) connected to the network (%s).", nick, username, host, normalizeBuffer(realname), server);
+ alog("LOGUSERS: %s (%s@%s) (%s) connected to the network (%s).", nick, username, host, logrealname, server);
}
}
+ Anope_Free(logrealname);
}
/* We used to ignore the ~ which a lot of ircd's use to indicate no