Hi all,
I was trying to use Kamailio 3.1.3 with acc module, but without DB
backend (syslog only). Unfortunately kamailio segfaulted after
receiving a NATed REGISTER (flagged in my script with the first pos
"0"). If I understood correctly, the trouble lies with some
misbehaviour with the acc parameters initializations, namely, even if
I remove the modparam with db_url, and set db_flag and db_missed_flag
to -1, the mod_init() function in modules_k/acc/acc_mod.c, reset the
flags to "0", because in its opinion db_url.s was not NULL.
Unfortunately I'm not confident with the config file parsing through
yacc, so I'm not sure where the problem actually is.
So, I tried a workaround specifying a "null" db_url (as I supposed to
be the default, reading the docs; and actually the value I found in
modules_k/acc/acc_mod.c):
modparam("acc", "db_url", 0)
or
modparam("acc", "db_url", "")
or
modparam("acc", "db_url", "NULL")
but, understandably, they don't work. Is there a way to specify a null
value for a modparam in the config file?
In the meanwhile I set the db_url to a valid value, created a valid
table `acc`, and used a flag that I never use in my script, but I know
it could be done better.
For example, maybe mod_init can reset db_flag and db_missed_flag to an
invalid value (-1?) when it find NULL the db_url variable (using a
valid flag, as 0, may lead to unexpected behaviour; or I've not got
what a valid flag is? In this case, I'm sorry).
Secondarily mod_init could check for the zero-length too, supposing
that no valid db_url can be zero-length.
Finally, and more importantly, do you have any idea about the reason
for which the config parser can see a default value for db_url (for
acc), different from the one in modules_k/acc/acc_mod.c (specifically,
it takes a valid db_url used by other modules)?
Thank you,
Best regards,
Francesco Castellano
Hello,
I think I have found two bugs in nathelper in Kamailio 3.1.3.
Has anyone else encountered these?
Bug one
-------
nat_uac_test() doesn't seem to work for requests that arrive over UDP. I
tried with the latest versions of X-Lite and Jitsi for Windows and
observed the same behaviour with both. As far as I could tell the UDP and
TCP REGISTER methods were identical except for transport, Call-ID, tags
(and so on).
At the moment I have worked around this by treating all UDP requests as if
they have come from behind a NAT - but this is not ideal.
Bug Two
-------
nat_uac_test() with flag bit 8 (SDP checks) set fails with an error if the
request does not contain SDP. I don't think this is correct behaviour as
it seems quite sensible to me to push all requests through the same NAT
detection route. In this case it is quite likely that only some of the
methods will contain SDP.
Surely in this case the correct thing would be for the SDP checks to fail,
but not be treated as an error?
Thanks for you help,
Peter
--
Peter Dunkley
Technical Director
Crocodile RCS Ltd
Module: sip-router
Branch: master
Commit: 87ee74902ef5c4a86fc3130a48ab783b1c605461
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=87ee749…
Author: Michal Matyska <michal.matyska(a)iptel.org>
Committer: Michal Matyska <michal.matyska(a)iptel.org>
Date: Mon Apr 11 10:20:43 2011 -0500
handle all cases after auth_api.pre_auth call
Added cases NO_CREDENTIALS, STALE_NONCE and NONCE_REUSED to the switch.
This prevents segfault after uninitialized var is used in gen_ha1 when
the code continues to check the credentials if there were none.
---
modules_s/auth_db/authorize.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/modules_s/auth_db/authorize.c b/modules_s/auth_db/authorize.c
index da1d6b4..1d3add1 100644
--- a/modules_s/auth_db/authorize.c
+++ b/modules_s/auth_db/authorize.c
@@ -345,10 +345,14 @@ static inline int authenticate(struct sip_msg* msg, str* realm, authdb_table_inf
ret = -2;
goto end;
+ case STALE_NONCE:
case NOT_AUTHENTICATED:
+ case NO_CREDENTIALS:
ret = -1;
goto end;
+ case NONCE_REUSED:
+ DBG("auth_db:authenticate: NONCE_REUSED\n");
case DO_AUTHENTICATION:
break;