mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-19 12:08:11 +00:00
fix regression in remote provisioning (empty file was silently accepted)
This commit is contained in:
parent
776577c673
commit
b6cecd507a
4 changed files with 19 additions and 13 deletions
|
|
@ -481,8 +481,12 @@ LinphoneStatus linphone_config_read_file(LpConfig *lpconfig, const char *filenam
|
|||
return -1;
|
||||
}
|
||||
|
||||
static char* _linphone_config_xml_convert(LpConfig *lpc, xml2lpc_context *context, int result) {
|
||||
char* error_msg = NULL;
|
||||
static const char *xml_to_lpc_failed = "xml to lpc failed";
|
||||
static const char *invalid_xml = "invalid xml";
|
||||
static const char *empty_xml = "empty provisioning file";
|
||||
|
||||
static const char* _linphone_config_xml_convert(LpConfig *lpc, xml2lpc_context *context, int result) {
|
||||
const char* error_msg = NULL;
|
||||
if (result == 0) {
|
||||
result = xml2lpc_convert(context, lpc);
|
||||
if (result == 0) {
|
||||
|
|
@ -492,18 +496,18 @@ static char* _linphone_config_xml_convert(LpConfig *lpc, xml2lpc_context *contex
|
|||
}
|
||||
lp_config_sync(lpc);
|
||||
} else {
|
||||
error_msg = "xml to lpc failed";
|
||||
error_msg = xml_to_lpc_failed;
|
||||
}
|
||||
} else {
|
||||
error_msg = "invalid xml";
|
||||
error_msg = invalid_xml;
|
||||
}
|
||||
return error_msg;
|
||||
}
|
||||
|
||||
char* linphone_config_load_from_xml_file(LinphoneConfig *lpc, const char *filename) {
|
||||
const char* linphone_config_load_from_xml_file(LinphoneConfig *lpc, const char *filename) {
|
||||
xml2lpc_context *context = NULL;
|
||||
char* path = lp_realpath(filename, NULL);
|
||||
char* error_msg = NULL;
|
||||
const char* error_msg = NULL;
|
||||
|
||||
if (path) {
|
||||
context = xml2lpc_context_new(NULL, NULL);
|
||||
|
|
@ -526,22 +530,24 @@ static void xml2lpc_callback(void *ctx, xml2lpc_log_level level, const char *fmt
|
|||
bctbx_logv(BCTBX_LOG_DOMAIN, bctbx_level,fmt,list);
|
||||
}
|
||||
|
||||
char* _linphone_config_load_from_xml_string(LpConfig *lpc, const char *buffer) {
|
||||
const char* _linphone_config_load_from_xml_string(LpConfig *lpc, const char *buffer) {
|
||||
xml2lpc_context *context = NULL;
|
||||
char* error_msg = NULL;
|
||||
const char* error_msg = NULL;
|
||||
|
||||
if (buffer != NULL) {
|
||||
context = xml2lpc_context_new(xml2lpc_callback, NULL);
|
||||
error_msg = _linphone_config_xml_convert(lpc, context, xml2lpc_set_xml_string(context, buffer));
|
||||
}else{
|
||||
error_msg = empty_xml;
|
||||
}
|
||||
if (context) xml2lpc_context_destroy(context);
|
||||
return error_msg;
|
||||
}
|
||||
|
||||
LinphoneStatus linphone_config_load_from_xml_string(LpConfig *lpc, const char *buffer) {
|
||||
char *status;
|
||||
const char *status;
|
||||
if ((status =_linphone_config_load_from_xml_string(lpc,buffer))) {
|
||||
ms_error("%s",status);
|
||||
//ms_free(status)
|
||||
return -1;
|
||||
} else
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -2035,7 +2035,7 @@ LinphoneVideoDefinition * linphone_video_definition_new(unsigned int width, unsi
|
|||
LinphoneVideoDefinition * linphone_factory_find_supported_video_definition(const LinphoneFactory *factory, unsigned int width, unsigned int height);
|
||||
LinphoneVideoDefinition * linphone_factory_find_supported_video_definition_by_name(const LinphoneFactory *factory, const char *name);
|
||||
|
||||
char* _linphone_config_load_from_xml_string(LpConfig *lpc, const char *buffer);
|
||||
const char* _linphone_config_load_from_xml_string(LpConfig *lpc, const char *buffer);
|
||||
LinphoneNatPolicy * linphone_config_create_nat_policy_from_section(const LinphoneConfig *config, const char* section);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
|
||||
static void linphone_remote_provisioning_apply(LinphoneCore *lc, const char *xml) {
|
||||
char* error_msg = _linphone_config_load_from_xml_string(linphone_core_get_config(lc), xml);
|
||||
const char* error_msg = _linphone_config_load_from_xml_string(linphone_core_get_config(lc), xml);
|
||||
|
||||
linphone_configuring_terminated(lc
|
||||
,error_msg ? LinphoneConfiguringFailed : LinphoneConfiguringSuccessful
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ LINPHONE_PUBLIC LinphoneStatus linphone_config_read_file(LinphoneConfig *lpconfi
|
|||
* @param lpconfig The LinphoneConfig object to fill with the content of the file
|
||||
* @param filename The filename of the config file to read to fill the LinphoneConfig
|
||||
*/
|
||||
LINPHONE_PUBLIC char* linphone_config_load_from_xml_file(LinphoneConfig *lpc, const char *filename);
|
||||
LINPHONE_PUBLIC const char* linphone_config_load_from_xml_file(LinphoneConfig *lpc, const char *filename);
|
||||
|
||||
/**
|
||||
* Reads a xml config string and fill the LinphoneConfig with the read config dynamic values.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue