diff options
author | Olle Johansson <oej@edvina.net> | 2008-10-13 15:32:55 +0000 |
---|---|---|
committer | Olle Johansson <oej@edvina.net> | 2008-10-13 15:32:55 +0000 |
commit | 1ec31a5f938c699ace76100aa35b79e2da39f263 (patch) | |
tree | 2faff2a8996133fa2d0925193a16c36f859236c3 /channels/chan_sip.c | |
parent | 1097de138290e4d61166401eaaa3d2cdfdc5e134 (diff) |
Sending a 403 after a 200 is considered very bad.
(found at SIPit)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@148471 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 2b23f6f0a..85fe601a0 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -11142,35 +11142,37 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct sockaddr if (sip_cancel_destroy(p)) ast_log(LOG_WARNING, "Unable to cancel SIP destruction. Expect bad things.\n"); - /* We have a successful registration attempt with proper authentication, - now, update the peer */ - 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); - peer->lastmsgssent = -1; - res = 0; - break; - case PARSE_REGISTER_UPDATE: - update_peer(peer, p->expiry); - /* Say OK and ask subsystem to retransmit msg counter */ - transmit_response_with_date(p, "200 OK", req); - if (!ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY)) - peer->lastmsgssent = -1; - res = 0; - break; - } - if (check_request_transport(peer, req)) { ast_set_flag(&p->flags[0], SIP_PENDINGBYE); transmit_response_with_date(p, "403 Forbidden", req); res = AUTH_BAD_TRANSPORT; + } else { + + /* We have a successful registration attempt with proper authentication, + now, update the peer */ + 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); + peer->lastmsgssent = -1; + res = 0; + break; + case PARSE_REGISTER_UPDATE: + update_peer(peer, p->expiry); + /* Say OK and ask subsystem to retransmit msg counter */ + transmit_response_with_date(p, "200 OK", req); + if (!ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY)) + peer->lastmsgssent = -1; + res = 0; + break; + } } + } } } |