Changeset 265 for trunk


Ignore:
Timestamp:
Dec 21, 2009, 8:54:07 PM (15 years ago)
Author:
katerina
Message:

Enhance logfile monitoring (tickets #183, #184, #185).

Location:
trunk
Files:
6 added
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.in

    r264 r265  
    123123        sh_mounts.h sh_userfiles.h sh_static.h sh_prelink.h \
    124124        sh_processcheck.h sh_portcheck.h sh_pthread.h sh_string.h \
    125         sh_log_check.h sh_log_evalrule.h sh_inotify.h
     125        sh_log_check.h sh_log_evalrule.h sh_log_correlate.h \
     126        sh_log_mark.h sh_log_repeat.h sh_inotify.h
    126127
    127128
     
    161162        $(srcsrc)/sh_log_parse_samba.c \
    162163        $(srcsrc)/sh_log_parse_apache.c $(srcsrc)/sh_log_evalrule.c \
     164        $(srcsrc)/sh_log_correlate.c $(srcsrc)/sh_log_mark.c \
    163165        $(srcsrc)/sh_log_check.c $(srcsrc)/dnmalloc.c \
    164         $(srcsrc)/sh_inotify.c \
     166        $(srcsrc)/sh_inotify.c $(srcsrc)/sh_log_repeat.c \
    165167        $(srcsrc)/t-test1.c
    166168
     
    179181        sh_log_parse_syslog.o sh_log_parse_pacct.o sh_log_parse_apache.o \
    180182        sh_log_parse_samba.o sh_log_evalrule.o sh_log_check.o \
     183        sh_log_correlate.o sh_log_mark.o sh_log_repeat.o \
    181184        sh_pthread.o sh_string.o sh_inotify.o dnmalloc.o
    182185
     
    16651668sh_files.o: $(srcsrc)/sh_files.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_tiger.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/zAVLTree.h
    16661669sh_getopt.o: $(srcsrc)/sh_getopt.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_getopt.h $(srcinc)/sh_files.h $(srcinc)/sh_utils.h $(srcinc)/sh_mail.h $(srcinc)/sh_forward.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h
    1667 sh_readconf.o: $(srcsrc)/sh_readconf.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_database.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_files.h $(srcinc)/sh_mail.h $(srcinc)/sh_nmail.h $(srcinc)/sh_calls.h $(srcinc)/sh_tiger.h $(srcinc)/sh_forward.h $(srcinc)/sh_modules.h $(srcinc)/sh_gpg.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_prelink.h $(srcinc)/sh_extern.h $(srcinc)/sh_tools.h $(srcinc)/sh_database.h $(srcinc)/sh_prelude.h
     1670sh_readconf.o: $(srcsrc)/sh_readconf.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_calls.h $(srcinc)/sh_error.h $(srcinc)/sh_extern.h $(srcinc)/sh_files.h $(srcinc)/sh_forward.h $(srcinc)/sh_gpg.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_database.h $(srcinc)/sh_mail.h $(srcinc)/sh_modules.h $(srcinc)/sh_nmail.h $(srcinc)/sh_prelink.h $(srcinc)/sh_prelude.h $(srcinc)/sh_tiger.h $(srcinc)/sh_tools.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h
    16681671sh_tiger0.o: $(srcsrc)/sh_tiger0.c Makefile config_xor.h $(srcinc)/sh_tiger.h $(srcinc)/sh_unix.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_pthread.h $(srcinc)/sh_string.h
    16691672sh_tiger1.o: $(srcsrc)/sh_tiger1.c Makefile config_xor.h
     
    17281731sh_log_parse_pacct.o: $(srcsrc)/sh_log_parse_pacct.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_log_check.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h
    17291732sh_log_parse_apache.o: $(srcsrc)/sh_log_parse_apache.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_log_check.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h
    1730 sh_log_evalrule.o: $(srcsrc)/sh_log_evalrule.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h $(srcinc)/zAVLTree.h
    1731 sh_log_check.o: $(srcsrc)/sh_log_check.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h $(srcinc)/sh_modules.h
     1733sh_log_evalrule.o: $(srcsrc)/sh_log_evalrule.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h $(srcinc)/sh_log_correlate.h $(srcinc)/sh_log_mark.h $(srcinc)/sh_log_repeat.h $(srcinc)/zAVLTree.h
     1734sh_log_check.o: $(srcsrc)/sh_log_check.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h $(srcinc)/sh_log_correlate.h $(srcinc)/sh_log_mark.h $(srcinc)/sh_log_repeat.h $(srcinc)/sh_modules.h
    17321735sh_log_parse_samba.o: $(srcsrc)/sh_log_parse_samba.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_log_check.h $(srcinc)/sh_string.h
    17331736sh_nmail.o: $(srcsrc)/sh_nmail.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_mem.h $(srcinc)/sh_mail.h $(srcinc)/sh_tiger.h $(srcinc)/sh_string.h $(srcinc)/sh_utils.h $(srcinc)/sh_fifo.h $(srcinc)/sh_filter.h $(srcinc)/sh_mail_int.h $(srcinc)/zAVLTree.h
    17341737sh_filter.o: $(srcsrc)/sh_filter.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_filter.h
    17351738sh_inotify.o: $(srcsrc)/sh_inotify.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_calls.h $(srcinc)/sh_inotify.h $(srcinc)/sh_mem.h $(srcinc)/slib.h $(srcinc)/sh_calls.h
     1739sh_log_correlate.o: $(srcsrc)/sh_log_correlate.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h
     1740sh_log_mark.o: $(srcsrc)/sh_log_mark.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_mem.h $(srcinc)/sh_string.h $(srcinc)/sh_error_min.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h $(srcinc)/zAVLTree.h
     1741sh_log_repeat.o: $(srcsrc)/sh_log_repeat.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h
  • trunk/acconfig.h

    r156 r265  
    342342/* Define if UINT64 is 32 bits.                 */
    343343#undef UINT64_IS_32
     344
     345/* Define if you have uint64_t.               */
     346#undef HAVE_UINT16_T
    344347
    345348/* Define if you have uint64_t.               */
  • trunk/configure.ac

    r259 r265  
    495495AC_C_LONG_DOUBLE
    496496SH_CHECK_TYPEDEF(long long, HAVE_LONG_LONG)
     497SH_CHECK_TYPEDEF(uint16_t, HAVE_UINT16_T)
    497498SH_CHECK_TYPEDEF(uint64_t, HAVE_UINT64_T)
    498499if test "$sh_HAVE_LONG_LONG" = "yes"; then
  • trunk/depend.dep

    r264 r265  
    77sh_files.o: $(srcsrc)/sh_files.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_tiger.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/zAVLTree.h
    88sh_getopt.o: $(srcsrc)/sh_getopt.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_getopt.h $(srcinc)/sh_files.h $(srcinc)/sh_utils.h $(srcinc)/sh_mail.h $(srcinc)/sh_forward.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h
    9 sh_readconf.o: $(srcsrc)/sh_readconf.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_database.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_files.h $(srcinc)/sh_mail.h $(srcinc)/sh_nmail.h $(srcinc)/sh_calls.h $(srcinc)/sh_tiger.h $(srcinc)/sh_forward.h $(srcinc)/sh_modules.h $(srcinc)/sh_gpg.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_prelink.h $(srcinc)/sh_extern.h $(srcinc)/sh_tools.h $(srcinc)/sh_database.h $(srcinc)/sh_prelude.h
     9sh_readconf.o: $(srcsrc)/sh_readconf.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_calls.h $(srcinc)/sh_error.h $(srcinc)/sh_extern.h $(srcinc)/sh_files.h $(srcinc)/sh_forward.h $(srcinc)/sh_gpg.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_database.h $(srcinc)/sh_mail.h $(srcinc)/sh_modules.h $(srcinc)/sh_nmail.h $(srcinc)/sh_prelink.h $(srcinc)/sh_prelude.h $(srcinc)/sh_tiger.h $(srcinc)/sh_tools.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h
    1010sh_tiger0.o: $(srcsrc)/sh_tiger0.c Makefile config_xor.h $(srcinc)/sh_tiger.h $(srcinc)/sh_unix.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_pthread.h $(srcinc)/sh_string.h
    1111sh_tiger1.o: $(srcsrc)/sh_tiger1.c Makefile config_xor.h
     
    7272sh_log_parse_pacct.o: $(srcsrc)/sh_log_parse_pacct.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_log_check.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h
    7373sh_log_parse_apache.o: $(srcsrc)/sh_log_parse_apache.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_log_check.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h
    74 sh_log_evalrule.o: $(srcsrc)/sh_log_evalrule.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h $(srcinc)/zAVLTree.h
    75 sh_log_check.o: $(srcsrc)/sh_log_check.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h $(srcinc)/sh_modules.h
     74sh_log_evalrule.o: $(srcsrc)/sh_log_evalrule.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h $(srcinc)/sh_log_correlate.h $(srcinc)/sh_log_mark.h $(srcinc)/sh_log_repeat.h $(srcinc)/zAVLTree.h
     75sh_log_check.o: $(srcsrc)/sh_log_check.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h $(srcinc)/sh_log_correlate.h $(srcinc)/sh_log_mark.h $(srcinc)/sh_log_repeat.h $(srcinc)/sh_modules.h
    7676sh_log_parse_samba.o: $(srcsrc)/sh_log_parse_samba.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_log_check.h $(srcinc)/sh_string.h
    7777sh_nmail.o: $(srcsrc)/sh_nmail.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_mem.h $(srcinc)/sh_mail.h $(srcinc)/sh_tiger.h $(srcinc)/sh_string.h $(srcinc)/sh_utils.h $(srcinc)/sh_fifo.h $(srcinc)/sh_filter.h $(srcinc)/sh_mail_int.h $(srcinc)/zAVLTree.h
    7878sh_filter.o: $(srcsrc)/sh_filter.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_filter.h
    7979sh_inotify.o: $(srcsrc)/sh_inotify.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_calls.h $(srcinc)/sh_inotify.h $(srcinc)/sh_mem.h $(srcinc)/slib.h $(srcinc)/sh_calls.h
     80sh_log_correlate.o: $(srcsrc)/sh_log_correlate.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h
     81sh_log_mark.o: $(srcsrc)/sh_log_mark.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_mem.h $(srcinc)/sh_string.h $(srcinc)/sh_error_min.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h $(srcinc)/zAVLTree.h
     82sh_log_repeat.o: $(srcsrc)/sh_log_repeat.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_string.h $(srcinc)/sh_log_check.h $(srcinc)/sh_log_evalrule.h
  • trunk/depend.sum

    r264 r265  
    1 188553029
     1968635974
  • trunk/docs/Changelog

    r263 r265  
    1 2.6.1:
     12.6.1 (21-12-2009):
     2        * add a routine to log monitoring module to guess the proper year
     3          for timestamps without year (standard syslog)
     4        * add feature to automatically detect and report bursts of
     5          similar messages in log monitoring module
     6        * add feature to check for missing heartbeat messages in
     7          log monitoring module
     8        * cache UIDs/GIDs to reduce the number of lookups
    29        * use inotify to track login/logout (sh_inotify.c, sh_utmp.c)
    310        * support event correlation in log monitoring module
     
    714          sh_unix_count_mlock() (reported by Remco Landegge).
    815       
    9 2.6.0:
     162.6.0 (01-11-2009):
    1017        * don't use statvfs() for process checking on FreeBSD
    1118        * fix bug with parallel compilation of cutest in Makefile
  • trunk/include/samhain.h

    r256 r265  
    106106#ifdef HAVE_STDINT_H
    107107#include <stdint.h>
     108#endif
     109
     110#if !defined(HAVE_UINT16_T)
     111#define UINT16 unsigned short
     112#else
     113#define UINT16 uint16_t
    108114#endif
    109115
  • trunk/include/sh_cat.h

    r260 r265  
    168168 MSG_LOGMON_SUM,
    169169 MSG_LOGMON_COR,
     170 MSG_LOGMON_MARK,
     171 MSG_LOGMON_BURST,
    170172#endif
    171173
  • trunk/include/sh_error.h

    r170 r265  
    109109void sh_error_fixup(void);
    110110
    111 /* convert a string to a numeric priority
    112  */
    113 int sh_error_convert_level (const char * str_s);
    114 
    115111/* only to stderr (GOOD/BAD)
    116112 */
  • trunk/include/sh_error_min.h

    r170 r265  
    2525                      long errnum, unsigned long  msg_index, ...);
    2626
     27/* convert a string to a numeric priority
     28 */
     29int sh_error_convert_level (const char * str_s);
     30
    2731#endif
  • trunk/include/sh_log_evalrule.h

    r260 r265  
    3939int sh_eval_process_msg(struct sh_logrecord * record);
    4040
    41 /* Match correlated rules
    42  */
    43 void sh_keep_match();
     41enum policies {
     42  EVAL_REPORT,
     43  EVAL_SUM
     44};
     45
     46struct sh_qeval  /* Queue with definitions */
     47{
     48  sh_string       * label;
     49  enum policies     policy;
     50  int               severity;
     51  time_t            interval;        /* if EVAL_SUM, interval   */
     52  struct sh_qeval * next;
     53};
     54
     55struct sh_qeval * sh_log_find_queue(const char * str);
     56
     57int sh_log_lookup_severity(const char * str);
    4458
    4559#endif
  • trunk/include/sh_string.h

    r260 r265  
    22#define SH_STRING_H
    33
     4#include <stdio.h>
    45
    56/* String definition and utility functions.
     
    8485char ** split_array_list(char *line, unsigned int * nfields, size_t * lengths);
    8586
     87/* Same as above, but split on delimiter list (token)
     88 */
     89char ** split_array_token (char *line,
     90                           unsigned int * nfields, size_t * lengths,
     91                           const char * token);
     92
    8693/* Return a split_array_list() of a list contained in 'PREFIX\s*( list ).*'
    8794 */
  • trunk/include/sh_unix.h

    r264 r265  
    219219void sh_unix_closeall (int fd, int except, int inchild);
    220220
     221/* Check whether directory for pid file exists
     222 */
     223int sh_unix_check_piddir (char * pidpath);
    221224
    222225/* write lock for filename
  • trunk/src/samhain.c

    r264 r265  
    753753#endif
    754754  delete_cache();
     755  sh_userid_destroy ();
    755756  sh_mem_stat();
    756757#endif
  • trunk/src/sh_cat.c

    r260 r265  
    159159  { MSG_LOGMON_REP,  SH_ERR_SEVERE,  EVENT, N_("msg=\"POLICY [Logfile] %s\" time=\"%s\" host=\"%s\" path=\"%s\"") },
    160160  { MSG_LOGMON_SUM,  SH_ERR_SEVERE,  EVENT, N_("msg=\"POLICY [Logfile] %s\" host=\"%s\" path=\"%s\"") },
    161   { MSG_LOGMON_COR,  SH_ERR_SEVERE,  EVENT, N_("msg=\"POLICY [Logfile] Correlated events %s\"") },
     161  { MSG_LOGMON_COR,  SH_ERR_SEVERE,  EVENT, N_("msg=\"POLICY [Logfile] Correlation event %s occured %d time(s)\"") },
     162  { MSG_LOGMON_MARK, SH_ERR_SEVERE,  EVENT, N_("msg=\"POLICY [Logfile] Event %s missing for %lu seconds\"") },
     163  { MSG_LOGMON_BURST, SH_ERR_SEVERE, EVENT, N_("msg=\"POLICY [Logfile] Repeated %d times: %s\" host=\"%s\"") },
    162164#endif
    163165
     
    487489  { MSG_LOGMON_EOPEN,SH_ERR_ERR,     RUN,   N_("msg=<Cannot open logfile %s>") },
    488490  { MSG_LOGMON_EREAD,SH_ERR_ERR,     RUN,   N_("msg=<Error while reading logfile %s>") },
    489   { MSG_LOGMON_REP,  SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY [Logfile] %s> time=<%s> host=<%s> path=<%s>") },
     491  { MSG_LOGMON_REP,  SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY [Logfile] %s> time=<%s>, host=<%s>, path=<%s>") },
    490492  { MSG_LOGMON_SUM,  SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY [Logfile] %s> host=<%s> path=<%s>") },
    491   { MSG_LOGMON_COR,  SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY [Logfile] Correlated events %s>") },
     493  { MSG_LOGMON_COR,  SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY [Logfile] Correlation event %s occured %d time(s)>") },
     494  { MSG_LOGMON_MARK, SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY [Logfile] Event %s missing for %lu seconds>") },
     495  { MSG_LOGMON_BURST, SH_ERR_SEVERE, EVENT, N_("msg=<POLICY [Logfile] Repeated %d times: %s>, host=<%s> ") },
    492496#endif
    493497
  • trunk/src/sh_inotify.c

    r261 r265  
    304304      } while (len < 0 || errno == EINTR);
    305305
    306       fprintf (stderr, "FIXME buflen=%ld\n", (long int) len);
    307 
    308306      if (len > 0)
    309307        {
     
    317315            event = (struct inotify_event *) &buffer[i];
    318316
    319             fprintf (stderr, "FIXME wd=%d mask=%u cookie=%u len=%u\n",
    320                     event->wd, event->mask,
    321                     event->cookie, event->len);
    322 
    323             if (event->len > 0)
    324               fprintf (stderr, "FIXME name=%s\n", event->name);
    325 
    326317            for (j = 0; j < watches->count; ++j)
    327318              {
    328                 fprintf (stderr, "FIXME %d watch=%d file=%s\n",
    329                          j, watches->watch[j], watches->file[j]);
    330 
    331319                if (watches->watch[j] == event->wd)
    332320                  {
    333                    
    334                     fprintf (stderr, "FIXME wd=%d mask=%u\n",
    335                              event->wd, event->mask);
    336 
    337321                    if (event->mask & IN_MODIFY)
    338322                      {
  • trunk/src/sh_log_check.c

    r260 r265  
    2323#include "sh_pthread.h"
    2424#include "sh_utils.h"
     25#include "sh_unix.h"
    2526#include "sh_string.h"
    2627#include "sh_log_check.h"
    2728#include "sh_log_evalrule.h"
     29#include "sh_log_correlate.h"
     30#include "sh_log_mark.h"
     31#include "sh_log_repeat.h"
    2832
    2933/* List of supported logfile types, format is
     
    5256  ino_t  inode;
    5357  fpos_t offset;
    54   /* FIXME include filename hash */
    5558};
    5659
    57 const char * save_dir = NULL;
     60static char * save_dir = NULL;
    5861
    5962static void * sh_dummy_path = NULL;
     
    105108  if (path)
    106109    {
     110      if (0 != sh_unix_check_piddir (path))
     111        {
     112          SH_FREE(path);
     113          return;
     114        }
     115
    107116      fd = fopen(path, "wb");
    108117      if (fd)
     
    771780 **********************************************************/
    772781
     782/* Return current year, unless that would result
     783 * in a date far in the future. If that happens,
     784 * return last year.
     785 */
     786static int year_guess (struct tm * btime)
     787{
     788  int           year;
     789  struct tm     ts;
     790  time_t        now    = time(NULL);
     791  time_t        check;
     792
     793  memcpy(&ts, localtime(&now), sizeof(struct tm));
     794  year = ts.tm_year;
     795
     796  /* Check result to detect year wrap
     797   * (logfile entry from last year).
     798   */
     799  btime->tm_year = year;
     800  check = mktime(btime);
     801  if (check > (now + (86400*30)))
     802    --year;
     803
     804  return year;
     805}
     806
    773807time_t conv_timestamp (struct tm * btime,
    774808                       struct tm * old_tm, time_t * old_time)
     
    776810  time_t timestamp;
    777811  long   offtime;
     812
    778813
    779814  /* timestamp - mktime is slooow, thus cache result
     
    788823        (btime->tm_min  - old_tm->tm_min)  * 60   +
    789824        (btime->tm_sec  - old_tm->tm_sec);
     825
    790826      *old_time += offtime;
    791827      memcpy(old_tm, btime, sizeof(struct tm));
     
    794830  else
    795831    {
     832      int year_btime = btime->tm_year;
     833
     834      if (btime->tm_year == 0)
     835        btime->tm_year = year_guess(btime);
    796836      timestamp = mktime(btime);
     837      btime->tm_year = year_btime;
     838
    797839      *old_time  = timestamp;
    798840      memcpy(old_tm, btime, sizeof(struct tm));
     
    866908      sh_check_watches();
    867909      sh_keep_match();
     910      sh_log_mark_check();
    868911    }
    869912  SH_MUTEX_UNLOCK(mutex_logmon_check);
     
    892935int sh_log_check_cleanup(void)
    893936{
     937  sh_log_mark_destroy();
    894938  return sh_log_check_reconf();
    895939}
     
    907951static int sh_logmon_add_rule  (const char * str);
    908952extern int sh_set_hidepid(const char *s);
     953static int sh_logmon_set_save_dir(const char *s);
    909954
    910955sh_rconf sh_log_check_table[] = {
     
    948993        N_("logmonhidepid"),
    949994        sh_set_hidepid,
     995    },
     996    {
     997        N_("logmonsavedir"),
     998        sh_logmon_set_save_dir,
     999    },
     1000    {
     1001        N_("logmonmarkseverity"),
     1002        sh_logmon_set_save_dir,
     1003    },
     1004    {
     1005        N_("logmonburstthreshold"),
     1006        sh_repeat_set_trigger,
     1007    },
     1008    {
     1009        N_("logmonburstqueue"),
     1010        sh_repeat_set_queue,
     1011    },
     1012    {
     1013        N_("logmonburstcron"),
     1014        sh_repeat_set_cron,
    9501015    },
    9511016    {
     
    9661031
    9671032  SL_RETURN((value), _("sh_logmon_set_active"));
     1033}
     1034
     1035static int sh_logmon_set_save_dir(const char *str)
     1036{
     1037  int retval = -1;
     1038   
     1039  SL_ENTER(_("sh_logmon_set_save_dir"));
     1040
     1041  if (str && str[0] == '/')
     1042    {
     1043      if (save_dir)
     1044        {
     1045          SH_FREE(save_dir);
     1046          save_dir = NULL;
     1047        }
     1048      save_dir = sh_util_strdup(str);
     1049      retval = 0;
     1050    }
     1051
     1052  SL_RETURN((retval), _("sh_logmon_set_save_dir"));
    9681053}
    9691054
  • trunk/src/sh_log_evalrule.c

    r262 r265  
    55#include <stdarg.h>
    66#include <string.h>
     7#include <ctype.h>
    78#include <time.h>
    89#include <limits.h>
     
    3132#include "sh_log_check.h"
    3233#include "sh_log_evalrule.h"
     34#include "sh_log_correlate.h"
     35#include "sh_log_mark.h"
     36#include "sh_log_repeat.h"
    3337#include "zAVLTree.h"
    3438
     
    3842
    3943#ifdef DEBUG_EVALRULES
    40 void DEBUG(const char *fmt, ...)
     44static void DEBUG(const char *fmt, ...)
    4145{
    4246  va_list ap;
     
    4751}
    4852#else
    49 void DEBUG(const char *fmt, ...)
     53static void DEBUG(const char *fmt, ...)
    5054{
    5155  (void) fmt;
     
    5357}
    5458#endif
    55 
    56 enum policies {
    57   EVAL_REPORT,
    58   EVAL_SUM
    59 };
    6059
    6160struct sh_ceval    /* Counter for summarizing    */
     
    8079}
    8180
    82 struct sh_qeval  /* Queue with definitions */
    83 {
    84   sh_string       * label;
    85   enum policies     policy;
    86   int               severity;
    87   time_t            interval;        /* if EVAL_SUM, interval   */
    88   struct sh_qeval * next;
    89 };
    90 
    9181enum {
    9282  RFL_ISRULE  = 1 << 0,
    9383  RFL_ISGROUP = 1 << 1,
    94   RFL_KEEP    = 1 << 2
     84  RFL_KEEP    = 1 << 2,
     85  RFL_MARK    = 1 << 3
    9586};
    9687
    97 /*--------------------------------------------------------------*/
    98 
    99 struct sh_keep
    100 {
    101   sh_string       * label;           /* label of keep rule   */
    102   unsigned long     delay;           /* valid delay             */
    103   time_t            last;            /* seen at                 */
    104   struct sh_keep *  next;
    105 };
    106 
    107 static struct sh_keep * keeplist  = NULL;
    108 static struct sh_keep * keeplast  = NULL;
    109 static unsigned long    keepcount = 0;
    110 
    111 static void sh_keep_free(void * item)
    112 {
    113   struct sh_keep * keep = (struct sh_keep *) item;
    114   if (!keep)
    115     return;
    116   sh_string_destroy(&(keep->label));
    117   SH_FREE(keep);
    118 }
    119 
    120 static void sh_keep_destroy()
    121 {
    122   struct sh_keep * keep;
    123 
    124   while (keeplist)
    125     {
    126       keep = keeplist;
    127       keeplist = keep->next;
    128       sh_keep_free(keep);
    129       --keepcount;
    130     }
    131   keeplist  = NULL;
    132   keeplast  = NULL;
    133   keepcount = 0;
    134 }
    135 
    136 static int sh_keep_add(sh_string * label, unsigned long delay, time_t last)
    137 {
    138   struct sh_keep * keep = SH_ALLOC(sizeof(struct sh_keep));
    139 
    140   keep->label = sh_string_copy(label);
    141   keep->delay = delay;
    142   keep->last  = last;
    143   keep->next  = NULL;
    144 
    145   if (keeplast && keeplist)
    146     {
    147       keeplast->next = keep;
    148       keeplast       = keep;
    149     }
    150   else
    151     {
    152       keeplist = keep;
    153       keeplast = keeplist;
    154     }
    155   ++keepcount;
    156   return 0;
    157 }
    158 
    159 int sh_keep_comp(const void * a, const void * b)
    160 {
    161   return ( (int)(((struct sh_keep *)a)->last) -
    162            (int)(((struct sh_keep *)b)->last) );
    163 }
    164 
    165 static sh_string * sh_keep_eval()
    166 {
    167   unsigned long count   = 0;
    168   sh_string * res       = NULL;
    169   time_t now            = time(NULL);
    170   struct sh_keep * keep = keeplist;
    171   struct sh_keep * prev = keeplist;
    172   struct sh_keep * arr;
    173 
    174   if (keepcount > 0)
    175     {
    176       arr = SH_ALLOC (keepcount * sizeof(struct sh_keep));
    177 
    178       while (count < keepcount && keep)
    179         {
    180           if ((now > keep->last) && ((unsigned long)(now - keep->last) <= keep->delay))
    181             {
    182               memcpy(&(arr[count]), keep, sizeof(struct sh_keep));
    183               ++count;
    184               prev = keep;
    185               keep = keep->next;
    186             }
    187           else /* Too old or in future, delete it */
    188             {
    189               if (keep != keeplist)
    190                 {
    191                   prev->next = keep->next;
    192                   sh_keep_free(keep);
    193                   keep = prev->next;
    194                   --keepcount;
    195                 }
    196               else /* list head */
    197                 {
    198                   keeplist = keep->next;
    199                   prev     = keeplist;
    200                   sh_keep_free(keep);
    201                   keep     = keeplist;
    202                   --keepcount;
    203                 }
    204             }
    205         }
    206 
    207       if (count > 0)
    208         {
    209           unsigned long i;
    210           qsort(arr, count, sizeof(struct sh_keep), sh_keep_comp);
    211           res = sh_string_copy(arr[0].label);
    212           for (i = 1; i < count; ++i)
    213             res = sh_string_add(res, arr[i].label);
    214         }
    215       SH_FREE(arr);
    216     }
    217   return res;
    218 }
    219 
    220 struct sh_mkeep
    221 {
    222   sh_string       * label;           /* label of match rule     */
    223   pcre            * rule;            /* compiled regex for rule */
    224   struct sh_qeval * queue;           /* assigned queue          */
    225   struct sh_mkeep * next;
    226 };
    227 
    228 struct sh_mkeep * mkeep_list = NULL;
    229 
    230 static struct sh_qeval * find_queue(const char * str);
    231 
    232 static int sh_keep_match_add(const char * str, const char * queue, const char * pattern)
    233 {
    234   unsigned int nfields = 1; /* seconds:label */
    235   size_t       lengths[1];
    236   char *       new    = sh_util_strdup(str);
    237   char **      splits = split_array_braced(new, _("CORRELATE"), &nfields, lengths);
    238 
    239   if (nfields == 1 && lengths[0] > 0)
    240     {
    241       struct sh_mkeep * mkeep = SH_ALLOC(sizeof(struct sh_mkeep));
    242       const char * error;
    243       int          erroffset;
    244       struct sh_qeval * rqueue = NULL;
    245 
    246       mkeep->rule = pcre_compile(pattern, PCRE_NO_AUTO_CAPTURE,
    247                              &error, &erroffset, NULL);
    248       if (!(mkeep->rule))
    249         {
    250           sh_string * msg =  sh_string_new(0);
    251           sh_string_add_from_char(msg, _("Bad regex: "));
    252           sh_string_add_from_char(msg, pattern);
    253          
    254           SH_MUTEX_LOCK(mutex_thread_nolog);
    255           sh_error_handle(SH_ERR_ERR, FIL__, __LINE__, 0, MSG_E_SUBGEN,
    256                           sh_string_str(msg),
    257                           _("sh_keep_match_add"));
    258           SH_MUTEX_UNLOCK(mutex_thread_nolog);
    259           sh_string_destroy(&msg);
    260          
    261           SH_FREE(splits);
    262           SH_FREE(mkeep);
    263           SH_FREE(new);
    264           return -1;
    265         }
    266 
    267       if (0 != strcmp(queue, _("trash")))
    268         {
    269 
    270           rqueue = find_queue(queue);
    271           if (!rqueue)
    272             {
    273               pcre_free(mkeep->rule);
    274               SH_FREE(splits);
    275               SH_FREE(mkeep);
    276               SH_FREE(new);
    277               return -1;
    278             }
    279         }
    280 
    281       mkeep->queue = rqueue;
    282       mkeep->label = sh_string_new_from_lchar(splits[0], strlen(splits[0]));
    283       mkeep->next  = mkeep_list;
    284       mkeep_list   = mkeep;
    285     }
    286   SH_FREE(new);
    287   return 0;
    288 }
    289 
    290 static void sh_keep_match_del()
    291 {
    292   struct sh_mkeep * mkeep = mkeep_list;
    293   while (mkeep)
    294     {
    295       mkeep_list = mkeep->next;
    296       sh_string_destroy(&(mkeep->label));
    297       pcre_free(mkeep->rule);
    298       mkeep = mkeep_list;
    299     }
    300   mkeep_list = NULL;
    301 }
    302 
    303 static struct sh_mkeep ** dummy_mkeep;
    304 
    305 void sh_keep_match()
    306 {
    307   if (mkeep_list)
    308     {
    309       sh_string       * res = sh_keep_eval();
    310 
    311       if (res)
    312         {
    313           struct sh_mkeep * mkeep = mkeep_list;
    314 
    315           dummy_mkeep = &mkeep;
    316 
    317           while (mkeep)
    318             {
    319               int val = pcre_exec(mkeep->rule, NULL,
    320                                   sh_string_str(res), (int)sh_string_len(res),
    321                                   0, 0, NULL, 0);
    322               if (val >= 0)
    323                 {
    324                   char * tmp;
    325                   SH_MUTEX_LOCK(mutex_thread_nolog);
    326                   tmp = sh_util_safe_name (sh_string_str(mkeep->label));
    327                   sh_error_handle (mkeep->queue->severity, FIL__, __LINE__, 0,
    328                                    MSG_LOGMON_COR, tmp);
    329                   SH_FREE(tmp);
    330                   SH_MUTEX_UNLOCK(mutex_thread_nolog);
    331                 }
    332               mkeep = mkeep->next;
    333             }
    334           sh_string_destroy(&res);
    335         }
    336     }
    337   return;
    338 }
    339 
    340 /*--------------------------------------------------------------*/
     88
     89/*--------------------------------------------------------------
     90 *
     91 *   Adding rules/groups/hosts
     92 *
     93 *--------------------------------------------------------------*/
    34194
    34295struct sh_geval  /* Group of rules (may be a single rule) */
     
    623376}
    624377
    625 static struct sh_qeval * find_queue(const char * str)
     378struct sh_qeval * sh_log_find_queue(const char * str)
    626379{
    627380  struct sh_qeval * retval = queuelist;
     
    639392}
    640393
    641 char * get_keep(char * str, unsigned long * seconds)
     394int sh_log_lookup_severity(const char * str)
     395{
     396  struct sh_qeval * queue;
     397
     398  if (str)
     399    {
     400      if (0 != strcmp(str, _("trash")))
     401        {
     402          queue = sh_log_find_queue(str);
     403         
     404          if (queue)
     405            return queue->severity;
     406        }
     407    }
     408  return SH_ERR_SEVERE;
     409}
     410
     411static char * get_label_and_time(const char * inprefix, char * str,
     412                                 unsigned long * seconds)
    642413{
    643414  char       * res    = NULL;
     
    646417  unsigned int nfields = 2; /* seconds:label */
    647418  size_t       lengths[2];
     419  char *       prefix = sh_util_strdup(inprefix);
    648420  char *       new    = sh_util_strdup(str);
    649   char **      splits = split_array_braced(new, _("KEEP"), &nfields, lengths);
    650 
    651   if (nfields == 2 && lengths[0] > 0 && lengths[1] > 0)
     421  char **      splits = split_array_braced(new, prefix, &nfields, lengths);
     422
     423  if (splits && nfields == 2 && lengths[0] > 0 && lengths[1] > 0)
    652424    {
    653425      *seconds = strtoul(splits[0], &endptr, 10);
     
    660432    SH_FREE(splits);
    661433  SH_FREE(new);
     434  SH_FREE(prefix);
    662435  return res;
    663436}
     
    677450  int          captures = 0;
    678451  unsigned int nfields = 2; /* queue:regex */
    679   size_t       lengths[2];
     452  size_t       lengths[3];
    680453  char *       new    = sh_util_strdup(str);
    681   char **      splits = split_array(new, &nfields, ':', lengths);
    682 
    683   int           qpos = 0;
    684   volatile int  rpos = 1;
    685   unsigned long dsec = 0;
    686   char *        dstr = NULL;
     454  char **      splits;
     455
     456  int           qpos  = 0;
     457  volatile int  rpos  = 1;
     458  unsigned long dsec  = 0;
     459  char *        dstr  = NULL;
     460  char *        s     = new;
     461  volatile char pflag = '-';
     462
     463  while ( *s && isspace((int)*s) ) ++s;
     464  if (0 == strncmp(s, _("KEEP"), 4)      ||
     465      0 == strncmp(s, _("CORRELATE"), 9) ||
     466      0 == strncmp(s, _("MARK"), 4))
     467    {
     468      pflag   = s[0];
     469      nfields = 3;
     470    }
     471
     472  splits = split_array(new, &nfields, ':', lengths);
    687473
    688474  dummy_queue = &queue;
     
    698484  if (nfields == 3)
    699485    {
    700       /* KEEP(nsec):queue:regex
    701        */
    702       dstr = get_keep(splits[0], &dsec);
    703       if (!dstr)
    704         {
    705           /* CORRELATE:queue:regex
     486      if (pflag == 'K')
     487        {
     488          /* KEEP(nsec,label):queue:regex
     489           */
     490          dstr = get_label_and_time(_("KEEP"), splits[0], &dsec);
     491          if (!dstr)
     492            {
     493              SH_FREE(splits);
     494              SH_FREE(new);
     495              return -1;
     496            }
     497        }
     498      else if (pflag == 'C')
     499        {
     500          /* CORRELATE(description):queue:regex
    706501           */
    707502          int retval = sh_keep_match_add(splits[0], splits[1], splits[2]);
     
    710505          return retval;
    711506        }
     507      else if (pflag == 'M')
     508        {
     509          /* MARK(description, interval):queue:regex
     510           */
     511          int retval = -1;
     512
     513          dstr = get_label_and_time(_("MARK"), splits[0], &dsec);
     514          if (dstr)
     515            {
     516              retval = sh_log_mark_add(dstr, dsec, splits[1]);
     517            }
     518          if (retval != 0)
     519            {
     520              SH_FREE(splits);
     521              SH_FREE(new);
     522              return retval;
     523            }
     524        }
    712525      ++qpos; ++rpos;
    713526    }
     
    715528  if (0 != strcmp(splits[qpos], _("trash")))
    716529    {
    717       queue = find_queue(splits[qpos]);
     530      queue = sh_log_find_queue(splits[qpos]);
    718531      if (!queue)
    719532        {
     
    784597
    785598
    786   if (dstr)
     599  if (pflag == 'K')
    787600    {
    788601      nr->label   = sh_string_new_from_lchar(dstr, strlen(dstr));
    789602      nr->flags  |= RFL_KEEP;
     603      nr->delay   = dsec;
     604      SH_FREE(dstr);
     605    }
     606  else if (pflag == 'M')
     607    {
     608      nr->label   = sh_string_new_from_lchar(dstr, strlen(dstr));
     609      nr->flags  |= RFL_MARK;
    790610      nr->delay   = dsec;
    791611      SH_FREE(dstr);
     
    1005825                  sl_snprintf(emsg,  SH_ERRBUF_SIZE, _("Rule %d matches, result = %d (keep)"),
    1006826                              count, res);
     827                else if ( rule->flags & RFL_MARK )
     828                  sl_snprintf(emsg,  SH_ERRBUF_SIZE, _("Rule %d matches, result = %d (mark)"),
     829                              count, res);
    1007830                else
    1008831                  sl_snprintf(emsg,  SH_ERRBUF_SIZE, _("Rule %d matches, result = %d"),
     
    1020843                sh_keep_add(rule->label, rule->delay,
    1021844                            timestamp == 0 ? time(NULL) : timestamp);
     845              }
     846
     847            else if ( rule->flags & RFL_MARK )
     848              {
     849                DEBUG("debug: rule %d matches (mark)\n", count);
     850                sh_log_mark_update(rule->label,
     851                                   timestamp == 0 ? time(NULL) : timestamp);
    1022852              }
    1023853
     
    13491179          msg_report(DEFAULT_SEVERITY, NULL, record);
    13501180        }
     1181
     1182      sh_repeat_message_check(record->host,
     1183                              record->message,
     1184                              record->timestamp);
     1185                             
    13511186      return 0;
    13521187    }
  • trunk/src/sh_log_parse_syslog.c

    r199 r265  
    7272
    7373
    74   if (sh_string_len(logline) > 0 && flag_err_debug == SL_TRUE)
     74  if (flag_err_debug == SL_TRUE && sh_string_len(logline) > 0)
    7575    {
    7676      SH_MUTEX_LOCK(mutex_thread_nolog);
  • trunk/src/sh_readconf.c

    r254 r265  
    2828
    2929#include "samhain.h"
     30#include "sh_calls.h"
    3031#include "sh_error.h"
    31 #include "sh_database.h"
    32 #include "sh_unix.h"
    33 #include "sh_utils.h"
     32#include "sh_extern.h"
    3433#include "sh_files.h"
    35 #include "sh_mail.h"
    36 #include "sh_nmail.h"
    37 #include "sh_calls.h"
    38 #include "sh_tiger.h"
    3934#include "sh_forward.h"
    40 #include "sh_modules.h"
    4135#include "sh_gpg.h"
    4236#include "sh_hash.h"
    4337#include "sh_ignore.h"
     38#include "sh_database.h"
     39#include "sh_mail.h"
     40#include "sh_modules.h"
     41#include "sh_nmail.h"
    4442#include "sh_prelink.h"
    45 #include "sh_extern.h"
    46 #include "sh_tools.h"
    47 
    48 #ifdef WITH_DATABASE
    49 #include "sh_database.h"
    50 #endif
    51 
    5243#ifdef HAVE_LIBPRELUDE
    5344#include "sh_prelude.h"
    5445#endif
     46#include "sh_tiger.h"
     47#include "sh_tools.h"
     48#include "sh_unix.h"
     49#include "sh_utils.h"
     50
    5551
    5652extern int set_reverse_lookup (const char * c);
  • trunk/src/sh_socket.c

    r264 r265  
    385385    }
    386386
     387  if (0 != sh_unix_check_piddir (sh_sockname))
     388    {
     389      SH_FREE(sh_sockname);
     390      SL_RETURN((-1),_("sh_socket_open_int"));
     391    }
    387392
    388393  pf_unix_fd = socket (PF_UNIX, SOCK_STREAM, 0);
  • trunk/src/sh_string.c

    r260 r265  
    133133char ** split_array_ws_int (char *line,
    134134                            unsigned int * nfields, size_t * lengths,
    135                             int isList)
     135                            const char *delim, int isList)
    136136{
    137137  char *a, *e, *s;
     
    161161      else
    162162        {
    163           if ( *s && (*s == ' ' || *s == '\t' || *s == ','))
    164             {
    165               do {
    166                 ++s;
    167               } while ( *s && (*s == ' ' || *s == '\t' || *s == ','));
    168             }
     163          if ( *s && strchr(delim, (int)*s))
     164            {
     165              do {
     166                ++s;
     167              } while ( *s && strchr(delim, (int)*s));
     168            }
     169
    169170        }
    170171
     
    183184          else
    184185            {
    185               do {
    186                 a++;
    187               } while ( *a && (*a != ' ' && *a != '\t' && *a != ','));
     186              do {
     187                a++;
     188              } while ( *a && NULL == strchr(delim, (int)*a));
    188189            }
    189190
     
    231232                        unsigned int * nfields, size_t * lengths)
    232233{
    233   return split_array_ws_int (line, nfields, lengths, SH_SPLIT_WS);
     234  return split_array_ws_int (line, nfields, lengths, NULL, SH_SPLIT_WS);
    234235}
    235236
     
    237238                          unsigned int * nfields, size_t * lengths)
    238239{
    239   return split_array_ws_int (line, nfields, lengths, SH_SPLIT_LIST);
     240  return split_array_ws_int (line, nfields, lengths, ", \t", SH_SPLIT_LIST);
     241}
     242
     243char ** split_array_token (char *line,
     244                           unsigned int * nfields, size_t * lengths,
     245                           const char * token)
     246{
     247  return split_array_ws_int (line, nfields, lengths, token, SH_SPLIT_LIST);
    240248}
    241249
  • trunk/src/sh_unix.c

    r264 r265  
    42354235}
    42364236
    4237 int sh_unix_check_piddir (char * pidfile)
     4237int sh_unix_check_piddir (char * pidpath)
    42384238{
    42394239  static        struct stat   buf;
     
    42434243  SL_ENTER(_("sh_unix_check_piddir"));
    42444244
    4245   pid_dir = sh_util_dirname (pidfile);
     4245  pid_dir = sh_util_dirname (pidpath);
    42464246
    42474247  status = retry_lstat (FIL__, __LINE__, pid_dir, &buf);
Note: See TracChangeset for help on using the changeset viewer.