text stringlengths 0 357 |
|---|
int vg_expect_encrypted = 1; |
if (join_vg) { |
int is_verified_group = 0; |
dc_get_chat_id_by_grpid(context, grpid, NULL, &is_verified_group); |
if (!is_verified_group) { |
// when joining a normal group after verification, |
// the vg-member-added message may be unencrypted |
// when not all group members have keys or prefer encryption. |
// this does not affect the contact verification as such. |
vg_expect_encrypted = 0; |
} |
} |
if (vg_expect_encrypted) { |
if (!encrypted_and_signed(mimeparser, scanned_fingerprint_of_alice)) { |
could_not_establish_secure_connection(context, contact_chat_id, "Contact confirm message not encrypted."); |
end_bobs_joining(context, DC_BOB_ERROR); |
goto cleanup; |
} |
} |
if (!mark_peer_as_verified(context, scanned_fingerprint_of_alice)) { |
could_not_establish_secure_connection(context, contact_chat_id, "Fingerprint mismatch on joiner-side."); // MitM? - key has changed since vc-auth-required message |
goto cleanup; |
} |
dc_scaleup_contact_origin(context, contact_id, DC_ORIGIN_SECUREJOIN_JOINED); |
context->cb(context, DC_EVENT_CONTACTS_CHANGED, 0/*no select event*/, 0); |
if (join_vg) { |
if (!dc_addr_equals_self(context, lookup_field(mimeparser, "Chat-Group-Member-Added"))) { |
dc_log_info(context, 0, "Message belongs to a different handshake (scaled up contact anyway to allow creation of group)."); |
goto cleanup; |
} |
} |
secure_connection_established(context, contact_chat_id); |
context->bob_expects = 0; |
if (join_vg) { |
send_handshake_msg(context, contact_chat_id, "vg-member-added-received", |
NULL, NULL, NULL); // Bob -> Alice |
} |
end_bobs_joining(context, DC_BOB_SUCCESS); |
} |
else if (strcmp(step, "vg-member-added-received")==0) |
{ |
/* ============================================================ |
==== Alice - the inviter side ==== |
==== Step 8 in "Out-of-band verified groups" protocol ==== |
============================================================ */ |
if (NULL==(contact=dc_get_contact(context, contact_id)) || !dc_contact_is_verified(contact)) { |
dc_log_warning(context, 0, "vg-member-added-received invalid."); |
goto cleanup; |
} |
context->cb(context, DC_EVENT_SECUREJOIN_INVITER_PROGRESS, contact_id, 800); |
context->cb(context, DC_EVENT_SECUREJOIN_INVITER_PROGRESS, contact_id, 1000); // done group joining |
} |
// for errors, we do not the corresponding message at all, |
// it may come eg. from another device or may be useful to find out what was going wrong. |
if (ret & DC_HANDSHAKE_STOP_NORMAL_PROCESSING) { |
ret |= DC_HANDSHAKE_ADD_DELETE_JOB; |
} |
cleanup: |
UNLOCK_QR |
dc_contact_unref(contact); |
free(scanned_fingerprint_of_alice); |
free(auth); |
free(own_fingerprint); |
free(grpid); |
return ret; |
} |
/** |
* @} |
*/ |
``` |
Filename: dc_smtp.c |
```c |
#include <unistd.h> |
#include <libetpan/libetpan.h> |
#include "dc_context.h" |
#include "dc_smtp.h" |
#include "dc_job.h" |
#include "dc_oauth2.h" |
#ifndef DEBUG_SMTP |
#define DEBUG_SMTP 0 |
#endif |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.