]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Only send MWI Notify on register if the registration is successful.
authorGregory Nietsky <gregory@distrotech.co.za>
Thu, 13 Oct 2011 08:46:47 +0000 (08:46 +0000)
committerGregory Nietsky <gregory@distrotech.co.za>
Thu, 13 Oct 2011 08:46:47 +0000 (08:46 +0000)
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.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@340770 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index fe7dab6291dbb83570b01c0be081a1c0bd3ab6af..7468c3a205d0bbdfee2f1b8294a65fc70c57154a 100644 (file)
@@ -14554,6 +14554,7 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
                                              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 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
                                                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 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
                                                /* 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 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
                                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 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
                                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 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sock
                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) {