Module: sip-router
Branch: master
Commit: b41f1a592a44ba9408070a9e1945b9e0503f59c7
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b41f1a5…
Author: Jan Janak <jan(a)ryngle.com>
Committer: Jan Janak <jan(a)ryngle.com>
Date: Mon Oct 26 16:25:02 2009 +0100
registrar: Fix handling of cases where contacts > max_contacts
Registrar should not report an error to syslog if a user exceeds the
maximum number of allowed contacts per user. The registrar module sends
a reply back with a description of what happened so there is no reason
to write this to syslog, max_contacts > 0 is a configuration choice
rather than an error.
This patch also changes all affected functions in registrar module to
indicate that the maximum number of allowed contacts was exceeded by
returning a positive number, instead of a negative number to indicate
that an error occurred.
---
modules_s/registrar/save.c | 38 +++++++++++++++++++++-----------------
1 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/modules_s/registrar/save.c b/modules_s/registrar/save.c
index 27d134c..fee4548 100644
--- a/modules_s/registrar/save.c
+++ b/modules_s/registrar/save.c
@@ -257,10 +257,11 @@ static int create_rcv_uri(str** uri, struct sip_msg* m)
/*
- * Message contained some contacts, but record with same address
- * of record was not found so we have to create a new record
- * and insert all contacts from the message that have expires
- * > 0
+ * Message contained some contacts, but record with same address of record was
+ * not found so we have to create a new record and insert all contacts from
+ * the message that have expires > 0. The function returns a negative number
+ * on error, a positive number if the number of contacts would exceed
+ * max_contacts and 0 on success.
*/
static inline int insert(struct sip_msg* _m, str* aor, contact_t* _c, udomain_t* _d, str* _u, str *ua, str* aor_filter, int sid)
{
@@ -289,7 +290,7 @@ static inline int insert(struct sip_msg* _m, str* aor, contact_t* _c, udomain_t*
if (max_contacts && (num >= max_contacts)) {
rerrno = R_TOO_MANY;
ul.delete_urecord(_d, _u);
- return -1;
+ return 1;
}
num++;
@@ -394,7 +395,7 @@ static int test_max_contacts(struct sip_msg* _m, urecord_t* _r, contact_t* _c)
_c = get_next_contact(_c);
}
- DBG("test_max_contacts: %d contacts after commit\n", num);
+ DBG("test_max_contacts: %d contacts after commit, max_contacts=%d\n", num, max_contacts);
if (num > max_contacts) {
rerrno = R_TOO_MANY;
return 1;
@@ -414,6 +415,11 @@ static int test_max_contacts(struct sip_msg* _m, urecord_t* _r, contact_t* _c)
* > 0, update the contact
* 3) If contact in usrloc exists and expires
* == 0, delete contact
+ *
+ * The function returns a negative number on error, a positive number if
+ * max_contacts is set and the number of contacts after the change would
+ * exceed that maximum number of allowed contacts. On success the function
+ * returns 0.
*/
static inline int update(struct sip_msg* _m, urecord_t* _r, str* aor, contact_t* _c, str* _ua, str* aor_filter, int sid)
{
@@ -434,8 +440,12 @@ static inline int update(struct sip_msg* _m, urecord_t* _r, str* aor, contact_t*
if (max_contacts) {
ret = test_max_contacts(_m, _r, _c);
if (ret != 0) {
+ /* test_max_contacts returns a negative number on error and a
+ * positive number if the number of contacts after the update
+ * exceeds the configured max_contacts. In both cases we return
+ * here. */
build_contact(_r->contacts, aor_filter);
- return -1;
+ return ret;
}
}
@@ -607,24 +617,18 @@ static inline int contacts(struct sip_msg* _m, contact_t* _c, udomain_t* _d, str
}
if (res == 0) { /* Contacts found */
- if (update(_m, r, aor, _c, _ua, aor_filter, sid) < 0) {
+ if ((res = update(_m, r, aor, _c, _ua, aor_filter, sid) < 0)) {
LOG(L_ERR, "contacts(): Error while updating record\n");
- build_contact(r->contacts, aor_filter);
- ul.release_urecord(r);
- ul.unlock_udomain(_d);
- return -3;
}
build_contact(r->contacts, aor_filter);
ul.release_urecord(r);
} else {
- if (insert(_m, aor, _c, _d, _u, _ua, aor_filter, sid) < 0) {
+ if ((res = insert(_m, aor, _c, _d, _u, _ua, aor_filter, sid) < 0)) {
LOG(L_ERR, "contacts(): Error while inserting record\n");
- ul.unlock_udomain(_d);
- return -4;
}
}
ul.unlock_udomain(_d);
- return 0;
+ return res;
}
#define UA_DUMMY_STR "Unknown"
@@ -684,7 +688,7 @@ static inline int save_real(struct sip_msg* _m, udomain_t* _t, char* aor_filt, i
if (no_contacts(_t, &uid, &aor_filter) < 0) goto error;
}
} else {
- if (contacts(_m, c, _t, &uid, &ua, &aor_filter) < 0) goto error;
+ if (contacts(_m, c, _t, &uid, &ua, &aor_filter) != 0) goto error;
}
if (doreply) {
Module: sip-router
Branch: sr_3.0
Commit: 6186194a7e6153871d9da019e64916f6f73ec922
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6186194…
Author: Jan Janak <jan(a)ryngle.com>
Committer: Jan Janak <jan(a)ryngle.com>
Date: Mon Oct 26 14:37:22 2009 +0100
domain: Do not report errors when domain cannot be extracted from URI.
We should not report an error to syslog when lookup_domain fails to
parse the URI it was given as argument. That URI usually comes from
SIP messages we received from another implementation and we cannot
guarantee that they will always be well-formed. Generating an error
each time we receive a malformed SIP message can easily result in
denial of service.
---
modules_s/domain/domain_mod.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules_s/domain/domain_mod.c b/modules_s/domain/domain_mod.c
index e5d5cb0..b175ff8 100644
--- a/modules_s/domain/domain_mod.c
+++ b/modules_s/domain/domain_mod.c
@@ -440,7 +440,7 @@ static int lookup_domain(struct sip_msg* msg, char* flags, char* fp)
track = 0;
if (get_str_fparam(&domain, msg, (fparam_t*)fp) != 0) {
- ERR("Cannot get domain name to lookup\n");
+ DBG("lookup_domain: Cannot get the domain name to lookup\n");
return -1;
}
Module: sip-router
Branch: master
Commit: 6907fb8dc86953dfae0e2924a2c5a24feff3ecad
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6907fb8…
Author: Jan Janak <jan(a)ryngle.com>
Committer: Jan Janak <jan(a)ryngle.com>
Date: Mon Oct 26 14:37:22 2009 +0100
domain: Do not report errors when domain cannot be extracted from URI.
We should not report an error to syslog when lookup_domain fails to
parse the URI it was given as argument. That URI usually comes from
SIP messages we received from another implementation and we cannot
guarantee that they will always be well-formed. Generating an error
each time we receive a malformed SIP message can easily result in
denial of service.
---
modules_s/domain/domain_mod.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules_s/domain/domain_mod.c b/modules_s/domain/domain_mod.c
index e5d5cb0..b175ff8 100644
--- a/modules_s/domain/domain_mod.c
+++ b/modules_s/domain/domain_mod.c
@@ -440,7 +440,7 @@ static int lookup_domain(struct sip_msg* msg, char* flags, char* fp)
track = 0;
if (get_str_fparam(&domain, msg, (fparam_t*)fp) != 0) {
- ERR("Cannot get domain name to lookup\n");
+ DBG("lookup_domain: Cannot get the domain name to lookup\n");
return -1;
}
Module: sip-router
Branch: master
Commit: 47e9d6d83617e79c774c8815ec88610dc24e3dc4
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=47e9d6d…
Author: Jan Janak <jan(a)ryngle.com>
Committer: Jan Janak <jan(a)ryngle.com>
Date: Mon Oct 26 14:15:53 2009 +0100
parse_sip_msg_uri: Log broken URIs only when debugging is enabled.
Logging broken Request-URIs with LOG(L_ERR) generates too much traffic
in syslog by default. Broken Request-URIs are beyond our control and
we should not generate an error message each time we receive and parse
one. We log them only when debugging is enabled.
---
parser/parse_uri.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/parser/parse_uri.c b/parser/parse_uri.c
index 60f28c5..b9d487e 100644
--- a/parser/parse_uri.c
+++ b/parser/parse_uri.c
@@ -1403,8 +1403,8 @@ int parse_sip_msg_uri(struct sip_msg* msg)
tmp_len=msg->first_line.u.request.uri.len;
}
if (parse_uri(tmp, tmp_len, &msg->parsed_uri)<0){
- LOG(L_ERR, "ERROR: parse_sip_msg_uri: bad uri <%.*s>\n",
- tmp_len, tmp);
+ DBG("ERROR: parse_sip_msg_uri: bad uri <%.*s>\n",
+ tmp_len, tmp);
msg->parsed_uri_ok=0;
return -1;
}
Module: sip-router
Branch: master
Commit: 084221763b27e7fab9fa2b860651972a97056467
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0842217…
Author: oej <oej(a)edvina.net>
Committer: oej <oej(a)edvina.net>
Date: Sun Oct 25 21:30:00 2009 +0100
Last doxygen updates of today.
---
modules_k/presence/bind_presence.c | 5 ++++-
modules_k/presence/bind_presence.h | 6 +++---
modules_k/presence/doc/presence_admin.xml | 24 ++++++++++++------------
3 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/modules_k/presence/bind_presence.c b/modules_k/presence/bind_presence.c
index c2093cb..154c220 100644
--- a/modules_k/presence/bind_presence.c
+++ b/modules_k/presence/bind_presence.c
@@ -27,7 +27,10 @@
*/
/*! \file
- * \brief Kamailio presence module
+ * \brief SIP-Router Presence :: Kamailio generic presence module
+ *
+ * This is the core presence module, used in combination with other modules.
+ *
* \ingroup presence
*/
diff --git a/modules_k/presence/bind_presence.h b/modules_k/presence/bind_presence.h
index 44858e2..5800315 100644
--- a/modules_k/presence/bind_presence.h
+++ b/modules_k/presence/bind_presence.h
@@ -25,10 +25,10 @@
* --------
* 2007-04-17 initial version (anca)
*/
-
/*! \file
- * \brief Kamailio presence module
- * \ingroup presence
+ * \brief SIP-Router Presence :: Kamailio generic presence module
+ *
+ * \ingroup presence
*/
diff --git a/modules_k/presence/doc/presence_admin.xml b/modules_k/presence/doc/presence_admin.xml
index 4273d7d..2dd8ec6 100644
--- a/modules_k/presence/doc/presence_admin.xml
+++ b/modules_k/presence/doc/presence_admin.xml
@@ -27,8 +27,8 @@
is periodically updated in the database, while for PUBLISH only the presence
or absence of stored info for a certain resource is maintained in memory
to avoid unnecessary, costly database operations.
- It is possible to disable in-memory caching by configurng a fallback to database mode
- (by setting module parameter "fallback2db"). In this mode, in case a searched record is not
+ It is possible to disable in-memory caching by configuring a fallback to database mode
+ (by setting the module parameter "fallback2db"). In this mode, in case a searched record is not
found in cache, the search is continued in database. This is useful for
an architecture in which processing and memory load might be divided on
several &kamailio; instances, maybe on different servers using the same database.
@@ -102,7 +102,7 @@
<programlisting format="linespecific">
...
modparam("presence", "db_url",
- "mysql://openser:openserrw@192.168.2.132/openser")
+ "&defaultdb;")
...
</programlisting>
</example>
@@ -225,7 +225,7 @@ modparam("presence", "to_tag_pref", 'pres')
<para>
The value in seconds that should be subtracted from the expires value when
sending a 200OK for a publish. It is used for forcing the client
- cu send an update before the old publish expires.
+ to send an update before the old publish expires.
</para>
<para>
<emphasis>Default value is <quote>0</quote>.
@@ -265,7 +265,7 @@ modparam("presence", "max_expires", 3600)
<title><varname>server_address</varname> (str)</title>
<para>
The presence server address which will become the value of Contact header filed
- for 200OK replies to Subscribe and Publish and in Notify messages.
+ for 200 OK replies to SUBSCRIBE and PUBLISH and in NOTIFY messages.
</para>
<example>
<title>Set <varname>server_address</varname> parameter</title>
@@ -299,8 +299,8 @@ modparam("presence", "fallback2db", 1)
<title><varname>subs_htable_size</varname> (int)</title>
<para>
The size of the in-memory hash table to store subscription dialogs.
- This parameter will be used as the power of 2 when computing table size.
- </para>
+ This parameter will be used as the power of 2 when computing table size.
+ </para>
<para>
<emphasis>Default value is <quote>9 (512)</quote>.
</emphasis>
@@ -318,8 +318,8 @@ modparam("presence", "subs_htable_size", 11)
<section>
<title><varname>pres_htable_size</varname> (int)</title>
<para>
- The size of the in-memory hash table to store publish records.
- This parameter will be used as the power of 2 when computing table size.
+ The size of the in-memory hash table to store publish records.
+ This parameter will be used as the power of 2 when computing table size.
</para>
<para>
<emphasis>Default value is <quote>9 (512)</quote>.
@@ -368,10 +368,10 @@ modparam("presence", "enable_sphere_check", 1)
</title>
<para>
Handles PUBLISH requests by storing and updating
- published information in memory cach and database, then calls functions to send
+ published information in memory cache and database, then calls functions to send
NOTIFY messages when changes in the published information occur.
It takes one argument -> sender_uri. The parameter was added
- for enabling BLA implementation. If present, Notification of
+ for enabling BLA implementation. If present, notification of
a change in published state is not sent to the respective uri
even though a subscription exists.
It should be taken from the Sender header. It was left at the
@@ -425,7 +425,7 @@ modparam("presence", "enable_sphere_check", 1)
</title>
<para>
The function which handles SUBSCRIBE requests. It stores or
- updates information in memory and database and calls functions to send Notify
+ updates information in memory and database and calls functions to send NOTIFY
messages when a SUBSCRIBE which initiate a dialog is received
</para>
<para>