(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/maildir/maildir-sync.c) |
| |
| 358 | | | static int maildir_scan_dir(struct maildir_sync_context *ctx, bool new_dir) |
| 359 | | | { |
| 360 | | | struct mail_storage *storage = &ctx->mbox->storage->storage; |
| 361 | | | const char *path; |
| 362 | | | DIR *dirp; |
| 363 | | | string_t *src, *dest; |
| 364 | | | struct dirent *dp; |
| 365 | | | struct stat st; |
| 366 | | | enum maildir_uidlist_rec_flag flags; |
| 367 | | | unsigned int i = 0, move_count = 0; |
| 368 | | | time_t now; |
| 369 | | | int ret = 1; |
| 370 | | | bool move_new, check_touch, dir_changed = FALSE; |
| 371 | | | |
| 372 | | | path = new_dir ? ctx->new_dir : ctx->cur_dir; |
Event 1:
new_dir evaluates to true.
hide
Event 2:
path is set to new_dir ? ctx->new_dir : ctx->cur_dir, which evaluates to ctx->new_dir.
hide
|
|
| 373 | | | for (i = 0;; i++) { |
| 374 | | | dirp = opendir(path); |
Event 3:
path, which evaluates to ctx->new_dir, is passed to opendir(). See related event 2.
hide
Event 4:
opendir() accesses the file named path, where path is ctx->new_dir. - The same name is used to access a file later, but it is not safe to assume that it will be the same underlying file.
See related event 3.
hide
|
|
| 375 | | | if (dirp != NULL) |
Event 5:
Skipping " if". dirp != (void *)0 evaluates to false.
hide
|
|
| 376 | | | break; |
| 377 | | | |
| 378 | | | if (errno != ENOENT || i == MAILDIR_DELETE_RETRY_COUNT) {
x /usr/include/asm-generic/errno-base.h |
| |
5 | #define ENOENT 2 /* No such file or directory */ |
| |
|
Event 6:
Taking true branch. errno != 2 evaluates to true.
hide
|
|
| 379 | | | if (errno == EACCES) {
x /usr/include/asm-generic/errno-base.h |
| |
16 | #define EACCES 13 /* Permission denied */ |
| |
|
Event 7:
Taking true branch. errno == 13 evaluates to true.
hide
|
|
| 380 | | | mail_storage_set_critical(storage, "%s", |
| 381 | [+] | | eacces_error_get("opendir", path)); |
Event 8:
path, which evaluates to ctx->new_dir, is passed to eacces_error_get() as the second argument. See related event 2.
hide
|
|
 |
| |