ossec-hids: localfile-config.c (HEAD) [dcid]

5 views
Skip to first unread message

OSSEC CVS

unread,
Jun 26, 2009, 8:47:45 AM6/26/09
to osse...@ossec.net
Module name: ossec-hids
Changes by: dcid 09/06/26 09:47:42

Modified files:
localfile-config.c

Log message:
Description: Fixing init scripts for Darwin (patch by Peter <peter....@acquia.com>)
Reviewed by: dcid
Bug:

Index: localfile-config.c
===================================================================
RCS file: /usr/cvsroot/ossec-hids/src/config/localfile-config.c,v
diff -u -r1.21 -r1.22
--- localfile-config.c 24 Jun 2009 17:06:25 -0000 1.21
+++ localfile-config.c 26 Jun 2009 12:47:42 -0000 1.22
@@ -99,7 +99,7 @@
ret = strftime(lfile, OS_FLSIZE, node[i]->content, p);
if(ret == 0)
{
- merror(PARSE_ERROR, ARGV0, logf[i].ffile);
+ merror(PARSE_ERROR, ARGV0, node[i]->content);
return(OS_INVALID);
}

@@ -142,9 +142,36 @@
i++;
continue;
}
- os_strdup(g.gl_pathv[glob_offset], logf[pl].file);
- glob_offset++;

+
+ /* Checking for strftime on globs too. */
+ if(strchr(g.gl_pathv[glob_offset], '%'))
+ {
+ struct tm *p;
+ time_t l_time = time(0);
+ char lfile[OS_FLSIZE + 1];
+ size_t ret;
+
+ p = localtime(&l_time);
+
+ lfile[OS_FLSIZE] = '\0';
+ ret = strftime(lfile, OS_FLSIZE, g.gl_pathv[glob_offset], p);
+ if(ret == 0)
+ {
+ merror(PARSE_ERROR, ARGV0, g.gl_pathv[glob_offset]);
+ return(OS_INVALID);
+ }
+
+ os_strdup(g.gl_pathv[glob_offset], logf[pl].ffile);
+ os_strdup(g.gl_pathv[glob_offset], logf[pl].file);
+ }
+ else
+ {
+ os_strdup(g.gl_pathv[glob_offset], logf[pl].file);
+ }
+
+
+ glob_offset++;
globfree(&g);

/* Now we need to create another file entry */

OSSEC CVS

unread,
Jun 29, 2009, 7:20:32 AM6/29/09
to osse...@ossec.net
Module name: ossec-hids
Changes by: dcid 09/06/29 08:20:29

Modified files:
localfile-config.c

Log message:
Description: Reading strftime+glob.
Reviewed by: dcid
Bug:

Index: localfile-config.c
===================================================================
RCS file: /usr/cvsroot/ossec-hids/src/config/localfile-config.c,v

diff -u -r1.22 -r1.23
--- localfile-config.c 26 Jun 2009 12:47:42 -0000 1.22
+++ localfile-config.c 29 Jun 2009 11:20:29 -0000 1.23
@@ -85,36 +85,14 @@
}
else if(strcmp(node[i]->element,xml_localfile_location) == 0)
{
- /* We need the format file (based on date) */
- if(strchr(node[i]->content, '%'))
- {
- struct tm *p;
- time_t l_time = time(0);
- char lfile[OS_FLSIZE + 1];
- size_t ret;
-
- p = localtime(&l_time);
-
- lfile[OS_FLSIZE] = '\0';
- ret = strftime(lfile, OS_FLSIZE, node[i]->content, p);
- if(ret == 0)
- {
- merror(PARSE_ERROR, ARGV0, node[i]->content);
- return(OS_INVALID);
- }
-
- os_strdup(node[i]->content, logf[pl].ffile);
- os_strdup(node[i]->content, logf[pl].file);
- }
-
/* This is a glob*.
* We will call this file multiple times until
* there is no one else available.
*/
#ifndef WIN32 /* No windows support for glob */
- else if(strchr(node[i]->content, '*') ||
- strchr(node[i]->content, '?') ||
- strchr(node[i]->content, '['))
+ if(strchr(node[i]->content, '*') ||
+ strchr(node[i]->content, '?') ||
+ strchr(node[i]->content, '['))
{
glob_t g;

@@ -190,7 +168,32 @@
/* We can not increment the file count in here */
continue;
}
+ else if(strchr(node[i]->content, '%'))
+ #else
+ if(strchr(node[i]->content, '%'))
#endif /* WIN32 */
+
+ /* We need the format file (based on date) */


+ {
+ struct tm *p;
+ time_t l_time = time(0);
+ char lfile[OS_FLSIZE + 1];
+ size_t ret;
+
+ p = localtime(&l_time);
+
+ lfile[OS_FLSIZE] = '\0';

+ ret = strftime(lfile, OS_FLSIZE, node[i]->content, p);


+ if(ret == 0)
+ {

+ merror(PARSE_ERROR, ARGV0, node[i]->content);
+ return(OS_INVALID);
+ }
+
+ os_strdup(node[i]->content, logf[pl].ffile);
+ os_strdup(node[i]->content, logf[pl].file);
+ }
+

/* Normal file */
else

Reply all
Reply to author
Forward
0 new messages