(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/imap/imap-search.c) |
| |
| 318 | | | static bool cmd_search_more(struct client_command_context *cmd) |
| 319 | | | { |
| 320 | | | struct imap_search_context *ctx = cmd->context; |
| 321 | | | enum search_return_options opts = ctx->return_options; |
| 322 | | | enum mailbox_sync_flags sync_flags; |
| 323 | | | struct timeval end_time; |
| 324 | | | const struct seq_range *range; |
| 325 | | | unsigned int count; |
| 326 | | | uint32_t id, id_min, id_max; |
| 327 | | | const char *ok_reply; |
| 328 | | | bool tryagain, minmax, lost_data; |
| 329 | | | |
| 330 | | | if (cmd->cancel) { |
Event 1:
Skipping " if". cmd->cancel evaluates to false.
hide
|
|
| 331 | | | (void)imap_search_deinit(ctx); |
| 332 | | | return TRUE; |
| 333 | | | } |
| 334 | | | |
| 335 | | | range = array_get(&ctx->result, &count);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
156 | #define array_get(array, count) \ |
157 | ARRAY_TYPE_CAST_CONST(array)array_get_i(&(array)->arr, count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
43 | # define ARRAY_TYPE_CAST_CONST(array) \ |
44 | (typeof(*(array)->v)) |
| |
|
| 336 | | | if (count == 0) { |
Event 2:
Taking false branch. count == 0 evaluates to false.
hide
|
|
| 337 | | | id_min = 0; |
| 338 | | | id_max = 0; |
| 339 | | | } else { |
| 340 | | | id_min = range[0].seq1; |
| 341 | | | id_max = range[count-1].seq2; |
| 342 | | | } |
| 343 | | | |
| 344 | | | minmax = (opts & (SEARCH_RETURN_MIN | SEARCH_RETURN_MAX)) != 0 && |
Event 3:
(opts & (SEARCH_RETURN_MIN | SEARCH_RETURN_MAX)) != 0 evaluates to true.
hide
|
|
| 345 | | | (opts & ~(SEARCH_RETURN_NORESULTS |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/imap/imap-search.h |
| |
17 | #define SEARCH_RETURN_NORESULTS \ |
18 | (SEARCH_RETURN_ESEARCH | SEARCH_RETURN_MODSEQ | SEARCH_RETURN_SAVE | \ |
19 | SEARCH_RETURN_UPDATE) |
| |
|
| 346 | | | SEARCH_RETURN_MIN | SEARCH_RETURN_MAX)) == 0; |
Event 4:
(opts & ~(SEARCH_RETURN_ESEARCH | SEARCH_RETURN_MODSEQ | SEARCH_RETURN_SAVE | SEARCH_RETURN_UPDATE | SEARCH_RETURN_MIN | SEARCH_RETURN_MAX)) == 0 evaluates to false.
hide
|
|
| 347 | | | while (mailbox_search_next_nonblock(ctx->search_ctx, ctx->mail, |
| 348 | [+] | | &tryagain) > 0) { |
 |
| 349 | | | id = cmd->uid ? ctx->mail->uid : ctx->mail->seq; |
| 350 | | | ctx->result_count++; |
| 351 | | | |
| 352 | | | if (minmax) { |
| 353 | | | |
| 354 | | | if (id_min == 0 && (opts & SEARCH_RETURN_MIN) != 0) |
| 355 | | | id_min = id; |
| 356 | | | if ((opts & SEARCH_RETURN_MAX) != 0) |
| 357 | | | id_max = id; |
| 358 | | | if (id == id_min || id == id_max) { |
| 359 | | | |
| 360 | | | |
| 361 | | | search_add_result_id(ctx, id); |
| 362 | | | } |
| 363 | | | continue; |
| 364 | | | } |
| 365 | | | |
| 366 | | | search_update_mail(ctx); |
| 367 | | | if ((opts & ~(SEARCH_RETURN_NORESULTS |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/imap/imap-search.h |
| |
17 | #define SEARCH_RETURN_NORESULTS \ |
18 | (SEARCH_RETURN_ESEARCH | SEARCH_RETURN_MODSEQ | SEARCH_RETURN_SAVE | \ |
19 | SEARCH_RETURN_UPDATE) |
| |
|
| 368 | | | SEARCH_RETURN_COUNT)) == 0) { |
| 369 | | | |
| 370 | | | continue; |
| 371 | | | } |
| 372 | | | search_add_result_id(ctx, id); |
| 373 | | | } |
| 374 | | | if (tryagain) |
Event 7:
Skipping " if". tryagain evaluates to false.
hide
|
|
| 375 | | | return FALSE; |
| 376 | | | |
| 377 | | | if (minmax && array_count(&ctx->result) > 0 && |
Event 8:
Skipping " if". minmax evaluates to false.
hide
|
|
| 378 | | | (opts & (SEARCH_RETURN_MODSEQ | SEARCH_RETURN_SAVE)) != 0) { |
| 379 | | | |
| 380 | | | if ((opts & SEARCH_RETURN_MIN) != 0) { |
| 381 | | | i_assert(id_min != 0);
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 |
| |
|
| 382 | | | if (cmd->uid) { |
| 383 | | | if (!mail_set_uid(ctx->mail, id_min)) |
| 384 | | | i_unreached();
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
208 | #define i_unreached() \ |
209 | i_panic("file %s: line %d: unreached", __FILE__, __LINE__) |
| |
|
| 385 | | | } else { |
| 386 | | | mail_set_seq(ctx->mail, id_min); |
| 387 | | | } |
| 388 | | | search_update_mail(ctx); |
| 389 | | | } |
| 390 | | | if ((opts & SEARCH_RETURN_MAX) != 0) { |
| 391 | | | i_assert(id_max != 0);
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 |
| |
|
| 392 | | | if (cmd->uid) { |
| 393 | | | if (!mail_set_uid(ctx->mail, id_max)) |
| 394 | | | i_unreached();
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/macros.h |
| |
208 | #define i_unreached() \ |
209 | i_panic("file %s: line %d: unreached", __FILE__, __LINE__) |
| |
|
| 395 | | | } else { |
| 396 | | | mail_set_seq(ctx->mail, id_max); |
| 397 | | | } |
| 398 | | | search_update_mail(ctx); |
| 399 | | | } |
| 400 | | | } |
| 401 | | | |
| 402 | | | lost_data = mailbox_search_seen_lost_data(ctx->search_ctx); |
| 403 | [+] | | if (imap_search_deinit(ctx) < 0) { |
 |
| 404 | | | client_send_storage_error(cmd, |
| 405 | | | mailbox_get_storage(cmd->client->mailbox)); |
| 406 | | | return TRUE; |
| 407 | | | } |
| 408 | | | |
| 409 | | | if (gettimeofday(&end_time, NULL) < 0) |
Event 14:
Skipping " if". gettimeofday(...) < 0 evaluates to false.
hide
|
|
| 410 | | | memset(&end_time, 0, sizeof(end_time)); |
| 411 | | | end_time.tv_sec -= ctx->start_time.tv_sec; |
| 412 | | | end_time.tv_usec -= ctx->start_time.tv_usec; |
| 413 | | | if (end_time.tv_usec < 0) { |
Event 15:
Skipping " if". end_time.tv_usec < 0 evaluates to false.
hide
|
|
| 414 | | | end_time.tv_sec--; |
| 415 | | | end_time.tv_usec += 1000000; |
| 416 | | | } |
| 417 | | | |
| 418 | | | sync_flags = MAILBOX_SYNC_FLAG_FAST; |
| 419 | | | if (!cmd->uid || ctx->have_seqsets) |
Event 16:
Taking true branch. cmd->uid evaluates to false.
hide
|
|
| 420 | | | sync_flags |= MAILBOX_SYNC_FLAG_NO_EXPUNGES; |
| 421 | | | ok_reply = t_strdup_printf("OK %s%s completed (%d.%03d secs).", |
Event 50:
ok_reply is set to t_strdup_printf(...), which evaluates to the value assigned to ret at data-stack.c:335. See related event 49.
hide
|
|
| 422 | | | lost_data ? "["IMAP_RESP_CODE_EXPUNGEISSUED"] " : "", |
Event 18:
lost_data evaluates to false.
hide
|
|
| 423 | | | !ctx->sorting ? "Search" : "Sort", |
Event 17:
ctx->sorting evaluates to true.
hide
|
|
| 424 | [+] | | (int)end_time.tv_sec, (int)(end_time.tv_usec/1000)); |
 |
| 425 | [+] | | return cmd_sync(cmd, sync_flags, 0, ok_reply); |
Event 51:
ok_reply, which evaluates to the value assigned to ret at data-stack.c:335, is passed to cmd_sync() as the fourth argument. See related event 50.
hide
|
|
 |
| |