- Timestamp:
- Nov 1, 2011, 9:29:51 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r371 r373 12 12 dnl start 13 13 dnl 14 AM_INIT_AUTOMAKE(samhain, 2.8.99)14 AM_INIT_AUTOMAKE(samhain, 3.0.0) 15 15 AC_DEFINE([SAMHAIN], 1, [Application is samhain]) 16 16 AC_CANONICAL_HOST -
trunk/docs/Changelog
r367 r373 1 1 3.0.0: 2 * Add support for the inotify API 2 3 * Fix missing check_mask storage for glob pattern 3 4 * Add support for integer keys in zAVL -
trunk/include/samhain.h
r367 r373 205 205 #define SH_INOTIFY_DOSCAN (1<<1) 206 206 #define SH_INOTIFY_NEEDINIT (1<<2) 207 #define SH_INOTIFY_INSCAN (1<<3) 207 208 208 209 -
trunk/include/sh_files.h
r371 r373 21 21 #define SH_FILES_H 22 22 23 void sh_audit_mark (c har * file);23 void sh_audit_mark (const char * file); 24 24 void sh_audit_delete_all (); 25 25 char * sh_audit_fetch (char * file, time_t time, char * result, size_t rsize); … … 226 226 227 227 ShFileType sh_files_filecheck (int class, unsigned long check_mask, 228 c har * dirName,229 c har * infileName,228 const char * dirName, 229 const char * infileName, 230 230 int * reported, 231 231 int rsrcflag); 232 232 233 int sh_files_search_file(char * name, int * class, unsigned long *check_mask, int * reported); 234 void sh_files_set_file_reported(char * name); 235 void sh_files_clear_file_reported(char * name); 233 int sh_files_checkdir (int iclass, unsigned long check_mask, 234 int idepth, char * iname, 235 char * relativeName); 236 237 int sh_files_search_file(char * name, int * class, 238 unsigned long *check_mask, int * reported); 239 int sh_files_search_dir(char * name, int * class, 240 unsigned long *check_mask, int *reported, 241 int * rdepth); 242 void sh_files_set_file_reported(const char * name); 243 void sh_files_clear_file_reported(const char * name); 236 244 237 245 #endif -
trunk/include/sh_inotify.h
r372 r373 32 32 33 33 int sh_inotify_add_watch(char * filename, sh_watches * watches, int * errnum, 34 int class, unsigned long check_mask, int type );34 int class, unsigned long check_mask, int type, int rdepth); 35 35 36 int sh_inotify_add_watch_later(char * filename, sh_watches * watches, int * errnum, 37 int class, unsigned long check_mask, int type); 36 int sh_inotify_add_watch_later(const char * filename, sh_watches * watches, 37 int * errnum, 38 int class, unsigned long check_mask, 39 int type, int rdepth); 38 40 39 char * sh_inotify_pop_dormant(sh_watches * watches, int * class, unsigned long * check_mask, int * type); 41 char * sh_inotify_pop_dormant(sh_watches * watches, int * class, 42 unsigned long * check_mask, int * type, int * rdepth); 40 43 41 44 void sh_inotify_purge_dormant(sh_watches * watches); … … 44 47 45 48 char * sh_inotify_search_item(sh_watches * watches, int watch, 46 int * class, unsigned long * check_mask, int * type); 49 int * class, unsigned long * check_mask, 50 int * type, int * rdepth); 47 51 ssize_t sh_inotify_read(char * buffer, size_t count); 48 52 ssize_t sh_inotify_read_timeout(char * buffer, size_t count, int timeout); -
trunk/include/sh_unix.h
r294 r373 307 307 /* obtain file info 308 308 */ 309 int sh_unix_getinfo (int level, c har * filename, file_type * theFile,309 int sh_unix_getinfo (int level, const char * filename, file_type * theFile, 310 310 char * fileHash, int flagrel); 311 311 -
trunk/include/sh_utils.h
r355 r373 187 187 /* check for obscure filenames 188 188 */ 189 int sh_util_obscurename (ShErrLevel level, c har * name, int flag);189 int sh_util_obscurename (ShErrLevel level, const char * name, int flag); 190 190 191 191 /* returns freshly allocated memory, return value should be free'd -
trunk/src/samhain.c
r367 r373 2001 2001 (flag_check_1 == 1 || flag_check_2 == 1)) 2002 2002 { 2003 sh.flag.inotify |= SH_INOTIFY_INSCAN; 2003 2004 /* Refresh list files matching glob patterns. 2004 2005 */ … … 2062 2063 flag_check_2 = 0; 2063 2064 check_done = 1; 2065 sh.flag.inotify &= ~SH_INOTIFY_INSCAN; 2064 2066 sh.flag.inotify &= ~SH_INOTIFY_DOSCAN; 2065 2067 -
trunk/src/sh_audit.c
r295 r373 224 224 } 225 225 226 void sh_audit_mark (c har * file)226 void sh_audit_mark (const char * file) 227 227 { 228 228 static int flushRules = 0; … … 372 372 return 0; 373 373 } 374 void sh_audit_mark (c har * file)374 void sh_audit_mark (const char * file) 375 375 { 376 376 (void) file; -
trunk/src/sh_fInotify.c
r372 r373 42 42 sh_watches sh_file_watches = SH_INOTIFY_INITIALIZER; 43 43 44 #if defined(HAVE_SYS_INOTIFY_H) 45 44 46 static sh_watches sh_file_missing = SH_INOTIFY_INITIALIZER; 45 46 #if defined(HAVE_SYS_INOTIFY_H)47 47 48 48 #include <sys/inotify.h> … … 111 111 static int sh_fInotify_process(struct inotify_event * event); 112 112 static int sh_fInotify_report(struct inotify_event * event, char * filename, 113 int class, unsigned long check_mask, int ftype );113 int class, unsigned long check_mask, int ftype, int rdepth); 114 114 115 115 int sh_fInotify_init(struct mod_type * arg) … … 205 205 return SH_MOD_FAILED; 206 206 } 207 208 } 207 } 209 208 210 209 /* Re-scan 'dormant' list of sh_file_missing. … … 218 217 { 219 218 count = 0; /* Re-expand glob patterns to discover added files. */ 219 sh.flag.inotify |= SH_INOTIFY_INSCAN; 220 220 sh_files_check_globFilePatterns(); 221 sh.flag.inotify &= ~SH_INOTIFY_INSCAN; 222 sh.flag.inotify |= SH_INOTIFY_NEEDINIT; 221 223 } 222 224 … … 224 226 { 225 227 count2 = 0; /* Update baseline database. */ 226 if (sh.flag.checkSum == SH_CHECK_CHECK && 227 sh.flag.update == S_TRUE) 228 if (sh.flag.checkSum == SH_CHECK_CHECK && sh.flag.update == S_TRUE) 228 229 sh_hash_writeout (); 229 230 } … … 314 315 int class; 315 316 int type; 317 int rdepth; 316 318 unsigned long check_mask; 317 319 int retval; … … 334 336 335 337 while (NULL != (filename = sh_inotify_pop_dormant(&sh_file_watches, 336 &class, &check_mask, &type))) 338 &class, &check_mask, 339 &type, &rdepth))) 337 340 { 338 341 retval = sh_inotify_add_watch(filename, &sh_file_watches, &errnum, 339 class, check_mask, type );342 class, check_mask, type, rdepth); 340 343 341 344 if (retval < 0) … … 375 378 } 376 379 380 static void sh_fInotify_logmask(struct inotify_event * event) 381 { 382 char dbgbuf[256]; 383 384 sl_strlcpy (dbgbuf, "inotify mask: ", sizeof(dbgbuf)); 385 386 if (event->mask & IN_ACCESS) sl_strlcat(dbgbuf, "IN_ACCESS ", sizeof(dbgbuf)); 387 if (event->mask & IN_ATTRIB) sl_strlcat(dbgbuf, "IN_ATTRIB ", sizeof(dbgbuf)); 388 if (event->mask & IN_CLOSE_WRITE) sl_strlcat(dbgbuf, "IN_CLOSE_WRITE ", sizeof(dbgbuf)); 389 if (event->mask & IN_CLOSE_NOWRITE) sl_strlcat(dbgbuf, "IN_CLOSE_NOWRITE ", sizeof(dbgbuf)); 390 if (event->mask & IN_CREATE) sl_strlcat(dbgbuf, "IN_CREATE ", sizeof(dbgbuf)); 391 if (event->mask & IN_DELETE) sl_strlcat(dbgbuf, "IN_DELETE ", sizeof(dbgbuf)); 392 if (event->mask & IN_DELETE_SELF) sl_strlcat(dbgbuf, "IN_DELETE_SELF ", sizeof(dbgbuf)); 393 if (event->mask & IN_MODIFY) sl_strlcat(dbgbuf, "IN_MODIFY ", sizeof(dbgbuf)); 394 if (event->mask & IN_MOVE_SELF) sl_strlcat(dbgbuf, "IN_MOVE_SELF ", sizeof(dbgbuf)); 395 if (event->mask & IN_MOVED_FROM) sl_strlcat(dbgbuf, "IN_MOVED_FROM ", sizeof(dbgbuf)); 396 if (event->mask & IN_MOVED_TO) sl_strlcat(dbgbuf, "IN_MOVED_TO ", sizeof(dbgbuf)); 397 if (event->mask & IN_OPEN) sl_strlcat(dbgbuf, "IN_OPEN ", sizeof(dbgbuf)); 398 if (event->mask & IN_IGNORED) sl_strlcat(dbgbuf, "IN_IGNORED ", sizeof(dbgbuf)); 399 if (event->mask & IN_ISDIR) sl_strlcat(dbgbuf, "IN_ISDIR ", sizeof(dbgbuf)); 400 if (event->mask & IN_Q_OVERFLOW) sl_strlcat(dbgbuf, "IN_Q_OVERFLOW ", sizeof(dbgbuf)); 401 if (event->mask & IN_UNMOUNT) sl_strlcat(dbgbuf, "IN_UNMOUNT ", sizeof(dbgbuf)); 402 403 /* fprintf(stderr, "FIXME: %s\n", dbgbuf); */ 404 405 SH_MUTEX_LOCK(mutex_thread_nolog); 406 sh_error_handle(SH_ERR_ALL, FIL__, __LINE__, 0, MSG_E_SUBGEN, 407 dbgbuf, _("sh_fInotify_process")); 408 SH_MUTEX_UNLOCK(mutex_thread_nolog); 409 } 410 377 411 static int sh_fInotify_process(struct inotify_event * event) 378 412 { 379 413 int class; 380 414 int ftype; 415 int rdepth; 381 416 unsigned long check_mask; 382 417 char * filename; … … 385 420 if (flag_err_debug == SL_TRUE) 386 421 { 387 char dbgbuf[256]; 388 389 sl_strlcpy (dbgbuf, "inotify mask: ", sizeof(dbgbuf)); 390 391 if (event->mask & IN_ACCESS) sl_strlcat(dbgbuf, "IN_ACCESS ", sizeof(dbgbuf)); 392 if (event->mask & IN_ATTRIB) sl_strlcat(dbgbuf, "IN_ATTRIB ", sizeof(dbgbuf)); 393 if (event->mask & IN_CLOSE_WRITE) sl_strlcat(dbgbuf, "IN_CLOSE_WRITE ", sizeof(dbgbuf)); 394 if (event->mask & IN_CLOSE_NOWRITE) sl_strlcat(dbgbuf, "IN_CLOSE_NOWRITE ", sizeof(dbgbuf)); 395 if (event->mask & IN_CREATE) sl_strlcat(dbgbuf, "IN_CREATE ", sizeof(dbgbuf)); 396 if (event->mask & IN_DELETE) sl_strlcat(dbgbuf, "IN_DELETE ", sizeof(dbgbuf)); 397 if (event->mask & IN_DELETE_SELF) sl_strlcat(dbgbuf, "IN_DELETE_SELF ", sizeof(dbgbuf)); 398 if (event->mask & IN_MODIFY) sl_strlcat(dbgbuf, "IN_MODIFY ", sizeof(dbgbuf)); 399 if (event->mask & IN_MOVE_SELF) sl_strlcat(dbgbuf, "IN_MOVE_SELF ", sizeof(dbgbuf)); 400 if (event->mask & IN_MOVED_FROM) sl_strlcat(dbgbuf, "IN_MOVED_FROM ", sizeof(dbgbuf)); 401 if (event->mask & IN_MOVED_TO) sl_strlcat(dbgbuf, "IN_MOVED_TO ", sizeof(dbgbuf)); 402 if (event->mask & IN_OPEN) sl_strlcat(dbgbuf, "IN_OPEN ", sizeof(dbgbuf)); 403 if (event->mask & IN_IGNORED) sl_strlcat(dbgbuf, "IN_IGNORED ", sizeof(dbgbuf)); 404 if (event->mask & IN_ISDIR) sl_strlcat(dbgbuf, "IN_ISDIR ", sizeof(dbgbuf)); 405 if (event->mask & IN_Q_OVERFLOW) sl_strlcat(dbgbuf, "IN_Q_OVERFLOW ", sizeof(dbgbuf)); 406 if (event->mask & IN_UNMOUNT) sl_strlcat(dbgbuf, "IN_UNMOUNT ", sizeof(dbgbuf)); 407 408 SH_MUTEX_LOCK(mutex_thread_nolog); 409 sh_error_handle(SH_ERR_ALL, FIL__, __LINE__, 0, MSG_E_SUBGEN, 410 dbgbuf, _("sh_fInotify_process")); 411 SH_MUTEX_UNLOCK(mutex_thread_nolog); 412 } 413 422 sh_fInotify_logmask(event); 423 } 414 424 415 425 if (event->wd >= 0) 416 426 { 417 427 filename = sh_inotify_search_item(&sh_file_watches, event->wd, 418 &class, &check_mask, &ftype );428 &class, &check_mask, &ftype, &rdepth); 419 429 420 430 if (filename) 421 431 { 422 sh_fInotify_report(event, filename, class, check_mask, ftype); 423 432 sh_fInotify_report(event, filename, class, check_mask, ftype, rdepth); 424 433 SH_FREE(filename); 425 434 } … … 435 444 SH_MUTEX_LOCK(mutex_thread_nolog); 436 445 sh_error_handle((-1), FIL__, __LINE__, event->wd, MSG_E_SUBGEN, 437 _("Watch removed: internal error -file path unknown"),446 _("Watch removed: file path unknown"), 438 447 _("sh_fInotify_process")); 439 448 SH_MUTEX_UNLOCK(mutex_thread_nolog); … … 444 453 sh.flag.inotify |= SH_INOTIFY_DOSCAN; 445 454 sh.flag.inotify |= SH_INOTIFY_NEEDINIT; 455 SH_MUTEX_LOCK(mutex_thread_nolog); 456 sh_error_handle(SH_ERR_WARN, FIL__, __LINE__, event->wd, MSG_E_SUBGEN, 457 _("Inotify queue overflow"), 458 _("sh_fInotify_process")); 459 SH_MUTEX_UNLOCK(mutex_thread_nolog); 446 460 return 1; 447 461 } … … 481 495 } 482 496 483 static int sh_fInotify_report(struct inotify_event * event, char * filename, 484 int class, unsigned long check_mask, int ftype) 485 { 486 char * fullpath = NULL; 487 char * path; 497 static int sh_fInotify_report_change (struct inotify_event * event, 498 char * path, char * filename, 499 int class, unsigned long check_mask, int ftype) 500 { 488 501 int reported; 489 490 if (event->len > 0) 491 {492 fullpath = sh_util_strconcat(filename, "/", event->name, NULL);493 path = fullpath;502 int ret = sh_files_search_file(path, &class, &check_mask, &reported); 503 504 if ((ret == 0) && (event->len > 0) && (ftype == SH_INOTIFY_FILE)) 505 { 506 ; /* do nothing, watch was for directory monitored as file only */ 494 507 } 495 508 else 496 509 { 497 path = filename; 498 } 499 500 if ( (event->mask & (IN_ATTRIB|IN_MODIFY)) != 0) 501 { 502 int ret = sh_files_search_file(path, &class, &check_mask, &reported); 503 510 sh_files_filecheck (class, check_mask, filename, 511 (event->len > 0) ? event->name : NULL, 512 &reported, 0); 513 } 514 return 0; 515 } 516 517 518 static int sh_fInotify_report_missing (struct inotify_event * event, 519 char * path, 520 int class, unsigned long check_mask, int ftype) 521 { 522 int reported; 523 int isdir = (event->mask & IN_ISDIR); 524 int level = (class == SH_LEVEL_ALLIGNORE) ? 525 ShDFLevel[class] : 526 ShDFLevel[(isdir == 0) ? SH_ERR_T_FILE : SH_ERR_T_DIR]; 527 528 if (S_FALSE == sh_ignore_chk_del(path)) 529 { 530 if (0 != hashreport_missing(path, level)) 531 { 532 int ret = sh_files_search_file(path, &class, &check_mask, &reported); 533 534 if ((ret == 0) && (event->len > 0) && (ftype == SH_INOTIFY_FILE)) 535 { 536 ; /* do nothing, watch was for directory monitored as file only */ 537 } 538 else 539 { 540 /* Removal of a directory triggers: 541 * (1) IN_DELETE IN_ISDIR 542 * (2) IN_DELETE_SELF 543 */ 544 if ((event->mask & IN_DELETE_SELF) == 0) 545 sh_fInotify_report_miss(path, level); 546 } 547 } 548 } 549 550 #ifndef REPLACE_OLD 551 sh_hash_set_visited_true(path); 552 #else 553 sh_hash_set_missing(path); 554 #endif 555 if (sh.flag.reportonce == S_TRUE) 556 sh_files_set_file_reported(path); 557 558 /* Move to 'dormant' list, if not file within directory. 559 */ 560 if (event->len == 0) 561 sh_inotify_rm_watch(&sh_file_watches, &sh_file_missing, event->wd); 562 563 return 0; 564 } 565 566 static int sh_fInotify_report_added (struct inotify_event * event, 567 char * path, char * filename, 568 int class, unsigned long check_mask, 569 int ftype, int rdepth) 570 { 571 if (S_FALSE == sh_ignore_chk_new(path)) 572 { 573 int reported; 574 int ret; 575 int retD = 0; 576 int rdepthD = rdepth; 577 578 sh_files_clear_file_reported(path); 579 580 ret = sh_files_search_file(path, &class, &check_mask, &reported); 581 504 582 if ((ret == 0) && (event->len > 0) && (ftype == SH_INOTIFY_FILE)) 505 583 { 506 ; /* do nothing */584 ; /* do nothing, watch was for directory monitored as file only */ 507 585 } 508 586 else 509 587 { 588 int classD = class; 589 int reportedD = reported; 590 unsigned long check_maskD = check_mask; 591 592 if (event->mask & IN_ISDIR) 593 { 594 retD = sh_files_search_dir(path, &classD, &check_maskD, 595 &reportedD, &rdepthD); 596 if (retD != 0) 597 { 598 if (ret == 0) 599 { 600 class = classD; 601 check_mask = check_maskD; 602 } 603 } 604 } 605 510 606 sh_files_filecheck (class, check_mask, filename, 511 607 (event->len > 0) ? event->name : NULL, 512 608 &reported, 0); 513 } 609 610 if (event->mask & IN_ISDIR) 611 { 612 sh.flag.inotify |= SH_INOTIFY_INSCAN; 613 sh_files_checkdir (classD, check_maskD, rdepthD, 614 path, (event->len > 0) ? event->name : NULL); 615 sh.flag.inotify &= ~SH_INOTIFY_INSCAN; 616 sh.flag.inotify |= SH_INOTIFY_NEEDINIT; 617 sh_dirs_reset (); 618 sh_files_reset (); 619 } 620 621 } 622 623 if (SH_FFLAG_REPORTED_SET(reported)) 624 sh_files_set_file_reported(path); 625 626 if ((ret != 0) || (event->mask & IN_ISDIR)) 627 { 628 sh_inotify_add_watch(path, &sh_file_watches, &ret, 629 class, check_mask, 630 (event->mask & IN_ISDIR)?SH_INOTIFY_DIR:SH_INOTIFY_FILE, 631 rdepthD); 632 } 633 } 634 return 0; 635 } 636 637 static int sh_fInotify_report(struct inotify_event * event, char * filename, 638 int class, unsigned long check_mask, int ftype, int rdepth) 639 { 640 char * fullpath = NULL; 641 char * path; 642 643 if (event->len > 0) 644 { 645 fullpath = sh_util_strconcat(filename, "/", event->name, NULL); 646 path = fullpath; 647 } 648 else 649 { 650 path = filename; 651 } 652 653 if ( (event->mask & (IN_ATTRIB|IN_MODIFY)) != 0) 654 { 655 sh_fInotify_report_change (event, path, filename, 656 class, check_mask, ftype); 514 657 } 515 658 else if ((event->mask & (IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_MOVED_FROM)) != 0) 516 659 { 517 int isdir = (event->mask & IN_ISDIR); 518 int level = (class == SH_LEVEL_ALLIGNORE) ? 519 ShDFLevel[class] : 520 ShDFLevel[(isdir == 0) ? SH_ERR_T_FILE : SH_ERR_T_DIR]; 521 522 if (S_FALSE == sh_ignore_chk_del(path)) 523 { 524 if (0 != hashreport_missing(path, level)) 525 { 526 int ret = sh_files_search_file(path, &class, &check_mask, &reported); 527 528 if ((ret == 0) && (event->len > 0) && (ftype == SH_INOTIFY_FILE)) 529 { 530 ; /* do nothing */ 531 } 532 else 533 { 534 sh_fInotify_report_miss(path, level); 535 } 536 } 537 } 538 539 #ifndef REPLACE_OLD 540 sh_hash_set_visited_true(path); 541 #else 542 sh_hash_set_missing(path); 660 sh_fInotify_report_missing (event, path, 661 class, check_mask, ftype); 662 } 663 else if((event->mask & (IN_CREATE|IN_MOVED_TO)) != 0) 664 { 665 sh_fInotify_report_added (event, path, filename, 666 class, check_mask, 667 ftype, rdepth); 668 } 669 670 if (fullpath) 671 SH_FREE(fullpath); 672 673 return 0; 674 } 675 676 543 677 #endif 544 if (sh.flag.reportonce == S_TRUE)545 sh_files_set_file_reported(path);546 547 /* Move to 'dormant' list, if not file within directory.548 */549 if (event->len == 0)550 sh_inotify_rm_watch(&sh_file_watches, &sh_file_missing, event->wd);551 }552 else if((event->mask & (IN_CREATE|IN_MOVED_TO)) != 0)553 {554 if (S_FALSE == sh_ignore_chk_new(path))555 {556 int ret;557 558 sh_files_clear_file_reported(path);559 560 ret = sh_files_search_file(path, &class, &check_mask, &reported);561 562 if ((ret == 0) && (event->len > 0) && (ftype == SH_INOTIFY_FILE))563 {564 ; /* do nothing */565 }566 else567 {568 sh_files_filecheck (class, check_mask, filename,569 (event->len > 0) ? event->name : NULL,570 &reported, 0);571 }572 573 if (SH_FFLAG_REPORTED_SET(reported))574 sh_files_set_file_reported(path);575 576 if (ret != 0)577 {578 sh_inotify_add_watch(path, &sh_file_watches, &ret,579 class, check_mask, SH_INOTIFY_FILE);580 }581 }582 }583 584 return 0;585 }586 587 678 588 679 #endif 589 590 #endif -
trunk/src/sh_files.c
r372 r373 287 287 SH_MUTEX_STATIC(mutex_zfiles, PTHREAD_MUTEX_INITIALIZER); 288 288 SH_MUTEX_STATIC(mutex_zglob, PTHREAD_MUTEX_INITIALIZER); 289 290 static int sh_files_fullpath (char * testdir, char * d_name, 289 SH_MUTEX_RECURSIVE(mutex_zdirs); 290 291 static int sh_files_fullpath (const char * testdir, 292 const char * d_name, 291 293 char * statpath); 292 294 static int sh_files_pushdir (int class, const char * str_s); 293 295 static int sh_files_pushfile (int class, const char * str_s); 294 static int sh_files_checkdir (int class, unsigned long check_mask,295 int rdepth, char * dirName,296 char * relativeName);297 296 298 297 static long MaxRecursionLevel = 0; … … 367 366 } 368 367 369 if ((sh.flag.inotify & SH_INOTIFY_ DOSCAN) != 0)368 if ((sh.flag.inotify & SH_INOTIFY_INSCAN) != 0) 370 369 { 371 370 sh_inotify_add_watch_later(ptr->name, &sh_file_watches, NULL, 372 ptr->class, ptr->check_mask, SH_INOTIFY_FILE); 371 ptr->class, ptr->check_mask, 372 SH_INOTIFY_FILE, 0); 373 373 } 374 374 … … 540 540 int sh_files_setrec () 541 541 { 542 volatile int ret; 543 SH_MUTEX_RECURSIVE_INIT(mutex_zdirs); 544 SH_MUTEX_RECURSIVE_LOCK(mutex_zdirs); 542 545 sh_files_setrec_int(zdirListOne); 543 return sh_files_setrec_int(zdirListTwo); 546 ret = sh_files_setrec_int(zdirListTwo); 547 SH_MUTEX_RECURSIVE_UNLOCK(mutex_zdirs); 548 549 return ret; 544 550 } 545 551 … … 555 561 int sh_files_deldirstack () 556 562 { 563 SH_MUTEX_RECURSIVE_INIT(mutex_zdirs); 564 SH_MUTEX_RECURSIVE_LOCK(mutex_zdirs); 557 565 zdirListOne = sh_files_deldirstack_int(zdirListOne); 558 566 zdirListTwo = sh_files_deldirstack_int(zdirListTwo); 567 SH_MUTEX_RECURSIVE_UNLOCK(mutex_zdirs); 559 568 return 0; 560 569 } … … 583 592 SL_ENTER(_("sh_dirs_reset")); 584 593 594 SH_MUTEX_RECURSIVE_INIT(mutex_zdirs); 595 SH_MUTEX_RECURSIVE_LOCK(mutex_zdirs); 585 596 for (ptr = (dirstack_t *) zAVLFirst(&avlcursor1, zdirListOne); ptr; 586 597 ptr = (dirstack_t *) zAVLNext(&avlcursor1)) … … 590 601 ptr = (dirstack_t *) zAVLNext(&avlcursor2)) 591 602 ptr->checked = 0; 603 SH_MUTEX_RECURSIVE_UNLOCK(mutex_zdirs); 592 604 593 605 SL_RET0(_("sh_dirs_reset")); … … 896 908 char * fileName; 897 909 int ret; 910 int count = 0; 898 911 899 912 SL_ENTER(_("sh_files_push_file_int")); … … 942 955 else 943 956 { 944 unsigned long mask = sh_files_maskof(class); 945 if (MODI_AUDIT_ENABLED(mask)) 957 int reported; 958 unsigned long check_mask = sh_files_maskof(class); 959 960 if ((sh.flag.inotify & SH_INOTIFY_INSCAN) != 0) 946 961 { 947 sh_audit_mark(new_item_ptr->name); 962 sh_files_filecheck (class, check_mask, str_s, NULL, 963 &reported, 0); 964 if (SH_FFLAG_REPORTED_SET(reported)) 965 sh_files_set_file_reported(str_s); 966 sh_inotify_add_watch_later(str_s, &sh_file_watches, NULL, 967 class, check_mask, 968 SH_INOTIFY_FILE, 0); 948 969 } 949 } 950 SL_RETURN(0, _("sh_files_push_file_int")); 970 971 if (MODI_AUDIT_ENABLED(check_mask)) 972 { 973 sh_audit_mark(str_s); 974 } 975 ++count; 976 } 977 SL_RETURN(count, _("sh_files_push_file_int")); 951 978 } 952 979 … … 966 993 static zAVLTree * zglobList = NULL; 967 994 968 static voidsh_files_pushglob (int class, int type, const char * p, int rdepth,995 static int sh_files_pushglob (int class, int type, const char * p, int rdepth, 969 996 unsigned long check_mask_in, int flag) 970 997 { … … 973 1000 glob_t pglob; 974 1001 1002 int count = 0; 975 1003 volatile unsigned long check_mask = check_mask_in; 976 1004 … … 1024 1052 if (type == SH_LIST_FILE) 1025 1053 { 1026 sh_files_push_file_int (class, pglob.gl_pathv[gloop],1027 sl_strlen(pglob.gl_pathv[gloop]));1054 count += sh_files_push_file_int (class, pglob.gl_pathv[gloop], 1055 sl_strlen(pglob.gl_pathv[gloop])); 1028 1056 } 1029 1057 else … … 1031 1059 which_dirList = type; 1032 1060 1033 sh_files_push_dir_int (class, pglob.gl_pathv[gloop],1034 sl_strlen(pglob.gl_pathv[gloop]), rdepth);1061 count += sh_files_push_dir_int (class, pglob.gl_pathv[gloop], 1062 sl_strlen(pglob.gl_pathv[gloop]), rdepth); 1035 1063 } 1036 1064 } … … 1071 1099 1072 1100 globfree(&pglob); 1073 SL_RET 0(_("sh_files_pushglob"));1074 return ;1101 SL_RETURN(count, _("sh_files_pushglob")); 1102 return count; 1075 1103 } 1076 1104 … … 1283 1311 int sh_files_is_allignore (char * str) 1284 1312 { 1285 if (1 == sh_files_is_allignore_int(str, zdirListOne)) 1286 return 1; 1287 if (NULL == zdirListTwo) 1288 return 0; 1289 return sh_files_is_allignore_int(str, zdirListTwo); 1313 int retval = 0; 1314 1315 SH_MUTEX_RECURSIVE_INIT(mutex_zdirs); 1316 SH_MUTEX_RECURSIVE_LOCK(mutex_zdirs); 1317 retval = sh_files_is_allignore_int(str, zdirListOne); 1318 1319 if (NULL != zdirListTwo && retval == 0) 1320 { 1321 retval = sh_files_is_allignore_int(str, zdirListTwo); 1322 } 1323 SH_MUTEX_RECURSIVE_UNLOCK(mutex_zdirs); 1324 return retval; 1290 1325 } 1291 1326 … … 1306 1341 sh_dummy_ptr = (void *) &ptr; 1307 1342 1343 SH_MUTEX_RECURSIVE_INIT(mutex_zdirs); 1344 SH_MUTEX_RECURSIVE_LOCK(mutex_zdirs); 1308 1345 if (which == 1) 1309 1346 tree = zdirListOne; … … 1315 1352 { 1316 1353 if (sig_urgent > 0) { 1317 SL_RETURN(dcount, _("sh_dirs_chk"));1354 goto out; 1318 1355 } 1319 1356 … … 1330 1367 { 1331 1368 BREAKEXIT(sh_files_filecheck); 1332 sh_files_filecheck (dst_ptr->class, dst_ptr->check_mask, ptr->name, 1369 sh_files_filecheck (dst_ptr->class, dst_ptr->check_mask, 1370 ptr->name, 1333 1371 NULL, &status, 0); 1334 1372 dst_ptr->checked = S_TRUE; … … 1343 1381 1344 1382 if (status == S_FALSE) 1345 sh_files_filecheck (ptr->class, ptr->check_mask, ptr->name, NULL, &status, 0); 1383 sh_files_filecheck (ptr->class, ptr->check_mask, 1384 ptr->name, NULL, &status, 0); 1346 1385 1347 1386 BREAKEXIT(sh_files_checkdir); 1348 status = sh_files_checkdir (ptr->class, ptr->check_mask, ptr->rdepth, ptr->name, 1387 status = sh_files_checkdir (ptr->class, ptr->check_mask, 1388 ptr->rdepth, ptr->name, 1349 1389 ptr->name); 1350 1390 … … 1410 1450 1411 1451 if (sig_urgent > 0) { 1412 SL_RETURN(dcount, _("sh_dirs_chk"));1452 goto out; 1413 1453 } 1414 1454 1415 1455 } 1456 out: 1457 SH_MUTEX_RECURSIVE_UNLOCK(mutex_zdirs); 1458 1416 1459 SL_RETURN(dcount, _("sh_dirs_chk")); 1417 1460 } … … 1508 1551 new_item_ptr->childs_checked = S_FALSE; 1509 1552 1553 SH_MUTEX_RECURSIVE_INIT(mutex_zdirs); 1554 SH_MUTEX_RECURSIVE_LOCK(mutex_zdirs); 1510 1555 if (which_dirList == SH_LIST_DIR1) 1511 1556 { … … 1532 1577 1533 1578 ret = zAVLInsert (tree, new_item_ptr); 1579 SH_MUTEX_RECURSIVE_UNLOCK(mutex_zdirs); 1534 1580 1535 1581 if (-1 == ret) … … 1547 1593 new_item_ptr = NULL; 1548 1594 } 1549 1550 if (new_item_ptr && MODI_AUDIT_ENABLED(new_item_ptr->check_mask)) 1551 { 1552 sh_audit_mark(new_item_ptr->name); 1553 } 1554 1595 else 1596 { 1597 unsigned long mask = sh_files_maskof(class); 1598 if (MODI_AUDIT_ENABLED(mask)) 1599 { 1600 sh_audit_mark(tail); 1601 } 1602 } 1555 1603 SL_RETURN(0, _("sh_files_push_dir_int")); 1556 1604 } … … 1808 1856 static void * sh_dummy_dirlist; 1809 1857 1810 /* -- check a single directory and its content 1858 /* -- Check a single directory and its content. Does not 1859 * check the directory inode itself. 1811 1860 */ 1812 staticint sh_files_checkdir (int iclass, unsigned long check_mask,1813 1814 1861 int sh_files_checkdir (int iclass, unsigned long check_mask, 1862 int idepth, char * iname, 1863 char * relativeName) 1815 1864 { 1816 1865 struct sh_dirent * dirlist; … … 1949 1998 } 1950 1999 1951 if ((sh.flag.inotify & SH_INOTIFY_ DOSCAN) != 0)2000 if ((sh.flag.inotify & SH_INOTIFY_INSCAN) != 0) 1952 2001 { 1953 2002 sh_inotify_add_watch_later(iname, &sh_file_watches, &status, 1954 iclass, check_mask, SH_INOTIFY_DIR );2003 iclass, check_mask, SH_INOTIFY_DIR, idepth); 1955 2004 } 1956 2005 … … 2069 2118 * is checked with the policy of the parent directory 2070 2119 */ 2120 SH_MUTEX_RECURSIVE_INIT(mutex_zdirs); 2121 SH_MUTEX_RECURSIVE_LOCK(mutex_zdirs); 2071 2122 dst_ptr = (dirstack_t *) zAVLSearch(zdirListOne, tmpcat); 2072 2123 … … 2099 2150 } 2100 2151 } 2101 2102 SH_MUTEX_LOCK(mutex_zfiles); 2152 SH_MUTEX_RECURSIVE_UNLOCK(mutex_zdirs); 2153 2154 SH_MUTEX_LOCK_UNSAFE(mutex_zfiles); 2103 2155 dst_ptr = (dirstack_t *) zAVLSearch(zfileList, tmpcat); 2104 2156 … … 2114 2166 /* not set, hence always FALSE */ 2115 2167 /* cchecked_flag = dst_ptr->childs_checked; */ 2168 2169 if (checked_flag != S_TRUE) 2170 { 2171 /* -- need to check the file itself -- 2172 */ 2173 if (sh.flag.reportonce == S_TRUE) 2174 dummy = dst_ptr->is_reported; 2175 } 2116 2176 } 2117 SH_MUTEX_UNLOCK (mutex_zfiles);2177 SH_MUTEX_UNLOCK_UNSAFE(mutex_zfiles); 2118 2178 2119 2179 /* ---- Has been checked already. ---- … … 2145 2205 /* -- need to check the file itself -- 2146 2206 */ 2147 if (dst_ptr && sh.flag.reportonce == S_TRUE) 2148 dummy = dst_ptr->is_reported; 2207 /* -- moved up -- 2208 * if (dst_ptr && sh.flag.reportonce == S_TRUE) 2209 * dummy = dst_ptr->is_reported; 2210 */ 2149 2211 2150 2212 checkit = sh_files_filecheck (file_class_next, file_check_mask_next, … … 2153 2215 &dummy, 0); 2154 2216 2217 2218 SH_MUTEX_LOCK_UNSAFE(mutex_zfiles); 2219 dst_ptr = (dirstack_t *) zAVLSearch(zfileList, tmpcat); 2220 2155 2221 if (dst_ptr && checked_flag == S_FALSE) 2156 2222 dst_ptr->checked = S_TRUE; 2223 2157 2224 /* Thu Mar 7 15:09:40 CET 2002 Propagate the 'reported' flag 2158 2225 */ 2159 2226 if (dst_ptr && sh.flag.reportonce == S_TRUE) 2160 2227 dst_ptr->is_reported = dummy; 2228 2229 if (dst_ptr) 2230 dst_ptr->childs_checked = S_TRUE; 2231 SH_MUTEX_UNLOCK_UNSAFE(mutex_zfiles); 2161 2232 } 2162 2233 … … 2178 2249 cchecked_flag = -1; 2179 2250 2251 SH_MUTEX_RECURSIVE_INIT(mutex_zdirs); 2252 SH_MUTEX_RECURSIVE_LOCK(mutex_zdirs); 2180 2253 tmp_ptr = (dirstack_t *) zAVLSearch(zdirListOne, tmpcat); 2181 2254 … … 2212 2285 } 2213 2286 } 2214 2215 if (cchecked_flag == S_FALSE)2287 2288 if (tmp_ptr && cchecked_flag == S_FALSE) 2216 2289 { 2217 sh_files_checkdir (class_next, check_mask_next, rdepth_next, tmpcat,2218 dirlist->sh_d_name);2219 2290 tmp_ptr->childs_checked = S_TRUE; 2220 2291 /* … … 2223 2294 tmp_ptr->checked = S_TRUE; 2224 2295 } 2296 SH_MUTEX_RECURSIVE_UNLOCK(mutex_zdirs); 2297 2298 if (cchecked_flag == S_FALSE) 2299 { 2300 sh_files_checkdir (class_next, check_mask_next, rdepth_next, 2301 tmpcat, dirlist->sh_d_name); 2302 /* 2303 tmp_ptr->childs_checked = S_TRUE; 2304 tmp_ptr->checked = S_TRUE; 2305 */ 2306 } 2225 2307 else if (checked_flag == -1) 2226 sh_files_checkdir (class_next, check_mask_next, rdepth_next, tmpcat,2227 dirlist->sh_d_name);2308 sh_files_checkdir (class_next, check_mask_next, rdepth_next, 2309 tmpcat, dirlist->sh_d_name); 2228 2310 2229 2311 } … … 2248 2330 dirlist = dirlist->next; 2249 2331 2250 if (dst_ptr) 2251 dst_ptr->childs_checked = S_TRUE; 2252 2332 /* -- moved up, only affects zfileList anyway 2333 * if (dst_ptr) 2334 * dst_ptr->childs_checked = S_TRUE; 2335 */ 2336 2253 2337 } while (dirlist != NULL); 2254 2338 … … 2309 2393 2310 2394 ShFileType sh_files_filecheck (int class, unsigned long check_mask, 2311 c har * dirName,2312 c har * infileName,2395 const char * dirName, 2396 const char * infileName, 2313 2397 int * reported, 2314 2398 int rsrcflag) … … 2322 2406 char * tmpdir; 2323 2407 char * tmpname; 2324 c har* fileName;2408 const char * fileName; 2325 2409 struct utimbuf utime_buf; 2326 2410 static unsigned int state = 1; … … 2546 2630 /* concatenate statpath = testdir"/"d_name 2547 2631 */ 2548 static int sh_files_fullpath (char * testdir, char * d_name, char * statpath) 2632 static int sh_files_fullpath (const char * testdir, const char * d_name, 2633 char * statpath) 2549 2634 { 2550 2635 int llen = 0; … … 2575 2660 * ----------------------------------- 2576 2661 */ 2662 int sh_files_search_dir(char * name, int * class, 2663 unsigned long *check_mask, int *reported, 2664 int * rdepth) 2665 { 2666 int retval = 0; 2667 #if defined(HAVE_GLOB_H) && defined(HAVE_FNMATCH_H) 2668 sh_globstack_t * testPattern; 2669 zAVLCursor cursor; 2670 #endif 2671 dirstack_t * item; 2672 2673 SH_MUTEX_RECURSIVE_INIT(mutex_zdirs); 2674 SH_MUTEX_RECURSIVE_LOCK(mutex_zdirs); 2675 2676 item = zAVLSearch(zdirListOne, name); 2677 2678 if (item) 2679 { 2680 *check_mask = item->check_mask; 2681 *class = item->class; 2682 *reported = item->is_reported; 2683 *rdepth = item->rdepth; 2684 item->checked = S_FALSE; 2685 item->childs_checked = S_FALSE; 2686 item->is_reported = S_FALSE; 2687 retval = 1; 2688 goto out; 2689 } 2690 2691 item = zAVLSearch(zdirListTwo, name); 2692 2693 if (item) 2694 { 2695 *check_mask = item->check_mask; 2696 *class = item->class; 2697 *reported = item->is_reported; 2698 *rdepth = item->rdepth; 2699 item->checked = S_FALSE; 2700 item->childs_checked = S_FALSE; 2701 item->is_reported = S_FALSE; 2702 retval = 1; 2703 goto out; 2704 } 2705 2706 #if defined(HAVE_GLOB_H) && defined(HAVE_FNMATCH_H) 2707 SH_MUTEX_LOCK(mutex_zglob); 2708 for (testPattern = (sh_globstack_t *) zAVLFirst (&cursor, zglobList); 2709 testPattern; 2710 testPattern = (sh_globstack_t *) zAVLNext (&cursor)) 2711 { 2712 if (testPattern->type == SH_LIST_DIR1 || 2713 testPattern->type == SH_LIST_DIR2) 2714 { 2715 if (0 == fnmatch(testPattern->name, name, FNM_PATHNAME|FNM_PERIOD)) 2716 { 2717 *check_mask = testPattern->check_mask; 2718 *class = testPattern->class; 2719 *rdepth = testPattern->rdepth; 2720 retval = 1; 2721 break; 2722 } 2723 2724 } 2725 } 2726 SH_MUTEX_UNLOCK(mutex_zglob); 2727 #endif 2728 out: 2729 SH_MUTEX_RECURSIVE_UNLOCK(mutex_zdirs); 2730 return retval; 2731 } 2732 2577 2733 int sh_files_search_file(char * name, int * class, 2578 2734 unsigned long *check_mask, int *reported) … … 2622 2778 } 2623 2779 2624 void sh_files_set_file_reported(c har * name)2780 void sh_files_set_file_reported(const char * name) 2625 2781 { 2626 2782 dirstack_t * item; … … 2638 2794 } 2639 2795 2640 void sh_files_clear_file_reported(c har * name)2796 void sh_files_clear_file_reported(const char * name) 2641 2797 { 2642 2798 dirstack_t * item; … … 2771 2927 int sh_files_test_setup () 2772 2928 { 2773 int retval = 0; 2774 2929 int retval; 2930 2931 SH_MUTEX_RECURSIVE_INIT(mutex_zdirs); 2932 SH_MUTEX_RECURSIVE_LOCK(mutex_zdirs); 2775 2933 /* Test for modifications allowed in ReadOnly directory 2776 2934 */ … … 2787 2945 if (retval != 0) 2788 2946 aud_exit(FIL__, __LINE__, EXIT_FAILURE); 2789 2790 2791 /* 2792 retval = sh_files_test_double (zfileList, NULL); 2793 if (retval != 0) 2794 aud_exit(FIL__, __LINE__, EXIT_FAILURE); 2795 */ 2947 SH_MUTEX_RECURSIVE_UNLOCK(mutex_zdirs); 2948 2796 2949 return 0; 2797 2950 } -
trunk/src/sh_inotify.c
r372 r373 128 128 short type; 129 129 int class; 130 int rdepth; 130 131 unsigned long check_mask; 131 132 char * file; … … 245 246 } 246 247 247 static sh_watch * sh_inotify_create_watch(c har * file, int nwatch, int flag)248 static sh_watch * sh_inotify_create_watch(const char * file, int nwatch, int flag) 248 249 { 249 250 sh_watch * this = SH_ALLOC(sizeof(sh_watch)); … … 356 357 357 358 char * sh_inotify_pop_dormant(sh_watches * watches, 358 int * class, unsigned long * check_mask, int * type) 359 int * class, unsigned long * check_mask, 360 int * type, int * rdepth) 359 361 { 360 362 char * popret = NULL; … … 372 374 if (this) 373 375 { 374 *class = this->watch->class; 375 *type = this->watch->type; 376 *class = this->watch->class; 377 *type = this->watch->type; 378 *rdepth = this->watch->rdepth; 376 379 *check_mask = this->watch->check_mask; 377 popret = sh_util_strdup(this->watch->file);380 popret = sh_util_strdup(this->watch->file); 378 381 379 382 watches->dormant_watches = this->next; … … 472 475 /* Create an item and put it on the 'dormant' list for later watch creation 473 476 */ 474 int sh_inotify_add_watch_later(c har * filename, sh_watches * watches,477 int sh_inotify_add_watch_later(const char * filename, sh_watches * watches, 475 478 int * errnum, 476 int class, unsigned long check_mask, int type )479 int class, unsigned long check_mask, int type, int rdepth) 477 480 { 478 481 sh_watch * item; … … 482 485 item->class = class; 483 486 item->type = (short) type; 487 item->rdepth = (short) rdepth; 484 488 item->check_mask = check_mask; 485 489 … … 574 578 */ 575 579 int sh_inotify_add_watch(char * filename, sh_watches * watches, int * errnum, 576 int class, unsigned long check_mask, int type )580 int class, unsigned long check_mask, int type, int rdepth) 577 581 { 578 582 volatile int retval = 0; … … 618 622 item->class = class; 619 623 item->type = type; 624 item->rdepth = rdepth; 620 625 item->check_mask = check_mask; 621 626 … … 646 651 ++(watches->count); 647 652 } 653 else if (type == SH_INOTIFY_DIR) /* watch exists */ 654 { 655 /* This covers the case that a directory has been added, 656 * but is watched as file at first because it is also 657 * specified as file in the config. 658 */ 659 item = zAVLSearch(watches->list_of_watches, &index); 660 661 if (item && item->type == SH_INOTIFY_FILE) 662 { 663 item->type = SH_INOTIFY_DIR; 664 } 665 } 648 666 } 649 667 retpoint: … … 655 673 656 674 char * sh_inotify_search_item(sh_watches * watches, int watch, 657 int * class, unsigned long * check_mask, int * type) 675 int * class, unsigned long * check_mask, 676 int * type, int * rdepth) 658 677 { 659 678 sh_watch * item; … … 673 692 *check_mask = item->check_mask; 674 693 *type = item->type; 694 *rdepth = item->rdepth; 675 695 sret = sh_util_strdup(item->file); 676 696 } … … 710 730 if (filename) 711 731 { 712 if (sh_inotify_add_watch(filename, watches, errnum, 0, 0, SH_INOTIFY_FILE) < 0) 732 if (sh_inotify_add_watch(filename, watches, errnum, 733 0, 0, SH_INOTIFY_FILE, 0) < 0) 713 734 { 714 735 retry_msleep(waitsec, 0); … … 841 862 842 863 int sh_inotify_add_watch(char * filename, sh_watches * watches, int * errnum, 843 int class, unsigned long check_mask )864 int class, unsigned long check_mask, int type, int rdepth) 844 865 { 845 866 (void) filename; … … 847 868 (void) class; 848 869 (void) check_mask; 870 (void) type; 871 (void) rdepth; 849 872 *errnum = 0; 850 873 return 0; 851 874 } 852 875 853 int sh_inotify_add_watch_later(c har * filename, sh_watches * watches,876 int sh_inotify_add_watch_later(const char * filename, sh_watches * watches, 854 877 int * errnum, 855 int class, unsigned long check_mask )878 int class, unsigned long check_mask, int type, int rdepth) 856 879 { 857 880 (void) filename; … … 859 882 (void) class; 860 883 (void) check_mask; 884 (void) type; 885 (void) rdepth; 861 886 *errnum = 0; 862 887 return 0; … … 876 901 char * p; 877 902 int class; 903 int type; 904 int rdepth; 878 905 unsigned long check_mask; 879 906 int nrun = 0; 880 907 881 sh_watch aw1 = { -1, 0, 1, 1, "a1" };882 sh_watch aw2 = { -1, 0, 2, 1, "a2" };883 sh_watch aw3 = { 2, 0, 3, 1, "a3" };884 sh_watch aw4 = { -1, 0, 4, 1, "a4" };885 sh_watch aw5 = { 5, 0, 5, 1, "a5" };908 sh_watch aw1 = { -1, 0, 0, 1, 99, 1, "a1" }; 909 sh_watch aw2 = { -1, 0, 0, 2, 99, 1, "a2" }; 910 sh_watch aw3 = { 2, 0, 0, 3, 99, 1, "a3" }; 911 sh_watch aw4 = { -1, 0, 0, 4, 99, 1, "a4" }; 912 sh_watch aw5 = { 5, 0, 0, 5, 99, 1, "a5" }; 886 913 887 914 do { … … 971 998 CuAssertIntEquals(tc, count, 5); 972 999 973 p = sh_inotify_pop_dormant(&twatch, &class, &check_mask );1000 p = sh_inotify_pop_dormant(&twatch, &class, &check_mask, &type, &rdepth); 974 1001 CuAssertStrEquals(tc, p, "a5"); 975 1002 976 p = sh_inotify_pop_dormant(&twatch, &class, &check_mask );1003 p = sh_inotify_pop_dormant(&twatch, &class, &check_mask, &type, &rdepth); 977 1004 CuAssertStrEquals(tc, p, "a3"); 978 1005 CuAssertIntEquals(tc, class, 3); 979 1006 980 p = sh_inotify_pop_dormant(&twatch, &class, &check_mask );1007 p = sh_inotify_pop_dormant(&twatch, &class, &check_mask, &type, &rdepth); 981 1008 CuAssertTrue(tc, NULL == p); 982 1009 CuAssertTrue(tc, NULL == twatch.dormant_watches); -
trunk/src/sh_unix.c
r367 r373 3590 3590 static void * sh_dummy_tmp2; 3591 3591 3592 int sh_unix_getinfo (int level, c har * filename, file_type * theFile,3592 int sh_unix_getinfo (int level, const char * filename, file_type * theFile, 3593 3593 char * fileHash, int policy) 3594 3594 { -
trunk/src/sh_utils.c
r355 r373 1804 1804 1805 1805 1806 int sh_util_obscurename (ShErrLevel level, c har * name_orig, int flag)1807 { 1808 unsigned char * name = (unsigned char *) name_orig;1806 int sh_util_obscurename (ShErrLevel level, const char * name_orig, int flag) 1807 { 1808 const unsigned char * name = (unsigned char *) name_orig; 1809 1809 char * safe; 1810 1810 unsigned int i;
Note:
See TracChangeset
for help on using the changeset viewer.