[asterisk-commits] irroot: branch 10 r340770 - /branches/10/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 13 03:46:52 CDT 2011
Author: irroot
Date: Thu Oct 13 03:46:47 2011
New Revision: 340770
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=340770
Log:
Only send MWI Notify on register if the registration is successful.
lastmsgssent was removed from chan_sip and the old behavior of
sending a mwi notify on register [except when subscribemwi is set]
was restored but this must only happen when registration succeeds.
leaking information for unsuccessful registrations is not secure.
Modified:
branches/10/channels/chan_sip.c
Modified: branches/10/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/chan_sip.c?view=diff&rev=340770&r1=340769&r2=340770
==============================================================================
--- branches/10/channels/chan_sip.c (original)
+++ branches/10/channels/chan_sip.c Thu Oct 13 03:46:47 2011
@@ -14554,6 +14554,7 @@
struct sip_request *req, const char *uri)
{
enum check_auth_result res = AUTH_NOT_FOUND;
+ int sendmwi = 0;
struct sip_peer *peer;
char tmp[256];
char *name = NULL, *c, *domain = NULL, *dummy = NULL;
@@ -14650,6 +14651,7 @@
ast_string_field_set(p, fullcontact, peer->fullcontact);
transmit_response_with_date(p, "200 OK", req);
res = 0;
+ sendmwi = 1;
break;
case PARSE_REGISTER_UPDATE:
ast_string_field_set(p, fullcontact, peer->fullcontact);
@@ -14657,6 +14659,7 @@
/* Say OK and ask subsystem to retransmit msg counter */
transmit_response_with_date(p, "200 OK", req);
res = 0;
+ sendmwi = 1;
break;
}
}
@@ -14691,6 +14694,7 @@
ast_string_field_set(p, fullcontact, peer->fullcontact);
transmit_response_with_date(p, "200 OK", req);
res = 0;
+ sendmwi = 1;
break;
case PARSE_REGISTER_UPDATE:
ast_string_field_set(p, fullcontact, peer->fullcontact);
@@ -14698,6 +14702,7 @@
transmit_response_with_date(p, "200 OK", req);
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Registered\r\nAddress: %s\r\n", peer->name, ast_sockaddr_stringify(addr));
res = 0;
+ sendmwi = 1;
break;
}
ao2_unlock(peer);
@@ -14712,7 +14717,9 @@
sched_yield();
}
if (!res) {
- sip_send_mwi_to_peer(peer, 0);
+ if (sendmwi) {
+ sip_send_mwi_to_peer(peer, 0);
+ }
ast_devstate_changed(AST_DEVICE_UNKNOWN, "SIP/%s", peer->name);
}
if (res < 0) {
More information about the asterisk-commits
mailing list