prelude-lml/master: Whitespace police

[email protected] Thu, 16 Jul 2009 15:42:29 +0200 (CEST)
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
commit 58da58b373ac045862a65abacbdc6846c32c3056
Author: Yoann Vandoorselaere <[email protected]>
Date:   Fri Jul 10 09:12:22 2009 +0200

    Whitespace police


========================================

 NEWS                     |   16 +++++-----
 plugins/debug/debug.c    |   24 ++++++++--------
 src/include/log-entry.h  |    2 +-
 src/include/log-source.h |    2 +-
 src/lml-alert.c          |   70 +++++++++++++++++++++++-----------------------
 src/log-entry.c          |   54 +++++++++++++++++-----------------
 src/log-source.c         |   62 ++++++++++++++++++++--------------------
 src/udp-server.c         |   36 ++++++++++++------------
 8 files changed, 133 insertions(+), 133 deletions(-)

========================================

diff --git a/NEWS b/NEWS
index 8645a5d..ff5e7ec 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
 * 2008-10-17, prelude-lml-0.9.14:
 
-- Fix log file permission error, that could happen thought the user 
+- Fix log file permission error, that could happen thought the user
   Prelude-LML was running as could access the file (#291).
 
 - ModSecurity ruleset update, by Dan Kopecek <[email protected]>:
@@ -8,16 +8,16 @@
   [file ..], [line ...], [tag ...] fields and fine tune targets/types
   (#321).
 
-- Deprecate Gamin/FAM support in favor of libev: the previous implementation 
-  had problem on SELinux enabled system due to Gamin server startup being 
+- Deprecate Gamin/FAM support in favor of libev: the previous implementation
+  had problem on SELinux enabled system due to Gamin server startup being
   triggered by other program, and thus using improper role for Prelude-LML.
   (#326).
 
-- Improved polling architecture by using Operating System specific backend 
+- Improved polling architecture by using Operating System specific backend
   when possible.
 
-- We now monitor files that are not immediately available for reading on 
-  startup: once the file can be monitored, libev provide us with a notification. 
+- We now monitor files that are not immediately available for reading on
+  startup: once the file can be monitored, libev provide us with a notification.
 
 
 
@@ -30,10 +30,10 @@
 - New rulesets for FreeBSD su attempts, by Alexander Afonyashin <[email protected]>
   (Fix #304).
 
-- Add additional format to the default configuration to deal with apache 
+- Add additional format to the default configuration to deal with apache
   error_log file format, by Alexander Afonyashin <[email protected]> (Fix #307).
 
-- Normalize some classification: introduce Remote Login, and 
+- Normalize some classification: introduce Remote Login, and
   Credentials Change. Cleanup SSH ruleset, and remove duplicated rules.
 
 - Automated regression tests on make check.
diff --git a/plugins/debug/debug.c b/plugins/debug/debug.c
index 6833914..ae0a139 100644
--- a/plugins/debug/debug.c
+++ b/plugins/debug/debug.c
@@ -6,7 +6,7 @@
 * This file is part of the Prelude-LML program.
 *
 * This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by 
+* it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
@@ -80,9 +80,9 @@ static void debug_run(prelude_plugin_instance_t *pi, const lml_log_source_t *ls,
                 goto err;
         }
         prelude_string_set_constant(str, "LML debug Alert");
-                
+
         lml_alert_emit(ls, log_entry, message);
-        
+
         if ( plugin->out_stderr )
                 fprintf(stderr, "Debug: log received, log=%s\n", lml_log_entry_get_original_log(log_entry));
 
@@ -95,13 +95,13 @@ static void debug_run(prelude_plugin_instance_t *pi, const lml_log_source_t *ls,
 static int debug_activate(prelude_option_t *opt, const char *optarg, prelude_string_t *err, void *context)
 {
         debug_plugin_t *new;
-                
+
         new = calloc(1, sizeof(*new));
-        if ( ! new ) 
+        if ( ! new )
                 return prelude_error_from_errno(errno);
 
         prelude_plugin_instance_set_plugin_data(context, new);
-        
+
         return 0;
 }
 
@@ -127,7 +127,7 @@ static int debug_get_output_stderr(prelude_option_t *opt, prelude_string_t *out,
 static int debug_set_output_stderr(prelude_option_t *opt, const char *optarg, prelude_string_t *err, void *context)
 {
         debug_plugin_t *plugin = prelude_plugin_instance_get_plugin_data(context);
-        
+
         plugin->out_stderr = ! plugin->out_stderr;
 
         return 0;
@@ -140,22 +140,22 @@ int debug_LTX_lml_plugin_init(prelude_plugin_entry_t *pe, void *lml_root_optlist
         int ret;
         prelude_option_t *opt;
         int hook = PRELUDE_OPTION_TYPE_CLI|PRELUDE_OPTION_TYPE_CFG;
-        
+
         ret = prelude_option_add(lml_root_optlist, &opt, hook, 0, "debug", "Debug plugin option",
                                  PRELUDE_OPTION_ARGUMENT_OPTIONAL, debug_activate, NULL);
 
         prelude_plugin_set_activation_option(pe, opt, NULL);
-        
+
         prelude_option_add(opt, NULL, hook, 's', "stderr",
                            "Output to stderr when plugin is called", PRELUDE_OPTION_ARGUMENT_NONE,
                            debug_set_output_stderr, debug_get_output_stderr);
-        
+
         plugin.run = debug_run;
         prelude_plugin_set_name(&plugin, "Debug");
         prelude_plugin_set_destroy_func(&plugin, debug_destroy);
-        
+
         prelude_plugin_entry_set_plugin(pe, (void *) &plugin);
-        
+
         return 0;
 }
 
diff --git a/src/include/log-entry.h b/src/include/log-entry.h
index 0b96609..d849d76 100644
--- a/src/include/log-entry.h
+++ b/src/include/log-entry.h
@@ -6,7 +6,7 @@
 * This file is part of the Prelude-LML program.
 *
 * This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by 
+* it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
diff --git a/src/include/log-source.h b/src/include/log-source.h
index 2996654..624becf 100644
--- a/src/include/log-source.h
+++ b/src/include/log-source.h
@@ -6,7 +6,7 @@
 * This file is part of the Prelude-LML program.
 *
 * This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by 
+* it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
diff --git a/src/lml-alert.c b/src/lml-alert.c
index f47ed3c..ed5fbdc 100644
--- a/src/lml-alert.c
+++ b/src/lml-alert.c
@@ -6,7 +6,7 @@
 * This file is part of the Prelude-LML program.
 *
 * This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by 
+* it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
@@ -69,7 +69,7 @@ static int resolve_failed_fallback(idmef_node_t *node, const char *hostname)
         int ret;
         idmef_address_t *address;
         prelude_string_t *string;
-        
+
         /*
          * we want to know if it's an ip address or an hostname.
          */
@@ -83,21 +83,21 @@ static int resolve_failed_fallback(idmef_node_t *node, const char *hostname)
                         return ret;
         } else {
                 ret = idmef_node_new_address(node, &address, IDMEF_LIST_APPEND);
-                if ( ret < 0 ) 
+                if ( ret < 0 )
                         return ret;
 
                 ret = idmef_address_new_address(address, &string);
                 if ( ret < 0 )
                         return ret;
         }
-        
+
         return prelude_string_set_dup(string, hostname);
 }
 
 
 
 
-static int fill_target_node_from_addrinfo(idmef_node_t *node, struct addrinfo *ai) 
+static int fill_target_node_from_addrinfo(idmef_node_t *node, struct addrinfo *ai)
 {
         int ret;
         char str[128];
@@ -105,7 +105,7 @@ static int fill_target_node_from_addrinfo(idmef_node_t *node, struct addrinfo *a
         idmef_address_t *addr;
         prelude_string_t *string;
 
-        while ( ai ) {                
+        while ( ai ) {
                 ret = idmef_node_new_address(node, &addr, IDMEF_LIST_APPEND);
                 if ( ret < 0 )
                         return -1;
@@ -113,11 +113,11 @@ static int fill_target_node_from_addrinfo(idmef_node_t *node, struct addrinfo *a
                 in_addr = prelude_sockaddr_get_inaddr(ai->ai_addr);
                 if ( ! in_addr )
                         return -1;
-                
+
                 idmef_address_set_category(addr, (ai->ai_family == AF_INET) ?
                                            IDMEF_ADDRESS_CATEGORY_IPV4_ADDR :
                                            IDMEF_ADDRESS_CATEGORY_IPV6_ADDR);
-                
+
                 if ( ! inet_ntop(ai->ai_family, in_addr, str, sizeof(str)) ) {
                         prelude_log(PRELUDE_LOG_ERR, "inet_ntop returned an error: %s.\n", strerror(errno));
                         return -1;
@@ -126,7 +126,7 @@ static int fill_target_node_from_addrinfo(idmef_node_t *node, struct addrinfo *a
                 ret = idmef_address_new_address(addr, &string);
                 if ( ret < 0 )
                         return -1;
-                
+
                 if ( prelude_string_set_dup(string, str) < 0 )
                         return -1;
 
@@ -134,7 +134,7 @@ static int fill_target_node_from_addrinfo(idmef_node_t *node, struct addrinfo *a
                         ret = idmef_node_new_name(node, &string);
                         if ( ret < 0 )
                                 return -1;
-                        
+
                         if ( prelude_string_set_dup(string, ai->ai_canonname) < 0 )
                                 return -1;
                 }
@@ -151,15 +151,15 @@ static int fill_target_node(idmef_node_t *node, const char *host)
 {
         int ret;
         struct addrinfo *ai, hints;
-        
+
         if ( config.no_resolve )
                 ret = resolve_failed_fallback(node, host);
-        else {                
+        else {
                 memset(&hints, 0, sizeof(hints));
                 hints.ai_flags = AI_CANONNAME;
                 hints.ai_socktype = SOCK_STREAM;
-                
-                ret = getaddrinfo(host, NULL, &hints, &ai);                
+
+                ret = getaddrinfo(host, NULL, &hints, &ai);
                 if ( ret != 0 ) {
                         prelude_log(PRELUDE_LOG_WARN, "error resolving \"%s\": %s.\n", host, gai_strerror(ret));
                         return resolve_failed_fallback(node, host);
@@ -192,7 +192,7 @@ static int fill_analyzer(const lml_log_entry_t *log_entry, idmef_analyzer_t *ana
                 ret = idmef_process_new_name(process, &str);
                 if ( ret < 0 )
                         return -1;
-                
+
                 prelude_string_set_ref(str, tmp);
 
                 tmp = lml_log_entry_get_target_process_pid(log_entry);
@@ -201,10 +201,10 @@ static int fill_analyzer(const lml_log_entry_t *log_entry, idmef_analyzer_t *ana
         }
 
         tmp = lml_log_entry_get_target_hostname(log_entry);
-        if ( tmp && ! idmef_analyzer_get_node(analyzer) ) {                
+        if ( tmp && ! idmef_analyzer_get_node(analyzer) ) {
 
                 ret = idmef_analyzer_new_node(analyzer, &node);
-                if ( ret < 0 ) 
+                if ( ret < 0 )
                         return -1;
 
                 ret = fill_target_node(node, tmp);
@@ -214,7 +214,7 @@ static int fill_analyzer(const lml_log_entry_t *log_entry, idmef_analyzer_t *ana
 }
 
 
-static int generate_target(const lml_log_entry_t *log_entry, idmef_alert_t *alert) 
+static int generate_target(const lml_log_entry_t *log_entry, idmef_alert_t *alert)
 {
         int ret = 0;
         const char *tmp;
@@ -226,7 +226,7 @@ static int generate_target(const lml_log_entry_t *log_entry, idmef_alert_t *aler
         target = idmef_alert_get_next_target(alert, NULL);
         if ( ! target ) {
                 ret = idmef_alert_new_target(alert, &target, IDMEF_LIST_APPEND);
-                if ( ret < 0 ) 
+                if ( ret < 0 )
                         return ret;
         }
 
@@ -239,7 +239,7 @@ static int generate_target(const lml_log_entry_t *log_entry, idmef_alert_t *aler
                 ret = idmef_process_new_name(process, &str);
                 if ( ret < 0 )
                         return ret;
-                
+
                 prelude_string_set_dup(str, tmp);
 
                 tmp = lml_log_entry_get_target_process_pid(log_entry);
@@ -250,7 +250,7 @@ static int generate_target(const lml_log_entry_t *log_entry, idmef_alert_t *aler
         tmp = lml_log_entry_get_target_hostname(log_entry);
         if ( tmp && ! idmef_target_get_node(target) ) {
                 ret = idmef_target_new_node(target, &node);
-                if ( ret < 0 ) 
+                if ( ret < 0 )
                         return ret;
 
                 ret = fill_target_node(node, tmp);
@@ -274,7 +274,7 @@ static int generate_additional_data(idmef_alert_t *alert, const char *meaning, c
         ret = idmef_additional_data_new_meaning(adata, &str);
         if ( ret < 0 )
                 return ret;
-        
+
         prelude_string_set_ref(str, meaning);
 
         return idmef_additional_data_set_string_dup(adata, data);
@@ -293,17 +293,17 @@ int lml_alert_prepare(idmef_message_t *message, const lml_log_source_t *ls, cons
         alert = idmef_message_get_alert(message);
         if ( ! alert )
                 return -1;
-        
+
         ret = idmef_alert_new_detect_time(alert, &time);
         if ( ret < 0 )
                 return ret;
-        
+
         idmef_time_set_from_timeval(time, lml_log_entry_get_timeval(log));
-        
+
         if ( lml_log_entry_get_target_hostname(log) || lml_log_entry_get_target_process(log) ) {
                 if ( generate_target(log, alert) < 0 )
                         return -1;
-                
+
                 cur_analyzer = idmef_alert_get_next_analyzer(alert, NULL);
                 if ( cur_analyzer && fill_analyzer(log, cur_analyzer) < 0 )
                         return -1;
@@ -335,40 +335,40 @@ void lml_alert_emit(const lml_log_source_t *ls, const lml_log_entry_t *log, idme
                 if ( ret < 0 )
                         return;
         }
-                
+
         alert = idmef_message_get_alert(message);
         if ( ! alert )
                 return;
-        
+
         ret = idmef_time_new_from_gettimeofday(&time);
         if ( ret < 0 )
                 return;
         idmef_alert_set_create_time(alert, time);
-        
+
         if ( idmef_analyzer )
                 idmef_alert_set_analyzer(alert, idmef_analyzer_ref(idmef_analyzer), IDMEF_LIST_PREPEND);
 
         if ( config.text_output_fd )
                 idmef_message_print(message, config.text_output_fd);
-        
-        if ( ! config.dry_run ) 
+
+        if ( ! config.dry_run )
                 prelude_client_send_idmef(config.lml_client, message);
-        
+
         config.alert_count++;
 }
 
 
 
 
-int lml_alert_init(prelude_client_t *lml_client) 
+int lml_alert_init(prelude_client_t *lml_client)
 {
         int ret;
         prelude_string_t *string;
-        
+
         idmef_analyzer = prelude_client_get_analyzer(lml_client);
         if ( ! idmef_analyzer )
                 return -1;
-        
+
         ret = idmef_analyzer_new_model(idmef_analyzer, &string);
         if ( ret < 0 )
                 return -1;
diff --git a/src/log-entry.c b/src/log-entry.c
index c9b3308..c16d7a7 100644
--- a/src/log-entry.c
+++ b/src/log-entry.c
@@ -6,7 +6,7 @@
 * This file is part of the Prelude-LML program.
 *
 * This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by 
+* it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
@@ -49,7 +49,7 @@
 struct lml_log_entry {
         char *original_log;
         size_t original_log_len;
-        
+
         char *message;
         size_t message_len;
 
@@ -68,12 +68,12 @@ static void lml_log_entry_destroy_substring(lml_log_entry_t *log_entry)
                 free(log_entry->target_hostname);
                 log_entry->target_hostname = NULL;
         }
-        
+
         if ( log_entry->target_process ) {
                 free(log_entry->target_process);
                 log_entry->target_process = NULL;
         }
-        
+
         if ( log_entry->target_process_pid ) {
                 free(log_entry->target_process_pid);
                 log_entry->target_process_pid = NULL;
@@ -82,14 +82,14 @@ static void lml_log_entry_destroy_substring(lml_log_entry_t *log_entry)
 
 
 
-static int parse_ts(lml_log_format_t *format, lml_log_source_t *ls, const char *string, void **out) 
+static int parse_ts(lml_log_format_t *format, lml_log_source_t *ls, const char *string, void **out)
 {
         time_t now;
         struct tm *lt;
         const char *end;
         struct timeval *tv = *out;
         const char *ts_fmt = lml_log_format_get_ts_fmt(format);
-        
+
         /*
          * We first get the localtime from this system,
          * so that all the struct tm member are filled.
@@ -98,16 +98,16 @@ static int parse_ts(lml_log_format_t *format, lml_log_source_t *ls, const char *
          * avoid us some computation error.
          */
         now = time(NULL);
-        
+
         lt = localtime(&now);
         if ( ! lt )
                 goto err;
 
         /*
          * strptime() return a pointer to the first non matched character.
-         */        
+         */
         end = strptime(string, ts_fmt, lt);
-        if ( ! end ) 
+        if ( ! end )
                 goto err;
 
         /*
@@ -143,7 +143,7 @@ static int parse_prefix(lml_log_format_t *format, lml_log_source_t *ls, lml_log_
                 { "timestamp", parse_ts, (void **) &tv                                     },
                 { NULL, NULL, NULL                                                         },
         };
-        
+
         matches = pcre_exec(prefix_regex, lml_log_format_get_prefix_regex_extra(format),
                             log_entry->original_log, log_entry->original_log_len, 0, 0, ovector,
                             sizeof(ovector) / sizeof(int));
@@ -153,7 +153,7 @@ static int parse_prefix(lml_log_format_t *format, lml_log_source_t *ls, lml_log_
         for ( i = 0; tbl[i].field != NULL; i++ ) {
                 ret = pcre_get_named_substring(prefix_regex, log_entry->original_log,
                                                ovector, matches, tbl[i].field, (const char **) &string);
-                
+
                 if ( ret == PCRE_ERROR_NOSUBSTRING )
                         continue;
 
@@ -161,14 +161,14 @@ static int parse_prefix(lml_log_format_t *format, lml_log_source_t *ls, lml_log_
                         prelude_log(PRELUDE_LOG_WARN, "could not get referenced string: %d.\n", ret);
                         return -1;
                 }
-                
+
                 if ( ! tbl[i].cb )
                         *tbl[i].ptr = string;
-                
+
                 else {
                         ret = tbl[i].cb(format, ls, string, tbl[i].ptr);
                         free(string);
-                        
+
                         if ( ret < 0 )
                                 return -1;
                 }
@@ -179,15 +179,15 @@ static int parse_prefix(lml_log_format_t *format, lml_log_source_t *ls, lml_log_
 
 
 
-static char *get_hostname(void) 
+static char *get_hostname(void)
 {
         int ret;
         char out[256];
-                
+
         ret = gethostname(out, sizeof(out));
         if ( ret < 0 )
                 return NULL;
-        
+
         return strdup(out);
 }
 
@@ -253,21 +253,21 @@ lml_log_entry_t *lml_log_entry_new(void)
         }
 
         gettimeofday(&log_entry->tv, NULL);
-        
+
         return log_entry;
 }
 
 
 
 
-int lml_log_entry_set_log(lml_log_entry_t *log_entry, lml_log_source_t *ls, const char *entry, size_t size) 
+int lml_log_entry_set_log(lml_log_entry_t *log_entry, lml_log_source_t *ls, const char *entry, size_t size)
 {
         int ret = -1;
         prelude_list_t *tmp;
         lml_log_format_container_t *fc;
-        
+
         log_entry->original_log_len = size;
-        
+
         log_entry->original_log = strdup(entry);
         if ( ! log_entry->original_log ) {
                 prelude_log(PRELUDE_LOG_ERR, "memory exhausted.\n");
@@ -276,26 +276,26 @@ int lml_log_entry_set_log(lml_log_entry_t *log_entry, lml_log_source_t *ls, cons
 
         log_entry->message = log_entry->original_log;
         log_entry->message_len = log_entry->original_log_len;
-        
+
         prelude_list_for_each(lml_log_source_get_format_list(ls), tmp) {
                 fc = prelude_linked_object_get_object(tmp);
-                
+
                 ret = parse_prefix(lml_log_format_container_get_format(fc), ls, log_entry);
                 if ( ret == 0 )
                         break;
 
                 lml_log_entry_destroy_substring(log_entry);
         }
-        
+
         if ( ! log_entry->target_hostname )
                 log_entry->target_hostname = get_hostname();
-        
+
         if ( ret != 0 ) {
                 lml_log_source_warning(ls, "no appropriate format defined for log entry: '%s'.\n", log_entry->original_log);
                 gettimeofday(&log_entry->tv, NULL);
                 return -1;
         }
-        
+
         return 0;
 }
 
@@ -305,7 +305,7 @@ void lml_log_entry_destroy(lml_log_entry_t *log_entry)
 {
         if ( log_entry->original_log )
                 free(log_entry->original_log);
-        
+
         lml_log_entry_destroy_substring(log_entry);
 
         free(log_entry);
diff --git a/src/log-source.c b/src/log-source.c
index 8b11adb..d210254 100644
--- a/src/log-source.c
+++ b/src/log-source.c
@@ -6,7 +6,7 @@
 * This file is part of the Prelude-LML program.
 *
 * This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by 
+* it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
@@ -71,7 +71,7 @@ struct lml_log_format_container {
 
 struct lml_log_source {
         prelude_list_t list;
-        
+
         char *name;
         regex_list_t *rlist;
 
@@ -92,13 +92,13 @@ static PRELUDE_LIST(source_list);
  * Log format stuff
  */
 static void lml_log_format_destroy(lml_log_format_t *format)
-{        
+{
         if ( --format->refcount != 0 )
                 return;
- 
+
         if ( format->ts_fmt )
                 free(format->ts_fmt);
-        
+
         if ( format->prefix_regex)
                 free(format->prefix_regex);
 
@@ -123,13 +123,13 @@ lml_log_format_t *lml_log_format_new(const char *name)
                 prelude_log(PRELUDE_LOG_ERR, "memory exhausted.\n");
                 return NULL;
         }
-        
+
         new->name = strdup(name);
         if ( ! new->name ) {
                 free(new);
                 return NULL;
         }
-        
+
         if ( lml_log_format_set_ts_fmt(new, SYSLOG_TS_FMT) < 0 ) {
                 prelude_log(PRELUDE_LOG_WARN, "failed to set log timestamp format.\n");
                 return NULL;
@@ -139,7 +139,7 @@ lml_log_format_t *lml_log_format_new(const char *name)
                 prelude_log(PRELUDE_LOG_WARN, "failed to set log message prefix.\n");
                 return NULL;
         }
-        
+
         return new;
 }
 
@@ -153,13 +153,13 @@ const char *lml_log_format_get_name(lml_log_format_t *lf)
 
 
 int lml_log_format_set_prefix_regex(lml_log_format_t *ls, const char *regex)
-{       
+{
         int erroffset;
         const char *errptr;
 
         if ( ls->prefix_regex )
                 free(ls->prefix_regex);
-        
+
         ls->prefix_regex = pcre_compile(regex, 0, &errptr, &erroffset, NULL);
         if ( ! ls->prefix_regex ) {
                 prelude_log(PRELUDE_LOG_WARN, "Unable to compile regex: %s : %s.\n", regex, errptr);
@@ -179,10 +179,10 @@ int lml_log_format_set_prefix_regex(lml_log_format_t *ls, const char *regex)
 
 
 int lml_log_format_set_ts_fmt(lml_log_format_t *ls, const char *fmt)
-{        
+{
         if ( ls->ts_fmt )
                 free(ls->ts_fmt);
-        
+
         ls->ts_fmt = strdup(fmt);
         if ( ! ls->ts_fmt ) {
                 prelude_log(PRELUDE_LOG_ERR, "memory exhausted.\n");
@@ -228,10 +228,10 @@ static lml_log_source_t *search_source(const char *name)
 {
         prelude_list_t *tmp;
         lml_log_source_t *ls;
-        
+
         prelude_list_for_each(&source_list, tmp) {
                 ls = prelude_linked_object_get_object(tmp);
-                
+
                 if ( strcmp(lml_log_source_get_name(ls), name) == 0 )
                         return ls;
         }
@@ -243,7 +243,7 @@ static lml_log_source_t *search_source(const char *name)
 static int source_set_format(lml_log_source_t *ls, lml_log_format_t *format)
 {
         lml_log_format_container_t *fc;
-        
+
         fc = malloc(sizeof(*fc));
         if ( ! fc )
                 return -1;
@@ -263,17 +263,17 @@ regex_list_t *lml_log_source_get_regex_list(lml_log_source_t *ls)
 
 
 
-int lml_log_source_set_name(lml_log_source_t *ls, const char *name) 
+int lml_log_source_set_name(lml_log_source_t *ls, const char *name)
 {
         if ( ls->name )
                 free(ls->name);
-        
+
         ls->name = strdup(name);
         if ( ! ls->name ) {
                 prelude_log(PRELUDE_LOG_ERR, "memory exhausted.\n");
                 return -1;
         }
-        
+
         return 0;
 }
 
@@ -287,23 +287,23 @@ int lml_log_source_new(lml_log_source_t **ls, lml_log_format_t *format, const ch
                 ret = source_set_format(*ls, format);
                 if ( ret < 0 )
                         return -1;
-                
+
                 return 1;
         }
-        
+
         *ls = calloc(1, sizeof(**ls));
         if ( ! *ls ) {
                 prelude_log(PRELUDE_LOG_ERR, "memory exhausted.\n");
                 return -1;
         }
-        
+
         (*ls)->name = strdup(name);
         if ( ! (*ls)->name) {
                 prelude_log(PRELUDE_LOG_ERR, "memory exhausted.\n");
                 free(*ls);
                 return -1;
         }
-        
+
         (*ls)->rlist = regex_init(name);
         if ( ! (*ls)->rlist ) {
                 free((*ls)->name);
@@ -311,7 +311,7 @@ int lml_log_source_new(lml_log_source_t **ls, lml_log_format_t *format, const ch
                 return -1;
         }
 
-        (*ls)->warning_limit = config.warning_limit;        
+        (*ls)->warning_limit = config.warning_limit;
         prelude_list_init(&(*ls)->format_list);
 
         ret = source_set_format(*ls, format);
@@ -319,14 +319,14 @@ int lml_log_source_new(lml_log_source_t **ls, lml_log_format_t *format, const ch
                 return ret;
 
         prelude_list_add_tail(&source_list, &(*ls)->list);
-        
+
         return 0;
 }
 
 
 
 const char *lml_log_source_get_name(const lml_log_source_t *ls)
-{        
+{
         return ls->name;
 }
 
@@ -336,7 +336,7 @@ void lml_log_source_destroy(lml_log_source_t *source)
 {
         prelude_list_t *tmp, *bkp;
         lml_log_format_container_t *fc;
-        
+
         prelude_list_for_each_safe(&source->format_list, tmp, bkp) {
                 fc = prelude_linked_object_get_object(tmp);
                 prelude_linked_object_del((prelude_linked_object_t *) fc);
@@ -344,13 +344,13 @@ void lml_log_source_destroy(lml_log_source_t *source)
                 lml_log_format_destroy(fc->format);
                 free(fc);
         }
-        
+
         if ( source->rlist )
                 regex_destroy(source->rlist);
-        
+
         if ( source->name )
                 free(source->name);
-        
+
         free(source);
 }
 
@@ -365,7 +365,7 @@ void lml_log_source_warning(lml_log_source_t *ls, const char *fmt, ...)
          */
         if ( ls->warning_limit > 0 && ls->warning_count == ls->warning_limit ) {
                 ls->warning_count++;
-                
+
                 prelude_log(PRELUDE_LOG_WARN, "Limit of %d errors for source %s reached. Further errors will be supressed.\n",
                             ls->warning_limit, lml_log_source_get_name(ls));
                 return;
@@ -375,7 +375,7 @@ void lml_log_source_warning(lml_log_source_t *ls, const char *fmt, ...)
                 return;
 
         ls->warning_count++;
-        
+
         va_start(ap, fmt);
         prelude_log_v(PRELUDE_LOG_WARN, fmt, ap);
         va_end(ap);
diff --git a/src/udp-server.c b/src/udp-server.c
index 27f2544..d3a251d 100644
--- a/src/udp-server.c
+++ b/src/udp-server.c
@@ -6,7 +6,7 @@
 * This file is part of the Prelude-LML program.
 *
 * This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by 
+* it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
@@ -73,11 +73,11 @@ extern lml_config_t config;
 
 
 static char *my_strnchr(char *input, char wanted, size_t size)
-{        
+{
         while ( *input && size-- ) {
                 if ( *input == 0 )
                         break;
-                
+
                 if ( *input == wanted )
                         return input;
 
@@ -96,7 +96,7 @@ void udp_server_process_event(udp_server_t *server)
         char src[512];
         struct sockaddr_in addr;
         char buf[SYSLOG_MSG_MAX_SIZE], *ptr = NULL;
-        
+
         len = sizeof(struct sockaddr);
 
         ret = recvfrom(server->sockfd, buf, sizeof(buf) - 1, 0, (struct sockaddr *) &addr, &len);
@@ -107,10 +107,10 @@ void udp_server_process_event(udp_server_t *server)
 
         if ( ret == 0 )
                 return;
-        
+
         buf[ret] = '\0';
-        
-        snprintf(src, sizeof(src), "%s:%d", inet_ntoa(addr.sin_addr), addr.sin_port);        
+
+        snprintf(src, sizeof(src), "%s:%d", inet_ntoa(addr.sin_addr), addr.sin_port);
         lml_log_source_set_name(server->ls, src);
 
         /*
@@ -126,14 +126,14 @@ void udp_server_process_event(udp_server_t *server)
                         ret -= (ptr - buf);
                 }
         }
-        
+
         lml_dispatch_log(server->ls, ptr ? ptr : buf, ret);
 }
 
 
 
 void udp_server_close(udp_server_t *server)
-{        
+{
         lml_log_source_destroy(server->ls);
 
         close(server->sockfd);
@@ -155,11 +155,11 @@ unsigned int udp_server_get_port(udp_server_t *server)
 }
 
 
-int udp_server_get_event_fd(udp_server_t *server) 
+int udp_server_get_event_fd(udp_server_t *server)
 {
         if ( ! server )
                 return -1;
-        
+
         return server->sockfd;
 }
 
@@ -171,28 +171,28 @@ udp_server_t *udp_server_new(lml_log_source_t *ls,  const char *addr, unsigned i
         udp_server_t *server;
         char buf[sizeof("65535")];
         struct addrinfo hints, *ai;
-        
+
         memset(&hints, 0, sizeof(hints));
         snprintf(buf, sizeof(buf), "%u", port);
-        
+
         hints.ai_family = PF_UNSPEC;
         hints.ai_socktype = SOCK_DGRAM;
         hints.ai_protocol = IPPROTO_UDP;
-        
+
         ret = getaddrinfo(addr, buf, &hints, &ai);
         if ( ret != 0 ) {
                 fprintf(stderr, "could not resolve %s: %s.\n", addr,
                         (ret == EAI_SYSTEM) ? strerror(errno) : gai_strerror(ret));
                 return NULL;
         }
-        
+
         sockfd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
         if ( sockfd < 0 ) {
                 prelude_log(PRELUDE_LOG_ERR, "couldn't create socket.\n");
                 freeaddrinfo(ai);
                 return NULL;
         }
-        
+
         ret = bind(sockfd, ai->ai_addr, ai->ai_addrlen);
         if ( ret < 0 ) {
                 prelude_log(PRELUDE_LOG_ERR, "couldn't bind to socket: %s.\n", strerror(errno));
@@ -202,7 +202,7 @@ udp_server_t *udp_server_new(lml_log_source_t *ls,  const char *addr, unsigned i
         }
 
         freeaddrinfo(ai);
-        
+
         server = malloc(sizeof(*server));
         if ( ! server ) {
                 prelude_log(PRELUDE_LOG_ERR, "memory exhausted.\n");
@@ -214,6 +214,6 @@ udp_server_t *udp_server_new(lml_log_source_t *ls,  const char *addr, unsigned i
         server->port = port;
         server->sockfd = sockfd;
         server->ls = ls;
-        
+
         return server;
 }
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog