Commit c0696f78 authored by jehan's avatar jehan

zrtp cache migration must only take uri from local identity instead of whole...

zrtp cache migration must only take uri from local identity instead of whole LinphoneAddress, including display name.
parent 1ff50ec1
......@@ -6541,6 +6541,7 @@ void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook
}
void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){
LinphoneProxyConfig *proxy = linphone_core_get_default_proxy_config(lc);
if (lc->zrtp_secrets_cache != NULL) {
ms_free(lc->zrtp_secrets_cache);
}
......@@ -6548,7 +6549,7 @@ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){
lc->zrtp_secrets_cache=file ? ms_strdup(file) : NULL;
/* shall we perform cache migration ? */
if (!lp_config_get_int(lc->config,"sip","zrtp_cache_migration_done",FALSE)) {
if (proxy && !lp_config_get_int(lc->config,"sip","zrtp_cache_migration_done",FALSE)) {
char *tmpFile = reinterpret_cast<char *>(bctbx_malloc(strlen(file)+6));
/* check we have a valid xml cache file given in path */
FILE *CACHEFD = NULL;
......@@ -6579,12 +6580,13 @@ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){
/* migrate */
char *bkpFile = reinterpret_cast<char *>(bctbx_malloc(strlen(file)+6));
sprintf(bkpFile,"%s.bkp", file);
if ((ret = ms_zrtp_cache_migration((void *)cacheXml, linphone_core_get_zrtp_cache_db(lc), linphone_core_get_identity(lc))) == 0) {
char *selfURI = linphone_address_as_string_uri_only(linphone_proxy_config_get_identity_address(proxy));
if ((ret = ms_zrtp_cache_migration((void *)cacheXml, linphone_core_get_zrtp_cache_db(lc), selfURI)) == 0) {
ms_message("LIME/ZRTP cache migration successfull, obsolete xml file kept as backup in %s", bkpFile);
} else {
ms_error("LIME/ZRTP cache migration failed(returned -%x), start with a fresh cache, old one kept as backup in %s", -ret, bkpFile);
}
ms_free(selfURI);
/* rename the newly created sqlite3 file in to the given file name */
rename(file, bkpFile);
......
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