regards
klaus

-------- Original Message --------
Subject: [Serdev] domain module: case insensitive error in hash function
Date: Thu, 17 Nov 2005 13:42:14 +0100
From: Axel Böger <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>

Hi,

domain module in caching mode does not match when domain-name from SIP request and DB
differ in use of small characters.
The hash-function in modules/domain/hash.c is case-sensitive. For example
hash('iptel.org') != hash('Iptel.org').
This could be fixed with following patch:

--- sip_router/modules/domain/hash.c    2004-08-24 10:58:27.000000000 +0200
+++ sip_router-patched/modules/domain/hash.c 2005-11-17 13:34:36.314480955 +0100
@@ -35,6 +35,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#include <ctype.h>


 /* String hash function */
@@ -49,7 +50,7 @@
   len = domain->len;

   for (i = 0; i < len; i++) {
-         h = ( h << 5 ) - h + *(p + i);
+         h = ( h << 5 ) - h + tolower(*(p + i));
   }

   return h % HASH_SIZE;


  Regards,
    Axel

_______________________________________________
Serdev mailing list
[EMAIL PROTECTED]
http://mail.iptel.org/mailman/listinfo/serdev





Papadopoulos Georgios wrote:
Hello,

I have been looking into the code. strncasecmp does case insensitive
comparison, so this part is correct.
My guess is that the hash function should use the lowercase domain.
In my case I have in the domain table "i-call.gr" and "sip.i-call.gr".
If the From header is [EMAIL PROTECTED] then is_from_local() returns false
(in caching mode).

I hope this helps

George

-----Original Message-----
From: Bogdan-Andrei Iancu [mailto:[EMAIL PROTECTED] Sent: Monday, March 13, 2006 11:32 AM
To: Papadopoulos Georgios
Cc: [EMAIL PROTECTED]; [email protected]; Juha Heinanen
Subject: Re: [Users] Domain: is_from_local() is case sensitive in caching mode.

Hi Georgios,

indeed, the search through the cache is done case sensitive via strncasesmp().

Juha, souldn't the domain matching be case insensitive?

regards,
bogdan


Georgios Papadopoulos wrote:

I am pretty sure (I am using OpenSER 1.0.0). What about the part where the table is cached into memory? Do you do select lower(domain) from domain? I tried briefly to find
the relevant
piece of code but I couldn't.

George


-----Original Message-----
From: Daniel-Constantin Mierla [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 11, 2006 3:50 PM
To: Papadopoulos Georgios
Cc: [email protected]
Subject: Re: [Users] Domain: is_from_local() is case sensitive in caching mode.

Hello,

On 03/10/06 17:51, Papadopoulos Georgios wrote:
Hello,

I have noticed that is_from_local in the Domain module is case-sensitive if the module is in caching mode. In
non-caching mode
it is case insensitive.
Could this be fixed in the future?
are you sure? I was looking in the sources and the comparison is case-insensitive.

Cheers,
Daniel

thank you

George

Disclaimer
The information in this e-mail and any attachments is
confidential. It is intended solely for the attention and
use of the
named addressee(s). If you are not the intended recipient,
or person
responsible for delivering this information to the intended
recipient,
please notify the sender immediately. Unless you are the intended recipient or his/her representative you are not authorized to, and must not, read, copy, distribute, use or retain this message or any part of it. E-mail transmission cannot be guaranteed to be
secure or
error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.
_______________________________________________
Users mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users



Disclaimer
The information in this e-mail and any attachments is confidential. It is 
intended solely for the attention and use of the named addressee(s). If you are 
not the intended recipient, or person responsible for delivering this 
information to the intended recipient, please notify the sender immediately. 
Unless you are the intended recipient or his/her representative you are not 
authorized to, and must not, read, copy, distribute, use or retain this message 
or any part of it. E-mail transmission cannot be guaranteed to be secure or 
error-free as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.



_______________________________________________
Users mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users

Reply via email to