mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Fix remote provisioning zero-length values. Fixes #1457 again.
This commit is contained in:
parent
6de4c89510
commit
3c32fd4397
5 changed files with 38 additions and 7 deletions
|
|
@ -497,10 +497,10 @@ void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *ke
|
|||
lp_item_set_value(item,value);
|
||||
else lp_section_remove_item(sec,item);
|
||||
}else{
|
||||
if (value!=NULL)
|
||||
if (value!=NULL && value[0] != '\0')
|
||||
lp_section_add_item(sec,lp_item_new(key,value));
|
||||
}
|
||||
}else if (value!=NULL){
|
||||
}else if (value!=NULL && value[0] != '\0'){
|
||||
sec=lp_section_new(section);
|
||||
lp_config_add_section(lpconfig,sec);
|
||||
lp_section_add_item(sec,lp_item_new(key,value));
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ struct _LinphoneCall
|
|||
bool_t playing_ringbacktone;
|
||||
bool_t ringing_beep; /* whether this call is ringing through an already existent current call*/
|
||||
bool_t auth_token_verified;
|
||||
|
||||
|
||||
bool_t defer_update;
|
||||
bool_t was_automatically_paused;
|
||||
bool_t ping_replied;
|
||||
|
|
@ -482,8 +482,8 @@ typedef enum _LinphoneIsComposingState {
|
|||
} LinphoneIsComposingState;
|
||||
|
||||
struct _LinphoneChatRoom{
|
||||
belle_sip_object_t base;
|
||||
void *user_data;
|
||||
belle_sip_object_t base;
|
||||
void *user_data;
|
||||
struct _LinphoneCore *lc;
|
||||
char *peer;
|
||||
LinphoneAddress *peer_url;
|
||||
|
|
@ -886,7 +886,7 @@ void linphone_core_invalidate_friend_subscriptions(LinphoneCore *lc);
|
|||
|
||||
void linphone_configuring_terminated(LinphoneCore *lc, LinphoneConfiguringState state, const char *message);
|
||||
int linphone_remote_provisioning_download_and_apply(LinphoneCore *lc, const char *remote_provisioning_uri);
|
||||
|
||||
int linphone_remote_provisioning_load_file( LinphoneCore* lc, const char* file_path);
|
||||
|
||||
/*****************************************************************************
|
||||
* Player interface
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ static void linphone_remote_provisioning_apply(LinphoneCore *lc, const char *xml
|
|||
, error_msg);
|
||||
}
|
||||
|
||||
static int linphone_remote_provisioning_load_file( LinphoneCore* lc, const char* file_path){
|
||||
int linphone_remote_provisioning_load_file( LinphoneCore* lc, const char* file_path){
|
||||
int status = -1;
|
||||
FILE* f = fopen(file_path, "r");
|
||||
|
||||
|
|
|
|||
7
tester/rcfiles/remote_zero_length_params_rc
Normal file
7
tester/rcfiles/remote_zero_length_params_rc
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config xmlns="http://www.linphone.org/xsds/lpconfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.linphone.org/xsds/lpconfig.xsd lpconfig.xsd">
|
||||
<section name="test">
|
||||
<entry name="zero_len" overwrite="true"></entry>
|
||||
<entry name="non_zero_len" overwrite="true">test</entry>
|
||||
</section>
|
||||
</config>
|
||||
|
|
@ -143,6 +143,29 @@ static void linphone_lpconfig_from_file_zerolen_value(){
|
|||
lp_config_destroy(conf);
|
||||
}
|
||||
|
||||
static void linphone_lpconfig_from_xml_zerolen_value(){
|
||||
static const char* zero_xml_file = "remote_zero_length_params_rc";
|
||||
char* xml_path = ms_strdup_printf("%s/rcfiles/%s", liblinphone_tester_file_prefix, zero_xml_file);
|
||||
LpConfig* conf;
|
||||
|
||||
LinphoneCoreManager* mgr = linphone_core_manager_new2("empty_rc",FALSE);
|
||||
|
||||
CU_ASSERT_EQUAL(linphone_remote_provisioning_load_file(mgr->lc, xml_path), 0);
|
||||
|
||||
conf = mgr->lc->config;
|
||||
|
||||
ms_error("ZERO: %s", lp_config_get_string(conf,"test","zero_len","LOL"));
|
||||
|
||||
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL");
|
||||
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test");
|
||||
|
||||
lp_config_set_string(conf, "test", "non_zero_len", ""); /* should remove "non_zero_len" */
|
||||
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL");
|
||||
|
||||
linphone_core_manager_destroy(mgr);
|
||||
|
||||
}
|
||||
|
||||
void linphone_proxy_config_address_equal_test() {
|
||||
LinphoneAddress *a = linphone_address_new("sip:toto@titi");
|
||||
LinphoneAddress *b = linphone_address_new("sips:toto@titi");
|
||||
|
|
@ -226,6 +249,7 @@ test_t setup_tests[] = {
|
|||
{ "LPConfig from buffer", linphone_lpconfig_from_buffer },
|
||||
{ "LPConfig zero_len value from buffer", linphone_lpconfig_from_buffer_zerolen_value },
|
||||
{ "LPConfig zero_len value from file", linphone_lpconfig_from_file_zerolen_value },
|
||||
{ "LPConfig zero_len value from XML", linphone_lpconfig_from_xml_zerolen_value },
|
||||
{ "Chat room", chat_root_test }
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue