[Freeswitch-branches] [commit] r3644 - in freeswitch/branches/knhor/trunk: . src src/mod/endpoints/mod_sofia
Author: knhor Date: Wed Dec 13 21:29:33 2006 New Revision: 3644 Modified: freeswitch/branches/knhor/trunk/ (props changed) freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c freeswitch/branches/knhor/trunk/src/switch_rtp.c Log: Merged revisions 3635-3639 via svnmerge from trunk Modified: freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Wed Dec 13 21:29:33 2006 @@ -454,7 +454,7 @@ char uridigest[2 * SU_MD5_DIGEST_SIZE + 1]; char bigdigest[2 * SU_MD5_DIGEST_SIZE + 1]; char *nonce, *uri, *qop, *cnonce, *nc, *response, *input = NULL, *input2 = NULL; - auth_res_t ret = AUTH_OK; + auth_res_t ret = AUTH_FORBIDDEN; char *npassword = NULL; int cnt = 0; nonce = uri = qop = cnonce = nc = response = NULL; @@ -527,7 +527,7 @@ su_md5_strupdate(&ctx, input2); su_md5_hexdigest(&ctx, bigdigest); su_md5_deinit(&ctx); - + if (!strcasecmp(bigdigest, response)) { ret = AUTH_OK; } else { @@ -1437,6 +1437,8 @@ } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP CHANGING DEST TO: [%s:%d]\n", tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port); + /* Reactivate the NAT buster flag. */ + switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ); } return SWITCH_STATUS_SUCCESS; } @@ -2815,7 +2817,6 @@ } sql = switch_mprintf("select passwd from sip_authentication where nonce='%q'", nonce); - if (switch_core_db_prepare(db, sql, -1, &stmt, 0)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Statement Error!\n"); goto fail; @@ -2939,9 +2940,11 @@ } if (authorization) { - auth_res = parse_auth(profile, authorization, (char *)sip->sip_request->rq_method_name, key, keylen); + if ((auth_res = parse_auth(profile, authorization, (char *)sip->sip_request->rq_method_name, key, keylen)) == AUTH_STALE) { + stale = 1; + } - if (auth_res != AUTH_OK && auth_res != AUTH_STALE) { + if (auth_res != AUTH_OK && !stale) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "send %s for [%s@%s]\n", forbidden ? "forbidden" : "challange", from_user, from_host); @@ -3014,15 +3017,14 @@ switch_uuid_format(uuid_str, &uuid); sql = switch_mprintf("delete from sip_authentication where user='%q' and host='%q';\n" - "insert into sip_authentication values('%q','%q','%q','%q', %ld)", - from_user, - from_host, - from_user, - from_host, - hexdigest, - uuid_str, - time(NULL) + 60); - + "insert into sip_authentication values('%q','%q','%q','%q', %ld)", + from_user, + from_host, + from_user, + from_host, + hexdigest, + uuid_str, + time(NULL) + 60); auth_str = switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", from_host, uuid_str, stale ? " stale=\"true\"," : ""); @@ -4165,7 +4167,8 @@ sip_t const *sip, tagi_t tags[]) { - handle_register(nua, profile, nh, sip, REG_REGISTER, NULL, 0); + char key[128] = ""; + handle_register(nua, profile, nh, sip, REG_REGISTER, key, sizeof(key)); } Modified: freeswitch/branches/knhor/trunk/src/switch_rtp.c ============================================================================== --- freeswitch/branches/knhor/trunk/src/switch_rtp.c (original) +++ freeswitch/branches/knhor/trunk/src/switch_rtp.c Wed Dec 13 21:29:33 2006 @@ -865,18 +865,15 @@ if (rtp_session->recv_msg.header.version) { if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && rtp_session->from_addr->port) { - if ((rtp_session->from_addr->port != rtp_session->remote_port)) { + char *tx_host; + char *old_host; + char bufa[30], bufb[30]; + tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr); + old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr); + + if ((rtp_session->from_addr->port != rtp_session->remote_port) || strcmp(tx_host, old_host)) { const char *err; - char *tx_host; uint32_t old = rtp_session->remote_port; - char *old_host; - char bufa[30], bufb[30]; - - //switch_sockaddr_ip_get(&tx_host, rtp_session->from_addr); - //switch_sockaddr_ip_get(&old_host, rtp_session->remote_addr); - - tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr); - old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr); if (!switch_strlen_zero(tx_host) && rtp_session->from_addr->port > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Auto Changing port from %s:%u to %s:%u\n",
participants (1)
-
Freeswitch SVN