All of lore.kernel.org
 help / color / mirror / Atom feed
* [ULOG PATCH 0/4] misc fixes, and new DBI output plugin
@ 2008-12-01 12:41 Pierre Chifflier
  2008-12-01 12:41 ` [PATCH 1/4] Link ulogd2 with libpthread Pierre Chifflier
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Pierre Chifflier @ 2008-12-01 12:41 UTC (permalink / raw)
  To: netfilter-devel

The first two patches fixes the following problems:
- impossibility to run ulogd in gdb, due to a missing link to libpthread
- possible use of uninitialized memory in a calloc(0), spotted by valgrind

It also adds a new output mode, libdbi
libdbi implements a database-independent abstraction layer in C, similar to
the DBI/DBD layer in Perl.
It allows to use all database types supported by libdbi, including
MySQL, PostgreSQL, sqlite, Firebird, MSSQL, Sybase, Oracle, ingres ..

It does not, however, replace other database modules, because as a common
abstraction layer, it is unable to use any specific function, for ex. the
asynchronous API for PostgreSQL.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] Link ulogd2 with libpthread
  2008-12-01 12:41 [ULOG PATCH 0/4] misc fixes, and new DBI output plugin Pierre Chifflier
@ 2008-12-01 12:41 ` Pierre Chifflier
  2008-12-10 11:00   ` Eric Leblond
  2008-12-01 12:41 ` [PATCH 2/4] Fix light memory error in parse_mac2str Pierre Chifflier
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Pierre Chifflier @ 2008-12-01 12:41 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Pierre Chifflier

Explicitly link with libpthread. This allows to run ulogd within gdb,
else it fails with message: Cannot find new threads: generic error

Signed-off-by: Pierre Chifflier <chifflier@inl.fr>
---
 src/Makefile.am |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index aa9a3fa..343cdcc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,4 +6,4 @@ AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include \
 sbin_PROGRAMS = ulogd
 
 ulogd_SOURCES = ulogd.c select.c timer.c rbtree.c conffile.c hash.c
-ulogd_LDFLAGS = -export-dynamic
+ulogd_LDFLAGS = -lpthread -export-dynamic
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] Fix light memory error in parse_mac2str
  2008-12-01 12:41 [ULOG PATCH 0/4] misc fixes, and new DBI output plugin Pierre Chifflier
  2008-12-01 12:41 ` [PATCH 1/4] Link ulogd2 with libpthread Pierre Chifflier
@ 2008-12-01 12:41 ` Pierre Chifflier
  2008-12-10 11:01   ` Eric Leblond
  2008-12-01 12:41 ` [PATCH 3/4] Add new output plugin DBI Pierre Chifflier
  2008-12-01 12:41 ` [PATCH 4/4] Search for libdbi includes during configure Pierre Chifflier
  3 siblings, 1 reply; 9+ messages in thread
From: Pierre Chifflier @ 2008-12-01 12:41 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Pierre Chifflier

When len is 0 (for ex. when the input mac is NULL), parse_mac2str tries
to calloc a 0-bytes bloc, which leads to a conditional jump based
on uninitialized value (spotted by valgrind).

Signed-off-by: Pierre Chifflier <chifflier@inl.fr>
---
 filter/ulogd_filter_HWHDR.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/filter/ulogd_filter_HWHDR.c b/filter/ulogd_filter_HWHDR.c
index af44791..8df4f00 100644
--- a/filter/ulogd_filter_HWHDR.c
+++ b/filter/ulogd_filter_HWHDR.c
@@ -111,13 +111,19 @@ static struct ulogd_key mac2str_keys[] = {
 static int parse_mac2str(struct ulogd_key *ret, unsigned char *mac,
 			 int okey, int len)
 {
-	char *mac_str = calloc(len/sizeof(char)*3, sizeof(char));
-	char *buf_cur = mac_str;
+	char *mac_str;
+	char *buf_cur;
 	int i;
 
+	if (len > 0)
+		mac_str = calloc(len/sizeof(char)*3, sizeof(char));
+	else
+		mac_str = strdup("");
+
 	if (mac_str == NULL)
 		return ULOGD_IRET_ERR;
 
+	buf_cur = mac_str;
 	for (i = 0; i < len; i++)
 		buf_cur += sprintf(buf_cur, "%02x%c", mac[i],
 				i == len - 1 ? 0 : ':');
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] Add new output plugin DBI
  2008-12-01 12:41 [ULOG PATCH 0/4] misc fixes, and new DBI output plugin Pierre Chifflier
  2008-12-01 12:41 ` [PATCH 1/4] Link ulogd2 with libpthread Pierre Chifflier
  2008-12-01 12:41 ` [PATCH 2/4] Fix light memory error in parse_mac2str Pierre Chifflier
@ 2008-12-01 12:41 ` Pierre Chifflier
  2008-12-10 11:04   ` Eric Leblond
  2008-12-01 12:41 ` [PATCH 4/4] Search for libdbi includes during configure Pierre Chifflier
  3 siblings, 1 reply; 9+ messages in thread
