Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2006-06-30 23:46:09 UTC

Modified files:
     ChangeLog ircd/ircd_parser.y ircd/s_auth.c

Log message:

Fix some authorization stage memory leaks.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.789 ircu2.10/ChangeLog:1.790
--- ircu2.10/ChangeLog:1.789    Fri Jun 30 14:59:49 2006
+++ ircu2.10/ChangeLog  Fri Jun 30 16:45:59 2006
@@ -1,5 +1,15 @@
 2006-06-30  Michael Poole <[EMAIL PROTECTED]>
 
+       * ircd/ircd_parser.y (iauth*): Avoid leaking program name string.
+
+2006-06-30  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/s_auth.c (check_auth_finished): Free auth structure when
+       done with it.
+       (sendto_iauth): Free message buffer when done with it.
+
+2006-06-30  Michael Poole <[EMAIL PROTECTED]>
+
        * ircd/m_info.c (m_functions): Delete duplicative comment.
        (m_info): Write doxygen comment.
        (ms_info): Write doxygen comment.
Index: ircu2.10/ircd/ircd_parser.y
diff -u ircu2.10/ircd/ircd_parser.y:1.65 ircu2.10/ircd/ircd_parser.y:1.66
--- ircu2.10/ircd/ircd_parser.y:1.65    Wed Jun 28 17:52:41 2006
+++ ircu2.10/ircd/ircd_parser.y Fri Jun 30 16:45:59 2006
@@ -17,7 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  *  USA.
- * $Id: ircd_parser.y,v 1.65 2006/06/29 00:52:41 entrope Exp $
+ * $Id: ircd_parser.y,v 1.66 2006/06/30 23:45:59 entrope Exp $
  */
 %{
 
@@ -1130,7 +1130,7 @@
   if (permitted(BLOCK_IAUTH, 1))
     auth_spawn(stringno, stringlist);
   while (stringno > 0)
-    MyFree(stringlist[stringno--]);
+    MyFree(stringlist[--stringno]);
 };
 
 iauthitems: iauthitem iauthitems | iauthitem;
@@ -1138,7 +1138,7 @@
 iauthprogram: PROGRAM '='
 {
   while (stringno > 0)
-    MyFree(stringlist[stringno--]);
+    MyFree(stringlist[--stringno]);
 } stringlist ';';
 
 includeblock: INCLUDE blocklimit QSTRING ';' {
Index: ircu2.10/ircd/s_auth.c
diff -u ircu2.10/ircd/s_auth.c:1.44 ircu2.10/ircd/s_auth.c:1.45
--- ircu2.10/ircd/s_auth.c:1.44 Mon Jun 26 17:11:17 2006
+++ ircu2.10/ircd/s_auth.c      Fri Jun 30 16:45:59 2006
@@ -31,7 +31,7 @@
  */
 /** @file
  * @brief Implementation of DNS and ident lookups.
- * @version $Id: s_auth.c,v 1.44 2006/06/27 00:11:17 entrope Exp $
+ * @version $Id: s_auth.c,v 1.45 2006/06/30 23:45:59 entrope Exp $
  */
 #include "config.h"
 
@@ -426,12 +426,16 @@
     FlagSet(&auth->flags, AR_IAUTH_HURRY);
 
   destroy_auth_request(auth);
-  if (!IsUserPort(auth->client))
-    return 0;
-  memset(cli_passwd(auth->client), 0, sizeof(cli_passwd(auth->client)));
-  res = auth_set_username(auth);
-  if (res == 0)
+  if (IsUserPort(auth->client))
+  {
+    memset(cli_passwd(auth->client), 0, sizeof(cli_passwd(auth->client)));
+    res = auth_set_username(auth);
+    if (res == 0)
       res = register_user(auth->client, auth->client);
+  }
+  else
+    res = 0;
+  MyFree(auth);
   return res;
 }
 
@@ -1399,6 +1403,7 @@
   /* Tack it onto the iauth sendq and try to write it. */
   ++iauth->i_sendM;
   msgq_add(i_sendQ(iauth), mb, 0);
+  msgq_clean(mb);
   iauth_write(iauth);
   return 1;
 }
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to