Changeset 183 for trunk/src


Ignore:
Timestamp:
Oct 26, 2008, 12:59:48 PM (16 years ago)
Author:
katerina
Message:

Support for logfile monitoring (ticket #122). Also improved some configure error messages.

Location:
trunk/src
Files:
5 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_cat.c

    r180 r183  
    9797#ifdef SH_USE_KERN
    9898  /* FreeBSD */
    99   { MSG_KERN_POLICY, SH_ERR_SEVERE,  EVENT, N_("msg=\"POLICY KERNEL BSD syscall table: new: %#lx old: %#lx\" syscall=\"%03d %s\"") },
    100   { MSG_KERN_POL_CO, SH_ERR_SEVERE,  EVENT, N_("msg=\"POLICY KERNEL BSD syscall code: new: %#x,%#x old: %#x,%#x\" syscall=\"%03d %s\"") },
     99  { MSG_KERN_POLICY, SH_ERR_SEVERE,  EVENT, N_("msg=\"POLICY [Kernel] BSD syscall table: new: %#lx old: %#lx\" syscall=\"%03d %s\"") },
     100  { MSG_KERN_POL_CO, SH_ERR_SEVERE,  EVENT, N_("msg=\"POLICY [Kernel] BSD syscall code: new: %#x,%#x old: %#x,%#x\" syscall=\"%03d %s\"") },
    101101
    102102  /* Linux */
     
    143143  { MSG_MNT_CHECK,   SH_ERR_INFO,    RUN,   N_("msg=\"Checking mounts\"")},
    144144  { MSG_MNT_MEMLIST, SH_ERR_ERR,     RUN,   N_("msg=\"Cannot read mount list from memory\"")},
    145   { MSG_MNT_MNTMISS, SH_ERR_WARN,    EVENT, N_("msg=\"Mount missing\" path=\"%s\"")},
    146   { MSG_MNT_OPTMISS, SH_ERR_WARN,    EVENT, N_("msg=\"Mount option missing\" path=\"%s\" option=\"%s\"")},
     145  { MSG_MNT_MNTMISS, SH_ERR_WARN,    EVENT, N_("msg=\"POLICY [Mounts] Mount missing\" path=\"%s\"")},
     146  { MSG_MNT_OPTMISS, SH_ERR_WARN,    EVENT, N_("msg=\"POLICY [Mounts] Mount option missing\" path=\"%s\" option=\"%s\"")},
    147147#endif
    148148
    149149#ifdef SH_USE_USERFILES
    150150  { MSG_USERFILES_SUMMARY,SH_ERR_INFO,    RUN,   N_("msg=\"Checked for users files\"") },
     151#endif
     152
     153#ifdef USE_LOGFILE_MONITOR
     154  { MSG_LOGMON_CHKS, SH_ERR_INFO,    RUN,   N_("msg=\"Checking logfile %s\"") },
     155  { MSG_LOGMON_CHKE, SH_ERR_INFO,    RUN,   N_("msg=\"Finished logfile %s, %lu new records processed\"") },
     156  { MSG_LOGMON_MISS, SH_ERR_ERR,     RUN,   N_("msg=\"Missing logfile %s\"") },
     157  { MSG_LOGMON_EOPEN,SH_ERR_ERR,     RUN,   N_("msg=\"Cannot open logfile %s\"") },
     158  { MSG_LOGMON_EREAD,SH_ERR_ERR,     RUN,   N_("msg=\"Error while reading logfile %s\"") },
     159  { MSG_LOGMON_REP,  SH_ERR_SEVERE,  EVENT, N_("msg=\"POLICY [Logfile] %s\" time=\"%s\" host=\"%s\" path=\"%s\"") },
     160  { MSG_LOGMON_SUM,  SH_ERR_SEVERE,  EVENT, N_("msg=\"POLICY [Logfile] %s\" host=\"%s\" path=\"%s\"") },
    151161#endif
    152162
     
    413423
    414424#ifdef SH_USE_KERN
    415   { MSG_KERN_POLICY, SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY KERNEL BSD syscall table: new: %#lx old: %#lx>, syscall=<%03d %s>") },
    416   { MSG_KERN_POL_CO, SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY KERNEL BSD syscall code: new: %#x,%#x old: %#x,%#x>, syscall=<%03d %s>") },
     425  { MSG_KERN_POLICY, SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY [Kernel] BSD syscall table: new: %#lx old: %#lx>, syscall=<%03d %s>") },
     426  { MSG_KERN_POL_CO, SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY [Kernel] BSD syscall code: new: %#x,%#x old: %#x,%#x>, syscall=<%03d %s>") },
    417427
    418428  { MSG_KERN_SYSCALL,SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY [Kernel] SYSCALL modified> syscall=<%03d %s>, %s") },
     
    461471  { MSG_MNT_CHECK,   SH_ERR_INFO,    RUN,   N_("msg=<Checking mounts>")},
    462472  { MSG_MNT_MEMLIST, SH_ERR_ERR,     RUN,   N_("msg=<Cannot read mount list from memory>")},
    463   { MSG_MNT_MNTMISS, SH_ERR_WARN,    EVENT, N_("msg=<Mount missing>, path=<%s>")},
    464   { MSG_MNT_OPTMISS, SH_ERR_WARN,    EVENT, N_("msg=<Mount option missing>, path=<%s>, option=<%s>")},
     473  { MSG_MNT_MNTMISS, SH_ERR_WARN,    EVENT, N_("msg=<POLICY [Mounts] Mount missing>, path=<%s>")},
     474  { MSG_MNT_OPTMISS, SH_ERR_WARN,    EVENT, N_("msg=<POLICY [Mounts] Mount option missing>, path=<%s>, option=<%s>")},
    465475#endif
    466476
    467477#ifdef SH_USE_USERFILES
    468478  { MSG_USERFILES_SUMMARY,SH_ERR_INFO,    RUN,   N_("msg=<Checked for users files>") },
     479#endif
     480
     481#ifdef USE_LOGFILE_MONITOR
     482  { MSG_LOGMON_CHKS, SH_ERR_INFO,    RUN,   N_("msg=<Checking logfile %s>") },
     483  { MSG_LOGMON_CHKE, SH_ERR_INFO,    RUN,   N_("msg=<Finished logfile %s, %lu new records processed>") },
     484  { MSG_LOGMON_MISS, SH_ERR_ERR,     RUN,   N_("msg=<Missing logfile %s>") },
     485  { MSG_LOGMON_EOPEN,SH_ERR_ERR,     RUN,   N_("msg=<Cannot open logfile %s>") },
     486  { MSG_LOGMON_EREAD,SH_ERR_ERR,     RUN,   N_("msg=<Error while reading logfile %s>") },
     487  { MSG_LOGMON_REP,  SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY [Logfile] %s> time=<%s> host=<%s> path=<%s>") },
     488  { MSG_LOGMON_SUM,  SH_ERR_SEVERE,  EVENT, N_("msg=<POLICY [Logfile] %s> host=<%s> path=<%s>") },
    469489#endif
    470490
  • trunk/src/sh_getopt.c

    r182 r183  
    535535  if (num > 0) fputc (',', stdout);
    536536  fputs (_(" ports"), stdout); ++num;
     537#endif
     538#ifdef USE_LOGFILE_MONITOR
     539  if (num > 0) fputc (',', stdout);
     540  fputs (_(" logfile monitor"), stdout); ++num;
    537541#endif
    538542  if (num == 0)
  • trunk/src/sh_modules.c

    r149 r183  
    1616#include "sh_processcheck.h"
    1717#include "sh_portcheck.h"
     18#include "sh_logmon.h"
    1819
    1920sh_mtype modList[] = {
     
    130131#endif
    131132
     133#ifdef USE_LOGFILE_MONITOR
     134  {
     135    N_("LOGMON"),
     136    -1,
     137    sh_log_check_init,
     138    sh_log_check_timer,
     139    sh_log_check_check,
     140    sh_log_check_cleanup,
     141    sh_log_check_reconf,
     142
     143    N_("[LogMon]"),
     144    sh_log_check_table,
     145    PTHREAD_MUTEX_INITIALIZER,
     146  },
     147#endif
     148
    132149  {
    133150    NULL,
  • trunk/src/sh_processcheck.c

    r170 r183  
    13111311      clean_list (&list_fake);
    13121312    }
     1313
    13131314  SH_MUTEX_UNLOCK(mutex_proc_check);
    13141315
  • trunk/src/sh_string.c

    r171 r183  
    108108
    109109    setnext:
    110       lengths[i] = (a-s);
     110      lengths[i] = (size_t) (a-s); /* a >= s always */
    111111      arr[i] = s;
    112112      ++i;
     
    184184                }
    185185            }
    186           lengths[i] = (a-s);
     186          lengths[i] = (size_t)(a-s); /* a >= s always */
    187187          arr[i]     = s;
    188188          ++i;
     
    266266}
    267267
    268 sh_string * sh_string_cat_lchar(sh_string * s, char * str, size_t len)
     268sh_string * sh_string_cat_lchar(sh_string * s, const char * str, size_t len)
    269269{
    270270  if (sl_ok_adds(len, s->siz) == SL_TRUE)
     
    283283}
    284284
    285 sh_string * sh_string_set_from_char(sh_string * s, char * str)
     285sh_string * sh_string_set_from_char(sh_string * s, const char * str)
    286286{
    287287  size_t len = strlen(str);
     
    296296}
    297297
    298 sh_string * sh_string_new_from_lchar(char * str, size_t len)
     298sh_string * sh_string_add_from_char(sh_string * s, const char * str)
     299{
     300  size_t len   = strlen(str);
     301  size_t avail = (s->siz - s->len);
     302
     303  if ((len+1) > avail)
     304    {
     305      (void) sh_string_grow(s, ((len+1) - avail) );
     306    }
     307  memcpy(&(s->str[s->len]), str, (len+1));
     308  s->len += len;
     309  return s;
     310}
     311
     312sh_string * sh_string_new_from_lchar(const char * str, size_t len)
    299313{
    300314  sh_string * s;
     
    308322}
    309323
    310 sh_string * sh_string_new_from_lchar3(char * str1, size_t len1,
    311                                       char * str2, size_t len2,
    312                                       char * str3, size_t len3)
     324sh_string * sh_string_new_from_lchar3(const char * str1, size_t len1,
     325                                      const char * str2, size_t len2,
     326                                      const char * str3, size_t len3)
    313327{
    314328  sh_string * s;
  • trunk/src/sh_unix.c

    r175 r183  
    10641064
    10651065#if defined(HOST_IS_CYGWIN) || defined(__cygwin__) || defined(__CYGWIN32__) || defined(__CYGWIN__)
    1066 int tf_trust_check (char * file, int mode)
     1066int tf_trust_check (const char * file, int mode)
    10671067{
    10681068  (void) file;
     
    10711071}
    10721072#else
    1073 int tf_trust_check (char * file, int mode)
     1073int tf_trust_check (const char * file, int mode)
    10741074{
    10751075  char * tmp;
  • trunk/src/slib.c

    r174 r183  
    26522652static struct sl_trustfile_store * sl_trusted_files = NULL;
    26532653
    2654 void sl_add_trusted_file(char * filename, uid_t teuid)
     2654static void sl_add_trusted_file(const char * filename, uid_t teuid)
    26552655{
    26562656  struct sl_trustfile_store *new = SH_ALLOC(sizeof(struct sl_trustfile_store));
     
    26642664}
    26652665
    2666 char * sl_check_trusted_file(char * filename, uid_t teuid)
     2666static const char * sl_check_trusted_file(const char * filename, uid_t teuid)
    26672667{
    26682668  struct sl_trustfile_store *new = sl_trusted_files;
     
    26782678}
    26792679
    2680 void sl_clear_trusted_file(struct sl_trustfile_store * file)
     2680static void sl_clear_trusted_file(struct sl_trustfile_store * file)
    26812681{
    26822682  if (file)
     
    26902690}
    26912691
    2692 int sl_trustfile_euid(char * filename, uid_t teuid)
     2692int sl_trustfile_euid(const char * filename, uid_t teuid)
    26932693{
    26942694  long          status;
  • trunk/src/trustfile.c

    r171 r183  
    319319
    320320/* not static to circumvent stupid gcc 4 bug */
    321 int getfname(char *fname, char *rbuf, int rsz)
     321int getfname(const char *fname, char *rbuf, int rsz)
    322322{
    323323#ifndef TRUST_MAIN
     
    678678}
    679679
    680 int sl_trustfile(char *fname, uid_t *okusers, uid_t *badusers)
     680int sl_trustfile(const char *fname, uid_t *okusers, uid_t *badusers)
    681681{
    682682  char fexp[MAXFILENAME];       /* file name fully expanded        */
Note: See TracChangeset for help on using the changeset viewer.