From: Pierre Chifflier @ 2008-12-01 12:41 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Pierre Chifflier

libdbi implements a database-independent abstraction layer in C, similar to
the DBI/DBD layer in Perl.
This module brings support for all database types supported by libdbi.

Signed-off-by: Pierre Chifflier <chifflier@inl.fr>
---
 configure.in                  |    1 +
 output/Makefile.am            |    2 +-
 output/dbi/Makefile.am        |   12 ++
 output/dbi/ulogd_output_DBI.c |  313 +++++++++++++++++++++++++++++++++++++++++
 ulogd.conf.in                 |   10 ++
 5 files changed, 337 insertions(+), 1 deletions(-)
 create mode 100644 output/dbi/Makefile.am
 create mode 100644 output/dbi/ulogd_output_DBI.c

diff --git a/configure.in b/configure.in
index 0e173a3..5e9a02b 100644
--- a/configure.in
+++ b/configure.in
@@ -75,4 +75,5 @@ AC_OUTPUT(include/Makefile include/ulogd/Makefile include/libipulog/Makefile \
 	  input/Makefile input/packet/Makefile input/flow/Makefile \
 	  filter/Makefile filter/raw2packet/Makefile filter/packet2flow/Makefile \
 	  output/Makefile output/pcap/Makefile output/mysql/Makefile output/pgsql/Makefile output/sqlite3/Makefile \
+	  output/dbi/Makefile \
 	  src/Makefile Makefile Rules.make)
diff --git a/output/Makefile.am b/output/Makefile.am
index 78df01d..69578a0 100644
--- a/output/Makefile.am
+++ b/output/Makefile.am
@@ -1,7 +1,7 @@
 INCLUDES = $(all_includes) -I$(top_srcdir)/include
 LIBS=""
 
-SUBDIRS= pcap mysql pgsql sqlite3
+SUBDIRS= pcap mysql pgsql sqlite3 dbi
 
 pkglib_LTLIBRARIES = ulogd_output_LOGEMU.la ulogd_output_SYSLOG.la \
 		     ulogd_output_OPRINT.la ulogd_output_IPFIX.la \
