Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sipreg: skip digest challenge for de-register #49

Merged
merged 1 commit into from
Dec 4, 2020

Conversation

njeisecke
Copy link

The dialog will stop after sending the REGISTER with expires=0
(de-register). So the 401 unauthorized response does not trigger another
REGISTER as it would usually be the case.

So in order to allow proper de-register, include auth in this case.

src/sipreg/reg.c Outdated
sip_auth_reset(reg->auth);
/* the dialog will stop in case of a de-registration so we
* must skip the digest challenge */
if (!reg->terminated)
Copy link
Collaborator

@cspiel1 cspiel1 Dec 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous commit was mine d8cfc30. We checked again if a re-REGISTER should start with a new digest challenge and found that it might not be necessary. We found this examples:

I tested with https://routr.io/ and sip.linphone.org without the sip_auth_reset() call. Then the nonce is reused. The cnonce and the digest response is updated. Would I saw is these SIP proxies accept the re-REGISTER with the old nonce.

Let's suppose that the SIP registrar does not accept the old nonce. Then it will answer with a Status 401 and then we start a new digest challenge. So it would also work.

So we think that line 300 (the call to sip_auth_reset()) should be completely removed. It will reactivate the old behavior before the commit d8cfc30.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't mind that. Should I update the PR?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say yes. We suggest to remove the line completely.

For a re-register an expired nonce will automatically result in 401
anyway, so no need to force that.

For a de-register the dialog will be stopped after sending the REGISTER
with expires=0 so in case of an 401 response we're out of luck anyway
and the server must do its house-keeping.
@cspiel1
Copy link
Collaborator

cspiel1 commented Dec 3, 2020

Looks good now.

@sreimers sreimers merged commit a9e1ffe into baresip:master Dec 4, 2020
@njeisecke
Copy link
Author

Thanks!

@sreimers sreimers added this to the v2.0.0 milestone Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants