(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/imap/cmd-copy.c) |
| |
| 93 | | | bool cmd_copy(struct client_command_context *cmd) |
| 94 | | | { |
| 95 | | | struct client *client = cmd->client; |
| 96 | | | struct mail_storage *storage; |
| 97 | | | struct mailbox *destbox; |
| 98 | | | struct mailbox_transaction_context *t; |
| 99 | | | struct mail_search_args *search_args; |
| 100 | | | const char *messageset, *mailbox, *src_uidset, *msg = NULL; |
| 101 | | | enum mailbox_sync_flags sync_flags = 0; |
| 102 | | | enum imap_sync_flags imap_flags = 0; |
| 103 | | | unsigned int copy_count; |
| 104 | | | uint32_t uid_validity, uid1, uid2; |
| 105 | | | int ret; |
| 106 | | | |
| 107 | | | |
| 108 | [+] | | if (!client_read_string_args(cmd, 2, &messageset, &mailbox)) |
 |
| 109 | | | return FALSE; |
| 110 | | | |
| 111 | [+] | | if (!client_verify_open_mailbox(cmd)) |
 |
| 112 | | | return TRUE; |
| 113 | | | |
| 114 | | | |
| 115 | | | if (!client_verify_mailbox_name(cmd, mailbox, |
| 116 | [+] | | CLIENT_VERIFY_MAILBOX_SHOULD_EXIST_TRYCREATE)) |
 |
| 117 | | | return TRUE; |
| 118 | | | |
| 119 | [+] | | ret = imap_search_get_seqset(cmd, messageset, cmd->uid, &search_args); |
 |
| 120 | | | if (ret <= 0) |
Event 24:
Skipping " if". ret <= 0 evaluates to false.
hide
|
|
| 121 | | | return ret < 0; |
| 122 | | | |
| 123 | [+] | | storage = client_find_storage(cmd, &mailbox); |
 |
| 124 | | | if (storage == NULL) |
Event 31:
Skipping " if". storage == (void *)0 evaluates to false.
hide
|
|
| 125 | | | return TRUE; |
| 126 | | | |
| 127 | | | if (mailbox_equals(client->mailbox, storage, mailbox)) |
Event 32:
Taking false branch. mailbox_equals(...) evaluates to false.
hide
|
|
| 128 | | | destbox = client->mailbox; |
| 129 | | | else { |
| 130 | | | destbox = mailbox_open(&storage, mailbox, NULL, |
| 131 | | | MAILBOX_OPEN_SAVEONLY | |
| 132 | | | MAILBOX_OPEN_FAST | |
| 133 | [+] | | MAILBOX_OPEN_KEEP_RECENT); |
 |
| 134 | | | if (destbox == NULL) { |
Event 37:
Skipping " if". destbox == (void *)0 evaluates to false.
hide
|
|
| 135 | | | client_send_storage_error(cmd, storage); |
| 136 | | | return TRUE; |
| 137 | | | } |
| 138 | | | if (client->enabled_features != 0) |
Event 38:
Skipping " if". client->enabled_features != 0 evaluates to false.
hide
|
|
| 139 | | | mailbox_enable(destbox, client->enabled_features); |
| 140 | | | } |
| 141 | | | |
| 142 | | | t = mailbox_transaction_begin(destbox, |
| 143 | | | MAILBOX_TRANSACTION_FLAG_EXTERNAL | |
| 144 | | | MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS); |
| 145 | | | ret = fetch_and_copy(client, destbox, t, search_args, |
| 146 | [+] | | &src_uidset, ©_count); |
 |
| 147 | | | mail_search_args_unref(&search_args); |
| 148 | | | |
| 149 | | | if (ret <= 0) |
Event 42:
Taking false branch. ret <= 0 evaluates to false.
hide
|
|
| 150 | | | mailbox_transaction_rollback(&t); |
| 151 | | | else if (mailbox_transaction_commit_get_uids(&t, &uid_validity, |
| 152 | | | &uid1, &uid2) < 0) |
Event 43:
Taking false branch. mailbox_transaction_commit_get_uids(...) < 0 evaluates to false.
hide
|
|
| 153 | | | ret = -1; |
| 154 | | | else if (copy_count == 0) |
Event 44:
Taking false branch. copy_count == 0 evaluates to false.
hide
|
|
| 155 | | | msg = "OK No messages copied."; |
| 156 | | | else { |
| 157 | | | i_assert(copy_count == uid2 - uid1 + 1);
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 45:
Skipping " if". copy_count == uid2 - uid1 + 1 evaluates to true.
hide
Event 46:
Skipping " if". !(copy_count == uid2 - uid1 + 1) evaluates to false.
hide
Event 47:
Skipping " if". !!(copy_count == uid2 - uid1 + 1) evaluates to true.
hide
Event 48:
Skipping " if". !!!(copy_count == uid2 - uid1 + 1) evaluates to false.
hide
Event 49:
Skipping " if". __builtin_expect(...) evaluates to false.
hide
|
|
| 158 | | | |
| 159 | | | if (uid1 == 0) |
Event 50:
Skipping " if". uid1 == 0 evaluates to false.
hide
|
|
| 160 | | | msg = "OK Copy completed."; |
| 161 | | | if (uid1 == uid2) { |
Event 51:
Taking true branch. uid1 == uid2 evaluates to true.
hide
|
|
| 162 | | | msg = t_strdup_printf("OK [COPYUID %u %s %u] " |
Event 83:
msg is set to t_strdup_printf(...), which evaluates to the value assigned to ret at data-stack.c:335. See related event 82.
hide
|
|
| 163 | | | "Copy completed.", |
| 164 | [+] | | uid_validity, src_uidset, uid1); |
 |
| 165 | | | } else { |
| 166 | | | msg = t_strdup_printf("OK [COPYUID %u %s %u:%u] " |
| 167 | | | "Copy completed.", |
| 168 | | | uid_validity, src_uidset, |
| 169 | | | uid1, uid2); |
| 170 | | | } |
| 171 | | | } |
| 172 | | | |
| 173 | | | if (destbox != client->mailbox) { |
Event 84:
Skipping " if". destbox != client->mailbox evaluates to false.
hide
|
|
| 174 | | | sync_flags |= MAILBOX_SYNC_FLAG_FAST; |
| 175 | | | imap_flags |= IMAP_SYNC_FLAG_SAFE; |
| 176 | | | mailbox_close(&destbox); |
| 177 | | | } |
| 178 | | | |
| 179 | | | if (ret > 0) |
Event 85:
Taking true branch. ret > 0 evaluates to true.
hide
|
|
| 180 | [+] | | return cmd_sync(cmd, sync_flags, imap_flags, msg); |
Event 86:
msg, 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 83.
hide
|
|
 |
| |