diff --git a/output/dbi/Makefile.am b/output/dbi/Makefile.am
new file mode 100644
index 0000000..d127587
--- /dev/null
+++ b/output/dbi/Makefile.am
@@ -0,0 +1,12 @@
+
+INCLUDES = $(all_includes) -I$(top_srcdir)/include $(DBI_INC)
+LIBS=$(DBI_LIB)
+
+if HAVE_DBI
+
+pkglib_LTLIBRARIES = ulogd_output_DBI.la
+
+ulogd_output_DBI_la_SOURCES = ulogd_output_DBI.c ../../util/db.c
+ulogd_output_DBI_la_LDFLAGS = -module
+
+endif
diff --git a/output/dbi/ulogd_output_DBI.c b/output/dbi/ulogd_output_DBI.c
new file mode 100644
index 0000000..a758b7b
--- /dev/null
+++ b/output/dbi/ulogd_output_DBI.c
@@ -0,0 +1,313 @@
+/* ulogd_DBI.c, Version $Revision$
+ *
+ * ulogd output plugin for logging to a database using the DBI abstraction
+ * layer
+ *
+ * (C) 2000-2008 by Pierre Chifflier <chifflier@inl.fr>
+ * This software is distributed under the terms of GNU GPL 
+ * 
+ * This plugin is based on the PostgreSQL plugin made by Harald Welte.
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <arpa/inet.h>
+
+#include <ulogd/ulogd.h>
+#include <ulogd/conffile.h>
+#include <ulogd/db.h>
+
+#include <dbi.h>
+
+#ifdef DEBUG_DBI
+#define DEBUGP(x, args...)	fprintf(stderr, x, ## args)
+#else
+#define DEBUGP(x, args...)
+#endif
+
+struct dbi_instance {
+	struct db_instance db_inst;
+
+	dbi_conn dbh;
+	dbi_result result;
+};
+#define TIME_ERR	((time_t)-1)
+
+/* our configuration directives */
+static struct config_keyset dbi_kset = {
+	.num_ces = DB_CE_NUM + 7,
+	.ces = {
+		DB_CES,
+		{ 
+			.key = "db", 
+			.type = CONFIG_TYPE_STRING,
+			.options = CONFIG_OPT_MANDATORY,
+		},
+		{
+			.key = "host", 
+			.type = CONFIG_TYPE_STRING,
+			.options = CONFIG_OPT_NONE,
+		},
+		{ 
+			.key = "user", 
+			.type = CONFIG_TYPE_STRING,
+			.options = CONFIG_OPT_MANDATORY,
+		},
+		{
+			.key = "pass", 
+			.type = CONFIG_TYPE_STRING,
+			.options = CONFIG_OPT_NONE,
+		},
+		{
+			.key = "port",
+			.type = CONFIG_TYPE_INT,
+			.options = CONFIG_OPT_NONE,
+		},
+		{
+			.key = "schema", 
+			.type = CONFIG_TYPE_STRING,
+			.options = CONFIG_OPT_NONE,
+			.u.string = "public",
+		},
+		{ 
+			.key = "dbtype", 
+			.type = CONFIG_TYPE_STRING,
+			.options = CONFIG_OPT_MANDATORY,
+		},
+	},
+};
+#define db_ce(x)	(x->ces[DB_CE_NUM+0])
+#define host_ce(x)	(x->ces[DB_CE_NUM+1])
+#define user_ce(x)	(x->ces[DB_CE_NUM+2])
+#define pass_ce(x)	(x->ces[DB_CE_NUM+3])
+#define port_ce(x)	(x->ces[DB_CE_NUM+4])
+#define schema_ce(x)	(x->ces[DB_CE_NUM+5])
+#define dbtype_ce(x)	(x->ces[DB_CE_NUM+6])
+
+/* find out which columns the table has */
+static int get_columns_dbi(struct ulogd_pluginstance *upi)
+{
+	struct dbi_instance *pi = (struct dbi_instance *) upi->private;
+	char query[256] = "SELECT * FROM ulog\0";
+	unsigned int ui;
+
+	if (!pi->dbh) {
+		ulogd_log(ULOGD_ERROR, "no database handle\n");
+		return 1;
+	}
+
+	ulogd_log(ULOGD_DEBUG, "%s\n", query);
+	pi->result = dbi_conn_query(pi->dbh,query);
+	if (!pi->result) {
+		const char *errptr;
+		dbi_conn_error(pi->dbh, &errptr);
+		ulogd_log(ULOGD_DEBUG, "Could not fetch columns (%s)",
+			  errptr);
+		return -1;
+	}
+
+	if (upi->input.keys)
+		free(upi->input.keys);
+
+	upi->input.num_keys = dbi_result_get_numfields(pi->result);
+	ulogd_log(ULOGD_DEBUG, "%u fields in table\n", upi->input.num_keys);
+
+	upi->input.keys = malloc(sizeof(struct ulogd_key) *
+						upi->input.num_keys);
+	if (!upi->input.keys) {
+		upi->input.num_keys = 0;
+		ulogd_log(ULOGD_ERROR, "ENOMEM\n");
+		dbi_result_free(pi->result);
+		return -ENOMEM;
+	}
+
+	memset(upi->input.keys, 0, sizeof(struct ulogd_key) *
+						upi->input.num_keys);
+
+	for (ui=1; ui<=upi->input.num_keys; ui++) {
+		char buf[ULOGD_MAX_KEYLEN+1];
+		char *underscore;
+		const char* field_name = dbi_result_get_field_name(pi->result, ui);
+
+		if (!field_name)
+			break;
+
+		/* replace all underscores with dots */
+		strncpy(buf, field_name, ULOGD_MAX_KEYLEN);
+		while ((underscore = strchr(buf, '_')))
+			*underscore = '.';
+
+		DEBUGP("field '%s' found: ", buf);
+
+		/* add it to list of input keys */
+		strncpy(upi->input.keys[ui-1].name, buf, ULOGD_MAX_KEYLEN);
+	}
+
+	/* ID is a sequence */
+	upi->input.keys[0].flags |= ULOGD_KEYF_INACTIVE;
+
+	dbi_result_free(pi->result);
+
+	return 0;
+}
+
+static int close_db_dbi(struct ulogd_pluginstance *upi)
+{
+	struct dbi_instance *pi = (struct dbi_instance *) upi->private;
+
+	ulogd_log(ULOGD_DEBUG, "dbi: closing connection\n");
+	dbi_conn_close(pi->dbh);
+	pi->dbh = NULL;
+	//dbi_shutdown();
+
+	return 0;
+}
+
+/* make connection and select database */
+static int open_db_dbi(struct ulogd_pluginstance *upi)
+{
+	struct dbi_instance *pi = (struct dbi_instance *) upi->private;
+	char *server = host_ce(upi->config_kset).u.string;
+	char *user = user_ce(upi->config_kset).u.string;
+	char *pass = pass_ce(upi->config_kset).u.string;
+	char *db = db_ce(upi->config_kset).u.string;
+	char *dbtype = dbtype_ce(upi->config_kset).u.string;
+	dbi_driver driver;
+	int ret;
+
+	if (pi->dbh != NULL)
+		return 0;
+
+	ulogd_log(ULOGD_ERROR, "Opening connection for db type %s\n",
+		  dbtype);
+	driver = dbi_driver_open(dbtype);
+	if (driver == NULL) {
+		ulogd_log(ULOGD_ERROR, "unable to load driver for db type %s\n",
+			  dbtype);
+		close_db_dbi(upi);
+		return -1;
+	}
+	pi->dbh = dbi_conn_new(dbtype);
+	if (pi->dbh == NULL) {
+		ulogd_log(ULOGD_ERROR, "unable to initialize db type %s\n",
+			  dbtype);
+		close_db_dbi(upi);
+		return -1;
+	}
+
+	if (server)
+		dbi_conn_set_option(pi->dbh, "host", server);
+	if (user)
+		dbi_conn_set_option(pi->dbh, "username", user);
+	if (pass)
+		dbi_conn_set_option(pi->dbh, "password", pass);
+	if (db)
+		dbi_conn_set_option(pi->dbh, "dbname", db);
+
+	ret = dbi_conn_connect(pi->dbh);
+	if (ret < 0) {
+		ulogd_log(ULOGD_ERROR, "unable to connect to db %s\n",
+			  db);
+		close_db_dbi(upi);
+		return -1;
+	}
+
+	return 0;
+}
+
+static int escape_string_dbi(struct ulogd_pluginstance *upi,
+			     char *dst, const char *src, unsigned int len)
+{
+	struct dbi_instance *pi = (struct dbi_instance *) upi->private;
+	char *newstr;
+	int ret;
+
+	if (len == 0) {
+		*dst = '\0';
+		return 0;
+	}
+
+	ret = dbi_conn_quote_string_copy(pi->dbh, src, &newstr);
+	if (ret <= 2)
+		return 0;
+
+	/* dbi_conn_quote_string_copy returns a quoted string,
+	 * but __interp_db already quotes the string
+	 * So we return a string without the quotes
+	 */
+	strncpy(dst,newstr+1,ret-2);
+	dst[ret-2] = '\0';
+	free(newstr);
+
+	return (ret-2);
+}
+
+static int execute_dbi(struct ulogd_pluginstance *upi,
+			 const char *stmt, unsigned int len)
+{
+	struct dbi_instance *pi = (struct dbi_instance *) upi->private;
+
+	pi->result = dbi_conn_query(pi->dbh,stmt);
+	if (!pi->result) {
+		const char *errptr;
+		dbi_conn_error(pi->dbh, &errptr);
+		ulogd_log(ULOGD_DEBUG, "execute failed (%s)\n",
+			  errptr);
+		ulogd_log(ULOGD_DEBUG, "failed query: [%s]\n",
+			  stmt);
+		return -1;
+	}
+
+	dbi_result_free(pi->result);
+
+	return 0;
+}
+
+static struct db_driver db_driver_dbi = {
+	.get_columns	= &get_columns_dbi,
+	.open_db	= &open_db_dbi,
+	.close_db	= &close_db_dbi,
+	.escape_string	= &escape_string_dbi,
+	.execute	= &execute_dbi,
+};
+
+static int configure_dbi(struct ulogd_pluginstance *upi,
+			 struct ulogd_pluginstance_stack *stack)
+{
+	struct dbi_instance *pi = (struct dbi_instance *) upi->private;
+
+	pi->db_inst.driver = &db_driver_dbi;
+
+	return ulogd_db_configure(upi, stack);
+}
+
+static struct ulogd_plugin dbi_plugin = { 
+	.name 		= "DBI", 
+	.input 		= {
+		.keys	= NULL,
+		.num_keys = 0,
+		.type	= ULOGD_DTYPE_PACKET | ULOGD_DTYPE_FLOW,
+	},
+	.output 	= {
+		.type	= ULOGD_DTYPE_SINK,
+	},
+	.config_kset 	= &dbi_kset,
+	.priv_size	= sizeof(struct dbi_instance),
+	.configure	= &configure_dbi,
+	.start		= &ulogd_db_start,
+	.stop		= &ulogd_db_stop,
+	.signal		= &ulogd_db_signal,
+	.interp		= &ulogd_db_interp,
+	.version	= ULOGD_VERSION,
+};
+
+void __attribute__ ((constructor)) init(void);
+
+void init(void)
+{
+	dbi_initialize(NULL);
+
+	ulogd_register_plugin(&dbi_plugin);
+}
diff --git a/ulogd.conf.in b/ulogd.conf.in
index 93662a8..e24e6b6 100644
--- a/ulogd.conf.in
+++ b/ulogd.conf.in
@@ -42,6 +42,7 @@ plugin="@libdir@/ulogd/ulogd_output_SYSLOG.so"
 #plugin="@libdir@/ulogd/ulogd_output_PCAP.so"
 #plugin="@libdir@/ulogd/ulogd_output_PGSQL.so"
 #plugin="@libdir@/ulogd/ulogd_output_MYSQL.so"
