[Asterisk-code-review] chan sip: Fix SUBSCRIBE with missing "Expires" header. (asterisk[13])
Corey Farrell
asteriskteam at digium.com
Tue Oct 24 11:03:36 CDT 2017
Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/6902
Change subject: chan_sip: Fix SUBSCRIBE with missing "Expires" header.
......................................................................
chan_sip: Fix SUBSCRIBE with missing "Expires" header.
When chan_sip receives a SUBSCRIBE request with no "Expires" header it
processes the request as an unsubscribe. This is incorrect, per RFC3264
when the "Expires" header is missing a default expiry should be used.
ASTERISK-18140
Change-Id: Ibf6dcd4fdd07a32c2bc38be1dd557981f08188b5
---
M channels/chan_sip.c
1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/02/6902/1
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index edaa387..a615b68 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -28460,7 +28460,13 @@
p->lastinvite = seqno;
}
if (!p->needdestroy) {
- p->expiry = atoi(sip_get_header(req, "Expires"));
+ const char *expires_str = sip_get_header(req, "Expires");
+
+ if (ast_strlen_zero(expires_str)) {
+ p->expiry = default_expiry;
+ } else {
+ p->expiry = atoi(expires_str);
+ }
/* check if the requested expiry-time is within the approved limits from sip.conf */
if (p->expiry > max_subexpiry) {
--
To view, visit https://gerrit.asterisk.org/6902
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf6dcd4fdd07a32c2bc38be1dd557981f08188b5
Gerrit-Change-Number: 6902
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171024/be5b8b69/attachment.html>
More information about the asterisk-code-review
mailing list