Skip to content

Commit

Permalink
Make sure the WWW-Authentication header exists when handling REGISTER…
Browse files Browse the repository at this point in the history
… challenges (fixes meetecho#2419)
  • Loading branch information
lminiero authored and PauKerr committed Nov 11, 2020
1 parent 493e75d commit 57fc222
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/janus_sip.c
Original file line number Diff line number Diff line change
Expand Up @@ -5479,11 +5479,19 @@ void janus_sip_sofia_callback(nua_event_t event, int status, char const *phrase,
if(status == 401) {
/* Get scheme/realm from 401 error */
sip_www_authenticate_t const* www_auth = sip->sip_www_authenticate;
if(www_auth == NULL) {
/* No WWW-Authenticate header, give up */
goto auth_failed;
}
scheme = www_auth->au_scheme;
realm = msg_params_find(www_auth->au_params, "realm=");
} else {
/* Get scheme/realm from 407 error, proxy-auth */
sip_proxy_authenticate_t const* proxy_auth = sip->sip_proxy_authenticate;
if(proxy_auth == NULL) {
/* No Proxy-Authenticate header, give up */
goto auth_failed;
}
scheme = proxy_auth->au_scheme;
realm = msg_params_find(proxy_auth->au_params, "realm=");
}
Expand Down Expand Up @@ -5517,6 +5525,7 @@ void janus_sip_sofia_callback(nua_event_t event, int status, char const *phrase,
NUTAG_AUTH(auth),
TAG_END());
} else if(status >= 400) {
auth_failed:
/* Authentication failed? */
session->account.registration_status = janus_sip_registration_status_failed;
/* Cleanup registration values */
Expand Down

0 comments on commit 57fc222

Please sign in to comment.