+#plugin="@libdir@/ulogd/ulogd_output_DBI.so"
 plugin="@libdir@/ulogd/ulogd_raw2packet_BASE.so"
 
 # this is a stack for IPv4 packet-based logging via LOGEMU
@@ -173,6 +174,15 @@ table="ulog2_ct"
 pass="changeme"
 procedure="INSERT_OR_REPLACE_CT"
 
+[dbi1]
+db="ulog2"
+dbtype="pgsql"
+host="localhost"
+user="ulog2"
+table="ulog"
+pass="ulog2"
+procedure="INSERT_PACKET_FULL"
+
 [sys2]
 facility=LOG_LOCAL2
 
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] Search for libdbi includes during configure
  2008-12-01 12:41 [ULOG PATCH 0/4] misc fixes, and new DBI output plugin Pierre Chifflier
                   ` (2 preceding siblings ...)
  2008-12-01 12:41 ` [PATCH 3/4] Add new output plugin DBI Pierre Chifflier
@ 2008-12-01 12:41 ` Pierre Chifflier
  2008-12-10 11:05   ` Eric Leblond
  3 siblings, 1 reply; 9+ messages in thread
From: Pierre Chifflier @ 2008-12-01 12:41 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Pierre Chifflier

libdbi is a database-independent abstraction layer in C, similar
to the DBI/DBD layer in Perl.

