Commit f1f6fd7c authored by Ghislain MARY's avatar Ghislain MARY

Prevent crashes when printing string with null pointer.

parent 9a444a27
......@@ -152,17 +152,20 @@ const char* belle_sip_tester_private_key_passwd="secret";
static void process_auth_requested(void *user_ctx, belle_sip_auth_event_t *event){
BELLESIP_UNUSED(user_ctx);
if (belle_sip_auth_event_get_mode(event) == BELLE_SIP_AUTH_MODE_HTTP_DIGEST) {
const char *username = belle_sip_auth_event_get_username(event);
const char *realm = belle_sip_auth_event_get_realm(event);
belle_sip_message("process_auth_requested requested for [%s@%s]"
,belle_sip_auth_event_get_username(event)
,belle_sip_auth_event_get_realm(event));
,username?username:""
,realm?realm:"");
belle_sip_auth_event_set_passwd(event,"secret");
} else if (belle_sip_auth_event_get_mode(event) == BELLE_SIP_AUTH_MODE_TLS) {
const char *distinguished_name = NULL;
belle_sip_certificates_chain_t* cert = belle_sip_certificates_chain_parse(belle_sip_tester_client_cert,strlen(belle_sip_tester_client_cert),BELLE_SIP_CERTIFICATE_RAW_FORMAT_PEM);
belle_sip_signing_key_t* key = belle_sip_signing_key_parse(belle_sip_tester_private_key,strlen(belle_sip_tester_private_key),belle_sip_tester_private_key_passwd);
belle_sip_auth_event_set_client_certificates_chain(event,cert);
belle_sip_auth_event_set_signing_key(event,key);
belle_sip_message("process_auth_requested requested for DN[%s]"
,belle_sip_auth_event_get_distinguished_name(event));
distinguished_name = belle_sip_auth_event_get_distinguished_name(event);
belle_sip_message("process_auth_requested requested for DN[%s]",distinguished_name?distinguished_name:"");
} else {
belle_sip_error("Unexpected auth mode");
......
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