From b2ef7599c8f71fbaeac8e7d2b6c98d952495d625 Mon Sep 17 00:00:00 2001 From: Thomas Ries Date: Sun, 21 Mar 2004 11:15:23 +0000 Subject: [PATCH] - added ./autogen.sh - proxy_rewrite_invitation_body: check success of starting RTP relay before rewriting SDP body - proxy_rewrite_invitation_body: don't fail on Contact header with no user part. - security_check_sip: CSeq header must be present. --- ChangeLog | 9 ++++++++ RELNOTES | 19 +++++----------- autogen.sh | 13 +++++++++++ configure.in | 2 +- src/proxy.c | 53 +++++++++++++++++++++++++++----------------- src/rtpproxy_relay.c | 2 +- src/security.c | 32 ++++++++++---------------- src/sip_utils.c | 3 +++ 8 files changed, 78 insertions(+), 55 deletions(-) create mode 100755 autogen.sh diff --git a/ChangeLog b/ChangeLog index dd110b0..e79745a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +0.5.5 +===== + 21-Mar-2004: - added ./autogen.sh + 19-Mar-2004: - proxy_rewrite_invitation_body: check success of + starting RTP relay before rewriting SDP body + - proxy_rewrite_invitation_body: don't fail on + Contact header with no user part. + 18-Mar-2004: - security_check_sip: CSeq header must be present. + 0.5.4 ===== 6-Mar-2004: - Released 0.5.4 diff --git a/RELNOTES b/RELNOTES index 3d19e39..8c92d09 100644 --- a/RELNOTES +++ b/RELNOTES @@ -1,9 +1,9 @@ -Release Notes for siproxd-0.5.4 +Release Notes for siproxd-0.5.5 =============================== -Major changes since 0.5.3: - - minor documentation and FAQ updates - - some bugfixes in Proxy Authorization handling +Major changes since 0.5.4: + - + - General Overview: - SIP (RFC3261) Proxy for SIP based softphones hidden behind a @@ -71,16 +71,9 @@ distribution I'd be happy to get a short notice. ----- -md5sum for siproxd-0.5.4.tar.gz: 7bbde9fb65a3285b125b4d208a0cdf62 +md5sum for siproxd-0.5.5.tar.gz: -GnuPG signature for siproxd-0.5.4.tar.gz archive: ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.2.1 (GNU/Linux) - -iD8DBQBASaprCfzBioe83JQRAswDAJ4rEERvkU0s3HHEnbuA1o44XykMhgCfVpG9 -9JqbE3KKTC4/W72C9NUxUn8= -=LvlG ------END PGP SIGNATURE----- +GnuPG signature for siproxd-0.5.5.tar.gz archive: GnuPG: pub 1024D/87BCDC94 2000-03-19 Thomas Ries diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..e166bb2 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +test -f configure.in || { + echo "**Error**: This directory does not look like the top-level directory" + exit 1 +} + +set -e +aclocal +autoheader +automake -a +autoconf diff --git a/configure.in b/configure.in index cea5d2c..5c9a925 100644 --- a/configure.in +++ b/configure.in @@ -37,7 +37,7 @@ dnl Release Version dnl SPD_MAJOR_VERSION=0 SPD_MINOR_VERSION=5 -SPD_MICRO_VERSION=4 +SPD_MICRO_VERSION=5 SPD_VERSION=$SPD_MAJOR_VERSION.$SPD_MINOR_VERSION.$SPD_MICRO_VERSION diff --git a/src/proxy.c b/src/proxy.c index 89766e3..5462990 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -963,29 +963,42 @@ if (configuration.debuglevel) if (msg_port > 0) { osip_uri_t *cont_url = NULL; - char *user=NULL; + char *client_id=NULL; + /* try to get some additional UA specific unique ID. + * Try: + * 1) User part of Contact header + * 2) Host part of Contact header (will be different + * between internal UA and external UA) + */ if (!osip_list_eol(mymsg->contacts, 0)) cont_url = ((osip_contact_t*)(mymsg->contacts->node->element))->url; - if (cont_url) user=cont_url->username; - - rtp_start_fwd(osip_message_get_call_id(mymsg), - user, - rtp_direction, - media_stream_no, - map_addr, &map_port, - msg_addr, msg_port); - /* and rewrite the port */ - sdp_med=osip_list_get(sdp->m_medias, media_stream_no); - if (sdp_med && sdp_med->m_port) { - osip_free(sdp_med->m_port); - sdp_med->m_port=osip_malloc(8); /* 5 digits, \0 + align */ - sprintf(sdp_med->m_port, "%i", map_port); - DEBUGC(DBCLASS_PROXY, "proxy_rewrite_invitation_body: " - "m= rewrote port to [%i]",map_port); - } else { - ERROR("rewriting port in m= failed sdp_med=%p, " - "m_number_of_port=%p", sdp_med, sdp_med->m_port); + if (cont_url) { + client_id=cont_url->username; + if (client_id == NULL) client_id=cont_url->host; } + + + sts = rtp_start_fwd(osip_message_get_call_id(mymsg), + client_id, + rtp_direction, + media_stream_no, + map_addr, &map_port, + msg_addr, msg_port); + + if (sts == STS_SUCCESS) { + /* and rewrite the port */ + sdp_med=osip_list_get(sdp->m_medias, media_stream_no); + if (sdp_med && sdp_med->m_port) { + osip_free(sdp_med->m_port); + sdp_med->m_port=osip_malloc(8); /* 5 digits, \0 + align */ + sprintf(sdp_med->m_port, "%i", map_port); + DEBUGC(DBCLASS_PROXY, "proxy_rewrite_invitation_body: " + "m= rewrote port to [%i]",map_port); + } else { + ERROR("rewriting port in m= failed sdp_med=%p, " + "m_number_of_port=%p", sdp_med, sdp_med->m_port); + } + } /* sts == success */ } /* if msg_port > 0 */ } else { /* no port defined - skip entry */ diff --git a/src/rtpproxy_relay.c b/src/rtpproxy_relay.c index dc195a1..dbc22a9 100644 --- a/src/rtpproxy_relay.c +++ b/src/rtpproxy_relay.c @@ -348,7 +348,7 @@ int rtp_relay_start_fwd (osip_call_id_t *callid, char *client_id, } if (client_id == NULL) { - ERROR("rtp_relay_start_fwd: contact header is NULL!"); + ERROR("rtp_relay_start_fwd: did not get a client ID!"); return STS_FAILURE; } diff --git a/src/security.c b/src/security.c index e4ef3a4..63ed84c 100644 --- a/src/security.c +++ b/src/security.c @@ -83,39 +83,31 @@ int security_check_sip(osip_message_t *sip){ } } + /* check for existing To: header */ - if (sip->to == NULL) { + if ((sip->to==NULL)||(sip->to->url==NULL)||(sip->to->url->host==NULL)) { ERROR("security check failed: NULL To Header"); return STS_FAILURE; } - /* check for existing To: URL */ - if (sip->to->url == NULL) { - ERROR("security check failed: NULL To->url Header"); - return STS_FAILURE; - } - /* check for existing TO URL host*/ - if (sip->to->url->host == NULL) { - ERROR("security check failed: NULL To->url->host Header"); - return STS_FAILURE; - } /* check for existing FROM */ - if (sip->from == NULL) { + if ((sip->from==NULL)||(sip->from->url==NULL)||(sip->from->url->host==NULL)) { ERROR("security check failed: NULL From Header"); return STS_FAILURE; } - /* check for existing FROM URL */ - if (sip->from->url == NULL) { - ERROR("security check failed: NULL From->url Header"); - return STS_FAILURE; - } - /* check for existing FROM URL host*/ - if (sip->from->url->host == NULL) { - ERROR("security check failed: NULL From->url->host Header"); + + /* check for existing CSEQ header */ + if ((sip->cseq==NULL)||(sip->cseq->method==NULL)||(sip->cseq->number==NULL)) { + ERROR("security check failed: NULL CSeq Header"); return STS_FAILURE; } +/* + check the RFC and implement tests for ALL mandatory headers here +*/ + + /* TODO: still way to go here ... */ return STS_SUCCESS; } diff --git a/src/sip_utils.c b/src/sip_utils.c index 7ba54d5..2100395 100644 --- a/src/sip_utils.c +++ b/src/sip_utils.c @@ -73,10 +73,12 @@ osip_message_t *msg_make_template_reply (osip_message_t * request, int code) { if (request->to==NULL) { ERROR("msg_make_template_reply: empty To in request header"); + return NULL; } if (request->from==NULL) { ERROR("msg_make_template_reply: empty From in request header"); + return NULL; } osip_to_clone (request->to, &response->to); @@ -97,6 +99,7 @@ osip_message_t *msg_make_template_reply (osip_message_t * request, int code) { } osip_call_id_clone(request->call_id,&response->call_id); + osip_cseq_clone(request->cseq,&response->cseq); return response;