Signed-off-by: Pierre Chifflier <chifflier@inl.fr>
---
 acinclude.m4 |   86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 configure.in |    3 ++
 2 files changed, 89 insertions(+), 0 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index ae6988a..4d80f10 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -367,3 +367,89 @@ fi
 fi
 
 ])
+
+
+dnl @synopsis CT_CHECK_DBI
+dnl
+dnl This macro tries to find the headers and libraries for libdbi.
+dnl
+dnl If includes are found, the variable DBI_INC will be set. If
+dnl libraries are found, the variable DBI_LIB will be set. if no check
+dnl was successful, the script exits with a error message.
+dnl
+dnl @category InstalledPackages
+dnl @author Pierre Chifflier <chifflier@inl.fr>
+dnl @version 2008-10-30
+dnl @license AllPermissive
+
+AC_DEFUN([CT_CHECK_DBI], [
+
+AC_ARG_WITH(dbi,
+	[  --with-dbi=PREFIX		Prefix of your libdbi installation],
+	[dbi=$withval], [dbi_prefix=])
+AC_ARG_WITH(dbi-inc,
+	[  --with-dbi-inc=PATH		Path to the include directory of dbi],
+	[dbi_inc=$withval], [dbi_inc=/usr/include])
+AC_ARG_WITH(dbi-lib,
+	[  --with-dbi-lib=PATH		Path to the libraries of dbi],
+	[dbi_lib=$withval], [dbi_lib=/usr/lib])
+
+
+AC_SUBST(DBI_INC)
+AC_SUBST(DBI_LIB)
+
+if test "$dbi_prefix" != "no"; then
+
+if test "$dbi_prefix" != ""; then
+   AC_MSG_CHECKING([for libdbi includes in $dbi_prefix/include])
+   if test -f "$dbi_prefix/include/dbi.h" ; then
+      DBI_INC="-I$dbi_prefix/include"
+      AC_MSG_RESULT([yes])
+   elif test -f "$dbi_prefix/include/dbi/dbi.h" ; then
+      DBI_INC="-I$dbi_prefix/include/dbi"
+      AC_MSG_RESULT([yes])
+   else
+      AC_MSG_WARN(dbi.h not found)
+   fi
+   AC_MSG_CHECKING([for libdbi in $dbi_prefix/lib])
+   if test -f "$dbi_prefix/lib/libdbi.so" ; then
+      DBI_LIB="-L$dbi_prefix/lib -ldbi";
+      AC_MSG_RESULT([yes])
+   else
+      AC_MSG_WARN(libdbi.so not found)
+   fi
+else
+  if test "$dbi_inc" != ""; then
+    AC_MSG_CHECKING([for libdbi includes in $dbi_inc])
+    if test -f "$dbi_inc/dbi.h" ; then
+      DBI_INC="-I$dbi_inc"
+      AC_MSG_RESULT([yes])
+    elif test -f "$dbi_inc/dbi/dbi.h" ; then
+      DBI_INC="-I$dbi_inc/dbi"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_WARN(dbi.h not found)
+    fi
+  fi
+  if test "$dbi_lib" != ""; then
+    AC_MSG_CHECKING([for libdbi in $dbi_lib])
+    if test -f "$dbi_lib/libdbi.so" ; then
+      DBI_LIB="-L$dbi_lib -ldbi";
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_WARN(libdbi.so not found)
+    fi
+  fi
+fi
+
+if test "$DBI_INC" = "" ; then
+  AC_CHECK_HEADER([dbi.h], [], AC_MSG_WARN(dbi.h not found))
+fi
+if test "$DBI_LIB" = "" ; then
+  AC_CHECK_LIB(dbi, dbi_close, [], AC_MSG_WARN(libdbi.so not found))
+fi
+
+fi
+
+])
+
diff --git a/configure.in b/configure.in
index 5e9a02b..9d3f02a 100644
--- a/configure.in
+++ b/configure.in
@@ -53,6 +53,9 @@ AM_CONDITIONAL(HAVE_MYSQL, test "x$MYSQL_LIB" != "x")
 CT_CHECK_SQLITE3_DB()
 AM_CONDITIONAL(HAVE_SQLITE3, test "x$SQLITE3_LIB" != "x")
 
