Permalink
Browse files

Fix for bug #23. Minor bug fix for sagan-external(). Debug option added.

  • Loading branch information...
beave committed Jun 26, 2012
1 parent 10e9e38 commit 5c51990f6f6d4319bba6777c6ff5dfe457a3f315
Showing with 27 additions and 24 deletions.
  1. +3 −3 config.h
  2. +12 −15 config.status
  3. +4 −0 src/output-plugins/sagan-external.c
  4. +5 −5 src/sagan-config.c
  5. +1 −1 src/sagan-usage.c
  6. +1 −0 src/sagan.c
  7. +1 −0 src/sagan.h
View
@@ -50,7 +50,7 @@
#define HAVE_LIBEE 1
/* Define to 1 if you have the `esmtp' library (-lesmtp). */
-#define HAVE_LIBESMTP 1
+/* #undef HAVE_LIBESMTP */
/* Define to 1 if you have the `estr' library (-lestr). */
#define HAVE_LIBESTR 1
@@ -71,10 +71,10 @@
#define HAVE_LIBPCRE 1
/* Define to 1 if you have the `pq' library (-lpq). */
-#define HAVE_LIBPQ 1
+/* #undef HAVE_LIBPQ */
/* Define to 1 if you have the `prelude' library (-lprelude). */
-#define HAVE_LIBPRELUDE 1
+/* #undef HAVE_LIBPRELUDE */
/* Define to 1 if you have the `pthread' library (-lpthread). */
#define HAVE_LIBPTHREAD 1
View
@@ -438,7 +438,7 @@ $config_commands
Report bugs to the package provider."
-ac_cs_config=""
+ac_cs_config="'--disable-postgresql' '--disable-esmtp' '--disable-prelude'"
ac_cs_version="\
config.status
configured by ./configure, generated by GNU Autoconf 2.65,
@@ -524,7 +524,7 @@ if $ac_cs_silent; then
fi
if $ac_cs_recheck; then
- set X '/bin/sh' './configure' $ac_configure_extra_args --no-create --no-recursion
+ set X '/bin/sh' './configure' '--disable-postgresql' '--disable-esmtp' '--disable-prelude' $ac_configure_extra_args --no-create --no-recursion
shift
$as_echo "running CONFIG_SHELL=/bin/sh $*" >&6
CONFIG_SHELL='/bin/sh'
@@ -666,21 +666,21 @@ S["CFLAGS"]="-g -O2"
S["CC"]="gcc"
S["ENDIAN"]="little"
S["target_os"]="linux-gnu"
-S["target_vendor"]="pc"
-S["target_cpu"]="i686"
-S["target"]="i686-pc-linux-gnu"
+S["target_vendor"]="unknown"
+S["target_cpu"]="x86_64"
+S["target"]="x86_64-unknown-linux-gnu"
S["host_os"]="linux-gnu"
-S["host_vendor"]="pc"
-S["host_cpu"]="i686"
-S["host"]="i686-pc-linux-gnu"
+S["host_vendor"]="unknown"
+S["host_cpu"]="x86_64"
+S["host"]="x86_64-unknown-linux-gnu"
S["build_os"]="linux-gnu"
-S["build_vendor"]="pc"
-S["build_cpu"]="i686"
-S["build"]="i686-pc-linux-gnu"
+S["build_vendor"]="unknown"
+S["build_cpu"]="x86_64"
+S["build"]="x86_64-unknown-linux-gnu"
S["target_alias"]=""
S["host_alias"]=""
S["build_alias"]=""
-S["LIBS"]="-ldnet -lpcap -llognorm -lee -lestr -lprelude -lesmtp -lpq -lmysqlclient_r -lm -lpthread -lpcre "
+S["LIBS"]="-ldnet -lpcap -llognorm -lee -lestr -lmysqlclient_r -lm -lpthread -lpcre "
S["ECHO_T"]=""
S["ECHO_N"]="-n"
S["ECHO_C"]=""
@@ -836,9 +836,6 @@ D["HAVE_LIBPCRE"]=" 1"
D["HAVE_LIBPTHREAD"]=" 1"
D["HAVE_LIBM"]=" 1"
D["HAVE_LIBMYSQLCLIENT_R"]=" 1"
-D["HAVE_LIBPQ"]=" 1"
-D["HAVE_LIBESMTP"]=" 1"
-D["HAVE_LIBPRELUDE"]=" 1"
D["HAVE_LIBESTR"]=" 1"
D["HAVE_LIBEE"]=" 1"
D["HAVE_LIBLOGNORM"]=" 1"
@@ -56,6 +56,8 @@ char tmpref[2048];
int ret;
char tmp[6];
+if ( Event->debug->debugexternal ) sagan_log(Event->config, 0, "[%s, line %d] In sagan_ext_thread()", __FILE__, __LINE__);
+
if ( Event->config->sagan_exttype == 1 ) {
/* Parsable */
@@ -130,6 +132,8 @@ if (( pid = fork()) == 0 ) {
buf[n] = 0;
waitpid(pid, NULL, 0);
+
+ if ( Event->debug->debugexternal == 1 ) sagan_log(Event->config, 0, "[%s, line %d] Executed %s", __FILE__, __LINE__, Event->config->sagan_extern);
}
View
@@ -260,12 +260,15 @@ if (!strcmp(sagan_option, "normalize:")) {
#endif
if (!strcmp(sagan_option, "output")) {
- sagan_var = strtok_r(NULL," ", &tok);
+
+ config->output_thread_flag = 1;
+
+ sagan_var = strtok_r(NULL," ", &tok);
if (!strcmp(sagan_var, "external:")) {
+ config->sagan_ext_flag=1;
snprintf(config->sagan_extern, sizeof(config->sagan_extern), "%s", strtok_r(NULL, " ", &tok));
if (strstr(strtok_r(NULL, " ", &tok), "parsable")) config->sagan_exttype=1;
- config->sagan_ext_flag=1;
}
@@ -321,7 +324,6 @@ if (!strcmp(sagan_var, "unified2:")) {
#ifdef HAVE_LIBPRELUDE
if (!strcmp(sagan_var, "prelude:")) {
- config->output_thread_flag = 1;
ptmp = sagan_var;
while (ptmp != NULL ) {
@@ -342,7 +344,6 @@ if (!strcmp(sagan_var, "unified2:")) {
#ifdef HAVE_LIBESMTP
if (!strcmp(sagan_var, "email:")) {
- config->output_thread_flag = 1;
ptmp = sagan_var;
while (ptmp != NULL ) {
@@ -371,7 +372,6 @@ if (!strcmp(sagan_var, "unified2:")) {
/* output type (database, etc) */
if (!strcmp(sagan_var, "database:")) {
- config->output_thread_flag = 1;
sagan_var = strtok_r(NULL, ",", &tok);
/* Type (only "log" is used right now */
View
@@ -39,7 +39,7 @@ void sagan_usage(void)
{
fprintf(stderr, "\n--[Sagan version %s | Help/usage screen]--------------------------------\n\n", VERSION);
fprintf(stderr, "-h, --help\t\tHelp (this screen).\n");
-fprintf(stderr, "-d, --debug [type]\tTypes: syslog, load, fwsam");
+fprintf(stderr, "-d, --debug [type]\tTypes: syslog, load, fwsam, external");
#if defined(HAVE_LIBMYSQLCLIENT_R) || defined(HAVE_LIBPQ)
fprintf(stderr, ", sql");
View
@@ -342,6 +342,7 @@ while ((c = getopt_long(argc, argv, short_options, long_options, &option_index))
if (strstr(optarg, "syslog")) debug->debugsyslog=1;
if (strstr(optarg, "load")) debug->debugload=1;
if (strstr(optarg, "fwsam")) debug->debugfwsam=1;
+ if (strstr(optarg, "external")) debug->debugexternal=1;
#ifdef HAVE_LIBLOGNORM
if (strstr(optarg, "normalize" )) debug->debugnormalize=1;
View
@@ -114,6 +114,7 @@ struct _SaganDebug {
sbool debugsyslog;
sbool debugload;
sbool debugfwsam;
+ sbool debugexternal;
#ifdef HAVE_LIBLOGNORM
sbool debugnormalize;

0 comments on commit 5c51990

Please sign in to comment.