Merged revisions 26760 via svnmerge from
authorKevin P. Fleming <kpfleming@digium.com>
Thu, 11 May 2006 09:01:53 +0000 (09:01 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Thu, 11 May 2006 09:01:53 +0000 (09:01 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r26760 | kpfleming | 2006-05-11 03:52:46 -0500 (Thu, 11 May 2006) | 2 lines

ensure that we send a response to REGISTER requests that are successfully authenticated but contain invalid Contact URIs

........

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

channels/chan_sip.c

index 137c353..154147c 100644 (file)
@@ -6814,6 +6814,9 @@ static int register_verify(struct sip_pvt *p, struct sockaddr_in *sin, struct si
                                switch (parse_register_contact(p, peer, req)) {
                                case PARSE_REGISTER_FAILED:
                                        ast_log(LOG_WARNING, "Failed to parse contact info\n");
+                                       transmit_response_with_date(p, "400 Bad Request", req);
+                                       peer->lastmsgssent = -1;
+                                       res = 0;
                                        break;
                                case PARSE_REGISTER_QUERY:
                                        transmit_response_with_date(p, "200 OK", req);
@@ -6837,11 +6840,13 @@ static int register_verify(struct sip_pvt *p, struct sockaddr_in *sin, struct si
                peer = temp_peer(name);
                if (peer) {
                        ASTOBJ_CONTAINER_LINK(&peerl, peer);
-                       peer->lastmsgssent = -1;
                        sip_cancel_destroy(p);
                        switch (parse_register_contact(p, peer, req)) {
                        case PARSE_REGISTER_FAILED:
                                ast_log(LOG_WARNING, "Failed to parse contact info\n");
+                               transmit_response_with_date(p, "400 Bad Request", req);
+                               peer->lastmsgssent = -1;
+                               res = 0;
                                break;
                        case PARSE_REGISTER_QUERY:
                                transmit_response_with_date(p, "200 OK", req);