+CT_CHECK_DBI()
+AM_CONDITIONAL(HAVE_DBI, test "x$DBI_LIB" != "x")
+
 CT_CHECK_PCAP()
 AM_CONDITIONAL(HAVE_PCAP, test "x$PCAP_LIB" != "x")
 
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] Link ulogd2 with libpthread
  2008-12-01 12:41 ` [PATCH 1/4] Link ulogd2 with libpthread Pierre Chifflier
@ 2008-12-10 11:00   ` Eric Leblond
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Leblond @ 2008-12-10 11:00 UTC (permalink / raw)
  To: Pierre Chifflier; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

Hi,

Le lundi 01 décembre 2008 à 13:41 +0100, Pierre Chifflier a écrit :
> Explicitly link with libpthread. This allows to run ulogd within gdb,
> else it fails with message: Cannot find new threads: generic error

Applied, thanks.

BR,
-- 
Éric Leblond <eric@inl.fr>
INL, http://www.inl.fr/
NuFW, http://www.nufw.org

[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] Fix light memory error in parse_mac2str
  2008-12-01 12:41 ` [PATCH 2/4] Fix light memory error in parse_mac2str Pierre Chifflier
@ 2008-12-10 11:01   ` Eric Leblond
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Leblond @ 2008-12-10 11:01 UTC (permalink / raw)
  To: Pierre Chifflier; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 389 bytes --]

