Module: kamailio
Branch: master
Commit: d83cc933342002bd652a40e96a5b475abdd583c1
URL: https://github.com/kamailio/kamailio/commit/d83cc933342002bd652a40e96a5b475…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2016-07-29T06:31:26+02:00
modules: readme files regenerated - http_async_client ...
---
Modified: modules/http_async_client/README
---
Diff: https://github.com/kamailio/kamailio/commit/…
[View More]d83cc933342002bd652a40e96a5b475…
Patch: https://github.com/kamailio/kamailio/commit/d83cc933342002bd652a40e96a5b475…
---
diff --git a/modules/http_async_client/README b/modules/http_async_client/README
index 8d59bae..5757f7c 100644
--- a/modules/http_async_client/README
+++ b/modules/http_async_client/README
@@ -263,7 +263,7 @@ modparam("http_async_client", "curl_verbose", 1)
Choose the memory manager used by curl:
* shm: curl will use kamailio's SHM pool and memory manager
- * sys: curl will use the system memory amd memory manager (malloc,
+ * sys: curl will use the system memory and memory manager (malloc,
free, ...)
Note: if this module is used in conjunction with another module using
[View Less]
Module: kamailio
Branch: master
Commit: eb6b9c6bbd3674dc9e2b6da80b010986dd300e3f
URL: https://github.com/kamailio/kamailio/commit/eb6b9c6bbd3674dc9e2b6da80b01098…
Author: AndreasHuber-CH <andreas.huber(a)nagra.com>
Committer: AndreasHuber-CH <andreas.huber(a)nagra.com>
Date: 2016-07-26T10:33:01+02:00
registrar: Add module parameter "contact_max_size" to make max contact size configurable
The new module parameter "contact_max_size" allows changing the max size of contact URIs
that …
[View More]are accepted in REGISTER requests.
The default value of this parameter is 255 which was the value of the compile time constant
that is replaced by this module parameter.
If configured one must make sure that the DB actually supports the configured size in the
column "contact".
---
Modified: modules/registrar/doc/registrar_admin.xml
Modified: modules/registrar/registrar.c
Modified: modules/registrar/registrar.h
Modified: modules/registrar/sip_msg.c
---
Diff: https://github.com/kamailio/kamailio/commit/eb6b9c6bbd3674dc9e2b6da80b01098…
Patch: https://github.com/kamailio/kamailio/commit/eb6b9c6bbd3674dc9e2b6da80b01098…
---
diff --git a/modules/registrar/doc/registrar_admin.xml b/modules/registrar/doc/registrar_admin.xml
index 15550d8..eb47652 100644
--- a/modules/registrar/doc/registrar_admin.xml
+++ b/modules/registrar/doc/registrar_admin.xml
@@ -929,6 +929,36 @@ modparam("registrar", "flow_timer", 25)
</example>
</section>
+ <section id="registrar.p.contact_max_size">
+ <title><varname>contact_max_size</varname> (integer)</title>
+ <para>
+ Max size of URIs in <quote>Contact:</quote> header.
+ </para>
+ <para>
+ The size of URIs in <quote>Contact:</quote> headers are checked to be
+ lower or equal to this value.
+ A warning is logged and a 400 Bad Request is sent in response to REGISTER
+ requests with contact URIs that are longer than this value.
+ </para>
+ <para>
+ If a database is used then you must make sure that your database model supports
+ strings of the configured size in the column <quote>contact</quote> of the table
+ specified in <quote>save()</quote> function.
+ </para>
+ <para>
+ <emphasis>
+ Default value is 255.
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>contact_max_size</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("registrar", "contact_max_size", 500)
+...
+ </programlisting>
+ </example>
+ </section>
</section>
diff --git a/modules/registrar/registrar.c b/modules/registrar/registrar.c
index b04dbb3..4277ed9 100644
--- a/modules/registrar/registrar.c
+++ b/modules/registrar/registrar.c
@@ -106,6 +106,8 @@ int reg_outbound_mode = 0;
int reg_regid_mode = 0;
int reg_flow_timer = 0;
+int contact_max_size = 255; /* max size of contact URIs */
+
str match_callid_name = str_init("match_callid");
str match_received_name = str_init("match_received");
str match_contact_name = str_init("match_contact");
@@ -225,6 +227,7 @@ static param_export_t params[] = {
{"outbound_mode", INT_PARAM, ®_outbound_mode },
{"regid_mode", INT_PARAM, ®_regid_mode },
{"flow_timer", INT_PARAM, ®_flow_timer },
+ {"contact_max_size", INT_PARAM, &contact_max_size },
{0, 0, 0}
};
diff --git a/modules/registrar/registrar.h b/modules/registrar/registrar.h
index 5dda71e..6c4b2be 100644
--- a/modules/registrar/registrar.h
+++ b/modules/registrar/registrar.h
@@ -39,7 +39,7 @@
/* if DB support is used, this values must not exceed the
* storage capacity of the DB columns! See db/schema/entities.xml */
-#define CONTACT_MAX_SIZE 255
+extern int contact_max_size; /* configurable using module parameter "contact_max_size" instead of compile time constant */
#define RECEIVED_MAX_SIZE 255
#define USERNAME_MAX_SIZE 64
#define DOMAIN_MAX_SIZE 128
diff --git a/modules/registrar/sip_msg.c b/modules/registrar/sip_msg.c
index dd4ccce..8bc56cc 100644
--- a/modules/registrar/sip_msg.c
+++ b/modules/registrar/sip_msg.c
@@ -190,7 +190,7 @@ int check_contacts(struct sip_msg* _m, int* _s)
}
/* check also the length of all contacts */
for(c=((contact_body_t*)p->parsed)->contacts ; c ; c=c->next) {
- if (c->uri.len > CONTACT_MAX_SIZE) {
+ if (c->uri.len > contact_max_size) {
LM_WARN("contact uri is too long: [%.*s]\n", c->uri.len, c->uri.s);
rerrno = R_CONTACT_LEN;
return 1;
[View Less]
Module: kamailio
Branch: master
Commit: c0697d76fc2ae8ea9676aa9a9b57db442b9c678f
URL: https://github.com/kamailio/kamailio/commit/c0697d76fc2ae8ea9676aa9a9b57db4…
Author: AndreasHuber-CH <andreas.huber(a)nagra.com>
Committer: AndreasHuber-CH <andreas.huber(a)nagra.com>
Date: 2016-07-26T09:00:35+02:00
registrar: Check max URI size of contact also for first contact header
The URI size of contacts is checked against a max size to ensure that it fits into the database column.
This …
[View More]check was already present before but was done only for the contact header fields other than the first header field
which made that REGISTER with a single contact were not checked for max size and were truncated later when stored to the database.
With this fix all contact URIs of all contact header fields are checked against the max size.
---
Modified: modules/registrar/sip_msg.c
---
Diff: https://github.com/kamailio/kamailio/commit/c0697d76fc2ae8ea9676aa9a9b57db4…
Patch: https://github.com/kamailio/kamailio/commit/c0697d76fc2ae8ea9676aa9a9b57db4…
---
diff --git a/modules/registrar/sip_msg.c b/modules/registrar/sip_msg.c
index 8856ce4..dd4ccce 100644
--- a/modules/registrar/sip_msg.c
+++ b/modules/registrar/sip_msg.c
@@ -179,10 +179,10 @@ int check_contacts(struct sip_msg* _m, int* _s)
*_s = 1;
} else { /* The first Contact HF is not star */
- /* Message must contain no star Contact HF */
- p = _m->contact->next;
+ p = _m->contact;
while(p) {
if (p->type == HDR_CONTACT_T) {
+ /* Message must contain no star Contact HF */
if (((contact_body_t*)p->parsed)->star == 1) {
LM_WARN("star contact cannot be mixed with other contacts\n");
rerrno = R_STAR_CONT;
@@ -193,7 +193,7 @@ int check_contacts(struct sip_msg* _m, int* _s)
if (c->uri.len > CONTACT_MAX_SIZE) {
LM_WARN("contact uri is too long: [%.*s]\n", c->uri.len, c->uri.s);
rerrno = R_CONTACT_LEN;
- return 1;
+ return 1;
}
if (c->received && c->received->len>RECEIVED_MAX_SIZE) {
LM_WARN("received attribute of contact is too long\n");
[View Less]
Module: kamailio
Branch: master
Commit: cc0b07d2bcadbd95b2f0dbfdcc873306acca8f2d
URL: https://github.com/kamailio/kamailio/commit/cc0b07d2bcadbd95b2f0dbfdcc87330…
Author: AndreasHuber-CH <andreas.huber(a)nagra.com>
Committer: AndreasHuber-CH <andreas.huber(a)nagra.com>
Date: 2016-07-26T08:41:20+02:00
registrar: Add warnings if contact is invalid and REGISTER will be rejected
Added some warnings in case a REGISTER is rejected because of an invalid contact header field.
Before, …
[View More]kamailio might answer a 400 Bad Request for a too long contact URI for example without logging any message.
---
Modified: modules/registrar/sip_msg.c
---
Diff: https://github.com/kamailio/kamailio/commit/cc0b07d2bcadbd95b2f0dbfdcc87330…
Patch: https://github.com/kamailio/kamailio/commit/cc0b07d2bcadbd95b2f0dbfdcc87330…
---
diff --git a/modules/registrar/sip_msg.c b/modules/registrar/sip_msg.c
index 36c4682..8856ce4 100644
--- a/modules/registrar/sip_msg.c
+++ b/modules/registrar/sip_msg.c
@@ -154,12 +154,14 @@ int check_contacts(struct sip_msg* _m, int* _s)
/* The first Contact HF is star */
/* Expires must be zero */
if (get_expires_hf(_m) != 0) {
+ LM_WARN("expires must be 0 for star contact\n");
rerrno = R_STAR_EXP;
return 1;
}
/* Message must contain no contacts */
if (((contact_body_t*)_m->contact->parsed)->contacts) {
+ LM_WARN("star contact cannot be mixed with other contacts\n");
rerrno = R_STAR_CONT;
return 1;
}
@@ -168,6 +170,7 @@ int check_contacts(struct sip_msg* _m, int* _s)
p = _m->contact->next;
while(p) {
if (p->type == HDR_CONTACT_T) {
+ LM_WARN("star contact cannot be mixed with other contacts\n");
rerrno = R_STAR_CONT;
return 1;
}
@@ -181,13 +184,19 @@ int check_contacts(struct sip_msg* _m, int* _s)
while(p) {
if (p->type == HDR_CONTACT_T) {
if (((contact_body_t*)p->parsed)->star == 1) {
+ LM_WARN("star contact cannot be mixed with other contacts\n");
rerrno = R_STAR_CONT;
return 1;
}
- /* check also the lenght of all contacts */
+ /* check also the length of all contacts */
for(c=((contact_body_t*)p->parsed)->contacts ; c ; c=c->next) {
- if (c->uri.len > CONTACT_MAX_SIZE
- || (c->received && c->received->len>RECEIVED_MAX_SIZE) ) {
+ if (c->uri.len > CONTACT_MAX_SIZE) {
+ LM_WARN("contact uri is too long: [%.*s]\n", c->uri.len, c->uri.s);
+ rerrno = R_CONTACT_LEN;
+ return 1;
+ }
+ if (c->received && c->received->len>RECEIVED_MAX_SIZE) {
+ LM_WARN("received attribute of contact is too long\n");
rerrno = R_CONTACT_LEN;
return 1;
}
[View Less]
I split the pull request in three commits to seperate the fix from the new feature, but they go together so I propose them in the same pull request:
cc0b07d: I added some log message that would have helped me to understand a 400 Bad Request response.
c0697d7: I fixed a bug that were the contact size is not checked on the first header field and 200 OK is sent instead of 400 Bad Request for too long contact URIs but the uri ends up beein truncated by the database.
eb6b9c6: I made the contact …
[View More]size configurable to allow longer contacts
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/725
-- Commit Summary --
* registrar: Add warnings if contact is invalid and REGISTER will be rejected
* registrar: Check max URI size of contact also for first contact header
* registrar: Add module parameter "contact_max_size" to make max contact size configurable
-- File Changes --
M modules/registrar/doc/registrar_admin.xml (30)
M modules/registrar/registrar.c (3)
M modules/registrar/registrar.h (2)
M modules/registrar/sip_msg.c (19)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/725.patchhttps://github.com/kamailio/kamailio/pull/725.diff
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/725
[View Less]