Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Commit time: 2006-07-09 12:33:55 UTC
Modified files:
ChangeLog ircd/s_auth.c
Log message:
Do not leak AuthRequest structs for clients who fail registration.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.793 ircu2.10/ChangeLog:1.794
--- ircu2.10/ChangeLog:1.793 Tue Jul 4 19:19:31 2006
+++ ircu2.10/ChangeLog Sun Jul 9 05:33:45 2006
@@ -1,3 +1,10 @@
+2006-07-05 Michael Poole <[EMAIL PROTECTED]>
+
+ * ircd/s_auth.c (auth_freelist): New static variable.
+ (check_auth_finished): Move call to destroy_auth_request().
+ (destroy_auth_request): Prepend auth request to freelist.
+ (start_auth): Use struct from auth freelist if possible.
+
2006-07-04 Michael Poole <[EMAIL PROTECTED]>
* ircd/m_quit.c (m_functions): Delete duplicative comment.
Index: ircu2.10/ircd/s_auth.c
diff -u ircu2.10/ircd/s_auth.c:1.45 ircu2.10/ircd/s_auth.c:1.46
--- ircu2.10/ircd/s_auth.c:1.45 Fri Jun 30 16:45:59 2006
+++ ircu2.10/ircd/s_auth.c Sun Jul 9 05:33:45 2006
@@ -31,7 +31,7 @@
*/
/** @file
* @brief Implementation of DNS and ident lookups.
- * @version $Id: s_auth.c,v 1.45 2006/06/30 23:45:59 entrope Exp $
+ * @version $Id: s_auth.c,v 1.46 2006/07/09 12:33:45 entrope Exp $
*/
#include "config.h"
@@ -200,7 +200,9 @@
#define i_debug(iauth) ((iauth)->i_debug)
/** Active instance of IAuth. */
-struct IAuth *iauth;
+static struct IAuth *iauth;
+/** Freelist of AuthRequest structures. */
+static struct AuthRequest *auth_freelist;
static void iauth_sock_callback(struct Event *ev);
static void iauth_stderr_callback(struct Event *ev);
@@ -425,7 +427,6 @@
else
FlagSet(&auth->flags, AR_IAUTH_HURRY);
- destroy_auth_request(auth);
if (IsUserPort(auth->client))
{
memset(cli_passwd(auth->client), 0, sizeof(cli_passwd(auth->client)));
@@ -435,7 +436,8 @@
}
else
res = 0;
- MyFree(auth);
+ if (res == 0)
+ destroy_auth_request(auth);
return res;
}
@@ -723,7 +725,10 @@
if (t_active(&auth->timeout))
timer_del(&auth->timeout);
+
cli_auth(auth->client) = NULL;
+ auth->next = auth_freelist;
+ auth_freelist = auth;
}
/** Handle a 'ping' (authorization) timeout for a client.
@@ -966,8 +971,13 @@
socket_events(&(cli_socket(client)), SOCK_ACTION_SET | SOCK_EVENT_READABLE);
/* Allocate the AuthRequest. */
- auth = MyCalloc(1, sizeof(*auth));
+ auth = auth_freelist;
+ if (auth)
+ auth_freelist = auth->next;
+ else
+ auth = MyMalloc(sizeof(*auth));
assert(0 != auth);
+ memset(auth, 0, sizeof(*auth));
auth->client = client;
cli_auth(client) = auth;
s_fd(&auth->socket) = -1;
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches