Changeset 305
- Timestamp:
- Nov 13, 2010, 11:24:24 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/Changelog
r304 r305 1 1 2.8.1: 2 * Fix incorrect handling of missing files when secondary schedule 3 is used (reported by Sergey) 2 4 * Fix null pointer dereference in config parse handler for SetMailAlias 3 5 (reported by Sergey) -
trunk/include/sh_hash.h
r294 r305 35 35 */ 36 36 int hashreport_missing( char *fullpath, int level); 37 38 /* remove internal db record for a file 39 */ 40 void sh_hash_remove (const char * path); 37 41 38 42 /* write database to stdout -
trunk/include/sh_utils.h
r214 r305 94 94 /* ask if a file should be updated (returns S_TRUE/S_FALSE) 95 95 */ 96 int sh_util_ask_update(c har * path);96 int sh_util_ask_update(const char * path); 97 97 int sh_util_set_interactive(const char * str); 98 98 -
trunk/src/samhain.c
r294 r305 2024 2024 if (flag_check_2 == 1 || FileSchedTwo == NULL) 2025 2025 { 2026 fprintf(stderr, "FIXME check unvisited\n"); 2026 2027 TPT((0, FIL__, __LINE__, _("msg=<Check for missing files.>\n"))) 2027 2028 sh_hash_unvisited (ShDFLevel[SH_ERR_T_FILE]); -
trunk/src/sh_files.c
r294 r305 377 377 if (S_FALSE == sh_ignore_chk_del(ptr->name)) 378 378 { 379 fprintf(stderr, "FIXME 1 %s, %d\n", ptr->name, ptr->is_reported); 379 380 if (0 != hashreport_missing(ptr->name, 380 381 (ptr->class == SH_LEVEL_ALLIGNORE) ? … … 430 431 * file has been added. 431 432 */ 432 if (sh_hash_have_it (ptr->name) >= 0) 433 if (sh_hash_have_it (ptr->name) >= 0 && 434 !SH_FFLAG_REPORTED_SET(ptr->is_reported)) 433 435 { 434 436 if (S_FALSE == sh_ignore_chk_del(ptr->name)) 435 437 { 438 fprintf(stderr, "FIXME 2 %s, %d\n", ptr->name, ptr->is_reported); 436 439 if (0 != hashreport_missing(ptr->name, 437 440 (ptr->class == SH_LEVEL_ALLIGNORE) ? … … 1289 1292 if (S_FALSE == sh_ignore_chk_del(ptr->name)) 1290 1293 { 1294 fprintf(stderr, "FIXME 2 %s, %d\n", ptr->name, ptr->is_reported); 1291 1295 if (0 != hashreport_missing(ptr->name, 1292 1296 (ptr->class == SH_LEVEL_ALLIGNORE) ? -
trunk/src/sh_hash.c
r294 r305 393 393 } 394 394 395 struct two_sh_file_t { 396 sh_file_t * prev; 397 sh_file_t * this; 398 }; 399 395 400 static sh_file_t * hashsearch (const char * s); 401 static int hashsearch_prev (const char * s, struct two_sh_file_t * a, int * index); 396 402 397 403 static sh_file_t * tab[TABSIZE]; … … 423 429 char hashbuf[KEYBUF_SIZE]; 424 430 int retval; 431 volatile int flag = 0; 425 432 426 433 /* -------- find the entry for the file ---------------- */ … … 449 456 sh_error_handle (level, FIL__, __LINE__, 0, 450 457 MSG_FI_MISS2, tmp, str); 458 flag = 1; 451 459 SH_FREE(tmp); 452 460 SH_FREE(str); … … 458 466 ; /* 'label at end of compound statement */ 459 467 SH_MUTEX_UNLOCK(mutex_hash); 468 460 469 return retval; 461 470 } … … 625 634 626 635 636 627 637 /********************************************************************* 628 638 * … … 646 656 SL_RET0(_("hash_unvisited")); 647 657 } 658 659 /********************************************************************* 660 * 661 * Remove a single file from the database. 662 * 663 *********************************************************************/ 664 void sh_hash_remove (const char * path) 665 { 666 struct two_sh_file_t entries; 667 int index; 668 669 SL_ENTER(_("sh_hash_remove")); 670 671 SH_MUTEX_LOCK(mutex_hash); 672 673 if ((sh.flag.reportonce == S_TRUE && sh.flag.update == S_FALSE) || 674 (S_TRUE == sh.flag.update && S_TRUE == sh_util_ask_update(path))) 675 { 676 if (0 == hashsearch_prev (path, &entries, &index)) 677 { 678 sh_file_t * p = entries.this; 679 #ifdef REPLACE_OLD 680 /* Remove the old entry 681 */ 682 if (entries.prev == p) 683 tab[index] = p->next; 684 else 685 entries.prev->next = p->next; 686 687 p = delete_db_entry(p); 688 689 goto end; 690 SL_RET0(_("sh_hash_remove")); 691 #else 692 SET_SH_FFLAG_REPORTED(p->fflags); 693 #endif 694 } 695 } 696 697 end: 698 ; /* 'label at end of compound statement' */ 699 SH_MUTEX_UNLOCK(mutex_hash); 700 701 SL_RET0(_("sh_hash_remove")); 702 } 703 648 704 649 705 /********************************************************************* … … 772 828 } 773 829 SL_RETURN( NULL, _("hashsearch")); 830 } 831 832 static int hashsearch_prev (const char * s, struct two_sh_file_t * a, int * index) 833 { 834 sh_file_t * this; 835 sh_file_t * prev = NULL; 836 837 SL_ENTER(_("hashsearch_prev")); 838 839 if (s) 840 { 841 *index = hashfunc(s); 842 843 this = tab[*index]; 844 845 prev = this; 846 847 if (this) 848 { 849 do { 850 851 if ((this->fullpath != NULL) && (0 == strcmp(s, this->fullpath))) 852 { 853 a->prev = prev; 854 a->this = this; 855 856 SL_RETURN( 0, _("hashsearch_prev")); 857 } 858 859 prev = this; 860 this = this->next; 861 862 } while(this); 863 } 864 } 865 SL_RETURN( -1, _("hashsearch")); 774 866 } 775 867 … … 2226 2318 int i; 2227 2319 SL_ENTER(_("sh_hash_set_missing")); 2320 2228 2321 i = sh_hash_set_visited_int(newname, SH_FFLAG_CHECKED); 2322 2323 if (sh.flag.checkSum != SH_CHECK_INIT) { 2324 sh_hash_remove(newname); 2325 } 2326 2229 2327 SL_RETURN(i, _("sh_hash_set_missing")); 2230 2328 } -
trunk/src/sh_utils.c
r294 r305 120 120 #endif 121 121 122 int sh_util_ask_update(c har * path)122 int sh_util_ask_update(const char * path) 123 123 { 124 124 int inchar, c;
Note:
See TracChangeset
for help on using the changeset viewer.