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

Diff of /monit/validate.c

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

revision 1.67 by martinp, Wed Aug 6 13:10:51 2003 UTC revision 1.68 by martinp, Wed Aug 6 14:51:13 2003 UTC
# Line 876  static int check_skip(Service_T s) { Line 876  static int check_skip(Service_T s) {
876    
877    
878  /**  /**
879   * Returns TRUE if the checksum was changed for any associated   * Returns TRUE if the checksum was changed for associated
880   * programs and send an alert warning. Also make sure that the program   * path and send an alert warning. Also make sure that the service
881   * will not be validated, started or restarted again in this   * will not be validated, started or restarted again in this
882   * session. Returns FALSE if the checksum is the same or not defined   * session. Returns FALSE if the checksum is the same or not defined
883   * for this service.   * for this service.
884   */   */
885  static int check_checksum(Service_T s) {  static int check_checksum(Service_T s) {
886    
   Checksum_T c;  
   
887    ASSERT(s);    ASSERT(s);
888    
889    if(!s->def_checksum) {    if(!s->md5) {
890      return FALSE;      return FALSE;
891    }    }
892    
893    for(c= s->checksumlist; c; c= c->next) {    if( !check_md5(s->path, s->md5) ) {
894      if(c->file && c->md5 && !check_md5(c->file, c->md5)) {      Event_post(s, EVENT_CHECKSUM, "'%s' CHECKSUM ERROR for %s\n",
895        Event_post(s, EVENT_CHECKSUM, "'%s' CHECKSUM ERROR for %s\n",                 s->name, s->path);
896                   s->name, c->file);      return TRUE;
       return TRUE;  
     }  
897    }    }
898        
899    DEBUG("'%s' has valid checksums\n", s->name);    DEBUG("'%s' has valid checksums\n", s->name);
# Line 923  static int check_timestamp_item(Service_ Line 919  static int check_timestamp_item(Service_
919      return FALSE;      return FALSE;
920    }    }
921    
922    if(!(timestamp= get_timestamp(t->pathname, S_IFDIR|S_IFREG))) {    if(!(timestamp= get_timestamp(s->path, S_IFDIR|S_IFREG))) {
923      snprintf(report, STRLEN, "can't get timestamp for %s", t->pathname);      snprintf(report, STRLEN, "can't get timestamp for %s", s->path);
924      return FALSE;      return FALSE;
925    }    }
926    
927    if(t->test_changes) {    if(t->test_changes) {
928      if(t->timestamp != timestamp) {      if(t->timestamp != timestamp) {
929        snprintf(report, STRLEN, "timestamp was changed for %s", t->pathname);        snprintf(report, STRLEN, "timestamp was changed for %s", s->path);
930        /* Set the old timestamp to the new value so we do not report        /* Set the old timestamp to the new value so we do not report
931         * this more than once per change */         * this more than once per change */
932        t->timestamp= timestamp;        t->timestamp= timestamp;
# Line 938  static int check_timestamp_item(Service_ Line 934  static int check_timestamp_item(Service_
934      }      }
935    } else {    } else {
936      if(compare_value(t->operator, (int)(now - timestamp), t->time)) {      if(compare_value(t->operator, (int)(now - timestamp), t->time)) {
937        snprintf(report, STRLEN, "timestamp test failed for %s", t->pathname);        snprintf(report, STRLEN, "timestamp test failed for %s", s->path);
938        return FALSE;        return FALSE;
939      }      }
940    }    }
941    
942    DEBUG("'%s' timestamp test passed for %s\n", s->name, t->pathname);    DEBUG("'%s' timestamp test passed for %s\n", s->name, s->path);
943                
944    return TRUE;    return TRUE;
945    

Legend:
Removed from v.1.67  
changed lines
  Added in v.1.68

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