Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
7ec31734
Commit
7ec31734
authored
Jul 09, 2014
by
Guillaume BIENKOWSKI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect invalid URI's for remote provisioning
parent
c8d65fc4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
16 deletions
+25
-16
coreapi/remote_provisioning.c
coreapi/remote_provisioning.c
+14
-15
tester/rcfiles/marie_remote_invalid_uri_rc
tester/rcfiles/marie_remote_invalid_uri_rc
+3
-0
tester/remote_provisioning_tester.c
tester/remote_provisioning_tester.c
+8
-1
No files found.
coreapi/remote_provisioning.c
View file @
7ec31734
...
...
@@ -110,33 +110,32 @@ static void belle_request_process_auth_requested(void *ctx, belle_sip_auth_event
}
int
linphone_remote_provisioning_download_and_apply
(
LinphoneCore
*
lc
,
const
char
*
remote_provisioning_uri
)
{
const
char
*
file_path
=
strstr
(
remote_provisioning_uri
,
"file://"
);
if
(
file_path
==
remote_provisioning_uri
){
// We allow for 'local remote-provisioning' in case the file is to be opened from the hard drive
file_path
+=
strlen
(
"file://"
);
belle_generic_uri_t
*
uri
=
belle_generic_uri_parse
(
remote_provisioning_uri
);
const
char
*
scheme
=
uri
?
belle_generic_uri_get_scheme
(
uri
)
:
NULL
;
if
(
scheme
&&
(
strcmp
(
scheme
,
"file"
)
==
0
)
){
// We allow for 'local remote-provisioning' in case the file is to be opened from the hard drive.
const
char
*
file_path
=
remote_provisioning_uri
+
strlen
(
"file://"
);
// skip scheme
return
linphone_remote_provisioning_load_file
(
lc
,
file_path
);
}
else
{
belle_generic_uri_t
*
uri
=
belle_generic_uri_parse
(
remote_provisioning_uri
);
}
else
if
(
scheme
&&
strncmp
(
scheme
,
"http"
,
4
)
==
0
)
{
belle_http_request_listener_callbacks_t
belle_request_listener
=
{
0
};
belle_http_request_listener_t
*
listener
;
belle_http_request_t
*
request
;
belle_request_listener
.
process_response
=
belle_request_process_response_event
;
belle_request_listener
.
process_auth_requested
=
belle_request_process_auth_requested
;
belle_request_listener
.
process_io_error
=
belle_request_process_io_error
;
belle_request_listener
.
process_timeout
=
belle_request_process_timeout
;
listener
=
belle_http_request_listener_create_from_callbacks
(
&
belle_request_listener
,
lc
);
if
(
uri
==
NULL
)
{
belle_sip_error
(
"Invalid provisioning URI [%s]"
,
remote_provisioning_uri
);
return
-
1
;
}
request
=
belle_http_request_create
(
"GET"
,
uri
,
NULL
);
belle_http_provider_send_request
(
lc
->
http_provider
,
request
,
listener
);
return
0
;
return
belle_http_provider_send_request
(
lc
->
http_provider
,
request
,
listener
);
}
else
{
ms_error
(
"Invalid provisioning URI [%s] (missing scheme?)"
,
remote_provisioning_uri
);
return
-
1
;
}
}
...
...
tester/rcfiles/marie_remote_invalid_uri_rc
0 → 100644
View file @
7ec31734
[misc]
config-uri=/tmp/lol
tester/remote_provisioning_tester.c
View file @
7ec31734
...
...
@@ -77,6 +77,12 @@ static void remote_provisioning_invalid(void) {
linphone_core_manager_destroy
(
marie
);
}
static
void
remote_provisioning_invalid_uri
(
void
)
{
LinphoneCoreManager
*
marie
=
linphone_core_manager_new2
(
"marie_remote_invalid_uri_rc"
,
FALSE
);
CU_ASSERT_TRUE
(
wait_for
(
marie
->
lc
,
NULL
,
&
marie
->
stat
.
number_of_LinphoneConfiguringFailed
,
1
));
linphone_core_manager_destroy
(
marie
);
}
static
void
remote_provisioning_default_values
(
void
)
{
LinphoneProxyConfig
*
lpc
;
LinphoneCoreManager
*
marie
=
linphone_core_manager_new2
(
"marie_remote_default_values_rc"
,
FALSE
);
...
...
@@ -120,7 +126,8 @@ test_t remote_provisioning_tests[] = {
{
"Remote provisioning invalid"
,
remote_provisioning_invalid
},
{
"Remote provisioning transient successful"
,
remote_provisioning_transient
},
{
"Remote provisioning default values"
,
remote_provisioning_default_values
},
{
"Remote provisioning from file"
,
remote_provisioning_file
}
{
"Remote provisioning from file"
,
remote_provisioning_file
},
{
"Remote provisioning invalid URI"
,
remote_provisioning_invalid_uri
}
};
test_suite_t
remote_provisioning_test_suite
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment