[mod_sofia] fix missing auth challange in 401 response #2648
+6
−68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This commit fixes issues #1779 and #2640
The bug was caused by the incoming subscribe handler calling directly
sofia_reg_parse_auth
with an exptime of 0, causing the nonce to get deleted from the db after hitting the nonce_ttl time. That by itself was wrong since the exptime should have been exptime + nonce-ttl, but the main problem was that the handler returned a 401 without an auth challenge.The fix was simple: instead of calling directly
sofia_reg_parse_auth
from the subscribe handler, it passes the authentication handling to thesofia_reg_handle_register
the same waysofia_handle_sip_i_invite
handler does.Bugs I noticed on the way:
sofia_handle_sip_i_invite
sets an exptime that is being used to calculate the nonce_ttlnonce_tll + exptime
and takes exptime from the expires header or from the contact header if exists or to a default value of 300.force-subscription-expires
after this commit) when setting the exptime.sofia::register_attempt
andsofia::register_failure
events on invitessofia_reg_handle_register_token
is meant for registration and is being called for invites as well