Changeset 185 for trunk/src/sh_log_evalrule.c
- Timestamp:
- Oct 29, 2008, 8:59:18 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_log_evalrule.c
r183 r185 170 170 ng->rule_extra = group_extra; 171 171 ng->ovector = NULL; 172 ng->ovecnum = 0; 172 173 ng->captures = 0; 173 174 ng->counterlist = NULL; 174 175 ng->queue = NULL; 175 176 ng->nextrule = NULL; 176 177 /* 178 * Insert at end, to keep user-defined order 179 */ 180 ng->next = NULL; 181 if (grouplist) 182 { 183 tmp = grouplist; 184 while (tmp->next != NULL) { tmp = tmp->next; } 185 tmp->next = ng; 186 } else { 187 grouplist = ng; 188 } 177 ng->next = NULL; 189 178 190 179 if (!host_open) … … 202 191 203 192 /* 204 * I f there is an open host group, add it to its205 * rulegroups206 */ 193 * Insert at end, to keep user-defined order 194 */ 195 207 196 if (host_open) 208 197 { 198 if (grouplist) 199 { 200 tmp = grouplist; 201 while (tmp->next != NULL) { tmp = tmp->next; } 202 tmp->next = ng; 203 } else { 204 grouplist = ng; 205 } 206 207 208 /* 209 * If there is an open host group, add it to its 210 * rulegroups 211 */ 212 209 213 if (host_open->rulegroups) 210 214 { … … 214 218 } else { 215 219 host_open->rulegroups = ng; 216 220 } 217 221 } 218 222 … … 427 431 nr->captures = captures; 428 432 nr->ovector = SH_ALLOC(sizeof(int) * (captures+1) * 3); 433 nr->ovecnum = 0; 429 434 nr->counterlist = NULL; 430 435 nr->queue = queue; … … 441 446 { 442 447 tmp = group_open->nextrule; 443 while (tmp->next != NULL) { tmp = tmp->next; }444 tmp->next = nr;448 while (tmp->nextrule != NULL) { tmp = tmp->nextrule; } /* next -> nextrule */ 449 tmp->nextrule = nr; /* next -> nextrule */ 445 450 } else { 446 451 group_open->nextrule = nr; … … 454 459 else 455 460 { 456 /*457 * Add rule as member to grouplist, to facilitate cleanup458 */459 if (grouplist)460 {461 tmp = grouplist;462 while (tmp->next != NULL) { tmp = tmp->next; }463 tmp->next = nr;464 } else {465 grouplist = nr;466 }467 468 461 if (!host_open) 469 462 { 470 463 if (0 != sh_eval_hadd("^.*")) 471 464 { 465 SH_FREE(nr->ovector); 472 466 SH_FREE(nr); 473 467 return -1; … … 475 469 } 476 470 477 /*478 * Add rule to host rulegroups479 */480 471 if (host_open) 481 472 { 473 /* 474 * Add rule as member to grouplist, to facilitate cleanup 475 */ 476 #if 0 477 if (grouplist) 478 { 479 tmp = grouplist; 480 while (tmp->next != NULL) { tmp = tmp->next; } 481 tmp->next = nr; 482 } else { 483 grouplist = nr; 484 } 485 #endif 486 487 /* 488 * Add rule to host rulegroups 489 */ 482 490 if (host_open->rulegroups) 483 491 { … … 488 496 while (tmp->nextrule != NULL) { tmp = tmp->nextrule; } 489 497 tmp->nextrule = nr; 490 } else { 498 } 499 else 500 { 491 501 /* First rule goes to host_open->rulegroups */ 492 502 host_open->rulegroups = nr; … … 495 505 else 496 506 { 507 SH_FREE(nr->ovector); 497 508 SH_FREE(nr); 498 509 return -1; … … 505 516 void sh_eval_cleanup() 506 517 { 507 struct sh_geval * nr;508 518 struct sh_geval * tmp; 509 519 … … 512 522 struct sh_heval * htmp; 513 523 514 gtmp = grouplist; 515 while (gtmp) 516 { 524 while (grouplist) 525 { 526 gtmp = grouplist; 527 grouplist = gtmp->next; 528 517 529 if (gtmp->label) sh_string_destroy(&(gtmp->label)); 518 530 if (gtmp->rule_extra) (*pcre_free)(gtmp->rule_extra); … … 522 534 if (gtmp->ovector) 523 535 SH_FREE(gtmp->ovector); 524 if (gtmp->nextrule) 525 { 526 tmp = gtmp->nextrule; 527 do { 528 nr = tmp->nextrule; 529 if (tmp->rule_extra) (*pcre_free)(tmp->rule_extra); 530 if (tmp->rule) (*pcre_free)(tmp->rule); 531 if (tmp->counterlist) 532 zAVLFreeTree(tmp->counterlist, sh_ceval_free); 533 if (tmp->ovector) 534 SH_FREE(tmp->ovector); 535 SH_FREE(tmp); 536 tmp = nr; 537 } while (tmp); 538 } 539 grouplist = gtmp->next; 536 537 while (gtmp->nextrule) 538 { 539 tmp = gtmp->nextrule; 540 gtmp->nextrule = tmp->nextrule; 541 542 if (tmp->rule_extra) (*pcre_free)(tmp->rule_extra); 543 if (tmp->rule) (*pcre_free)(tmp->rule); 544 if (tmp->counterlist) 545 zAVLFreeTree(tmp->counterlist, sh_ceval_free); 546 if (tmp->ovector) 547 SH_FREE(tmp->ovector); 548 SH_FREE(tmp); 549 } 550 540 551 SH_FREE(gtmp); 541 gtmp = grouplist;542 552 } 543 553 … … 678 688 SH_MUTEX_LOCK(mutex_thread_nolog); 679 689 tmp = sh_util_safe_name (record->filename); 680 msg = sh_util_safe_name (sh_string_str(record->message));681 ttt = sh_util_safe_name (sh_string_str(record->timestr));690 msg = sh_util_safe_name_keepspace (sh_string_str(record->message)); 691 ttt = sh_util_safe_name_keepspace (sh_string_str(record->timestr)); 682 692 sh_error_handle (severity, FIL__, __LINE__, 0, MSG_LOGMON_REP, 683 693 msg, … … 697 707 SH_MUTEX_LOCK(mutex_thread_nolog); 698 708 tmp = sh_util_safe_name (sh_string_str(path)); 699 msg = sh_util_safe_name (sh_string_str(message));709 msg = sh_util_safe_name_keepspace (sh_string_str(message)); 700 710 sh_error_handle (severity, FIL__, __LINE__, 0, MSG_LOGMON_SUM, 701 711 msg,
Note:
See TracChangeset
for help on using the changeset viewer.