Commit 3e6134c3 authored by Danmei Chen's avatar Danmei Chen

add test in the suite refresher when server is available for two algo

parent 9b728847
......@@ -40,6 +40,8 @@ typedef struct _bctbx_list belle_sip_list_t;
#define belle_sip_list_find bctbx_list_find
#define belle_sip_list_free bctbx_list_free
#define belle_sip_list_free_with_data bctbx_list_free_with_data
#define belle_sip_list_delete_custom bctbx_list_delete_custom
#define belle_sip_list_first_elem bctbx_list_first_elem
#define belle_sip_compare_func bctbx_compare_func
#define belle_sip_list_find_custom bctbx_list_find_custom
......
......@@ -90,6 +90,9 @@ BELLESIP_EXPORT void belle_sip_auth_event_set_userid(belle_sip_auth_event_t* eve
BELLESIP_EXPORT const char* belle_sip_auth_event_get_realm(const belle_sip_auth_event_t* event);
BELLESIP_EXPORT void belle_sip_auth_event_set_realm(belle_sip_auth_event_t* event, const char* value);
BELLESIP_EXPORT const char* belle_sip_auth_event_get_algorithm(const belle_sip_auth_event_t* event);
BELLESIP_EXPORT void belle_sip_auth_event_set_algorithm(belle_sip_auth_event_t* event, const char* value);
BELLESIP_EXPORT const char* belle_sip_auth_event_get_domain(const belle_sip_auth_event_t* event);
BELLESIP_EXPORT void belle_sip_auth_event_set_domain(belle_sip_auth_event_t* event, const char* value);
......
......@@ -56,19 +56,6 @@ BELLESIP_EXPORT void belle_sip_provider_send_response(belle_sip_provider_t *p, b
BELLESIP_EXPORT void belle_sip_provider_clean_channels(belle_sip_provider_t *p);
/**
* Add auth info to the request if found
* @param p object
* @param request to be updated
* @param resp response to take authentication values from, might be NULL
* @param from_uri optional - an uri to use instead of the from of the request, which can be anonymous.
* @param auth_infos optional - A newly allocated belle_sip_auth_info_t object is added to this list. These object contains useful information like realm and username.
* @param realm optional - If an outbound proxy realm is used, nounce can be reused from previous request to avoid re-authentication.
* @returns 0 in case of success,
*
**/
BELLESIP_EXPORT int belle_sip_provider_add_authorization_for_algorithm(belle_sip_provider_t *p, belle_sip_request_t* request,belle_sip_response_t *resp, belle_sip_uri_t *from_uri, belle_sip_list_t** auth_infos, const char* realm, const char* algorithm);
/**
* Add auth info to the request if found
* @param p object
......
......@@ -79,21 +79,11 @@ BELLESIP_EXPORT void belle_sip_refresher_set_retry_after(belle_sip_refresher_t*
*/
BELLESIP_EXPORT const char* belle_sip_refresher_get_realm(const belle_sip_refresher_t* refresher);
/**
* returns algorithm of the outbound proxy used for authentication, if any
*/
BELLESIP_EXPORT const char* belle_sip_refresher_get_algorithm(const belle_sip_refresher_t* refresher);
/**
* Realm of the outbound proxy used for authentication, if any
*/
BELLESIP_EXPORT void belle_sip_refresher_set_realm(belle_sip_refresher_t* refresher, const char* realm);
/**
* algorithm of the outbound proxy used for authentication, if any
*/
BELLESIP_EXPORT void belle_sip_refresher_set_algorithm(belle_sip_refresher_t* refresher, const char* algorithm);
/**
* get current client transaction
* @param refresher object
......
......@@ -83,17 +83,6 @@ BELLESIP_EXPORT belle_sip_refresher_t* belle_sip_client_transaction_create_refre
* */
BELLESIP_EXPORT belle_sip_request_t* belle_sip_client_transaction_create_authenticated_request(belle_sip_client_transaction_t *t,belle_sip_list_t** auth_infos,const char* realm);
/**
* Create an authenticated request based on an existing terminated transaction.
* <br>This function, update cseq, put route set and try to fill authorization headers. Initial request is not cloned.
* @param transaction . must be in state completed
* @param auth_infos if auth infos cannot be added for an authenticate header,
* @param realm optional - If an outbound proxy realm is used, digestion authentication can be optimized.
* @param algo for different algorithm MD5 or SHA-256
* a newly allocated belle_sip_auth_info_t object is added to this list. These object contains useful information like realm and username. May be NULL
* */
BELLESIP_EXPORT belle_sip_request_t* belle_sip_client_transaction_create_authenticated_request_for_algorithm(belle_sip_client_transaction_t *t,belle_sip_list_t** auth_infos,const char* realm,const char* algo);
/**
* For transactions over unreliable transports, stop retransmissions. This avoids for example to keep sending INVITE retransmissions of a call that has just been terminated, while
* keeping the transaction alive in order to eventually let a response being handled, so that the transaction can be cancelled properly.
......
......@@ -29,6 +29,7 @@ GET_SET_STRING(belle_sip_auth_event,domain)
GET_SET_STRING(belle_sip_auth_event,passwd)
GET_SET_STRING(belle_sip_auth_event,ha1)
GET_SET_STRING(belle_sip_auth_event,distinguished_name)
GET_SET_STRING(belle_sip_auth_event, algorithm)
belle_sip_auth_event_t* belle_sip_auth_event_create(belle_sip_object_t *source, const char* realm, const belle_sip_uri_t *from_uri) {
belle_sip_auth_event_t* result = belle_sip_new0(belle_sip_auth_event_t);
......@@ -50,6 +51,7 @@ void belle_sip_auth_event_destroy(belle_sip_auth_event_t* event) {
DESTROY_STRING(event,passwd);
DESTROY_STRING(event,ha1);
DESTROY_STRING(event,distinguished_name);
DESTROY_STRING(event,algorithm);
if (event->cert) belle_sip_object_unref(event->cert);
if (event->key) belle_sip_object_unref(event->key);
......
......@@ -977,6 +977,7 @@ struct belle_sip_auth_event {
char* distinguished_name;
belle_sip_certificates_chain_t * cert;
belle_sip_signing_key_t* key;
char* algorithm; /* either MD5 ot SHA256*/
};
belle_sip_auth_event_t* belle_sip_auth_event_create(belle_sip_object_t *source, const char* realm,const belle_sip_uri_t * from_uri);
......
......@@ -1105,17 +1105,16 @@ static belle_sip_list_t* belle_sip_provider_get_auth_context_by_realm_or_call_id
static void belle_sip_provider_update_or_create_auth_context(belle_sip_provider_t *p,belle_sip_header_call_id_t* call_id,belle_sip_header_www_authenticate_t* authenticate,belle_sip_uri_t *from_uri,const char* realm) {
belle_sip_list_t* auth_context_lst = NULL;
authorization_context_t* auth_context;
authorization_context_t* auth_context;
for (auth_context_lst=belle_sip_provider_get_auth_context_by_realm_or_call_id(p,call_id,from_uri,realm);auth_context_lst!=NULL;auth_context_lst=auth_context_lst->next) {
for (auth_context_lst= belle_sip_provider_get_auth_context_by_realm_or_call_id(p,call_id,from_uri,realm);auth_context_lst!=NULL;auth_context_lst=auth_context_lst->next) {
auth_context=(authorization_context_t*)auth_context_lst->data;
if (strcmp(auth_context->realm,belle_sip_header_www_authenticate_get_realm(authenticate))==0) {
authorization_context_fill_from_auth(auth_context,authenticate,from_uri);
if (auth_context_lst) belle_sip_free(auth_context_lst);
return; /*only one realm is supposed to be found for now*/
}
if ((strcmp(auth_context->realm,belle_sip_header_www_authenticate_get_realm(authenticate))==0)&&((auth_context->algorithm==NULL)||strcmp(auth_context->algorithm,belle_sip_header_www_authenticate_get_algorithm(authenticate))==0)) {
authorization_context_fill_from_auth(auth_context,authenticate,from_uri);
if (auth_context_lst) belle_sip_free(auth_context_lst);
return; /*only one realm is supposed to be found for now*/
}
}
/*no auth context found, creating one*/
auth_context=belle_sip_authorization_create(call_id);
......@@ -1134,9 +1133,31 @@ static void belle_sip_provider_update_or_create_auth_context(belle_sip_provider
return;
}
static belle_sip_list_t* belle_sip_list_find_event(belle_sip_list_t* list, belle_sip_auth_event_t* auth_event){
for(;list!=NULL;list=list->next){
belle_sip_auth_event_t* ref_event = (belle_sip_auth_event_t*)list->data;
if((!strcmp(ref_event->realm, auth_event->realm))&&(!strcmp(ref_event->username, auth_event->username)))
return list;
}
return NULL;
}
static belle_sip_list_t* belle_sip_list_find_double_events(belle_sip_list_t* list, belle_sip_auth_event_t* auth_event){
belle_sip_list_t* ref_list;
belle_sip_list_t* ref_list2;
if((ref_list=belle_sip_list_find_event(list,auth_event))&&(ref_list2=belle_sip_list_find_event(ref_list->next,auth_event))){
belle_sip_auth_event_t* ref_event = (belle_sip_auth_event_t*)ref_list2->data;
/*delete which hasn't passwd*/
if(ref_event->passwd)
return ref_list;
else
return ref_list2;
}
return NULL;
}
int belle_sip_provider_add_authorization_for_algorithm(belle_sip_provider_t *p, belle_sip_request_t* request, belle_sip_response_t *resp,
belle_sip_uri_t *from_uri, belle_sip_list_t** auth_infos, const char* realm, const char* algorithm) {
int belle_sip_provider_add_authorization(belle_sip_provider_t *p, belle_sip_request_t* request, belle_sip_response_t *resp,
belle_sip_uri_t *from_uri, belle_sip_list_t** auth_infos, const char* realm) {
belle_sip_header_call_id_t* call_id;
belle_sip_list_t* auth_context_iterator;
belle_sip_list_t* authenticate_lst;
......@@ -1155,7 +1176,7 @@ int belle_sip_provider_add_authorization_for_algorithm(belle_sip_provider_t *p,
/*check params*/
if (!p || !request) {
belle_sip_error("belle_sip_provider_add_authorization bad parameters");
return-1;
return 0;
}
request_method=belle_sip_request_get_method(request);
......@@ -1194,6 +1215,7 @@ int belle_sip_provider_add_authorization_for_algorithm(belle_sip_provider_t *p,
/*get authenticates value from response*/
if (resp) {
belle_sip_list_t *it;
call_id = belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(resp),belle_sip_header_call_id_t);
/*searching for authentication headers*/
authenticate_lst = belle_sip_list_copy(belle_sip_message_get_headers(BELLE_SIP_MESSAGE(resp),BELLE_SIP_WWW_AUTHENTICATE));
......@@ -1216,15 +1238,16 @@ int belle_sip_provider_add_authorization_for_algorithm(belle_sip_provider_t *p,
, from_uri?belle_sip_uri_get_user(from_uri):"(null)"
, call_id?belle_sip_header_call_id_get_call_id(call_id):"(null)"
);
head=belle_sip_provider_get_auth_context_by_realm_or_call_id(p,call_id,from_uri,realm);
/*we assume there no existing auth headers*/
head=belle_sip_provider_get_auth_context_by_realm_or_call_id(p,call_id,from_uri,realm);
/*we assume there no existing auth headers*/
for (auth_context_iterator=head;auth_context_iterator!=NULL;auth_context_iterator=auth_context_iterator->next) {
/*clear auth info*/
auth_context=(authorization_context_t*)auth_context_iterator->data;
auth_event = belle_sip_auth_event_create((belle_sip_object_t*)p,auth_context->realm,from_uri);
/*put data*/
/*call listener*/
BELLE_SIP_PROVIDER_INVOKE_LISTENERS(p->listeners,process_auth_requested,auth_event);
belle_sip_auth_event_set_algorithm(auth_event, auth_context->algorithm);
/*put data*/
/*call listener*/
BELLE_SIP_PROVIDER_INVOKE_LISTENERS(p->listeners,process_auth_requested,auth_event);
if (auth_event->passwd || auth_event->ha1) {
if (!auth_event->userid) {
/*if no userid, username = userid*/
......@@ -1258,12 +1281,7 @@ int belle_sip_provider_add_authorization_for_algorithm(belle_sip_provider_t *p,
belle_sip_header_authorization_set_nonce(authorization,auth_context->nonce);
belle_sip_header_authorization_set_qop(authorization,auth_context->qop);
belle_sip_header_authorization_set_opaque(authorization,auth_context->opaque);
if(algorithm==NULL){
belle_sip_header_authorization_set_algorithm(authorization,auth_context->algorithm);
}
else {
belle_sip_header_authorization_set_algorithm(authorization,algorithm);
}
belle_sip_header_authorization_set_algorithm(authorization,auth_context->algorithm);
belle_sip_header_authorization_set_uri(authorization,(belle_sip_uri_t*)belle_sip_request_get_uri(request));
if (auth_context->qop){
......@@ -1274,7 +1292,7 @@ int belle_sip_provider_add_authorization_for_algorithm(belle_sip_provider_t *p,
size = belle_sip_auth_define_size(algo);
if (!size) {
belle_sip_error("Algorithm [%s] is not correct ", algo);
return -1;
return 0;
}
if (auth_event->ha1) {
ha1=auth_event->ha1;
......@@ -1288,15 +1306,18 @@ int belle_sip_provider_add_authorization_for_algorithm(belle_sip_provider_t *p,
belle_sip_object_unref(authorization);
} else
belle_sip_message_add_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_HEADER(authorization));
result=1;
} else {
belle_sip_message("No auth info found for call id [%s]",belle_sip_header_call_id_get_call_id(call_id));
}
result=1;
} else {
belle_sip_message("No auth info found for call id [%s]",belle_sip_header_call_id_get_call_id(call_id));
}
/*provides auth info in any cases, usefull even if found because auth info can contain wrong password*/
if (auth_infos) {
/*stored to give user information on realm/username which requires authentications*/
*auth_infos=belle_sip_list_append(*auth_infos,auth_event);
} else {
if (auth_infos) {
/*stored to give user information on realm/username which requires authentications*/
*auth_infos=belle_sip_list_append(*auth_infos,auth_event);
belle_sip_list_t* elem=belle_sip_list_find_double_events(*auth_infos,auth_event);
if(elem!=NULL)
*auth_infos=belle_sip_list_delete_link(*auth_infos,elem);
} else {
belle_sip_auth_event_destroy(auth_event);
}
}
......@@ -1304,11 +1325,6 @@ int belle_sip_provider_add_authorization_for_algorithm(belle_sip_provider_t *p,
return result;
}
int belle_sip_provider_add_authorization(belle_sip_provider_t *p, belle_sip_request_t* request, belle_sip_response_t *resp,
belle_sip_uri_t *from_uri, belle_sip_list_t** auth_infos, const char* realm) {
belle_sip_provider_add_authorization_for_algorithm(p,request,resp,from_uri,auth_infos,realm,NULL);
return 0;
}
void belle_sip_provider_set_recv_error(belle_sip_provider_t *prov, int recv_error) {
belle_sip_list_t *lps;
belle_sip_list_t *channels;
......
......@@ -55,8 +55,7 @@ struct belle_sip_refresher {
int number_of_retry; /*counter to count number of unsuccesfull retry, used to know when to retry*/
timer_purpose_t timer_purpose;
unsigned char manual;
unsigned int publish_pending;
char* algo;
unsigned int publish_pending;
};
static void set_or_update_dialog(belle_sip_refresher_t* refresher, belle_sip_dialog_t* dialog);
static int set_expires_from_trans(belle_sip_refresher_t* refresher);
......@@ -482,7 +481,7 @@ static int belle_sip_refresher_refresh_internal(belle_sip_refresher_t* refresher
belle_sip_header_cseq_set_seq_number(cseq,belle_sip_header_cseq_get_seq_number(cseq)+1);
}
} else {
request=belle_sip_client_transaction_create_authenticated_request_for_algorithm(refresher->transaction,auth_infos,refresher->realm,refresher->algo);
request=belle_sip_client_transaction_create_authenticated_request(refresher->transaction,auth_infos,refresher->realm);
}
if (requri){
/*case where we are redirected*/
......@@ -521,10 +520,9 @@ static int belle_sip_refresher_refresh_internal(belle_sip_refresher_t* refresher
belle_sip_message_set_body(BELLE_SIP_MESSAGE(request), NULL, 0);
belle_sip_message_remove_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_CONTENT_TYPE);
belle_sip_message_remove_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_CONTENT_LENGTH);
}
}
belle_sip_provider_add_authorization_for_algorithm(prov,request,old_response,NULL,auth_infos,refresher->realm,refresher->algo);
belle_sip_provider_add_authorization(prov,request,old_response,NULL,auth_infos,refresher->realm);
break;
}
case BELLE_SIP_DIALOG_TERMINATED: {
......@@ -817,10 +815,6 @@ const char* belle_sip_refresher_get_realm(const belle_sip_refresher_t* refresher
return refresher->realm;
}
const char* belle_sip_refresher_get_algorithm(const belle_sip_refresher_t* refresher){
return refresher->algo;
}
void belle_sip_refresher_set_realm(belle_sip_refresher_t* refresher, const char* realm) {
if (refresher->realm){
belle_sip_free(refresher->realm);
......@@ -831,16 +825,6 @@ void belle_sip_refresher_set_realm(belle_sip_refresher_t* refresher, const char*
}
}
void belle_sip_refresher_set_algorithm(belle_sip_refresher_t* refresher, const char* algorithm) {
if (refresher->algo){
belle_sip_free(refresher->algo);
refresher->algo = NULL;
}
if (algorithm!=NULL){
refresher->algo=belle_sip_strdup(algorithm);
}
}
const belle_sip_client_transaction_t* belle_sip_refresher_get_transaction(const belle_sip_refresher_t* refresher) {
return refresher->transaction;
}
......
......@@ -663,7 +663,7 @@ belle_sip_refresher_t* belle_sip_client_transaction_create_refresher(belle_sip_c
return belle_sip_refresher_new(t);
}
belle_sip_request_t* belle_sip_client_transaction_create_authenticated_request_for_algorithm(belle_sip_client_transaction_t *t,belle_sip_list_t** auth_infos,const char* realm, const char* algo) {
belle_sip_request_t* belle_sip_client_transaction_create_authenticated_request(belle_sip_client_transaction_t *t,belle_sip_list_t** auth_infos,const char* realm) {
belle_sip_request_t* initial_request=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(t));
belle_sip_request_t* req=belle_sip_request_clone_with_body(initial_request);
belle_sip_header_cseq_t* cseq=belle_sip_message_get_header_by_type(req,belle_sip_header_cseq_t);
......@@ -681,13 +681,10 @@ belle_sip_request_t* belle_sip_client_transaction_create_authenticated_request_f
belle_sip_message_remove_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_PROXY_AUTHORIZATION);
/*put auth header*/
belle_sip_provider_add_authorization_for_algorithm(t->base.provider,req,t->base.last_response,NULL,auth_infos,realm,algo);
belle_sip_provider_add_authorization(t->base.provider,req,t->base.last_response,NULL,auth_infos,realm);
return req;
}
belle_sip_request_t* belle_sip_client_transaction_create_authenticated_request(belle_sip_client_transaction_t *t,belle_sip_list_t** auth_infos,const char* realm){
return belle_sip_client_transaction_create_authenticated_request_for_algorithm(t,auth_infos,realm,NULL);
}
/*
rfc 3265
3.3.4. Dialog creation and termination
......
......@@ -156,7 +156,7 @@ static void server_process_request_event(void *obj, const belle_sip_request_even
belle_sip_header_via_t* via;
const char* raw_authenticate_digest;
const char* raw_proxy_authenticate_digest;
if((!strcmp(endpoint->algo,"MD5"))||(!strcmp(endpoint->algo,"MD_SHA"))){
if((endpoint->algo==NULL)||(!strcmp(endpoint->algo,"MD5"))||(!strcmp(endpoint->algo,"MD_SHA"))){
raw_authenticate_digest = "WWW-Authenticate: Digest "
"algorithm=MD5, realm=\"" SIPDOMAIN "\", opaque=\"1bc7f9097684320\"";
raw_proxy_authenticate_digest = "Proxy-Authenticate: Digest "
......@@ -321,7 +321,7 @@ static void server_process_request_event(void *obj, const belle_sip_request_even
}
resp=belle_sip_response_create_from_request(belle_sip_request_event_get_request(event),response_code);
if (www_authenticate){
if (!strcmp(endpoint->algo,"MD_SHA")){
if ((endpoint->algo!=NULL)&&(!strcmp(endpoint->algo,"MD_SHA"))){
two_www_authenticate = BELLE_SIP_HEADER_WWW_AUTHENTICATE(belle_sip_object_clone(BELLE_SIP_OBJECT(www_authenticate)));
belle_sip_header_www_authenticate_set_algorithm(two_www_authenticate, algo_ref);
belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp),BELLE_SIP_HEADER(two_www_authenticate));
......@@ -386,11 +386,12 @@ static void client_process_response_event(void *obj, const belle_sip_response_ev
//}
static void client_process_auth_requested(void *obj, belle_sip_auth_event_t *event){
BELLESIP_UNUSED(obj);
endpoint_t* endpoint = (endpoint_t*)obj;
belle_sip_message("process_auth_requested requested for [%s@%s]"
,belle_sip_auth_event_get_username(event)
,belle_sip_auth_event_get_realm(event));
belle_sip_auth_event_set_passwd(event,PASSWD);
if ((endpoint->algo==NULL)||((event->algorithm)&&(strcmp(endpoint->algo,event->algorithm))) == 0)
belle_sip_auth_event_set_passwd(event,PASSWD);
}
static void belle_sip_refresher_listener (belle_sip_refresher_t* refresher
......@@ -503,7 +504,7 @@ static belle_sip_refresher_t* refresher_base_with_body2( endpoint_t* client
}
if (client->realm
&&
belle_sip_provider_add_authorization_for_algorithm(client->provider, req, NULL, NULL,NULL, client->realm, client->algo)) {
belle_sip_provider_add_authorization(client->provider, req, NULL, NULL,NULL, client->realm)) {
}
trans=belle_sip_provider_create_client_transaction(client->provider,req);
......@@ -514,8 +515,6 @@ static belle_sip_refresher_t* refresher_base_with_body2( endpoint_t* client
client->refresher = refresher = belle_sip_client_transaction_create_refresher(trans);
if (client->realm)
belle_sip_refresher_set_realm(client->refresher, client->realm);
if (client->algo)
belle_sip_refresher_set_algorithm(client->refresher, client->algo);
} else {
if (server->auth == none) {
BC_ASSERT_TRUE(wait_for(server->stack,client->stack,&client->stat.twoHundredOk,1,1000));
......@@ -526,15 +525,14 @@ static belle_sip_refresher_t* refresher_base_with_body2( endpoint_t* client
BC_ASSERT_TRUE(wait_for(server->stack,client->stack,&client->stat.fourHundredSeven,1,1000));
}
/*update cseq*/
req=belle_sip_client_transaction_create_authenticated_request_for_algorithm(trans,NULL,NULL,client->algo);
req=belle_sip_client_transaction_create_authenticated_request(trans,NULL,NULL);
belle_sip_object_unref(trans);
trans=belle_sip_provider_create_client_transaction(client->provider,req);
belle_sip_object_ref(trans);
belle_sip_client_transaction_send_request(trans);
BC_ASSERT_TRUE(wait_for(server->stack,client->stack,&client->stat.twoHundredOk,1,1000));
}
client->refresher= refresher = belle_sip_client_transaction_create_refresher(trans);
belle_sip_refresher_set_algorithm(client->refresher, client->algo);
client->refresher= refresher = belle_sip_client_transaction_create_refresher(trans);
}
if (BC_ASSERT_PTR_NOT_NULL(refresher)) {
belle_sip_object_unref(trans);
......@@ -603,9 +601,15 @@ static void refresher_base_with_param(const char* method, unsigned char expire_i
refresher_base_with_param_and_body(method,expire_in_contact,auth_mode,FALSE,NULL,NULL,client_algo,server_algo);
}
static void register_test_with_param_for_algorithm(unsigned char expire_in_contact,auth_mode_t auth_mode,const char* client_algo,const char* server_algo) {
refresher_base_with_param("REGISTER",expire_in_contact,auth_mode,client_algo,server_algo);
}
static void register_test_with_param(unsigned char expire_in_contact,auth_mode_t auth_mode) {
refresher_base_with_param("REGISTER",expire_in_contact,auth_mode,"MD5","MD5");
register_test_with_param_for_algorithm(expire_in_contact,auth_mode,NULL,NULL);
}
static char *list = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<resource-lists xmlns=\"urn:ietf:params:xml:ns:resource-lists\"\n"
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"
......@@ -776,6 +780,18 @@ static void register_expires_in_contact_header_digest_auth(void) {
register_test_with_param(1,digest_auth);
}
static void register_expires_in_contact_header_digest_auth_sha256(void) {
register_test_with_param_for_algorithm(1,digest_auth,"SHA-256","SHA-256");
}
static void register_expires_in_contact_header_digest_md_sha(void) {
register_test_with_param_for_algorithm(1,digest_auth,"MD5","MD_SHA");
}
static void register_expires_in_contact_header_digest_md_sha256(void) {
register_test_with_param_for_algorithm(1,digest_auth,"SHA-256","MD_SHA");
}
static void register_with_failure(void) {
belle_sip_listener_callbacks_t client_callbacks;
belle_sip_listener_callbacks_t server_callbacks;
......@@ -1063,6 +1079,9 @@ test_t refresher_tests[] = {
TEST_NO_TAG("REGISTER Expires in Contact", register_expires_in_contact),
TEST_NO_TAG("REGISTER Expires header digest", register_expires_header_digest),
TEST_NO_TAG("REGISTER Expires in Contact digest auth", register_expires_in_contact_header_digest_auth),
TEST_NO_TAG("REGISTER Expires in Contact digest auth SHA-256", register_expires_in_contact_header_digest_auth_sha256),
TEST_NO_TAG("REGISTER Expires in Contact digest auth MD_SHA", register_expires_in_contact_header_digest_md_sha),
TEST_NO_TAG("REGISTER Expires in Contact digest auth MD_SHA-256", register_expires_in_contact_header_digest_md_sha256),
TEST_NO_TAG("REGISTER with failure", register_with_failure),
TEST_NO_TAG("REGISTER with early refresher",register_early_refresher),
TEST_NO_TAG("SUBSCRIBE", subscribe_test),
......
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