- Again '*' Contact header in unREGISTER

- new: tools/extract_sip.pl
This commit is contained in:
Thomas Ries 2004-03-30 19:45:01 +00:00
parent 2fba2bcb3b
commit e3ed50d8db
4 changed files with 53 additions and 17 deletions

View File

@ -1,5 +1,7 @@
0.5.5
=====
30-Mar-2004: - Again '*' Contact header in unREGISTER
- new: tools/extract_sip.pl
26-Mar-2004: - SDP rewrite: properly handle 'c=' items in session
*and* media part of SDP data.
22-Mar-2004: - deal with wildcard Contact header for unREGISTER

View File

@ -242,19 +242,38 @@ int register_client(osip_message_t *my_msg, int force_lcl_masq) {
}
url1_to=my_msg->to->url;
url1_contact=((osip_contact_t*)(my_msg->contacts->node->element))->url;
DEBUGC(DBCLASS_REG,"register: %s@%s expires=%i seconds",
(url1_contact->username) ? url1_contact->username : "*NULL*",
(url1_contact->host) ? url1_contact->host : "*NULL*",
expires);
/*
* REGISTER
*/
if (expires > 0) {
/* Update registration. There are two possibilities:
/*
* First make sure, we have a prober Contact header:
* - url
* - url -> hostname
*
* Libosip parses an:
* "Contact: *"
* the following way (Note: Display name!! and URL is NULL)
* (gdb) p *((osip_contact_t*)(sip->contacts->node->element))
* $5 = {displayname = 0x8af8848 "*", url = 0x0, gen_params = 0x8af8838}
*/
url1_contact=((osip_contact_t*)(my_msg->contacts->node->element))->url;
if ((url1_contact == NULL) || (url1_contact->host == NULL)) {
/* Don't have reqiured Contact fields */
ERROR("tried registration with empty Contact header");
return STS_FAILURE;
}
DEBUGC(DBCLASS_REG,"register: %s@%s expires=%i seconds",
(url1_contact->username) ? url1_contact->username : "*NULL*",
(url1_contact->host) ? url1_contact->host : "*NULL*",
expires);
/*
* Update registration. There are two possibilities:
* - already registered, then update the existing record
* - not registered, then create a new record
*/

View File

@ -239,17 +239,6 @@ RFC 3261 SIP: Session Initiation Protocol June 2002
return STS_FAILURE;
}
/*
* check for existing Contact: header
* according to RFC3261 not mandatory, but siproxd relies on it
* on REGISTER...
*/
if (MSG_IS_REGISTER(sip) && ((sip->contacts==NULL)||
(sip->contacts->node==NULL)||(sip->contacts->node->element==NULL)||
((osip_contact_t*)(sip->contacts->node->element))->url==NULL)) {
ERROR("security check failed: NULL Contact Header");
return STS_FAILURE;
}
/* TODO: still way to go here ... */

26
tools/extract_sip.pl Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/perl
#
#
# extract a buffer dump from siproxd's debug log and
# write the plain content into a file. This file then
# may be used to feed netcat for a replay.#
#
# $ netcat -u siphost 5060 < buffer.sip
#
# usage:
# reads from STDIN and writes to STDOUT
#
# $ cat bufferdump.log | extract_sip.pl > buffer.sip
while (<>) {
# strip off CR/LF
chomp;
# cut out the hex digits and store them into an array
my @hex=split(/ /, substr($_, 2, 47));
for (my $i=0; $i<16; $i++) {
# write HEX byte as character
print chr(hex($hex[$i]));
}
}