/[monit]/monit/validate.c
ViewVC logotype

Diff of /monit/validate.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.72 by martinp, Tue Aug 12 13:40:42 2003 UTC revision 1.73 by martinp, Wed Aug 13 19:50:05 2003 UTC
# Line 304  static int check_timestamps(Service_T s) Line 304  static int check_timestamps(Service_T s)
304  static int check_directory(Service_T s) {  static int check_directory(Service_T s) {
305    
306    struct stat stat_buf;    struct stat stat_buf;
307      char report[STRLEN];
308    
309    if(stat(s->path, &stat_buf) != 0) {    if(stat(s->path, &stat_buf) != 0) {
310      Event_post(s, EVENT_RESTART,      Event_post(s, EVENT_RESTART,
# Line 317  static int check_directory(Service_T s) Line 318  static int check_directory(Service_T s)
318      return FALSE;      return FALSE;
319    }    }
320    
321    if(check_perm(s, stat_buf.st_mode))    if(check_perm(s, stat_buf.st_mode)) {
322      return FALSE;      s->perm->event_flag= TRUE;
323        if(! eval_actions(s->perm->action, s, report, "permission", EVENT_PERMISSION))
324    if(check_uid(s, stat_buf.st_uid))        return FALSE;
325      return FALSE;    }
326    
327    if(check_gid(s, stat_buf.st_gid))    if(check_uid(s, stat_buf.st_uid)) {
328      return FALSE;      s->uid->event_flag= TRUE;
329        if(! eval_actions(s->uid->action, s, report, "uid", EVENT_UID))
330          return FALSE;
331      }
332    
333      if(check_gid(s, stat_buf.st_gid)) {
334        s->gid->event_flag= TRUE;
335        if(! eval_actions(s->gid->action, s, report, "gid", EVENT_GID))
336          return FALSE;
337      }
338    
339    return TRUE;    return TRUE;
340    
# Line 351  static int check_file(Service_T s) { Line 361  static int check_file(Service_T s) {
361      return FALSE;      return FALSE;
362    }    }
363        
364    if(check_checksum(s))    if(check_checksum(s)) {
365      return FALSE;      s->checksum->event_flag= TRUE;
366        if(! eval_actions(s->checksum->action, s, report, "checksum", EVENT_CHECKSUM))
367          return FALSE;
368      }
369    
370    if(check_perm(s, stat_buf.st_mode))    if(check_perm(s, stat_buf.st_mode)) {
371      return FALSE;      s->perm->event_flag= TRUE;
372        if(! eval_actions(s->perm->action, s, report, "permission", EVENT_PERMISSION))
373          return FALSE;
374      }
375    
376    if(check_uid(s, stat_buf.st_uid))    if(check_uid(s, stat_buf.st_uid)) {
377      return FALSE;      s->uid->event_flag= TRUE;
378        if(! eval_actions(s->uid->action, s, report, "uid", EVENT_UID))
379          return FALSE;
380      }
381    
382    if(check_gid(s, stat_buf.st_gid))    if(check_gid(s, stat_buf.st_gid)) {
383      return FALSE;      s->gid->event_flag= TRUE;
384        if(! eval_actions(s->gid->action, s, report, "gid", EVENT_GID))
385          return FALSE;
386      }
387    
388    for(sl= s->sizelist; sl; sl= sl->next) {    for(sl= s->sizelist; sl; sl= sl->next) {
389      if(!check_size_item(s, sl, (unsigned long)stat_buf.st_size, report)) {      if(!check_size_item(s, sl, (unsigned long)stat_buf.st_size, report)) {
# Line 394  static int check_device(Service_T s) { Line 416  static int check_device(Service_T s) {
416      return FALSE;      return FALSE;
417    }    }
418        
419    if(check_perm(s, stat_buf.st_mode))    if(check_perm(s, stat_buf.st_mode)) {
420      return FALSE;      s->perm->event_flag= TRUE;
421        if(! eval_actions(s->perm->action, s, report, "permission", EVENT_PERMISSION))
422    if(check_uid(s, stat_buf.st_uid))        return FALSE;
423      return FALSE;    }
424    
425    if(check_gid(s, stat_buf.st_gid))    if(check_uid(s, stat_buf.st_uid)) {
426      return FALSE;      s->uid->event_flag= TRUE;
427        if(! eval_actions(s->uid->action, s, report, "uid", EVENT_UID))
428          return FALSE;
429      }
430    
431      if(check_gid(s, stat_buf.st_gid)) {
432        s->gid->event_flag= TRUE;
433        if(! eval_actions(s->gid->action, s, report, "gid", EVENT_GID))
434          return FALSE;
435      }
436    
437    /* Test devices */    /* Test devices */
438    if(s->devicelist) {    if(s->devicelist) {

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.73

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26