X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fshared%2Freport_op.c;fp=src%2Fshared%2Freport_op.c;h=e7236fdc07d815e3548511e10e10b194dfd68e09;hp=ede6310fae4f9725836c95e58c1e8e98a686df0c;hb=789cbc8e52da68eba3517b920ef22e000cf3c9fd;hpb=ef70704f0b31b59bb719b884d6a99cb9e3e2044a diff --git a/src/shared/report_op.c b/src/shared/report_op.c index ede6310..e7236fd 100755 --- a/src/shared/report_op.c +++ b/src/shared/report_op.c @@ -112,10 +112,13 @@ int _os_report_check_filters(alert_data *al_data, report_filter *r_filter) /* Checking for the filters. */ if(r_filter->group) { - if(!strstr(al_data->group, r_filter->group)) - { - return(0); - } + if(al_data->group) /* Probably unnecessary, all (?) alerts should have groups) */ + { + if(!strstr(al_data->group, r_filter->group)) + { + return(0); + } + } } if(r_filter->rule) { @@ -140,24 +143,34 @@ int _os_report_check_filters(alert_data *al_data, report_filter *r_filter) } if(r_filter->srcip) { - if(!strstr(al_data->srcip, r_filter->srcip)) - { - return(0); - } + + if(al_data->srcip) + { + if(!strstr(al_data->srcip, r_filter->srcip)) + { + return(0); + } + } } if(r_filter->user) { - if(!strstr(al_data->user, r_filter->user)) - { - return(0); - } + if(al_data->user) + { + if(!strstr(al_data->user, r_filter->user)) + { + return(0); + } + } } if(r_filter->files) { - if(!strstr(al_data->filename, r_filter->files)) - { - return(0); - } + if(al_data->filename) + { + if(!strstr(al_data->filename, r_filter->files)) + { + return(0); + } + } } return(1); } @@ -330,13 +343,13 @@ int _os_report_print_related(int print_related, OSList *st_data) l_print_out(" group: '%s'", saved_aldata->group); else if(print_related & REPORT_REL_RULE) l_print_out(" rule: '%d'", saved_aldata->rule); - else if(print_related & REPORT_REL_SRCIP && saved_aldata->srcip) + else if((print_related & REPORT_REL_SRCIP) && saved_aldata->srcip) l_print_out(" srcip: '%s'", saved_aldata->srcip); - else if(print_related & REPORT_REL_USER && saved_aldata->user) + else if((print_related & REPORT_REL_USER) && saved_aldata->user) l_print_out(" user: '%s'", saved_aldata->user); else if(print_related & REPORT_REL_LEVEL) l_print_out(" level: '%d'", saved_aldata->level); - else if(print_related & REPORT_REL_FILE && saved_aldata->filename) + else if((print_related & REPORT_REL_FILE) && saved_aldata->filename) l_print_out(" filename: '%s'", saved_aldata->filename); } @@ -393,11 +406,11 @@ void os_report_printtop(void *topstore_pt, char *hname, int print_related) /* With location we leave more space to be clearer. */ if(!print_related) { - if(strlen(lkey) > 46) + if(strlen(lkey) > 76) { - lkey[44] = '.'; - lkey[45] = '.'; - lkey[46] = '\0'; + lkey[74] = '.'; + lkey[75] = '.'; + lkey[76] = '\0'; } if(!dopdout) @@ -405,7 +418,7 @@ void os_report_printtop(void *topstore_pt, char *hname, int print_related) _os_header_print(print_related, hname); dopdout = 1; } - l_print_out("%-48s|%-8d|", (char *)next_node->key, st_data->currently_size); + l_print_out("%-78s|%-8d|", (char *)next_node->key, st_data->currently_size); } @@ -417,7 +430,7 @@ void os_report_printtop(void *topstore_pt, char *hname, int print_related) _os_header_print(print_related, hname); dopdout = 1; } - l_print_out("%-48s|%-8d|", (char *)next_node->key, st_data->currently_size); + l_print_out("%-78s|%-8d|", (char *)next_node->key, st_data->currently_size); if(print_related & REPORT_REL_LOCATION) _os_report_print_related(REPORT_REL_LOCATION, st_data); @@ -469,7 +482,7 @@ void os_ReportdStart(report_filter *r_filter) /* Getting current time before starting */ tm = time(NULL); - p = localtime(&tm); + p = localtime(&tm);