Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
18d21119
Commit
18d21119
authored
May 07, 2013
by
jehan
Browse files
add tls certificates tester
parent
8e124bc7
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
10 deletions
+71
-10
coreapi/bellesip_sal/sal_op_call.c
coreapi/bellesip_sal/sal_op_call.c
+4
-3
tester/flexisip.conf
tester/flexisip.conf
+1
-1
tester/liblinphone_tester.c
tester/liblinphone_tester.c
+6
-3
tester/multi_account_lrc
tester/multi_account_lrc
+1
-1
tester/pauline_rc
tester/pauline_rc
+2
-2
tester/register_tester.c
tester/register_tester.c
+57
-0
No files found.
coreapi/bellesip_sal/sal_op_call.c
View file @
18d21119
...
@@ -358,15 +358,16 @@ static void process_sdp_for_invite(SalOp* op,belle_sip_request_t* invite) {
...
@@ -358,15 +358,16 @@ static void process_sdp_for_invite(SalOp* op,belle_sip_request_t* invite) {
}
}
static
void
process_request_event
(
void
*
op_base
,
const
belle_sip_request_event_t
*
event
)
{
static
void
process_request_event
(
void
*
op_base
,
const
belle_sip_request_event_t
*
event
)
{
SalOp
*
op
=
(
SalOp
*
)
op_base
;
SalOp
*
op
=
(
SalOp
*
)
op_base
;
belle_sip_server_transaction_t
*
server_transaction
=
belle_sip_provider_create_server_transaction
(
op
->
base
.
root
->
prov
,
belle_sip_request_event_get_request
(
event
))
;
belle_sip_server_transaction_t
*
server_transaction
=
NULL
;
belle_sdp_session_description_t
*
sdp
;
belle_sdp_session_description_t
*
sdp
;
belle_sip_request_t
*
req
=
belle_sip_request_event_get_request
(
event
);
belle_sip_request_t
*
req
=
belle_sip_request_event_get_request
(
event
);
belle_sip_dialog_state_t
dialog_state
;
belle_sip_dialog_state_t
dialog_state
;
belle_sip_response_t
*
resp
;
belle_sip_response_t
*
resp
;
belle_sip_header_t
*
call_info
;
belle_sip_header_t
*
call_info
;
if
(
server_transaction
){
if
(
strcmp
(
"ACK"
,
belle_sip_request_get_method
(
req
))
!=
0
){
/*ACK does'nt create srv transaction*/
belle_sip_object_ref
(
server_transaction
);
/*ACK does'nt create srv transaction*/
server_transaction
=
belle_sip_provider_create_server_transaction
(
op
->
base
.
root
->
prov
,
belle_sip_request_event_get_request
(
event
));
belle_sip_object_ref
(
server_transaction
);
belle_sip_transaction_set_application_data
(
BELLE_SIP_TRANSACTION
(
server_transaction
),
op
);
belle_sip_transaction_set_application_data
(
BELLE_SIP_TRANSACTION
(
server_transaction
),
op
);
sal_op_ref
(
op
);
sal_op_ref
(
op
);
}
}
...
...
tester/flexisip.conf
View file @
18d21119
...
@@ -44,7 +44,7 @@ transports=sip:127.0.0.1:5060 sips:127.0.0.1:5061
...
@@ -44,7 +44,7 @@ transports=sip:127.0.0.1:5060 sips:127.0.0.1:5061
# Default value: /etc/flexisip/tls
# Default value: /etc/flexisip/tls
#tls-certificates-dir=/etc/flexisip/tls
#tls-certificates-dir=/etc/flexisip/tls
#tls-certificates-dir=/media/sf_workspaces/workspace-macosx/flexisip
#tls-certificates-dir=/media/sf_workspaces/workspace-macosx/flexisip
tls
-
certificates
-
dir
=/
Users
/
jehanmonnier
/
workspaces
/
workspace
-
macosx
/
flexisip
tls
-
certificates
-
dir
=/
Users
/
jehanmonnier
/
workspaces
/
workspace
-
sip
-
parser
/
linphone
-
private
/
tester
/
certificates
##
##
## STUN server parameters.
## STUN server parameters.
...
...
tester/liblinphone_tester.c
View file @
18d21119
...
@@ -108,13 +108,16 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c
...
@@ -108,13 +108,16 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c
char
filepath
[
256
];
char
filepath
[
256
];
char
ringpath
[
256
];
char
ringpath
[
256
];
char
ringbackpath
[
256
];
char
ringbackpath
[
256
];
char
rootcapath
[
256
];
sprintf
(
filepath
,
"%s/%s"
,
path
,
file
);
sprintf
(
filepath
,
"%s/%s"
,
path
,
file
);
lc
=
linphone_core_new
(
v_table
,
NULL
,
filepath
,
NULL
);
lc
=
linphone_core_new
(
v_table
,
NULL
,
filepath
,
NULL
);
linphone_core_set_user_data
(
lc
,
&
global_stat
);
linphone_core_set_user_data
(
lc
,
&
global_stat
);
counters
=
(
stats
*
)
linphone_core_get_user_data
(
lc
);
counters
=
(
stats
*
)
linphone_core_get_user_data
(
lc
);
/* until we have good certificates on our test server... */
/* until we have good certificates on our test server...
linphone_core_verify_server_certificates
(
lc
,
FALSE
);
linphone_core_verify_server_certificates(lc,FALSE);*/
sprintf
(
rootcapath
,
"%s/certificates/cacert.pem"
,
path
);
linphone_core_set_root_ca
(
lc
,
rootcapath
);
sprintf
(
ringpath
,
"%s/%s"
,
path
,
"oldphone.wav"
);
sprintf
(
ringpath
,
"%s/%s"
,
path
,
"oldphone.wav"
);
sprintf
(
ringbackpath
,
"%s/%s"
,
path
,
"ringback.wav"
);
sprintf
(
ringbackpath
,
"%s/%s"
,
path
,
"ringback.wav"
);
...
@@ -122,7 +125,7 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c
...
@@ -122,7 +125,7 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c
linphone_core_set_ringback
(
lc
,
ringbackpath
);
linphone_core_set_ringback
(
lc
,
ringbackpath
);
reset_counters
(
counters
);
reset_counters
(
counters
);
CU_ASSERT_EQUAL
(
ms_list_size
(
linphone_core_get_proxy_config_list
(
lc
)),
proxy_count
);
/*
CU_ASSERT_EQUAL(ms_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count);
*/
while
(
counters
->
number_of_LinphoneRegistrationOk
<
proxy_count
&&
retry
++
<
20
)
{
while
(
counters
->
number_of_LinphoneRegistrationOk
<
proxy_count
&&
retry
++
<
20
)
{
linphone_core_iterate
(
lc
);
linphone_core_iterate
(
lc
);
...
...
tester/multi_account_lrc
View file @
18d21119
...
@@ -29,7 +29,7 @@ passwd=secret
...
@@ -29,7 +29,7 @@ passwd=secret
realm="sip.example.org"
realm="sip.example.org"
[proxy_0]
[proxy_0]
reg_proxy=sip
.exampl
e.org;transport=tls
reg_proxy=sip
2.linphon
e.org;transport=tls
reg_identity=sip:pauline@sip.example.org
reg_identity=sip:pauline@sip.example.org
reg_expires=3600
reg_expires=3600
reg_sendregister=1
reg_sendregister=1
...
...
tester/pauline_rc
View file @
18d21119
...
@@ -14,8 +14,8 @@ realm="sip.example.org"
...
@@ -14,8 +14,8 @@ realm="sip.example.org"
[proxy_0]
[proxy_0]
reg_proxy=sip
.exampl
e.org;transport=tls
reg_proxy=sip
2.linphon
e.org;transport=tls
reg_route=sip
.exampl
e.org;transport=tls
;lr
reg_route=sip
2.linphon
e.org;transport=tls
reg_identity=sip:pauline@sip.example.org
reg_identity=sip:pauline@sip.example.org
reg_expires=3600
reg_expires=3600
reg_sendregister=1
reg_sendregister=1
...
...
tester/register_tester.c
View file @
18d21119
...
@@ -354,11 +354,68 @@ static void io_recv_error(){
...
@@ -354,11 +354,68 @@ static void io_recv_error(){
}
}
static
void
tls_certificate_failure
(){
LinphoneCoreVTable
v_table
;
LinphoneCore
*
lc
;
stats
stat
;
stats
*
counters
;
char
rootcapath
[
256
];
memset
(
&
v_table
,
0
,
sizeof
(
v_table
));
reset_counters
(
&
stat
);
v_table
.
registration_state_changed
=
registration_state_changed
;
lc
=
configure_lc_from
(
&
v_table
,
liblinphone_tester_file_prefix
,
"pauline_rc"
,
0
);
linphone_core_set_user_data
(
lc
,
&
stat
);
counters
=
(
stats
*
)
linphone_core_get_user_data
(
lc
);
sprintf
(
rootcapath
,
"%s/certificates/agent.pem"
,
liblinphone_tester_file_prefix
);
/*bad root ca*/
linphone_core_set_root_ca
(
lc
,
rootcapath
);
linphone_core_set_network_reachable
(
lc
,
TRUE
);
CU_ASSERT_TRUE
(
wait_for
(
lc
,
lc
,
&
stat
.
number_of_LinphoneRegistrationFailed
,
1
));
linphone_core_set_root_ca
(
lc
,
NULL
);
/*no root ca*/
linphone_core_refresh_registers
(
lc
);
CU_ASSERT_TRUE
(
wait_for
(
lc
,
lc
,
&
stat
.
number_of_LinphoneRegistrationFailed
,
2
));
sprintf
(
rootcapath
,
"%s/certificates/cacert.pem"
,
liblinphone_tester_file_prefix
);
/*goot root ca*/
linphone_core_set_root_ca
(
lc
,
rootcapath
);
linphone_core_refresh_registers
(
lc
);
CU_ASSERT_TRUE
(
wait_for
(
lc
,
lc
,
&
stat
.
number_of_LinphoneRegistrationOk
,
1
));
CU_ASSERT_EQUAL
(
stat
.
number_of_LinphoneRegistrationFailed
,
2
);
linphone_core_destroy
(
lc
);
}
/*
static void tls_with_non_tls_server(){
LinphoneCoreVTable v_table;
LinphoneCore* lc;
stats stat;
stats* counters;
LinphoneProxyConfig* proxy_cfg;
LinphoneAddress* addr;
char tmp[256];
memset (&v_table,0,sizeof(v_table));
reset_counters(&stat);
v_table.registration_state_changed=registration_state_changed;
lc = configure_lc_from(&v_table,liblinphone_tester_file_prefix, "marie_rc", 0);
linphone_core_set_user_data(lc,&stat);
counters = (stats*)linphone_core_get_user_data(lc);
linphone_core_get_default_proxy(lc,&proxy_cfg);
linphone_proxy_config_edit(proxy_cfg);
addr=linphone_address_new(linphone_proxy_config_get_addr(proxy_cfg));
snprintf(tmp,sizeof(tmp),"sip:%s:%i;transport=tls" ,linphone_address_get_domain(addr)
,linphone_address_get_port_int(addr));
linphone_proxy_config_set_server_addr(proxy_cfg,tmp);
linphone_proxy_config_done(proxy_cfg);
linphone_address_destroy(addr);
CU_ASSERT_TRUE(wait_for(lc,lc,&stat.number_of_LinphoneRegistrationFailed,1));
linphone_core_destroy(lc);
}*/
test_t
register_tests
[]
=
{
test_t
register_tests
[]
=
{
{
"Simple register"
,
simple_register
},
{
"Simple register"
,
simple_register
},
{
"TCP register"
,
simple_tcp_register
},
{
"TCP register"
,
simple_tcp_register
},
{
"TCP register compatibility mode"
,
simple_tcp_register_compatibility_mode
},
{
"TCP register compatibility mode"
,
simple_tcp_register_compatibility_mode
},
{
"TLS register"
,
simple_tls_register
},
{
"TLS register"
,
simple_tls_register
},
{
"TLS certificate not verified"
,
tls_certificate_failure
},
/* { "TLS with non tls server",tls_with_non_tls_server},*/
{
"Simple authenticated register"
,
simple_authenticated_register
},
{
"Simple authenticated register"
,
simple_authenticated_register
},
{
"Ha1 authenticated register"
,
ha1_authenticated_register
},
{
"Ha1 authenticated register"
,
ha1_authenticated_register
},
{
"Digest auth without initial credentials"
,
authenticated_register_with_no_initial_credentials
},
{
"Digest auth without initial credentials"
,
authenticated_register_with_no_initial_credentials
},
...
...
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