Hi, when using check_from or check_to, is the username part of the uri checked in mode case sensitive or insensitive? It should be case sensitive as per SIP grammar. But in the code (uri_db/checks.c) I see the opposite:
/* URI table not used, simply compare digest username and From/To * username, the comparison is case insensitive */ if (_uri->user.len == c->digest.username.user.len) { if (!strncasecmp(_uri->user.s, c->digest.username.user.s, _uri->user.len)) { LM_DBG("Digest username and URI username match\n"); return 1; } }
2010/6/1 Iñaki Baz Castillo ibc@aliax.net:
Hi, when using check_from or check_to, is the username part of the uri checked in mode case sensitive or insensitive? It should be case sensitive as per SIP grammar. But in the code (uri_db/checks.c) I see the opposite:
/* URI table not used, simply compare digest username and From/To * username, the comparison is case insensitive */ if (_uri->user.len == c->digest.username.user.len) { if (!strncasecmp(_uri->user.s, c->digest.username.user.s, _uri->user.len)) { LM_DBG("Digest username and URI username match\n"); return 1; } }
Shouldn't it use strncmp()?
Am 01.06.2010 18:10, schrieb Iñaki Baz Castillo:
2010/6/1 Iñaki Baz Castilloibc@aliax.net:
Hi, when using check_from or check_to, is the username part of the uri checked in mode case sensitive or insensitive? It should be case sensitive as per SIP grammar. But in the code (uri_db/checks.c) I see the opposite:
/* URI table not used, simply compare digest username and From/To * username, the comparison is case insensitive */ if (_uri->user.len == c->digest.username.user.len) { if (!strncasecmp(_uri->user.s,
c->digest.username.user.s, _uri->user.len)) { LM_DBG("Digest username and URI username match\n"); return 1; } }
Shouldn't it use strncmp()?
Probably it should.
regards Klaus
btw: how is "if ($au!=$tU)" compared?
2010/6/1 Klaus Darilion klaus.mailinglists@pernau.at:
Shouldn't it use strncmp()?
Probably it should.
regards Klaus
btw: how is "if ($au!=$tU)" compared?
The problem is that more SIP username related stuff is also case insensitive in Kamailio, i.e. the database columns. For example a user "TEST" with a location entry with username "test" woudl be retrieved because the location.username column is case insensitive.
2010/6/1 Iñaki Baz Castillo ibc@aliax.net:
btw: how is "if ($au!=$tU)" compared?
All the comparisons in kamailio are case insensitive. The only way would be using avopos to perform a case sensitive comparison.
Hello,
On 6/1/10 7:03 PM, Iñaki Baz Castillo wrote:
2010/6/1 Iñaki Baz Castilloibc@aliax.net:
btw: how is "if ($au!=$tU)" compared?
All the comparisons in kamailio are case insensitive. The only way would be using avopos to perform a case sensitive comparison.
the latest versions have dedicateds fucntion for str comparisons: http://kamailio.org/docs/modules/stable/modules_k/textops.html#id2748954
You can use them to compare $au and $fU/$tU.
On the other hand, if RFC says so, check_to/check_from must be fixed as well.
Cheers, Daniel
Cheers, Daniel
Am 01.06.2010 19:02, schrieb Iñaki Baz Castillo:
2010/6/1 Klaus Darilionklaus.mailinglists@pernau.at:
Shouldn't it use strncmp()?
Probably it should.
regards Klaus
btw: how is "if ($au!=$tU)" compared?
The problem is that more SIP username related stuff is also case insensitive in Kamailio, i.e. the database columns. For example a user "TEST" with a location entry with username "test" woudl be retrieved because the location.username column is case insensitive.
IIRC that depends on the DB backend: MySQL is by default case insensitive, Postgresql is by default case sensitive.
regards Klaus
2010/6/1 Klaus Darilion klaus.mailinglists@pernau.at:
The problem is that more SIP username related stuff is also case insensitive in Kamailio, i.e. the database columns. For example a user "TEST" with a location entry with username "test" woudl be retrieved because the location.username column is case insensitive.
IIRC that depends on the DB backend: MySQL is by default case insensitive, Postgresql is by default case sensitive.
Yes, this is correct. Then:
- check_from / check_to should b fixed to use case sensitive comparison.
- MySQL database schema should use case sensitive columns for 'username' in subscriber, location and any other tables containing an 'username' column.
Do I miss something?
On Wednesday 02 June 2010, Iñaki Baz Castillo wrote:
The problem is that more SIP username related stuff is also case insensitive in Kamailio, i.e. the database columns. For example a user "TEST" with a location entry with username "test" woudl be retrieved because the location.username column is case insensitive.
IIRC that depends on the DB backend: MySQL is by default case insensitive, Postgresql is by default case sensitive.
Yes, this is correct. Then:
- check_from / check_to should b fixed to use case sensitive comparison.
Hi Iñaki,
this should be properly documented, as it has the potential of breaking some configurations.
- MySQL database schema should use case sensitive columns for
'username' in subscriber, location and any other tables containing an 'username' column.
I think we should think a bit more about this step, as it would be a major change in the way most people expect the database to work, which happens to be mostly mysql in our case. Add devel list as CC.
Henning
2010/6/2 Henning Westerholt henning.westerholt@1und1.de:
Yes, this is correct. Then:
- check_from / check_to should b fixed to use case sensitive comparison.
Hi Iñaki,
this should be properly documented, as it has the potential of breaking some configurations.
- MySQL database schema should use case sensitive columns for
'username' in subscriber, location and any other tables containing an 'username' column.
I think we should think a bit more about this step, as it would be a major change in the way most people expect the database to work, which happens to be mostly mysql in our case. Add devel list as CC.
Sure, it would involve an important change so it should be part of a new version and be properly documented. I will check out all the stuf that this would require (table columns, module functions and so) and will document it.
Regards.
2010/6/2 Iñaki Baz Castillo ibc@aliax.net:
- check_from / check_to should b fixed to use case sensitive comparison.
A workaround for this would be using:
if ! avp_check("$tU","eq/$au")
instead of:
if ! check_to()
On 6/3/10 12:52 PM, Iñaki Baz Castillo wrote:
2010/6/2 Iñaki Baz Castilloibc@aliax.net:
- check_from / check_to should b fixed to use case sensitive comparison.
A workaround for this would be using:
if ! avp_check("$tU","eq/$au")
instead of:
if ! check_to()
note that cmp_str/cmp_istr are availave in 1.5.x as well:
http://kamailio.org/docs/modules/1.5.x/textops.html#id2507121
Cheers, Daniel
2010/6/3 Daniel-Constantin Mierla miconda@gmail.com:
note that cmp_str/cmp_istr are availave in 1.5.x as well:
http://kamailio.org/docs/modules/1.5.x/textops.html#id2507121
Ops, I looked for them yesterday in 1.5 documentation and didn't find them :) (my fault).
Thanks a lot.