Hi,

Le lundi 01 décembre 2008 à 13:41 +0100, Pierre Chifflier a écrit :
> When len is 0 (for ex. when the input mac is NULL), parse_mac2str tries
> to calloc a 0-bytes bloc, which leads to a conditional jump based
> on uninitialized value (spotted by valgrind).
> 

Applied, thanks.

BR,
-- 
Éric Leblond <eric@inl.fr>
INL, http://www.inl.fr/
NuFW, http://www.nufw.org

[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] Add new output plugin DBI
  2008-12-01 12:41 ` [PATCH 3/4] Add new output plugin DBI Pierre Chifflier
@ 2008-12-10 11:04   ` Eric Leblond
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Leblond @ 2008-12-10 11:04 UTC (permalink / raw)
  To: Pierre Chifflier; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]

Hi,

Le lundi 01 décembre 2008 à 13:41 +0100, Pierre Chifflier a écrit :
> libdbi implements a database-independent abstraction layer in C, similar to
> the DBI/DBD layer in Perl.
> This module brings support for all database types supported by libdbi.
> 
> Signed-off-by: Pierre Chifflier <chifflier@inl.fr>
> ---
>  configure.in                  |    1 +
>  output/Makefile.am            |    2 +-
>  output/dbi/Makefile.am        |   12 ++
>  output/dbi/ulogd_output_DBI.c |  313 +++++++++++++++++++++++++++++++++++++++++
>  ulogd.conf.in                 |   10 ++
>  5 files changed, 337 insertions(+), 1 deletions(-)
>  create mode 100644 output/dbi/Makefile.am
>  create mode 100644 output/dbi/ulogd_output_DBI.c

> +		const char *errptr;
> +		dbi_conn_error(pi->dbh, &errptr);
> +		ulogd_log(ULOGD_DEBUG, "execute failed (%s)\n",
> +			  errptr);

Hmm, this is more an error message than a debug one.

> +		ulogd_log(ULOGD_DEBUG, "failed query: [%s]\n",
> +			  stmt);

Applied with the above modifications, thanks.

BR,
-- 
Éric Leblond <eric@inl.fr>
INL, http://www.inl.fr/
NuFW, http://www.nufw.org

[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] Search for libdbi includes during configure
  2008-12-01 12:41 ` [PATCH 4/4] Search for libdbi includes during configure Pierre Chifflier
@ 2008-12-10 11:05   ` Eric Leblond
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Leblond @ 2008-12-10 11:05 UTC (permalink / raw)
  To: Pierre Chifflier; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

Hi,

Le lundi 01 décembre 2008 à 13:41 +0100, Pierre Chifflier a écrit :
> libdbi is a database-independent abstraction layer in C, similar
> to the DBI/DBD layer in Perl.

Applied thanks.

BR,
-- 
Éric Leblond <eric@inl.fr>
INL, http://www.inl.fr/
NuFW, http://www.nufw.org

[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-12-10 11:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-01 12:41 [ULOG PATCH 0/4] misc fixes, and new DBI output plugin Pierre Chifflier
2008-12-01 12:41 ` [PATCH 1/4] Link ulogd2 with libpthread Pierre Chifflier
2008-12-10 11:00   ` Eric Leblond
2008-12-01 12:41 ` [PATCH 2/4] Fix light memory error in parse_mac2str Pierre Chifflier
2008-12-10 11:01   ` Eric Leblond
2008-12-01 12:41 ` [PATCH 3/4] Add new output plugin DBI Pierre Chifflier
2008-12-10 11:04   ` Eric Leblond
2008-12-01 12:41 ` [PATCH 4/4] Search for libdbi includes during configure Pierre Chifflier
2008-12-10 11:05   ` Eric Leblond

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.