Commit e9e27588 authored by jehan's avatar jehan
Browse files

fix lime to make sure zrtp trust is indexed by scheme, username and domain...

fix lime to make sure zrtp trust is indexed by scheme, username and domain only instead of full sip uri
# Conflicts:
#	coreapi/lime.c
#	coreapi/linphonecall.c
parent 3e851c23
......@@ -775,8 +775,9 @@ bool_t linphone_chat_room_lime_available(LinphoneChatRoom *cr) {
if (zrtp_cache_db != NULL) {
bool_t res;
limeURIKeys_t associatedKeys;
char *peer = linphone_address_as_string_uri_only(linphone_chat_room_get_peer_address(cr));
char *peer = ms_strdup_printf("%s:%s@%s" , linphone_address_get_scheme(linphone_chat_room_get_peer_address(cr))
, linphone_address_get_username(linphone_chat_room_get_peer_address(cr))
, linphone_address_get_domain(linphone_chat_room_get_peer_address(cr)));
/* retrieve keys associated to the peer URI */
associatedKeys.peerURI = bctbx_strdup(peer);
associatedKeys.selfURI = NULL; /* TODO : there is no sender associated to chatroom so check for any local URI available, shall we add sender to chatroom? */
......@@ -818,10 +819,15 @@ int lime_im_encryption_engine_process_incoming_message_cb(LinphoneImEncryptionEn
errcode = 500;
return errcode;
}
peerUri = linphone_address_as_string_uri_only(linphone_chat_message_get_from_address(msg));
selfUri = linphone_address_as_string_uri_only(linphone_chat_message_get_to_address(msg));
peerUri = ms_strdup_printf("%s:%s@%s" , linphone_address_get_scheme(linphone_chat_message_get_from_address(msg))
, linphone_address_get_username(linphone_chat_message_get_from_address(msg))
, linphone_address_get_domain(linphone_chat_message_get_from_address(msg)));
selfUri = ms_strdup_printf("%s:%s@%s" , linphone_address_get_scheme(linphone_chat_message_get_to_address(msg))
, linphone_address_get_username(linphone_chat_message_get_to_address(msg))
, linphone_address_get_domain(linphone_chat_message_get_to_address(msg)));
retval = lime_decryptMultipartMessage(zrtp_cache_db, (uint8_t *)linphone_chat_message_get_text(msg), selfUri, peerUri, &decrypted_body, &decrypted_content_type,
bctbx_time_string_to_sec(lp_config_get_string(lc->config, "sip", "lime_key_validity", "0")));
bctbx_time_string_to_sec(lp_config_get_string(lc->config, "sip", "lime_key_validity", "0")));
ms_free(peerUri);
ms_free(selfUri);
if (retval != 0) {
......@@ -881,8 +887,12 @@ int lime_im_encryption_engine_process_outgoing_message_cb(LinphoneImEncryptionEn
} else {
int retval;
uint8_t *crypted_body = NULL;
char *selfUri = linphone_address_as_string_uri_only(linphone_chat_message_get_from_address(msg));
char *peerUri = linphone_address_as_string_uri_only(linphone_chat_room_get_peer_address(room));
char *peerUri = ms_strdup_printf("%s:%s@%s" , linphone_address_get_scheme(linphone_chat_room_get_peer_address(room))
, linphone_address_get_username(linphone_chat_room_get_peer_address(room))
, linphone_address_get_domain(linphone_chat_room_get_peer_address(room)));
char *selfUri = ms_strdup_printf("%s:%s@%s" , linphone_address_get_scheme(linphone_chat_message_get_from_address(msg))
, linphone_address_get_username(linphone_chat_message_get_from_address(msg))
, linphone_address_get_domain(linphone_chat_message_get_from_address(msg)));
retval = lime_createMultipartMessage(zrtp_cache_db, linphone_chat_message_get_content_type(msg), (uint8_t *)linphone_chat_message_get_text(msg), selfUri, peerUri, &crypted_body);
if (retval != 0) { /* fail to encrypt */
......
......@@ -2381,8 +2381,14 @@ void MediaSessionPrivate::initializeAudioStream () {
/* Initialize zrtp even if we didn't explicitely set it, just in case peer offers it */
if (linphone_core_media_encryption_supported(q->getCore()->getCCore(), LinphoneMediaEncryptionZRTP)) {
char *peerUri = linphone_address_as_string_uri_only((direction == LinphoneCallIncoming) ? log->from : log->to);
char *selfUri = linphone_address_as_string_uri_only((direction == LinphoneCallIncoming) ? log->to : log->from);
LinphoneAddress *peerAddr = (direction == LinphoneCallIncoming) ? log->from : log->to;
LinphoneAddress *selfAddr = (direction == LinphoneCallIncoming) ? log->to : log->from;
char *peerUri = ms_strdup_printf("%s:%s@%s" , linphone_address_get_scheme(peerAddr)
, linphone_address_get_username(peerAddr)
, linphone_address_get_domain(peerAddr));
char *selfUri = ms_strdup_printf("%s:%s@%s" , linphone_address_get_scheme(selfAddr)
, linphone_address_get_username(selfAddr)
, linphone_address_get_domain(selfAddr));
MSZrtpParams params;
memset(&params, 0, sizeof(MSZrtpParams));
/* media encryption of current params will be set later when zrtp is activated */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment