diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index 99c859f52..771155918 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -419,6 +419,11 @@ SalBodyHandler * sal_body_handler_get_part(const SalBodyHandler *body_handler, i return (SalBodyHandler *)belle_sip_list_nth_data(l, idx); } +const belle_sip_list_t * sal_body_handler_get_parts(const SalBodyHandler *body_handler) { + if (!sal_body_handler_is_multipart(body_handler)) return NULL; + return belle_sip_multipart_body_handler_get_parts(BELLE_SIP_MULTIPART_BODY_HANDLER(body_handler)); +} + SalBodyHandler * sal_body_handler_find_part_by_header(const SalBodyHandler *body_handler, const char *header_name, const char *header_value) { const belle_sip_list_t *l = belle_sip_multipart_body_handler_get_parts(BELLE_SIP_MULTIPART_BODY_HANDLER(body_handler)); for (; l != NULL; l = l->next) { diff --git a/coreapi/factory.c b/coreapi/factory.c index 1c52181ea..e316a93ba 100644 --- a/coreapi/factory.c +++ b/coreapi/factory.c @@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +#include "address/address-p.h" + // TODO: From coreapi. Remove me later. #include "private.h" @@ -145,6 +147,7 @@ LinphoneFactory *linphone_factory_get(void) { } void linphone_factory_clean(void){ + LinphonePrivate::AddressPrivate::clearSipAddressesCache(); if (_factory){ belle_sip_object_unref(_factory); _factory = NULL; diff --git a/coreapi/ringtoneplayer_ios.h b/coreapi/ringtoneplayer_ios.h index 37aa2b22e..fce0a16dc 100644 --- a/coreapi/ringtoneplayer_ios.h +++ b/coreapi/ringtoneplayer_ios.h @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. extern "C" { #endif -LinphoneRingtonePlayer* linphone_ringtoneplayer_ios_new(); +LinphoneRingtonePlayer* linphone_ringtoneplayer_ios_new(void); void linphone_ringtoneplayer_ios_destroy(LinphoneRingtonePlayer* rp); int linphone_ringtoneplayer_ios_start_with_cb(LinphoneRingtonePlayer* rp, const char* ringtone, int loop_pause_ms, LinphoneRingtonePlayerFunc end_of_ringtone, void * user_data); bool_t linphone_ringtoneplayer_ios_is_started(LinphoneRingtonePlayer* rp); diff --git a/src/c-wrapper/api/c-content.cpp b/src/c-wrapper/api/c-content.cpp index 393059486..6d6bdde34 100644 --- a/src/c-wrapper/api/c-content.cpp +++ b/src/c-wrapper/api/c-content.cpp @@ -254,22 +254,9 @@ static LinphoneContent * linphone_content_new_with_body_handler(SalBodyHandler * linphone_content_set_string_buffer(content, (char *)sal_body_handler_get_data(body_handler)); } else { belle_sip_multipart_body_handler_t *mpbh = BELLE_SIP_MULTIPART_BODY_HANDLER(body_handler); - list contents; - for (const belle_sip_list_t *parts = belle_sip_multipart_body_handler_get_parts(mpbh); parts; parts = parts->next) { - belle_sip_body_handler_t *part = BELLE_SIP_BODY_HANDLER(parts->data); - LinphoneContent *part_content = linphone_content_new_with_body_handler((SalBodyHandler *)part); - - const belle_sip_list_t *headers = belle_sip_body_handler_get_headers(part); - for (; headers != NULL; headers = headers->next) { - belle_sip_header_t *header = BELLE_SIP_HEADER(headers->data); - L_GET_CPP_PTR_FROM_C_OBJECT(part_content)->addHeader(belle_sip_header_get_name(header), belle_sip_header_get_unparsed_value(header)); - } - - contents.push_back(*L_GET_CPP_PTR_FROM_C_OBJECT(part_content)); - linphone_content_unref(part_content); - } - LinphonePrivate::Content multipartContent = LinphonePrivate::ContentManager::contentListToMultipart(contents); - linphone_content_set_string_buffer(content, multipartContent.getBodyAsUtf8String().c_str()); + char *body = belle_sip_object_to_string(mpbh); + linphone_content_set_string_buffer(content, body); + belle_sip_free(body); } if (sal_body_handler_get_encoding(body_handler)) linphone_content_set_encoding(content, sal_body_handler_get_encoding(body_handler)); diff --git a/src/c-wrapper/internal/c-sal.h b/src/c-wrapper/internal/c-sal.h index dd2e53f8f..ebf373229 100644 --- a/src/c-wrapper/internal/c-sal.h +++ b/src/c-wrapper/internal/c-sal.h @@ -647,6 +647,7 @@ size_t sal_body_handler_get_size(const SalBodyHandler *body_handler); void sal_body_handler_set_size(SalBodyHandler *body_handler, size_t size); bool_t sal_body_handler_is_multipart(const SalBodyHandler *body_handler); SalBodyHandler * sal_body_handler_get_part(const SalBodyHandler *body_handler, int idx); +const belle_sip_list_t * sal_body_handler_get_parts(const SalBodyHandler *body_handler); SalBodyHandler * sal_body_handler_find_part_by_header(const SalBodyHandler *body_handler, const char *header_name, const char *header_value); const char * sal_body_handler_get_header(const SalBodyHandler *body_handler, const char *header_name); diff --git a/src/chat/modifier/multipart-chat-message-modifier.cpp b/src/chat/modifier/multipart-chat-message-modifier.cpp index 1365d03f8..13041bdb4 100644 --- a/src/chat/modifier/multipart-chat-message-modifier.cpp +++ b/src/chat/modifier/multipart-chat-message-modifier.cpp @@ -20,14 +20,10 @@ // TODO: Remove me later. #include "private.h" -#include "address/address.h" #include "chat/chat-message/chat-message.h" -#include "chat/chat-room/chat-room.h" #include "content/content-type.h" -#include "content/header-param.h" +#include "content/content-manager.h" #include "content/file-transfer-content.h" -#include "logger/logger.h" -#include "core/core.h" #include "multipart-chat-message-modifier.h" @@ -44,85 +40,30 @@ ChatMessageModifier::Result MultipartChatMessageModifier::encode ( if (message->getContents().size() <= 1) return ChatMessageModifier::Result::Skipped; - LinphoneCore *lc = message->getChatRoom()->getCore()->getCCore(); - char tmp[64]; - lc->sal->create_uuid(tmp, sizeof(tmp)); - string boundary = tmp; - stringstream multipartMessage; - - multipartMessage << "--" << boundary; - for (Content *content : message->getContents()) { - multipartMessage << "\r\n"; - multipartMessage << "Content-Type: " << content->getContentType().asString() << "\r\n\r\n"; - multipartMessage << content->getBodyAsString() << "\r\n\r\n"; - multipartMessage << "--" << boundary; - } - multipartMessage << "--"; - - Content newContent; - ContentType newContentType(ContentType::Multipart); - newContentType.addParameter("boundary", boundary); - newContent.setContentType(newContentType); - newContent.setBody(multipartMessage.str()); - message->setInternalContent(newContent); + Content content = ContentManager::contentListToMultipart(message->getContents()); + message->setInternalContent(content); return ChatMessageModifier::Result::Done; } ChatMessageModifier::Result MultipartChatMessageModifier::decode (const shared_ptr &message, int &errorCode) { - if (message->getInternalContent().getContentType().getType() == "multipart") { - string boundary = message->getInternalContent().getContentType().getParameter("boundary").getValue(); - if (boundary.empty()) { - lError() << "Boundary parameter of content-type not found: " << message->getInternalContent().getContentType().asString(); - return ChatMessageModifier::Result::Error; - } - - boundary = "--" + boundary; - lInfo() << "Multipart boundary is " << boundary; - - const vector body = message->getInternalContent().getBody(); - string contentsString(body.begin(), body.end()); - - size_t pos = contentsString.find(boundary); - if (pos == string::npos) { - lError() << "Boundary not found in body !"; - return ChatMessageModifier::Result::Error; - } - - size_t start = pos + boundary.length() + 2; // 2 is the size of \r\n - size_t end; - do { - end = contentsString.find(boundary, start); - if (end != string::npos) { - string contentString = contentsString.substr(start, end - start); - - size_t contentTypePos = contentString.find(": ") + 2; // 2 is the size of : - size_t endOfLinePos = contentString.find("\r\n"); - if (contentTypePos >= endOfLinePos) { - lError() << "Content should start by a 'Content-Type: ' line !"; - continue; + if (message->getInternalContent().getContentType().isMultipart()) { + for (Content &c : ContentManager::multipartToContentList(message->getInternalContent())) { + Content *content; + if (c.getContentType() == ContentType::FileTransfer) { + content = new FileTransferContent(); + content->setContentType(c.getContentType()); + content->setContentDisposition(c.getContentDisposition()); + content->setContentEncoding(c.getContentEncoding()); + for (const pair &pair : c.getHeaders()) { + content->addHeader(pair.first, pair.second); } - string contentTypeString = contentString.substr(contentTypePos, endOfLinePos - contentTypePos); - ContentType contentType(contentTypeString); - - endOfLinePos += 4; // 4 is two time the size of \r\n - string contentBody = contentString.substr(endOfLinePos, contentString.length() - (endOfLinePos + 4)); // 4 is two time the size of \r\n - - Content *content; - if (contentType == ContentType::FileTransfer) { - content = new FileTransferContent(); - } else { - content = new Content(); - } - content->setContentType(contentType); - content->setBody(contentBody); - message->addContent(content); - - lInfo() << "Parsed and added content with type " << contentType.asString(); + content->setBodyFromUtf8(c.getBodyAsUtf8String()); + } else { + content = new Content(c); } - start = end + boundary.length() + 2; // 2 is the size of \r\n - } while (end != string::npos); - + message->addContent(content); + } return ChatMessageModifier::Result::Done; } return ChatMessageModifier::Result::Skipped; diff --git a/src/conference/handlers/local-conference-event-handler.cpp b/src/conference/handlers/local-conference-event-handler.cpp index 3ee3eb4cc..61ac70bce 100644 --- a/src/conference/handlers/local-conference-event-handler.cpp +++ b/src/conference/handlers/local-conference-event-handler.cpp @@ -108,7 +108,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyMultipart (int notifyId) static_cast(notifyId) ); - list contents; + list contents; for (const auto &eventLog : events) { Content content; content.setContentType(ContentType("application","conference-info")); @@ -182,7 +182,7 @@ string LocalConferenceEventHandlerPrivate::createNotifyMultipart (int notifyId) continue; } content.setBody(body); - contents.push_back(content); + contents.push_back(&content); } if (contents.empty()) diff --git a/src/content/content-manager.cpp b/src/content/content-manager.cpp index a3b63568e..d6a46f121 100644 --- a/src/content/content-manager.cpp +++ b/src/content/content-manager.cpp @@ -19,6 +19,10 @@ #include +#include "c-wrapper/c-wrapper.h" + +#include "linphone/api/c-content.h" + #include "content-manager.h" #include "content-type.h" #include "content/content.h" @@ -33,87 +37,47 @@ LINPHONE_BEGIN_NAMESPACE // ----------------------------------------------------------------------------- list ContentManager::multipartToContentList (const Content &content) { - string boundary = content.getContentType().getParameter("boundary").getValue().empty() ? MultipartBoundary : content.getContentType().getParameter("boundary").getValue(); - const string body = content.getBodyAsString(); - belle_sip_multipart_body_handler_t *mpbh = belle_sip_multipart_body_handler_new_from_buffer( - body.c_str(), body.length(), boundary.c_str() - ); - belle_sip_object_ref(mpbh); + LinphoneContent *cContent = L_GET_C_BACK_PTR(&content); + SalBodyHandler *sbh = sal_body_handler_ref(sal_body_handler_from_content(cContent)); list contents; - for (const belle_sip_list_t *parts = belle_sip_multipart_body_handler_get_parts(mpbh); parts; parts = parts->next) { - belle_sip_body_handler_t *part = BELLE_SIP_BODY_HANDLER(parts->data); - Content content; - - for (const belle_sip_list_t *it = belle_sip_body_handler_get_headers(part); it; it = it->next) { - belle_sip_header_t *header = BELLE_SIP_HEADER(it->data); - if (strcasecmp("Content-Type", belle_sip_header_get_name(header)) == 0) { - belle_sip_header_content_type_t * partContentType = BELLE_SIP_HEADER_CONTENT_TYPE(header); - content.setContentType(ContentType( - belle_sip_header_content_type_get_type(partContentType), - belle_sip_header_content_type_get_subtype(partContentType) - )); - } else { - content.addHeader(belle_sip_header_get_name(header), belle_sip_header_get_unparsed_value(header)); - } - } - - content.setBody(static_cast( - belle_sip_memory_body_handler_get_buffer(BELLE_SIP_MEMORY_BODY_HANDLER(part)) - )); - - contents.push_back(move(content)); + for (const belle_sip_list_t *parts = sal_body_handler_get_parts(sbh); parts; parts = parts->next) { + SalBodyHandler *part = (SalBodyHandler *)parts->data; + LinphoneContent *cContent = linphone_content_from_sal_body_handler(part); + Content *cppContent = L_GET_CPP_PTR_FROM_C_OBJECT(cContent); + contents.push_back(*cppContent); + linphone_content_unref(cContent); } - belle_sip_object_unref(mpbh); + sal_body_handler_unref(sbh); + linphone_content_unref(cContent); return contents; } -Content ContentManager::contentListToMultipart (const list &contents, const string &boundary) { +Content ContentManager::contentListToMultipart (const list &contents, const string &boundary) { belle_sip_multipart_body_handler_t *mpbh = belle_sip_multipart_body_handler_new( nullptr, nullptr, nullptr, boundary.c_str() ); - belle_sip_object_ref(mpbh); + mpbh = (belle_sip_multipart_body_handler_t *)belle_sip_object_ref(mpbh); - for (const auto &content : contents) { - const ContentType &contentType = content.getContentType(); - belle_sip_header_t *cContentType = BELLE_SIP_HEADER( - belle_sip_header_content_type_create( - contentType.getType().c_str(), - string(contentType.getSubType() + "; charset=\"UTF-8\"").c_str() - ) - ); - - const string body = content.getBodyAsString(); - belle_sip_memory_body_handler_t *mbh = belle_sip_memory_body_handler_new_copy_from_buffer( - body.c_str(), body.length(), nullptr, nullptr - ); - belle_sip_body_handler_add_header(BELLE_SIP_BODY_HANDLER(mbh), cContentType); - - for (const auto &header : content.getHeaders()) { - belle_sip_header_t *additionalHeader = BELLE_SIP_HEADER( - belle_sip_header_create( - header.first.c_str(), - header.second.c_str() - ) - ); - belle_sip_body_handler_add_header(BELLE_SIP_BODY_HANDLER(mbh), additionalHeader); - } - - belle_sip_multipart_body_handler_add_part(mpbh, BELLE_SIP_BODY_HANDLER(mbh)); + for (Content *content : contents) { + LinphoneContent *cContent = L_GET_C_BACK_PTR(content); + SalBodyHandler *sbh = sal_body_handler_from_content(cContent); + belle_sip_multipart_body_handler_add_part(mpbh, BELLE_SIP_BODY_HANDLER(sbh)); + linphone_content_unref(cContent); } - char *desc = belle_sip_object_to_string(mpbh); - Content content; - content.setBody(desc); - belle_sip_free(desc); + SalBodyHandler *sbh = (SalBodyHandler *)mpbh; + sal_body_handler_set_type(sbh, ContentType::Multipart.getType().c_str()); + sal_body_handler_set_subtype(sbh, ContentType::Multipart.getSubType().c_str()); + sal_body_handler_set_content_type_parameter(sbh, "boundary", boundary); + LinphoneContent *cContent = linphone_content_from_sal_body_handler(sbh); + Content *content = L_GET_CPP_PTR_FROM_C_OBJECT(cContent); + Content returnContent = *content; + linphone_content_unref(cContent); belle_sip_object_unref(mpbh); - ContentType contentType = ContentType::Multipart; - contentType.addParameter("boundary", boundary); - content.setContentType(contentType); - - return content; + return returnContent; } LINPHONE_END_NAMESPACE diff --git a/src/content/content-manager.h b/src/content/content-manager.h index 5b1d26365..d44c9c3ad 100644 --- a/src/content/content-manager.h +++ b/src/content/content-manager.h @@ -35,7 +35,7 @@ namespace { } namespace ContentManager { std::list multipartToContentList (const Content &content); - Content contentListToMultipart (const std::list &contents, const std::string &boundary = MultipartBoundary); + Content contentListToMultipart (const std::list &contents, const std::string &boundary = MultipartBoundary); } LINPHONE_END_NAMESPACE diff --git a/src/sal/call-op.cpp b/src/sal/call-op.cpp index 936eb983b..238e6d255 100644 --- a/src/sal/call-op.cpp +++ b/src/sal/call-op.cpp @@ -376,7 +376,7 @@ void SalCallOp::set_error(belle_sip_response_t* response, bool_t fatal){ int SalCallOp::vfu_retry_cb (void *user_data, unsigned int events) { SalCallOp *op=(SalCallOp *)user_data; op->send_vfu_request(); - op->ref(); + op->unref(); return BELLE_SIP_STOP; } @@ -476,7 +476,7 @@ void SalCallOp::process_response_cb(void *op_base, const belle_sip_response_even && strcmp("media_control+xml",belle_sip_header_content_type_get_subtype(header_content_type))==0) { unsigned int retry_in = rand() % 1001; // [0;1000] belle_sip_source_t *s=op->root->create_timer(vfu_retry_cb,op->ref(), retry_in, "vfu request retry"); - ms_message("Rejected vfu request on op [%p], just retry in [%ui] ms",op,retry_in); + ms_message("Rejected vfu request on op [%p], just retry in [%u] ms",op,retry_in); belle_sip_object_unref(s); }else { /*ignoring*/ diff --git a/tester/call_single_tester.c b/tester/call_single_tester.c index 68d935442..029f921b8 100644 --- a/tester/call_single_tester.c +++ b/tester/call_single_tester.c @@ -810,10 +810,22 @@ static void multiple_answers_call_with_media_relay(void) { /* Scenario is this: pauline calls marie, which is registered 2 times. * Both linphones answer at the same time, and only one should get the * call running, the other should be terminated */ - LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc" ); - LinphoneCoreManager* marie1 = linphone_core_manager_new( "marie_rc" ); - LinphoneCoreManager* marie2 = linphone_core_manager_new( "marie_rc" ); + LinphoneCoreManager* pauline = linphone_core_manager_new2( "pauline_tcp_rc", FALSE); + LinphoneCoreManager* marie1 = linphone_core_manager_new2( "marie_rc", FALSE); + LinphoneCoreManager* marie2 = linphone_core_manager_new2( "marie_rc", FALSE ); + /* This tests a feature of the proxy (nta_msg_ackbye()) that doesn't work with gruu. + * Actually nta_msg_ackbye() is deprecated because it is not the task of the proxy to handle the race conditions of 200 Ok arriving at the same time. + * It is the job of the user-agent, see test multiple_answers_call() above. + */ + linphone_core_remove_supported_tag(pauline->lc,"gruu"); + linphone_core_remove_supported_tag(marie1->lc,"gruu"); + linphone_core_remove_supported_tag(marie2->lc,"gruu"); + + linphone_core_manager_start(pauline, TRUE); + linphone_core_manager_start(marie1, TRUE); + linphone_core_manager_start(marie2, TRUE); + LinphoneCall* call1, *call2; bctbx_list_t* lcs = bctbx_list_append(NULL,pauline->lc); @@ -5829,6 +5841,10 @@ static void call_with_zrtp_configured_callee_base(LinphoneCoreManager *marie, Li } } +static bool_t is_matching_local_v4_or_v6(const char *ip, const char *localv4, const char *localv6){ + if (strlen(ip)==0) return FALSE; + return strcmp(ip, localv4) == 0 || strcmp(ip, localv6) == 0; +} /* * this test checks the 'dont_default_to_stun_candidates' mode, where the c= line is left to host @@ -5836,20 +5852,24 @@ static void call_with_zrtp_configured_callee_base(LinphoneCoreManager *marie, Li static void call_with_ice_with_default_candidate_not_stun(void){ LinphoneCoreManager * marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - char localip[LINPHONE_IPADDR_SIZE]; + char localip[LINPHONE_IPADDR_SIZE]={0}; + char localip6[LINPHONE_IPADDR_SIZE]={0}; bool_t call_ok; lp_config_set_int(linphone_core_get_config(marie->lc), "net", "dont_default_to_stun_candidates", 1); linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce); linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce); linphone_core_get_local_ip(marie->lc, AF_INET, NULL, localip); + linphone_core_get_local_ip(marie->lc, AF_INET6, NULL, localip6); call_ok = call(marie, pauline); if (call_ok){ check_ice(marie, pauline, LinphoneIceStateHostConnection); - BC_ASSERT_STRING_EQUAL(_linphone_call_get_local_desc(linphone_core_get_current_call(marie->lc))->addr, localip); - BC_ASSERT_STRING_EQUAL(_linphone_call_get_result_desc(linphone_core_get_current_call(pauline->lc))->addr, localip); - BC_ASSERT_STRING_EQUAL(_linphone_call_get_local_desc(linphone_core_get_current_call(marie->lc))->streams[0].rtp_addr, localip); - BC_ASSERT_STRING_EQUAL(_linphone_call_get_result_desc(linphone_core_get_current_call(pauline->lc))->streams[0].rtp_addr, ""); + BC_ASSERT_TRUE(is_matching_local_v4_or_v6(_linphone_call_get_local_desc(linphone_core_get_current_call(marie->lc))->addr, localip, localip6)); + BC_ASSERT_TRUE(is_matching_local_v4_or_v6(_linphone_call_get_local_desc(linphone_core_get_current_call(marie->lc))->streams[0].rtp_addr, localip, localip6)); + BC_ASSERT_TRUE(is_matching_local_v4_or_v6(_linphone_call_get_local_desc(linphone_core_get_current_call(marie->lc))->streams[0].rtp_addr, localip, localip6)); + BC_ASSERT_TRUE(is_matching_local_v4_or_v6(_linphone_call_get_result_desc(linphone_core_get_current_call(pauline->lc))->streams[0].rtp_addr, localip, localip6) + || is_matching_local_v4_or_v6(_linphone_call_get_result_desc(linphone_core_get_current_call(pauline->lc))->addr, localip, localip6) + ); } end_call(marie, pauline); linphone_core_manager_destroy(marie); diff --git a/tester/certificates/client/cert2.pem b/tester/certificates/client/cert2.pem index dc359d851..bec3c3668 100644 --- a/tester/certificates/client/cert2.pem +++ b/tester/certificates/client/cert2.pem @@ -1,35 +1,35 @@ Certificate: Data: Version: 3 (0x2) - Serial Number: 13 (0xd) + Serial Number: 16 (0x10) Signature Algorithm: sha256WithRSAEncryption Issuer: C=FR, ST=Some-State, L=Grenoble, O=Belledonne Communications, OU=LAB, CN=Jehan Monnier/emailAddress=jehan.monnier@belledonne-communications.com Validity - Not Before: Nov 17 11:09:48 2016 GMT - Not After : Nov 17 11:09:48 2017 GMT - Subject: C=FR, ST=Some-State, L=Lorien, O=Internet Widgits Pty Ltd, CN=sip:galadrielle@sip.example.org + Not Before: Mar 21 16:35:56 2018 GMT + Not After : Mar 18 16:35:56 2028 GMT + Subject: C=FR, ST=Lorien, O=Elfes, CN=sip:galadrielle@sip.example.org Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (2048 bit) Modulus: - 00:ae:3c:ab:f2:34:4b:dd:3e:96:b4:0f:76:61:5f: - 59:dd:d0:93:6f:05:04:a2:2e:f7:f5:2f:65:35:02: - f5:6f:ed:dd:46:bb:72:3e:7c:47:b5:37:15:1d:1d: - 90:a7:dc:0f:bf:cc:a8:58:43:86:fb:b8:c7:7e:13: - 7f:05:09:47:6b:bf:a1:d1:76:7d:7a:d3:09:3a:46: - 78:22:08:49:cd:02:8d:80:10:ee:d1:18:3c:e4:df: - 50:be:05:80:88:56:c3:d4:36:2c:05:5d:57:07:9a: - 4a:13:99:7f:46:d9:0b:dd:81:51:29:bd:8e:3a:55: - b2:33:f2:e6:3e:1c:ce:f9:2f:80:68:ca:5a:78:c5: - e1:27:4a:b4:0b:65:9b:24:ee:df:8c:16:f0:74:dc: - fe:a5:9f:52:5a:a1:f9:09:1d:47:00:d9:8a:84:72: - e2:19:7b:cb:cd:62:b3:44:e3:4f:cf:9b:1c:a1:bc: - 70:d3:e0:10:8b:f2:51:28:91:84:61:92:56:03:3a: - 2c:bf:11:8d:b6:4b:c8:4f:1c:e7:75:54:b9:cd:f3: - d5:be:6b:af:6e:9f:ca:77:45:44:5c:55:6a:23:49: - e0:52:fc:30:3d:a9:a8:66:f1:d8:d0:a8:5b:97:3c: - a7:de:70:db:7b:85:c1:f5:8e:54:3c:f8:0f:3a:9f: - 36:2d + 00:e5:0b:bd:b3:f7:e7:c2:1f:27:40:1f:57:7f:0b: + 47:67:08:54:aa:6f:78:f9:02:32:10:fa:0c:fd:4a: + 0f:3c:a3:f2:34:d0:60:93:1c:c5:fe:25:a5:66:7f: + 02:11:23:cc:98:b2:34:3e:1b:31:8a:f4:9d:d6:89: + a6:41:d5:8f:fc:db:24:0f:61:af:e2:15:7b:71:d7: + 10:3e:25:ea:a4:dd:f6:c5:6b:ac:b8:a8:f5:34:fe: + a2:7e:fc:8e:b5:99:55:2a:74:c4:55:3f:9a:ae:a0: + 62:b3:03:50:aa:39:dd:8c:62:22:ac:3d:0d:60:d0: + da:49:0d:31:79:01:e4:59:9b:54:d8:78:e6:90:3d: + 8a:d6:1b:6c:1f:4e:4e:d7:76:a2:16:e7:37:d8:c8: + cf:33:95:b9:eb:fe:e0:b5:10:6f:b6:0d:31:a5:d4: + d5:86:07:1b:05:43:f1:42:0b:f7:ba:20:96:45:48: + ec:6f:c9:29:8c:fe:15:55:d8:26:f2:20:c6:db:37: + 67:e6:42:de:4b:66:fa:68:a1:4c:6f:39:01:56:92: + 5c:7d:68:2d:58:85:4a:67:a5:03:cb:c5:1d:22:7c: + 00:24:cd:49:3b:68:af:1a:0f:cf:ed:09:9f:74:7a: + 54:69:6c:2e:bf:72:76:46:b0:26:24:14:e0:74:8e: + 0e:23 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: @@ -37,38 +37,37 @@ Certificate: Netscape Comment: OpenSSL Generated Certificate X509v3 Subject Key Identifier: - 33:D0:36:5B:62:9B:1C:4D:31:47:9E:C0:91:41:E3:AE:29:61:AB:DB + 22:E0:9B:5C:30:1A:B0:02:A3:88:63:73:16:01:60:E1:16:1A:8A:AD X509v3 Authority Key Identifier: keyid:06:5F:5D:C7:16:AF:62:F8:2D:6E:71:03:88:A0:D6:1D:2B:04:7F:BA Signature Algorithm: sha256WithRSAEncryption - ba:a1:0a:7e:8e:a6:1e:e8:3d:5f:da:28:a6:57:3e:cb:50:79: - 06:8f:19:1b:df:b0:d2:e6:12:1f:ef:a2:bd:de:40:07:e2:5d: - 3d:64:41:34:10:24:3c:85:62:8e:69:0c:99:89:b7:ce:a4:f6: - 08:6d:37:8a:51:98:bd:46:b7:1b:dd:b2:ba:f7:f4:2f:47:d5: - 74:3f:c5:fe:95:60:b3:42:51:4f:d1:ac:ed:a4:c6:f6:16:f3: - 49:b6:8d:64:7f:76:e1:95:5e:ef:eb:46:4b:d7:a5:59:1d:0d: - ba:c5:07:5f:c3:db:2e:40:aa:6e:34:0c:1a:1d:4b:72:e3:ac: - 61:b5 + 12:78:7f:19:e2:38:d1:aa:9d:fe:c7:30:fb:00:00:ce:ce:28: + 66:fc:fe:d2:fb:3c:f8:af:68:83:11:96:30:ab:97:f9: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KYz+FVXYJvIgxts3Z+ZC3ktm ++mihTG85AVaSXH1oLViFSmelA8vFHSJ8ACTNSTtorxoPz+0Jn3R6VGlsLr9ydkaw +JiQU4HSODiMCAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3Bl +blNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCLgm1wwGrACo4hj +cxYBYOEWGoqtMB8GA1UdIwQYMBaAFAZfXccWr2L4LW5xA4ig1h0rBH+6MA0GCSqG +SIb3DQEBCwUAA4GBABJ4fxniONGqnf7HMPsAAM7OKGb8/tL7PPivaIMRljCrl/nw +zQlnEk+fl605HKLS8ow4cb4fCsgSk4tC1xo6KW4BCFBEo8wJOWOQXyAJcKhw7ZEe +eBvzXC2EqG5x/zYL+rUmY4vUgEPwSomG1Tc7I8IrQBQE5mdepWFojgO3TM0W -----END CERTIFICATE----- diff --git a/tester/certificates/client/key2.pem b/tester/certificates/client/key2.pem index d6eab8da5..e3b6c9551 100644 --- a/tester/certificates/client/key2.pem +++ b/tester/certificates/client/key2.pem @@ -1,28 +1,28 @@ -----BEGIN PRIVATE KEY----- -MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCuPKvyNEvdPpa0 -D3ZhX1nd0JNvBQSiLvf1L2U1AvVv7d1Gu3I+fEe1NxUdHZCn3A+/zKhYQ4b7uMd+ -E38FCUdrv6HRdn160wk6RngiCEnNAo2AEO7RGDzk31C+BYCIVsPUNiwFXVcHmkoT -mX9G2QvdgVEpvY46VbIz8uY+HM75L4Boylp4xeEnSrQLZZsk7t+MFvB03P6ln1Ja -ofkJHUcA2YqEcuIZe8vNYrNE40/PmxyhvHDT4BCL8lEokYRhklYDOiy/EY22S8hP -HOd1VLnN89W+a69un8p3RURcVWojSeBS/DA9qahm8djQqFuXPKfecNt7hcH1jlQ8 -+A86nzYtAgMBAAECggEAHyf8O0A8vKA/hI0rRvgs8qwkYPrNvE6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CICXCGSSutKBT8FRkCgYEA7zHsqzvBmJS8T57lNPBCqmpFI6viR5Vu +qza6zlJLSP7OTlWBiQ+coq4YmsAv2pF+i9j4VDizf77nF2tkNcC/2CJk70oXxj/Y +ahci9M5xnX9WyPn9x53clepT+XXUQ8yW/OvjKUc5gut1g5OZFsjGmWFk/EkzJLSz +p5lXMJl4iJsCgYA+5FQfpQmkup6d/15HXclgNRjsd/ne1jWSK7sOfmDuYrvFjqeE +dMHJz+iCDM8wv2omNLTUmNn64iL65gX9azmVQXbn+0mop0CtE2xTa81rm+7pNW9q +NRXZk8t11HtMKiRHq8zQG7qzvO95qa+5RIi7ZiESbxKXyWTKdQgx1mBuUQKBgHy1 +gdhRIoGj4n58sLImJgvltkB/6E08KuQXd9QEcf4P445R5GSKgDcNIATm+MwzGVBe +gjKfEW8kICZEto2T/jH41Lkx3y1csj+16mLKk8/yyVOli1wdARokfz3L4iyrKXma +nugxm1mX28ALH0ES0wC7F8S1gXW8xQI3346WJZLLAoGBALXykdDntTZ6RG5ahvQx +rLTr95sLxyujG2oyn7hatPcAfvqFatx2m+FiYVDw5x511XHJ49oFsxQ/+kiZrojJ +eKPvsy2gP8EievsEtK5+YDSkZQtZjzP65lOHd8g/0AmQGmO7RQ456GoG4qAhRc7+ +YwPlbSK0lTSXxcloSc2WW6ak -----END PRIVATE KEY----- diff --git a/tester/certificates/cn/openssl-cn.cnf b/tester/certificates/cn/openssl-cn.cnf index 908f6ed4c..fcfe5ef5f 100644 --- a/tester/certificates/cn/openssl-cn.cnf +++ b/tester/certificates/cn/openssl-cn.cnf @@ -70,7 +70,7 @@ cert_opt = ca_default # Certificate field options # crlnumber must also be commented out to leave a V1 CRL. # crl_extensions = crl_ext -default_days = 365 # how long to certify for +default_days = 3650 # how long to certify for default_crl_days= 30 # how long before next CRL default_md = default # use public key default MD preserve = no # keep passed DN ordering diff --git a/tester/content-manager-tester.cpp b/tester/content-manager-tester.cpp index e21cc6399..de371dfb4 100644 --- a/tester/content-manager-tester.cpp +++ b/tester/content-manager-tester.cpp @@ -27,7 +27,7 @@ using namespace LinphonePrivate; using namespace std; -static const char* multipart = \ +static const char* source_multipart = \ "-----------------------------14737809831466499882746641449\r\n" \ "Content-Type: application/rlmi+xml;charset=\"UTF-8\"\r\n\r\n" \ "" \ @@ -95,6 +95,78 @@ static const char* multipart = \ "" \ "-----------------------------14737809831466499882746641449--\r\n"; +static const char* generated_multipart = \ +"-----------------------------14737809831466499882746641449\r\n" \ +"Content-Type: application/rlmi+xml;charset=\"UTF-8\"\r\n\r\n" \ +"Content-Length:582" \ +"" \ +"" \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +"" \ +"-----------------------------14737809831466499882746641449\r\n" \ +"Content-Type: application/pidf+xml;charset=\"UTF-8\"\r\n\r\n" \ +"Content-Length:561" \ +"" \ +"" \ +" " \ +" " \ +" open" \ +" " \ +" sip:+YYYYYYYYYY@sip.linphone.org;user=phone" \ +" 2017-10-25T13:18:26" \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +"" \ +"-----------------------------14737809831466499882746641449\r\n" \ +"Content-Type: application/pidf+xml;charset=\"UTF-8\"\r\n\r\n" \ +"Content-Length:561" \ +"" \ +"" \ +" " \ +" " \ +" open" \ +" " \ +" sip:+XXXXXXXXXX@sip.linphone.org;user=phone" \ +" 2017-10-25T13:18:26" \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +"" \ +"-----------------------------14737809831466499882746641449\r\n" \ +"Content-Type: application/pidf+xml;charset=\"UTF-8\"\r\n\r\n" \ +"Content-Length:546" \ +"" \ +"" \ +" " \ +" " \ +" open" \ +" " \ +" sip:someone@sip.linphone.org" \ +" 2017-10-25T13:18:26" \ +" " \ +" " \ +" " \ +" " \ +" " \ +" " \ +"" \ +"-----------------------------14737809831466499882746641449--\r\n"; + static const char* part1 = \ "" \ "" \ @@ -162,7 +234,7 @@ static const char* part4 = \ void multipart_to_list () { Content multipartContent; - multipartContent.setBody(multipart); + multipartContent.setBody(source_multipart); multipartContent.setContentType(ContentType("multipart", "related")); list contents = ContentManager::multipartToContentList(multipartContent); @@ -234,29 +306,33 @@ void multipart_to_list () { generatedStr4.erase(std::remove(generatedStr4.begin(), generatedStr4.end(), '\r'), generatedStr4.end()); generatedStr4.erase(std::remove(generatedStr4.begin(), generatedStr4.end(), '\n'), generatedStr4.end()); ms_message("\n\n----- Generated part 4 -----"); - ms_message("%s", generatedStr3.c_str()); + ms_message("%s", generatedStr4.c_str()); ms_message("\n\n----- Original part 4 -----"); ms_message("%s", originalStr4.c_str()); BC_ASSERT_TRUE(originalStr4 == generatedStr4); } void list_to_multipart () { + ContentType contentType = ContentType("application", "rlmi+xml"); + contentType.addParameter("charset", "\"UTF-8\""); Content content1; content1.setBody(part1); - content1.setContentType(ContentType("application", "rlmi+xml")); + content1.setContentType(contentType); + contentType = ContentType("application", "pidf+xml"); + contentType.addParameter("charset", "\"UTF-8\""); Content content2; content2.setBody(part2); - content2.setContentType(ContentType("application", "pidf+xml")); + content2.setContentType(contentType); Content content3; content3.setBody(part3); - content3.setContentType(ContentType("application", "pidf+xml")); + content3.setContentType(contentType); Content content4; content4.setBody(part4); - content4.setContentType(ContentType("application", "pidf+xml")); - list contents = {content1, content2, content3, content4}; + content4.setContentType(contentType); + list contents = {&content1, &content2, &content3, &content4}; Content multipartContent = ContentManager::contentListToMultipart(contents); - string originalStr(multipart); + string originalStr(generated_multipart); originalStr.erase(std::remove(originalStr.begin(), originalStr.end(), ' '), originalStr.end()); originalStr.erase(std::remove(originalStr.begin(), originalStr.end(), '\t'), originalStr.end()); originalStr.erase(std::remove(originalStr.begin(), originalStr.end(), '\r'), originalStr.end()); diff --git a/tester/flexisip_tester.c b/tester/flexisip_tester.c index ef21a90ea..19bdbe9d7 100644 --- a/tester/flexisip_tester.c +++ b/tester/flexisip_tester.c @@ -1257,9 +1257,10 @@ static void tls_client_auth_try_register(const char *identity, bool_t with_good_ }else{ BC_ASSERT_TRUE(wait_for(lcm->lc, NULL, &lcm->stat.number_of_LinphoneRegistrationFailed, 1)); BC_ASSERT_EQUAL(lcm->stat.number_of_LinphoneRegistrationOk,0, int, "%d"); - /*we should expect 2 "auth_requested": one for the TLS certificate, another one because the server rejects the REGISTER with 401.*/ + /*we should expect at least 2 "auth_requested": one for the TLS certificate, another one because the server rejects the REGISTER with 401, + with eventually MD5 + SHA256 challenge*/ /*If the certificate isn't recognized at all, the connection will not happen and no SIP response will be received from server.*/ - if (with_good_cert) BC_ASSERT_EQUAL(lcm->stat.number_of_auth_info_requested,2, int, "%d"); + if (with_good_cert) BC_ASSERT_GREATER(lcm->stat.number_of_auth_info_requested,2, int, "%d"); else BC_ASSERT_EQUAL(lcm->stat.number_of_auth_info_requested,1, int, "%d"); } diff --git a/tester/setup_tester.c b/tester/setup_tester.c index e022f225d..b10705004 100644 --- a/tester/setup_tester.c +++ b/tester/setup_tester.c @@ -43,14 +43,16 @@ static const char *sFriends[S_SIZE_FRIEND] = { }; static void _create_friends_from_tab(LinphoneCore *lc, LinphoneFriendList *list, const char *friends[], const unsigned int size) { - for (unsigned int i = 0 ; i < size ; i++) { + unsigned int i; + for (i = 0 ; i < size ; i++) { LinphoneFriend *fr = linphone_core_create_friend_with_address(lc, friends[i]); linphone_friend_list_add_friend(list, fr); } } static void _remove_friends_from_list(LinphoneFriendList *list, const char *friends[], const unsigned int size) { - for (unsigned int i = 0 ; i < size ; i++) { + unsigned int i; + for (i = 0 ; i < size ; i++) { LinphoneFriend *fr = linphone_friend_list_find_friend_by_uri(list, friends[i]); if (fr) linphone_friend_list_remove_friend(list, fr); } @@ -81,7 +83,8 @@ static void _check_friend_result_list(LinphoneCore *lc, const bctbx_list_t *resu } } else { const bctbx_list_t *callLog = linphone_core_get_call_logs(lc); - for (const bctbx_list_t *f = callLog ; f != NULL ; f = bctbx_list_next(f)) { + const bctbx_list_t *f; + for (f = callLog ; f != NULL ; f = bctbx_list_next(f)) { LinphoneCallLog *log = (LinphoneCallLog*)(f->data); const LinphoneAddress *addr = (linphone_call_log_get_dir(log) == LinphoneCallIncoming) ? linphone_call_log_get_from_address(log) : linphone_call_log_get_to_address(log); @@ -842,11 +845,13 @@ static void search_friend_large_database(void) { char searchedFriend[] = {"6295103032641994169"}; char subBuff[30]; LinphoneCoreManager* manager = linphone_core_manager_new2("empty_rc", FALSE); + unsigned int i; + linphone_core_set_friends_database_path(manager->lc, dbPath); magicSearch = linphone_magic_search_new(manager->lc); - for (unsigned int i = 1; i < sizeof(searchedFriend) ; i++) { + for (i = 1; i < sizeof(searchedFriend) ; i++) { memcpy(subBuff, &searchedFriend, i); subBuff[i] = '\0'; liblinphone_tester_clock_start(&start); diff --git a/tester/tester.c b/tester/tester.c index 92fc68a86..c47cff87f 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -842,6 +842,7 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph linphone_core_iterate(callee->lc); linphone_call_stats_unref(stats1); linphone_call_stats_unref(stats2); + stats1 = stats2 = NULL; } ms_usleep(20000); } while (!liblinphone_tester_clock_elapsed(&ts,10000)); @@ -870,6 +871,7 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph linphone_core_iterate(callee->lc); linphone_call_stats_unref(stats1); linphone_call_stats_unref(stats2); + stats1 = stats2 = NULL; } ms_usleep(20000); } while (!liblinphone_tester_clock_elapsed(&ts,10000));