Subject: pkg/37241: Sugested patch for snort + MySQL
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: César Catrián Carreño <ccatrian@eml.cc>
List: pkgsrc-bugs
Date: 10/28/2007 16:05:00
>Number:         37241
>Category:       pkg
>Synopsis:       Sugested patch for snort + MySQL
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 28 16:05:00 +0000 2007
>Originator:     César Catrián Carreño
>Release:        NetBSD 4.99.31 i386
>Organization:
>Environment:


System: NetBSD 4.99.31 (Basado en GENERIC: 1.781) #0: Sun Sep 30 10:03:48 CLT 2007
	cetrox@core.cjc.cl:/home/cetrox/src/netbsd-current/src/sys/arch/i386/compile/SAT



>Description:


This patch is intended to make snort persistent in the reconnection to the MySQL database. It worked for me, please review. The issue and the origin of the patch is detailed in this url http://www.snort.org/archive-4-4983.html


>How-To-Repeat:





>Fix:


--- src/output-plugins/spo_database.c.orig      2007-10-20 15:35:55.000000000 -0300
+++ src/output-plugins/spo_database.c   2007-10-20 15:39:04.000000000 -0300
@@ -2910,6 +2910,8 @@
         {
             x = 0;
         }
+       my_bool reconnect = 1;
+       mysql_options(data->m_sock, MYSQL_OPT_RECONNECT, &reconnect);
         if(mysql_real_connect(data->m_sock, data->shared->host, data->user, data->password, data->shared->dbname, x, NULL, 0) == 0)
         {
             if(mysql_errno(data->m_sock))