(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/maildir/maildir-sync-index.c) |
| |
| 372 | | | int maildir_sync_index(struct maildir_index_sync_context *ctx, |
| 373 | | | bool partial) |
| 374 | | | { |
| 375 | | | struct maildir_mailbox *mbox = ctx->mbox; |
| 376 | | | struct mail_index_view *view = ctx->view; |
| 377 | | | struct mail_index_view *view2; |
| 378 | | | struct maildir_uidlist_iter_ctx *iter; |
| 379 | | | struct mail_index_transaction *trans = ctx->trans; |
| 380 | | | const struct *hdr; |
| 381 | | | struct empty_hdr; |
| 382 | | | const struct mail_index_record *rec; |
| 383 | | | uint32_t seq, seq2, uid, prev_uid; |
| 384 | | | enum maildir_uidlist_rec_flag uflags; |
| 385 | | | const char *filename; |
| 386 | | | uint32_t uid_validity, next_uid, hdr_next_uid, first_recent_uid; |
| 387 | | | uint32_t first_uid; |
| 388 | | | unsigned int changes = 0; |
| 389 | | | int ret = 0; |
| 390 | | | time_t time_before_sync; |
| 391 | | | struct stat st; |
| 392 | | | bool expunged, full_rescan = FALSE; |
| 393 | | | |
| 394 | | | i_assert(!mbox->syncing_commit);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
189 | #define i_assert(expr) STMT_START{ \ |
190 | if (unlikely(!(expr))) \ |
191 | i_panic("file %s: line %d (%s): assertion failed: (%s)", \ |
192 | __FILE__, \ |
193 | __LINE__, \ |
194 | __PRETTY_FUNCTION__, \ |
195 | #expr); }STMT_END |
| |
|
Event 1:
Skipping " if". !mbox->syncing_commit evaluates to true.
hide
Event 2:
Skipping " if". !!mbox->syncing_commit evaluates to false.
hide
Event 3:
Skipping " if". !!!mbox->syncing_commit evaluates to true.
hide
Event 4:
Skipping " if". !!!!mbox->syncing_commit evaluates to false.
hide
Event 5:
Skipping " if". __builtin_expect(...) evaluates to false.
hide
|
|
| 395 | | | |
| 396 | | | first_uid = 1; |
| 397 | | | hdr = (view); |
| 398 | | | uid_validity = maildir_uidlist_get_uid_validity(mbox->uidlist); |
| 399 | | | if (uid_validity != hdr->uid_validity && |
Event 6:
Skipping " if". uid_validity != hdr->uid_validity evaluates to false.
hide
|
|
| 400 | | | uid_validity != 0 && hdr->uid_validity != 0) { |
| 401 | | | |
| 402 | | | |
| 403 | | | |
| 404 | | | i_warning("Maildir %s: UIDVALIDITY changed (%u -> %u)", |
| 405 | | | mbox->path, hdr->uid_validity, uid_validity); |
| 406 | | | mail_index_reset(trans); |
| 407 | | | index_mailbox_reset_uidvalidity(&mbox->ibox); |
| 408 | | | maildir_uidlist_set_next_uid(mbox->uidlist, 1, TRUE); |
| 409 | | | |
| 410 | | | first_uid = hdr->messages_count + 1; |
| 411 | | | memset(&empty_hdr, 0, sizeof(empty_hdr)); |
| 412 | | | empty_hdr.next_uid = 1; |
| 413 | | | hdr = &empty_hdr; |
| 414 | | | } |
| 415 | | | hdr_next_uid = hdr->next_uid; |
| 416 | | | |
| 417 | | | time_before_sync = time(NULL); |
| 418 | | | mbox->syncing_commit = TRUE; |
Event 7:
!0 evaluates to true.
hide
|
|
| 419 | | | seq = prev_uid = 0; first_recent_uid = I_MAX(hdr->first_recent_uid, 1); |
Event 8:
hdr->first_recent_uid > 1 evaluates to false.
hide
|
|
| 420 | | | t_array_init(&ctx->keywords, MAILDIR_MAX_KEYWORDS);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
39 | #define t_array_init(array, init_count) \ |
40 | p_array_init(array, pool_datastack_create(), init_count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
35 | #define p_array_init(array, pool, init_count) \ |
36 | array_create(array, pool, sizeof(**(array)->v), init_count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
75 | #define array_create(array, pool, element_size, init_count) \ |
76 | array_create_i(&(array)->arr, pool, element_size, init_count) |
| |
|
| 421 | | | t_array_init(&ctx->idx_keywords, MAILDIR_MAX_KEYWORDS);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
39 | #define t_array_init(array, init_count) \ |
40 | p_array_init(array, pool_datastack_create(), init_count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
35 | #define p_array_init(array, pool, init_count) \ |
36 | array_create(array, pool, sizeof(**(array)->v), init_count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
75 | #define array_create(array, pool, element_size, init_count) \ |
76 | array_create_i(&(array)->arr, pool, element_size, init_count) |
| |
|
| 422 | | | iter = maildir_uidlist_iter_init(mbox->uidlist); |
| 423 | [+] | | while (maildir_uidlist_iter_next(iter, &uid, &uflags, &filename)) { |
 |
| 424 | | | maildir_filename_get_flags(ctx->keywords_sync_ctx, filename, |
| 425 | | | &ctx->flags, &ctx->keywords); |
| 426 | | | |
| 427 | | | i_assert(uid > prev_uid);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
189 | #define i_assert(expr) STMT_START{ \ |
190 | if (unlikely(!(expr))) \ |
191 | i_panic("file %s: line %d (%s): assertion failed: (%s)", \ |
192 | __FILE__, \ |
193 | __LINE__, \ |
194 | __PRETTY_FUNCTION__, \ |
195 | #expr); }STMT_END |
| |
|
| 428 | | | prev_uid = uid; |
| 429 | | | |
| 430 | | | |
| 431 | | | |
| 432 | | | ctx->flags &= ~mbox->ibox.box.private_flags_mask; |
| 433 | | | |
| 434 | | | again: |
| 435 | | | ctx->seq = ++seq; |
| 436 | | | ctx->uid = uid; |
| 437 | | | |
| 438 | | | if (seq > hdr->messages_count) { |
| 439 | | | if (uid < hdr_next_uid) { |
| 440 | | | if (maildir_handle_uid_insertion(ctx, uflags, |
| 441 | | | filename, |
| 442 | | | uid) < 0) |
| 443 | | | ret = -1; |
| 444 | | | seq--; |
| 445 | | | continue; |
| 446 | | | } |
| 447 | | | |
| 448 | | | |
| 449 | | | |
| 450 | | | |
| 451 | | | |
| 452 | | | if ((uflags & MAILDIR_UIDLIST_REC_FLAG_RECENT) == 0) { |
| 453 | | | if (uid >= first_recent_uid) |
| 454 | | | first_recent_uid = uid + 1; |
| 455 | | | } |
| 456 | | | |
| 457 | | | hdr_next_uid = uid + 1; |
| 458 | | | mail_index_append(trans, uid, &seq); |
| 459 | | | mail_index_update_flags(trans, seq, MODIFY_REPLACE, |
| 460 | | | ctx->flags); |
| 461 | | | if (array_count(&ctx->keywords) > 0) { |
| 462 | | | struct mail_keywords *kw; |
| 463 | | | |
| 464 | | | kw = mail_index_keywords_create_from_indexes( |
| 465 | | | mbox->ibox.index, &ctx->keywords); |
| 466 | | | mail_index_update_keywords(trans, seq, |
| 467 | | | MODIFY_REPLACE, kw); |
| 468 | | | mail_index_keywords_free(&kw); |
| 469 | | | } |
| 470 | | | continue; |
| 471 | | | } |
| 472 | | | |
| 473 | | | rec = mail_index_lookup(view, seq); |
| 474 | | | if (uid > rec->uid) { |
| 475 | | | |
| 476 | | | mail_index_expunge(trans, seq); |
| 477 | | | goto again; |
| 478 | | | } |
| 479 | | | |
| 480 | | | if (uid < rec->uid) { |
| 481 | | | if (maildir_handle_uid_insertion(ctx, uflags, |
| 482 | | | filename, uid) < 0) |
| 483 | | | ret = -1; |
| 484 | | | seq--; |
| 485 | | | continue; |
| 486 | | | } |
| 487 | | | |
| 488 | | | index_sync_changes_read(ctx->sync_changes, rec->uid, &expunged); |
| 489 | | | if (expunged) { |
| 490 | | | if (maildir_file_do(mbox, ctx->uid,
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/maildir/maildir-storage.h |
| |
117 | # define maildir_file_do(mbox, seq, callback, context) \ |
118 | ({(void)(1 ? 0 : callback((struct maildir_mailbox *)NULL, \ |
119 | (const char *)NULL, context)); \ |
120 | maildir_file_do(mbox, seq, \ |
121 | (maildir_file_do_func *)callback, context); }) |
| |
|
| 491 | | | maildir_expunge, ctx) >= 0) { |
| 492 | | | |
| 493 | | | mail_index_expunge(trans, seq); |
| 494 | | | } |
| 495 | | | if ((++changes % MAILDIR_SLOW_MOVE_COUNT) == 0) |
| 496 | | | maildir_sync_notify(ctx->maildir_sync_ctx); |
| 497 | | | continue; |
| 498 | | | } |
| 499 | | | |
| 500 | | | |
| 501 | | | ctx->flags |= rec->flags & mbox->ibox.box.private_flags_mask; |
| 502 | | | |
| 503 | | | if (index_sync_changes_have(ctx->sync_changes)) { |
| 504 | | | |
| 505 | | | if (maildir_file_do(mbox, ctx->uid,
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/maildir/maildir-storage.h |
| |
117 | # define maildir_file_do(mbox, seq, callback, context) \ |
118 | ({(void)(1 ? 0 : callback((struct maildir_mailbox *)NULL, \ |
119 | (const char *)NULL, context)); \ |
120 | maildir_file_do(mbox, seq, \ |
121 | (maildir_file_do_func *)callback, context); }) |
| |
|
| 506 | | | maildir_sync_flags, ctx) < 0) |
| 507 | | | ctx->flags |= MAIL_INDEX_MAIL_FLAG_DIRTY; |
| 508 | | | if ((++changes % MAILDIR_SLOW_MOVE_COUNT) == 0) |
| 509 | | | maildir_sync_notify(ctx->maildir_sync_ctx); |
| 510 | | | } |
| 511 | | | |
| 512 | | | if ((uflags & MAILDIR_UIDLIST_REC_FLAG_NONSYNCED) != 0) { |
| 513 | | | |
| 514 | | | if ((uflags & MAILDIR_UIDLIST_REC_FLAG_NEW_DIR) != 0) { |
| 515 | | | |
| 516 | | | |
| 517 | | | |
| 518 | | | full_rescan = TRUE; |
| 519 | | | } |
| 520 | | | continue; |
| 521 | | | } |
| 522 | | | |
| 523 | | | if ((rec->flags & MAIL_INDEX_MAIL_FLAG_DIRTY) != 0) { |
| 524 | | | |
| 525 | | | |
| 526 | | | continue; |
| 527 | | | } |
| 528 | | | |
| 529 | | | if (ctx->flags != (rec->flags & MAIL_FLAGS_NONRECENT)) { |
| 530 | | | mail_index_update_flags(trans, seq, MODIFY_REPLACE, |
| 531 | | | ctx->flags); |
| 532 | | | } |
| 533 | | | |
| 534 | | | maildir_sync_mail_keywords(ctx, seq); |
| 535 | | | } |
| 536 | | | maildir_uidlist_iter_deinit(&iter); |
| 537 | | | mbox->syncing_commit = FALSE; |
| 538 | | | |
| 539 | | | if (!partial) { |
Event 11:
Skipping " if". partial evaluates to true.
hide
|
|
| 540 | | | |
| 541 | | | for (seq++; seq <= hdr->messages_count; seq++) |
| 542 | | | mail_index_expunge(trans, seq); |
| 543 | | | } |
| 544 | | | |
| 545 | | | |
| 546 | | | |
| 547 | | | view2 = mail_index_transaction_open_updated_view(trans); |
| 548 | | | if (mail_index_lookup_seq_range(view2, first_recent_uid, (uint32_t)-1, |
| 549 | [+] | | &seq, &seq2) && seq2 >= first_uid) { |
 |
| 550 | | | if (seq < first_uid) { |
| 551 | | | |
| 552 | | | seq = first_uid; |
| 553 | | | } |
| 554 | | | index_mailbox_set_recent_seq(&mbox->ibox, view2, seq, seq2); |
| 555 | | | } |
| 556 | | | mail_index_view_close(&view2); |
| 557 | | | |
| 558 | | | if (ctx->uidlist_sync_ctx != NULL) { |
Event 14:
Taking true branch. ctx->uidlist_sync_ctx != (void *)0 evaluates to true.
hide
|
|
| 559 | | | if (maildir_uidlist_sync_deinit(&ctx->uidlist_sync_ctx, |
| 560 | | | TRUE) < 0) |
Event 15:
Skipping " if". !0 evaluates to true.
hide
Event 16:
Taking true branch. maildir_uidlist_sync_deinit(...) < 0 evaluates to true.
hide
|
|
| 561 | | | ret = -1; |
| 562 | | | } |
| 563 | | | |
| 564 | | | if (mbox->ibox.box.v.sync_notify != NULL) |
Event 17:
Taking true branch. mbox->ibox.box.v.sync_notify != (void *)0 evaluates to true.
hide
|
|
| 565 | | | mbox->ibox.box.v.sync_notify(&mbox->ibox.box, 0, 0); |
| 566 | | | |
| 567 | [+] | | if (stat(t_strconcat(mbox->path, "/cur", NULL), &st) == 0) { |
 |
| |