[OpenSIPS-Devel] [OpenSIPS/opensips] c94887: digest+m_auth: Allow a domain in the digest userna...

2014-02-18 Thread Walter Doekes
  Branch: refs/heads/1.9
  Home:   https://github.com/OpenSIPS/opensips
  Commit: c94887a5f5e950ee59e699f1bcfb3118d7cc78fb
  
https://github.com/OpenSIPS/opensips/commit/c94887a5f5e950ee59e699f1bcfb3118d7cc78fb
  Author: Walter Doekes walter+git...@wjd.nu
  Date:   2014-02-05 (Wed, 05 Feb 2014)

  Changed paths:
M modules/auth/auth_mod.c
M parser/digest/digest.c

  Log Message:
  ---
  digest+m_auth: Allow a domain in the digest username.

Before this patch, a domain in the digest username was allowed:

Digest username=abc@domain, realm=domain

but only if the domain is equal to the realm. This was introduced in
a92bf789 (Juha Heinanen, Mar. 29 2006).

The SIP spec. doesn't mention any such restriction.

This patch undoes that commit and makes sure the whole username is used
when authenticating through `pv_www_authorize` and `pv_proxy_authorize`.
That makes the following valid:

Digest username=abc@domain, realm=something different


___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] 26044b: digest+m_auth: Allow a domain in the digest userna...

2014-02-18 Thread Walter Doekes
  Branch: refs/heads/1.10
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 26044bfee42c28d3d53516fbe54080a3a9420a87
  
https://github.com/OpenSIPS/opensips/commit/26044bfee42c28d3d53516fbe54080a3a9420a87
  Author: Walter Doekes walter+git...@wjd.nu
  Date:   2014-02-05 (Wed, 05 Feb 2014)

  Changed paths:
M modules/auth/auth_mod.c
M parser/digest/digest.c

  Log Message:
  ---
  digest+m_auth: Allow a domain in the digest username.

Before this patch, a domain in the digest username was allowed:

Digest username=abc@domain, realm=domain

but only if the domain is equal to the realm. This was introduced in
a92bf789 (Juha Heinanen, Mar. 29 2006).

The SIP spec. doesn't mention any such restriction.

This patch undoes that commit and makes sure the whole username is used
when authenticating through `pv_www_authorize` and `pv_proxy_authorize`.
That makes the following valid:

Digest username=abc@domain, realm=something different


___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] statistics: fix compiler warning in 32-bit environments (15784be)

2014-03-05 Thread Walter Doekes
Better yet!

z  A following integer conversion corresponds to a size_t or ssize_t 
argument.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/commit/15784be2d541aa3b8909888eb184f963ab6b3ca7#commitcomment-5574778___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] presence_dialoginfo: Fix memory leak in dlginfo_agg_nbody. (#174)

2014-03-06 Thread Walter Doekes
(I squashes the two commits into one, just now.)

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/174#issuecomment-36837723___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] xcap_client: Fix two mem corruptions. (#176)

2014-03-12 Thread Walter Doekes
See the two commits:

- in both cases the first item of the linked list is not freed,
- the freed memory is read
- lastly a NULL is freed (or in the second case, a NULL-dereference)
You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-xcapclient_mem_corrupt

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/176

-- Commit Summary --

  * xcap_client: Fix possible memory curruption in destroy_xcapcb_list.
  * xcap_client: Fix memory leak and possible corruption in xcapFreeNodeSel.

-- File Changes --

M modules/xcap_client/xcap_callbacks.c (6)
M modules/xcap_client/xcap_functions.c (4)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/176.patch
https://github.com/OpenSIPS/opensips/pull/176.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/176
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] presence_dialoginfo: Fix bounds checking by using a helper function. (#177)

2014-03-12 Thread Walter Doekes
Reported by: dsandras
gt; About the bound checking error, the code was cutamp;pasted from another
gt; place in the same file where the same error is still present:
gt; ...

Also I replaced a heap str with a stack one in build_dialoginfo. This
one wasn#39;t freed either unless an error condition was hit.
You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-fix_dialogaggr_bounds

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/177

-- Commit Summary --

  * presence_dialoginfo: Fix bounds checking by using a helper function.

-- File Changes --

M modules/presence_dialoginfo/notify_body.c (75)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/177.patch
https://github.com/OpenSIPS/opensips/pull/177.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/177
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] presence_dialoginfo: Fix bounds checking by using a helper function. (#177)

2014-03-12 Thread Walter Doekes
   return NULL;
 - }
 - memcpy(buf, sip:, 4);
 - memcpy(buf+4, pres_user-s, pres_user-len);
 - buf[pres_user-len+4] = '@';
 - memcpy(buf + pres_user-len + 5, pres_domain-s, pres_domain-len);
 - buf[pres_user-len + 5 + pres_domain-len]= '\0';
 -
 - pres_uri = (str*)pkg_malloc(sizeof(str));
 - if(pres_uri == NULL)
 - {
 - LM_ERR(while allocating memory\n);
 - return NULL;
 - }
 - memset(pres_uri, 0, sizeof(str));

Memset just before setting it.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/177/files#r10510194___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] presence_dialoginfo: Fix bounds checking by using a helper function. (#177)

2014-03-12 Thread Walter Doekes
 @@ -444,10 +429,6 @@ str* build_dialoginfo(str* pres_user, str* pres_domain)
   xmlCleanupParser();
   return body;
  error:
 - if ( pres_uri )
 - {
 - pkg_free(pres_uri);

Here it was freed, but it wasn't when the function returned succesfully.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/177/files#r10510217___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] 2d1e4a: presence_dialoginfo: Fix bounds checking by using ...

2014-03-26 Thread Walter Doekes
  Branch: refs/heads/1.8
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 2d1e4a8706cf256b2f0883e457d9598d2420399e
  
https://github.com/OpenSIPS/opensips/commit/2d1e4a8706cf256b2f0883e457d9598d2420399e
  Author: Walter Doekes walter+git...@wjd.nu
  Date:   2014-03-26 (Wed, 26 Mar 2014)

  Changed paths:
M modules/presence_dialoginfo/notify_body.c

  Log Message:
  ---
  presence_dialoginfo: Fix bounds checking by using a helper function.

Reported by: dsandras
 About the bound checking error, the code was cutpasted from another
 place in the same file where the same error is still present:
 ...

Also I replaced a heap str with a stack one in build_dialoginfo. This
one wasn't freed either unless an error condition was hit.

(cherry picked from commit 6d058ec495c2faa015b24f412e2fe1b55526657e)


___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] 3972d2: presence_dialoginfo: Fix bounds checking by using ...

2014-03-26 Thread Walter Doekes
  Branch: refs/heads/1.10
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 3972d266958e6e49110a881e1c9733fa066873ff
  
https://github.com/OpenSIPS/opensips/commit/3972d266958e6e49110a881e1c9733fa066873ff
  Author: Walter Doekes walter+git...@wjd.nu
  Date:   2014-03-26 (Wed, 26 Mar 2014)

  Changed paths:
M modules/presence_dialoginfo/notify_body.c

  Log Message:
  ---
  presence_dialoginfo: Fix bounds checking by using a helper function.

Reported by: dsandras
 About the bound checking error, the code was cutpasted from another
 place in the same file where the same error is still present:
 ...

Also I replaced a heap str with a stack one in build_dialoginfo. This
one wasn't freed either unless an error condition was hit.

(cherry picked from commit 6d058ec495c2faa015b24f412e2fe1b55526657e)


___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] 38dc20: Fix two mem corruptions.

2014-03-26 Thread Walter Doekes
  Branch: refs/heads/1.10
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 38dc20be0c20576510a8c57e296741c24a743a80
  
https://github.com/OpenSIPS/opensips/commit/38dc20be0c20576510a8c57e296741c24a743a80
  Author: Walter Doekes walter+git...@wjd.nu
  Date:   2014-03-26 (Wed, 26 Mar 2014)

  Changed paths:
M modules/xcap_client/xcap_callbacks.c
M modules/xcap_client/xcap_functions.c

  Log Message:
  ---
  Fix two mem corruptions.

Closes github issue #176


___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] 9c3fdd: Fix two mem corruptions.

2014-03-26 Thread Walter Doekes
  Branch: refs/heads/1.8
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 9c3fdda8073fec5e67dcd55bd627c201a72d6d5b
  
https://github.com/OpenSIPS/opensips/commit/9c3fdda8073fec5e67dcd55bd627c201a72d6d5b
  Author: Walter Doekes walter+git...@wjd.nu
  Date:   2014-03-26 (Wed, 26 Mar 2014)

  Changed paths:
M modules/xcap_client/xcap_callbacks.c
M modules/xcap_client/xcap_functions.c

  Log Message:
  ---
  Fix two mem corruptions.

Closes github issue #176


___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Add listen interface (socket) checking to db based natping. (#127)

2014-05-01 Thread Walter Doekes
 @@ -130,6 +131,18 @@ static int get_all_db_ucontacts(void *buf, int len, 
 unsigned int flags,
  
   LM_DBG(buf: %p. flags: %d\n, buf, flags);
  
 + if (sockaddr_list_str.s) {
 + i = snprintf(query_socket, sizeof(query_socket),  and socket 
 in (%.*s),

I can't find the spec itself, but according to all pages that reference the 
spec., IN belongs in the core SQL.

Example:
http://www.postgresql.org/docs/7.4/static/features.html
http://developer.mimer.com/standard/features/core-sql-features.tml

In both cases they are listed as core sql. Look for `IN predicate with list of 
values`.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/127/files#r12183049___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] Fix a few typo's and double spaces in LM_* messages. (#232)

2014-05-19 Thread Walter Doekes

You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-misc_typos

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/232

-- Commit Summary --

  * s/interger/integer/
  * s/sever=/server=/
  * s/writting/writing/
  * Fix a few spacing issues and a few more typo#39;s.

-- File Changes --

M cfg.y (8)
M daemonize.c (2)
M main.c (2)
M mem/f_malloc.c (2)
M modules/avpops/avpops.c (2)
M modules/avpops/avpops_impl.c (2)
M modules/b2b_entities/b2be_db.c (4)
M modules/carrierroute/load_data.c (2)
M modules/db_berkeley/bdb_val.c (2)
M modules/db_berkeley/db_berkeley.c (4)
M modules/db_cachedb/doc/db_cachedb_admin.xml (2)
M modules/dialog/doc/dialog_admin.xml (2)
M modules/drouting/drouting.c (4)
M modules/event_route/event_route.c (2)
M modules/imc/imc.c (4)
M modules/load_balancer/doc/load_balancer_admin.xml (2)
M modules/load_balancer/lb_data.c (2)
M modules/load_balancer/load_balancer.c (2)
M modules/maxfwd/maxfwd.c (2)
M modules/mi_datagram/datagram_fnc.c (12)
M modules/mi_fifo/fifo_fnc.c (4)
M modules/nathelper/doc/nathelper_admin.xml (2)
M modules/sipcapture/sipcapture.c (2)
M modules/sms/sms.c (2)
M modules/snmpstats/interprocess_buffer.c (2)
M modules/snmpstats/utilities.c (2)
M modules/tm/t_fwd.c (2)
M modules/tm/tm.c (4)
M modules/uac_redirect/redirect.c (2)
M msg_translator.c (2)
M parser/parse_uri.c (4)
M pvar.c (4)
M resolve.h (2)
M script_cb.c (4)
M socket_info.h (2)
M tcp_main.c (18)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/232.patch
https://github.com/OpenSIPS/opensips/pull/232.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/232
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Fix a few typo's and double spaces in LM_* messages. (#232)

2014-05-19 Thread Walter Doekes
Drat. Didn't mean to make 4 commits out of that. I'll squash 'm next time. 
Sorry :)

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/232#issuecomment-43497369___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] RTPPROXY module: compatibility with topology hiding (#237)

2014-05-20 Thread Walter Doekes
   } else {
 - LM_ERR(can't extract 2nd via 
 found reply\n);
 + if (parse_headers(msg, 
 HDR_VIA2_F, 0) != -1 

You could make the `} else {` above an `} else if {`, that saves you some 
indentation.

Feel free to squash and push -f.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/237/files#r12830105___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] RTPPROXY module: compatibility with topology hiding (#237)

2014-05-20 Thread Walter Doekes
 @@ -3229,6 +3229,8 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* 
 str2, char *setid, char *
   struct force_rtpp_args args;
   struct force_rtpp_args *ap;
   union sockaddr_union to;
 + struct socket_info *si;
 + struct dlg_cell * dlg;

Please stay consistent with local code style: join the `*` to the `dlg`.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/237/files#r12830089___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] RTPPROXY module: compatibility with topology hiding (#238)

2014-05-21 Thread Walter Doekes
   } else {
 - LM_ERR(can't extract 2nd via 
 found reply\n);
 + if (parse_headers(msg, 
 HDR_VIA2_F, 0) != -1 

Hi! I believe I did suggest moving this `if` into the `else` above, avoiding 
unnecessary extra indentation.

TIA :)

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/238/files#r12897609___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Add listen interface (socket) checking to db based natping. (#127)

2014-05-22 Thread Walter Doekes
For the record. This should probably be improved to handle in-memory contacts 
as well, since this can now be binary-replicated (right?)

16:28  lirakis bogdan_vs, if there was a smart nat ping ... then i think 
you could do distributed usrloc out of the box with replication, path headers, 
and a smart nat ping
...
16:31  wdoekes lirakis: smart nat ping? do you mean: 
https://github.com/OpenSIPS/opensips/pull/127 ?
16:32  lirakis wdoekes, yes
16:33  lirakis was ... this merged?
16:33  wdoekes no
16:33  lirakis but yeah
16:34  lirakis i mean ... we do this already with our own custom usrloc stuff
16:34  lirakis im just saying for out of the box functionality
16:34  lirakis i think that would be the only thing missing that i can think 
of
16:34  wdoekes one could poke razvan to get it merged
16:35  lirakis razvan ... poke
16:35  lirakis he he
16:35  wdoekes =)
16:35  lirakis so .. you are actually just changing usrloc to return only 
local contacts from get_all_u_contacts ?
16:36  lirakis but ... are you actually stlil getting contacts on other 
servers when you do a lookup ?
16:36  lirakis b/c i would still wan that behavior
16:36  lirakis so you can use path headers to route from an adjecent proxy to 
the home proxy
16:36  lirakis wdoekes, not sure if im being clear
16:38  wdoekes it's only the get_all that is affected
16:38  wdoekes and then only the db-version
16:38  wdoekes so for your binary replication, we may need to improve the 
patch
16:39  lirakis ah
16:39  lirakis ok
16:39  wdoekes the get_all is only called from nathelper (afaics)
16:39  lirakis right
16:39  lirakis vs lookup
16:39  wdoekes correct
16:39  lirakis cool
16:40  wdoekes I don't store users in mem, so I didn't need that. but I see 
how that could be an improvement
16:41  wdoekes (and probably, the get_all_ should be renamed to get_all_local 
or something)
...
16:41  lirakis but again - im just thinking about generic out of the box 
functionality


---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/127#issuecomment-43891801___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Add topology_hiding() flag to also hide the callid for all requests/replies within a call (0f551f7)

2014-06-09 Thread Walter Doekes
If callid is shorter than topo_hiding_prefix.len, you'll be comparing random 
memory. In the worst case resulting in a segfault. Suggestion: add an `if 
(msg-callid-body.len  topo_hiding_prefix.len  ...`

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/commit/0f551f7cb668014798450848a4330d064108dc37#commitcomment-6601399___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] makefile: Move checks around for documentation dependencies. (#248)

2014-06-13 Thread Walter Doekes
The patch speaks for itself.

Mainly it adds the `-z quot;$(DBHTMLXSL)quot;` check, so I don#39;t get 
unexplainable errors.
You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-warn-if-no-docbook

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/248

-- Commit Summary --

  * makefile: Move checks around for documentation dependencies.

-- File Changes --

M Makefile (55)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/248.patch
https://github.com/OpenSIPS/opensips/pull/248.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/248
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] Port topoh.so (topology hiding without dialog.so) from kamailio. (#249)

2014-06-13 Thread Walter Doekes
See the three commits. The changes were trivial.

I don#39;t know about copyright and stuff though.
You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-topoh-from-kamailio

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/249

-- Commit Summary --

  * topoh: Add kamailio topo hiding module.
  * topoh: Port changes to opensips.
  * topoh: Make more opensips-ish. Fix README.

-- File Changes --

A modules/topoh/Makefile (10)
A modules/topoh/README (185)
A modules/topoh/doc/Makefile (4)
A modules/topoh/doc/topoh.xml (39)
A modules/topoh/doc/topoh_admin.xml (228)
A modules/topoh/th_mask.c (182)
A modules/topoh/th_mask.h (38)
A modules/topoh/th_msg.c (1084)
A modules/topoh/th_msg.h (55)
A modules/topoh/topoh_mod.c (434)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/249.patch
https://github.com/OpenSIPS/opensips/pull/249.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/249
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Split fromip and toip columns (#253)

2014-06-19 Thread Walter Doekes
 @@ -206,17 +206,35 @@ modparam(siptrace, duplicate_uri, 
 sip:10.1.1.1:5888)
  
  1.3.8. trace_local_ip (str)
  
 -   The address to be used in fromip field for local generated
 -   messages. If not set, the module sets it to the address of the
 -   socket that will be used to send the message.
 +   The address to be used in fromip fields (protocol, ip and port)

s/fromip/from/

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/253/files#r13965006___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Split fromip and toip columns (#253)

2014-06-19 Thread Walter Doekes
 @@ -206,17 +206,35 @@ modparam(siptrace, duplicate_uri, 
 sip:10.1.1.1:5888)
  
  1.3.8. trace_local_ip (str)
  
 -   The address to be used in fromip field for local generated
 -   messages. If not set, the module sets it to the address of the
 -   socket that will be used to send the message.
 +   The address to be used in fromip fields (protocol, ip and port)
 +   for local generated messages. If not set, the module sets it to
 +   the address of the socket that will be used to send the
 +   message. Protocol and/or port ar optional and if ommited will

are omitted

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/253/files#r13965013___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] doc: Fix typo's. Always regenerate all docs. (#258)

2014-06-30 Thread Walter Doekes
- Fix a few typo#39;s (*global, *allocate and a few others).
- Alter makefile so the docs are all touched when doing `make modules-readme`.
- Run `make modules-readme` to regenerate text readme#39;s.
You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-misc_typos

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/258

-- Commit Summary --

  * doc: Fix typo#39;s. Always regenerate all docs.

-- File Changes --

M Makefile (103)
M doc/entities.xml (2)
M modules/aaa_radius/README (9)
M modules/aaa_radius/doc/aaa_radius_admin.xml (2)
M modules/acc/README (2)
M modules/b2b_logic/README (3)
M modules/b2b_sca/README (18)
M modules/carrierroute/README (3)
M modules/cpl-c/README (3)
M modules/db_berkeley/README (3)
M modules/db_cachedb/README (2)
M modules/db_http/README (2)
M modules/db_mysql/README (9)
M modules/db_oracle/README (3)
M modules/db_perlvdb/README (17)
M modules/db_postgres/README (3)
M modules/db_unixodbc/README (3)
M modules/db_virtual/dbase.c (4)
M modules/dialog/README (2)
M modules/dialog/dialog.c (10)
M modules/dialog/dlg_tophiding.c (46)
M modules/httpd/README (3)
M modules/identity/README (2)
M modules/jabber/README (3)
M modules/json/README (2)
M modules/load_balancer/README (4)
M modules/load_balancer/lb_parser.c (2)
M modules/mangler/sdp_mangler.c (37)
M modules/mi_fifo/README (2)
M modules/mi_xmlrpc/README (5)
M modules/mi_xmlrpc_ng/README (7)
M modules/mmgeoip/README (3)
M modules/nathelper/README (6)
M modules/osp/README (10)
M modules/pi_http/README (7)
M modules/presence/README (5)
M modules/presence_dialoginfo/README (3)
M modules/presence_mwi/README (3)
M modules/presence_xml/README (5)
M modules/pua/README (5)
M modules/pua_bla/README (7)
M modules/pua_dialoginfo/README (4)
M modules/pua_mi/README (7)
M modules/pua_usrloc/README (7)
M modules/pua_xmpp/README (5)
M modules/ratelimit/ratelimit_helper.c (2)
M modules/regex/README (3)
M modules/rls/README (5)
M modules/rtpproxy/README (2)
M modules/tm/README (12)
M modules/uac_registrant/README (4)
M modules/xcap/README (52)
M modules/xcap_client/README (8)
M modules/xmpp/README (5)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/258.patch
https://github.com/OpenSIPS/opensips/pull/258.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/258
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] Add Call-ID mangling support. Dialog module not needed. (#259)

2014-06-30 Thread Walter Doekes
Add the quot;spiralquot; module that mangles the call-id without requiring 
the dialog state to be kept.

The `topoh` module pull request does the same, but more. This is limited to 
only altering the call-id header.
You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-spiral_module

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/259

-- Commit Summary --

  * Add Call-ID mangling support. Dialog module not needed.

-- File Changes --

A modules/spiral/Makefile (10)
A modules/spiral/README (107)
A modules/spiral/doc/spiral.xml (45)
A modules/spiral/doc/spiral_admin.xml (114)
A modules/spiral/spiral.c (631)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/259.patch
https://github.com/OpenSIPS/opensips/pull/259.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/259
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] doc: Fix typo's. Always regenerate all docs. (#258)

2014-07-01 Thread Walter Doekes
That's the flip side of the coin.

The other side is that I don't need to alter the modules-filter when I *do* 
want to regenerate all.

My problem with the current situation was that:
- I needed to generate one README
- I got 40% of the READMEs (because of the default selected modules)

I changed it to generate 100% of the readme's. At least now regeneration is 
consistent.

If you're considering changing things, I'd too favor an option to generate a 
single README. Preferably by just doing: `make modules/modulename/README` (or 
`make -C modules/modulename doc`)

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/258#issuecomment-47646142___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] make: Let `make modules-readme modules=aaa_radius` work again. (#263)

2014-07-01 Thread Walter Doekes
See #258.
You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-unbreak_modules_readme

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/263

-- Commit Summary --

  * make: Let `make modules-readme modules=aaa_radius` work again.

-- File Changes --

M Makefile (25)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/263.patch
https://github.com/OpenSIPS/opensips/pull/263.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/263
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Feature sipmsgvalidate for tofrom (#294)

2014-08-11 Thread Walter Doekes
  
 - return 1;
 +return 1;

You're reindenting huge bits of file here.

Looks like your replacing tabs with four spaces. That doesn't help the review, 
nor the code base. Please use tabs for every 4 spaces and force-push over this.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/294/files#r16042488___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Feature sipmsgvalidate for tofrom (#294)

2014-08-11 Thread Walter Doekes
 +if ((hdrs_len+2=msg-len)  
 (strncmp(CRLF,msg-unparsed,CRLF_LEN)==0) )
 +body.s = msg-unparsed + CRLF_LEN;
 +else if ( (hdrs_len+1=msg-len) 
 +(*(msg-unparsed)=='\n' || *(msg-unparsed)=='\r' ) )
 +body.s = msg-unparsed + 1;
 +else {
 +/* no body */
 +body.s = NULL;
 +body.len = 0;
 +}
 +
 +/* determine the length of the body */
 +body.len = msg-buf + msg-len - body.s;
 +
 +if (get_content_length(msg) != body.len) {
 +snprintf(reason, MAX_REASON-1, invalid body - content length 
 %ld different then 

different *than

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/294/files#r16042525___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Feature sipmsgvalidate for tofrom (#294)

2014-08-11 Thread Walter Doekes
 - goto failed;
 - }
 -
 - if (body.len  body.s) {
 - /* if it really has body, check for content type */
 - ret = SV_NO_CONTENT_TYPE;
 - CHECK_HEADER(, content_type);
 - }
 - }
 +if(flags  SIP_PARSE_CONTACT) {
 +/* iterate through Contact headers */
 +for(ptr = msg-contact; ptr; ptr = ptr-sibling) {
 +/* parse Contact header */
 +if(!ptr-parsed  (parse_contact(ptr)  0 
 +|| !ptr-parsed)) {
 +strcpy(reason, failed to parse \'Contact\' 
 header);

No need to escape single quotes within double quoted strings.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/294/files#r16042545___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] msg_translator: Passing MSG_TRANS_NOVIA_FLAG means don't touch Via. (#305)

2014-08-19 Thread Walter Doekes
Before this, if you passed the MSG_TRANS_NOVIA_FLAG flag to
build_res_buf_from_sip_res, the msg-gt;via1-gt;next would get checked but
not used. Now it#39;s not touched at all.
You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-msg_trans_no_via-no_crash

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/305

-- Commit Summary --

  * msg_translator: Passing MSG_TRANS_NOVIA_FLAG means don#39;t touch Via.

-- File Changes --

M msg_translator.c (32)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/305.patch
https://github.com/OpenSIPS/opensips/pull/305.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/305
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] New assert script keyword for script debugging (#313)

2014-08-26 Thread Walter Doekes
Nice! I always wanted something like that.

Does the string-part get it's pv's expanded? I'd want to put var(foo) is 
$var(foo) and not 42 in there.

(And I'd prefer a few more spaces between every operator in the code.)


---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/313#issuecomment-53397211___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Port topoh.so (topology hiding without dialog.so) from kamailio. (#249)

2014-08-26 Thread Walter Doekes
Yes. That sounds reasonable. Thanks for looking into this :)

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/249#issuecomment-53405415___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Port topoh.so (topology hiding without dialog.so) from kamailio. (#249)

2014-08-26 Thread Walter Doekes
Closed #249.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/249#event-157244587___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] dialog: Fix dialog_admin documentation regarding column names. (#351)

2014-10-08 Thread Walter Doekes

You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-dialog-modparam-columns

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/351

-- Commit Summary --

  * dialog: Fix dialog_admin documentation regarding column names.

-- File Changes --

M modules/dialog/README (305)
M modules/dialog/dialog.c (2)
M modules/dialog/dlg_db_handler.h (1)
M modules/dialog/doc/dialog_admin.xml (96)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/351.patch
https://github.com/OpenSIPS/opensips/pull/351.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/351
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] dialog: Fix dialog_admin documentation regarding column names. (#351)

2014-10-08 Thread Walter Doekes
I would think so. This is a very old bug. It's in kamailio as well.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/351#issuecomment-58351675___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] dialog: Fix dialog_admin documentation regarding column names. (#352)

2014-10-08 Thread Walter Doekes
(backport from b519d6997e6faa654ff4a513843359008f8cb66e)
You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-dialog-modparam-columns-1.8

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/352

-- Commit Summary --

  * dialog: Fix dialog_admin documentation regarding column names.

-- File Changes --

M modules/dialog/README (235)
M modules/dialog/dialog.c (2)
M modules/dialog/dlg_db_handler.c (1)
M modules/dialog/dlg_db_handler.h (2)
M modules/dialog/doc/dialog_admin.xml (76)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/352.patch
https://github.com/OpenSIPS/opensips/pull/352.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/352
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] dialog: Fix dialog_admin documentation regarding column names. (#353)

2014-10-08 Thread Walter Doekes
(backport from b519d6997e6faa654ff4a513843359008f8cb66e)
You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-dialog-modparam-columns-1.9

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/353

-- Commit Summary --

  * dialog: Fix dialog_admin documentation regarding column names.

-- File Changes --

M modules/dialog/README (251)
M modules/dialog/dialog.c (2)
M modules/dialog/dlg_db_handler.h (2)
M modules/dialog/doc/dialog_admin.xml (76)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/353.patch
https://github.com/OpenSIPS/opensips/pull/353.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/353
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] dialog: Fix dialog_admin documentation regarding column names. (#354)

2014-10-08 Thread Walter Doekes
(backport from b519d6997e6faa654ff4a513843359008f8cb66e)
You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-dialog-modparam-columns-1.10

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/354

-- Commit Summary --

  * dialog: Fix dialog_admin documentation regarding column names.

-- File Changes --

M modules/dialog/README (267)
M modules/dialog/dialog.c (2)
M modules/dialog/dlg_db_handler.h (2)
M modules/dialog/doc/dialog_admin.xml (76)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/354.patch
https://github.com/OpenSIPS/opensips/pull/354.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/354
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] dialog: Fix dialog_admin documentation regarding column names. (#355)

2014-10-08 Thread Walter Doekes
(backport from b519d6997e6faa654ff4a513843359008f8cb66e)
You can merge this Pull Request by running:

  git pull https://github.com/wdoekes/opensips wjd-dialog-modparam-columns-1.11

Or you can view, comment on it, or merge it online at:

  https://github.com/OpenSIPS/opensips/pull/355

-- Commit Summary --

  * dialog: Fix dialog_admin documentation regarding column names.

-- File Changes --

M modules/dialog/README (267)
M modules/dialog/dialog.c (2)
M modules/dialog/dlg_db_handler.h (2)
M modules/dialog/doc/dialog_admin.xml (76)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/355.patch
https://github.com/OpenSIPS/opensips/pull/355.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/355
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] dialog: Fix dialog_admin documentation regarding column names. (#351)

2014-10-08 Thread Walter Doekes
There you go. A bunch of pull request.

Only conflicts were between master-1.8 (no mflags yet).
1.8 upwards to 1.11 was conflict-free.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/351#issuecomment-58354247___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, avpenv) function for exec module (#360)

2014-10-16 Thread Walter Doekes
 + * output - pseudovariable where to store the output from the
 +   standard output of the command. Keep in mind that if this
 +   parameter is set, the async paramater will not be taken in
 +   consideration.
 + * input - String to be passed to the standard input of the
 +   command. The string can be given as a pseudovariable.
 + * envavp - Avp where to store the values for the environment
 +   variables to be passed for the command. The names of the
 +   environment variables will be OSIPS_EXEC_# where # will
 +   start from 0. For example if you store 2 values into an avp
 +   (a and b) OSIPS_EXEC_0 will contain the first value and
 +   OSIPS_EXEC_1 the second value.
 +
 +   WARNING: any OpenSIPS pseudo-vars which may contain special
 +   bash characters should be placed inside quotes, e.g.
 +   exec_getenv('$ct');

getenv? And if you require single quotes, shouldn't you also require the 
contents to be quoted? Or a single quote in $ct would undo the first quote...

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/360/files#r18956585___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, avpenv) function for exec module (#360)

2014-10-16 Thread Walter Doekes
 + } else if (outvar) {
 + pid = __popen(command-s, r, pout);
 + } else {
 + pid = fork();
 + if (pid == 0) {
 + execl(/bin/sh, /bin/sh, -c, command-s, NULL);
 + exit(-1);
 + }
 + }
 +
 + if (input-len) {
 + if (fwrite(input-s, 1, input-len, pin) != input-len) {
 + LM_ERR(failed to write to pipe\n);
 + ser_error=E_EXEC;
 + goto error;
 + }

This will stall if there is lots of output before the input is needed.

Pipes won't buffer an unlimited amount of data, and I doube that FILE streams 
will either.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/360/files#r18956935___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, avpenv) function for exec module (#360)

2014-10-16 Thread Walter Doekes
 +
 + if (ferror(pin)) {
 + LM_ERR(writing pipe: %s\n, strerror(errno));
 + ser_error=E_EXEC;
 + goto error;
 + }
 + pclose(pin);
 + }
 +
 + schedule_to_kill(pid);
 + wait(exit_status);
 +
 + if (outvar) {
 + while (fgets(tmpbuf, MAX_LINE_SIZE, pout)) {
 + tmplen = strlen(tmpbuf);
 + memcpy(buf+buflen, tmpbuf, tmplen);

Who checks that buf doesn't overflow? And use fread instead of fgets, since you 
don't care about there the line feeds are.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/360/files#r18957149___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, avpenv) function for exec module (#360)

2014-10-17 Thread Walter Doekes
 @@ -243,6 +246,48 @@ exec_getenv(HOSTNAME);
  exec_getenv(HOSTNAME, $avp(localhost));
  ...
  
 +1.4.5.  exec(command, [output], [input], [envavp])
 +
 +   Executes an external command. The input is passed to the
 +   standard input of the new process, if specified, and the output
 +   is saved in the output variable.
 +
 +   Meaning of the parameters is as follows:
 + * command - command to be executed.It can include
 +   pseudovariables.
 + * output - pseudovariable where to store the output from the
 +   standard output of the command. Keep in mind that if this
 +   parameter is set, the async paramater will not be taken in
 +   consideration.

I see that it's not supported in your code.

My point was that if you define the function like you do:

exec(command, [output], [input], [envavp])

it would be quirky to add stderr later:

exec(command, [output], [input], [envavp], [stderr])

You see how the argument order doesn't make sense.

So, it was less of a question of whether it exists, and more of a suggestion to 
add it now, while you're still free to define the function in the most logical 
manner.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/360/files#r19004237___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Backporting filename in runtime error messages to 1.11 (#372)

2014-10-24 Thread Walter Doekes
 @@ -142,6 +142,7 @@ struct action{
   int type;  /* forward, drop, log, send ...*/
   action_elem_t elem[MAX_ACTION_ELEMS];
   int line;
 + char *file;

Shouln't this be `const char *` ?

It's not like someone is allowed to alter it along the way, right?

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/372/files#r19325095___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, error, avpenv) function for exec (#375)

2014-10-29 Thread Walter Doekes
 @@ -332,6 +332,76 @@ exec_getenv(HOSTNAME, $avp(localhost));
   /example
   /section
  
 + section
 + title
 + function moreinfo=noneexec(command, [output], [input], 
 [error],[envavp])/function

Could you change that to [input], [output], [error] ? That makes sense for 
everyone familiar with standard unix convention (0=stdin, 1=stdout, 2=stderr). 
It's not too late to fix now.

And add a space before `[envavp]`.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/375/files#r19524707___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, error, avpenv) function for exec (#375)

2014-10-29 Thread Walter Doekes
 + paraemphasiserror/emphasis - pseudovariable where 
 to store the error from
 + the standard error of the process.
 + /para
 + /listitem
 + listitem
 + paraemphasisenvavp/emphasis - Avp where to store 
 the values for the
 + environment variables to be passed for the command. The 
 names of the environment
 + variables will be OSIPS_EXEC_# where # will start 
 from 0. For example if you
 + store 2 values into an avp (a and b) OSIPS_EXEC_0 
 will contain the first value
 + and OSIPS_EXEC_1 the second value.
 + /para
 + /listitem
 + /itemizedlist
 + para
 + WARNING: any OpenSIPS pseudo-vars which may contain special bash
 + characters should be placed inside quotes, e.g. 
 exec(update-stats.sh '$ct');

This does not help. You need to quote the contents of $ct too, or else I could 
do this:

Contact: sip:'; rm -rf /; echo '@whatever.com

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/375/files#r19524753___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, error, avpenv) function for exec (#375)

2014-10-29 Thread Walter Doekes
 + para
 + WARNING: input/output/error parameters are not designed 
 for a large amount of
 + data so one should be careful when using them because server 
 could considerably be
 + slowed down.
 + /para
 + para
 + This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
 + LOCAL_ROUTE, STARTUP_ROUTE, TIMER_ROUTE, EVENT_ROUTE, 
 ONREPLY_ROUTE.
 + /para
 + example
 + titlefunction moreinfo=noneexec/function usage/title
 + programlisting format=linespecific
 +...
 +$avp(env) = a;
 +$avp(env) = b;
 +exec(ls -l, $var(out),, $avp(env));

This example does not take stderr into account.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/375/files#r19524764___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, error, avpenv) function for exec (#375)

2014-10-29 Thread Walter Doekes
 + /para
 + para
 + This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
 + LOCAL_ROUTE, STARTUP_ROUTE, TIMER_ROUTE, EVENT_ROUTE, 
 ONREPLY_ROUTE.
 + /para
 + example
 + titlefunction moreinfo=noneexec/function usage/title
 + programlisting format=linespecific
 +...
 +$avp(env) = a;
 +$avp(env) = b;
 +exec(ls -l, $var(out),, $avp(env));
 +xlog(The output is $var(out)\n);
 +...
 +$var(input) = input;
 +exec(/home/../myscript.sh,, this is my $var(input) for exec\n, 
 $avp(env));

Nor does this.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/375/files#r19524771___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, error, avpenv) function for exec (#375)

2014-10-29 Thread Walter Doekes
 @@ -51,6 +51,7 @@ int schedule_to_kill( int pid );
   * @stream: stream to be returned to the caller
   */
  pid_t __popen(const char *cmd, const char *type, FILE **stream);
 +pid_t ___popen(const char *cmd, FILE **, FILE**, FILE**);

That's not very inventively named, is it? :-D

Python popen2 lib called it popen3:

popen2.popen3(cmd[, bufsize[, mode]])

Perhaps `__popen3` is a better name.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/375/files#r19525000___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, error, avpenv) function for exec (#375)

2014-10-29 Thread Walter Doekes
 + if ((buflen + tmplen) = MAX_BUF_SIZE) {
 + LM_WARN(no more space in output buffer\n);
 + break;
 + }
 + memcpy(buf+buflen, tmpbuf, tmplen);
 + buflen += tmplen;
 +
 + outval.flags = PV_VAL_STR;
 + outval.rs.s = buf;
 + outval.rs.len = buflen;
 +
 + if (buflen 
 + pv_set_value(msg, outvar-v.pve-spec, 0, outval)  
 0) {
 + LM_ERR(cannot set output pv value\n);
 + return -1;
 + }

Seems redundant to re-set outval.flags and rs.s every iteration (and rs.len for 
that matter).

Shouldn't you move everything from outval.flags to the end of this block to 
outside the `while{}`?

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/375/files#r19525189___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, error, avpenv) function for exec (#375)

2014-10-29 Thread Walter Doekes
 + goto error;
 + }
 +
 + if (ferror(pin)) {
 + ser_error=E_EXEC;
 + goto error;
 + }
 + pclose(pin);
 + }
 +
 + schedule_to_kill(pid);
 + wait(exit_status);
 +
 + if (outvar) {
 + if (read_and_write2var(msg, pout, outvar)  0) {
 + LM_ERR(failed reading from pipe\n);

+ stdout

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/375/files#r19525389___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, error, avpenv) function for exec (#375)

2014-10-29 Thread Walter Doekes
 + return -1;
 + }
 + }
 +
 + if (errvar) {
 + if (read_and_write2var(msg, perr, errvar)  0) {
 + LM_ERR(failed reading stderr from pipe\n);
 + return -1;
 + }
 + }
 +
 + ret=1;
 +
 +error:
 + if (outvar  ferror(pout)) {
 + LM_ERR(reading pipe: %s\n, strerror(errno));

`+ stdout`

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/375/files#r19525424___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, error, avpenv) function for exec (#375)

2014-10-29 Thread Walter Doekes
 + }
 + return 0;
 +}
 +
 +static inline int setenvvar(struct hf_wrapper** hf, int_str* value, int idx)
 +{
 + #define OSIPS_EXEC OSIPS_EXEC_
 +
 +
 + int len=0;
 + str sidx;
 +
 + sidx.s = int2str((unsigned long)idx, sidx.len);
 +
 + (*hf)-envvar=pkg_malloc(strlen(OSIPS_EXEC) + sidx.len + 1/*=*/
 + + (*value).s.len + 1/*\0*/);

`(*value).s` == `value-s`, the latter is more common.

Applies to this entire function.

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/375/files#r19525529___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] added exec(cmd, output, input, error, avpenv) function for exec (#375)

2014-10-29 Thread Walter Doekes
Thanks for fixing the other issues :)

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/375#issuecomment-60891337___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Add listen interface (socket) checking to db based natping. (#127)

2014-11-04 Thread Walter Doekes
That would suit my needs indeed; and make more sense than the awkward query 
that we do now.

Thinking out loud here: where do we get this ID from? Do we add a `server_id` 
integer parameter to `usrloc`? Or should we generate one automatically? If we 
use a parameter and default it to `1`, we get current behaviour (backwards 
compatible), but that means that we don't have a guarantee that the server_id 
is unique (perhaps we want that constraint later).



---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/127#issuecomment-61616955___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] cfgutils: Clarify shvset/varset error message. (#404)

2015-01-28 Thread Walter Doekes

You can view, comment on, or merge this pull request online at:

  https://github.com/OpenSIPS/opensips/pull/404

-- Commit Summary --

  * cfgutils: Clarify shvset/varset error message.

-- File Changes --

M modules/cfgutils/shvar.c (3)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/404.patch
https://github.com/OpenSIPS/opensips/pull/404.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/404
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] F_MALLOC: suppress warnings for free(NULL) (17d639b)

2015-06-15 Thread Walter Doekes
Shouldn't you fix the caller that pkg_free's without checking for NULL instead?

If you allow it, then you might as well drop all the `if(buf)` before every 
`pkg_free(buf)`. Allowing both makes the code inconsistent.

Right?

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/commit/17d639b9f11b415d51062005aadb86dd6c2375e2#commitcomment-11680174___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] travis: use FASTER compile time (489c300)

2015-08-27 Thread Walter Doekes
You do know that `-j` does not restrict the number of processes?

```
   -j [jobs], --jobs[=jobs]
Specifies  the  number of jobs (commands) to run simultaneously.  
If there is more than
one -j option, the last one is effective.  If the -j option is 
given without  an  argu‐
ment, make will not limit the number of jobs that can run 
simultaneously.
```
*make will not limit the number of jobs that can run simultaneously.*

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/commit/489c300e0958371b813ca4232302b96e53558047#commitcomment-12921089___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [opensips] dialog: Document that unset_dlg_profile can be used from request_route. (#664)

2015-10-02 Thread Walter Doekes
This has been possible since 23f2322d in 1.8 and higher.
You can view, comment on, or merge this pull request online at:

  https://github.com/OpenSIPS/opensips/pull/664

-- Commit Summary --

  * dialog: Document that unset_dlg_profile can be used from request_route.

-- File Changes --

M modules/dialog/README (4)
M modules/dialog/doc/dialog_admin.xml (2)

-- Patch Links --

https://github.com/OpenSIPS/opensips/pull/664.patch
https://github.com/OpenSIPS/opensips/pull/664.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/664
___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


Re: [OpenSIPS-Devel] [opensips] Remove annoying LM_INFO (d6d3dd5)

2015-11-27 Thread Walter Doekes
Compile error? And another one below..

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/commit/d6d3dd5bfe1636ad420af2a1fe3492fb22507944#commitcomment-14655312___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] 21dae8: Fix mantainer-clean -> maintainer-clean typo

2019-04-24 Thread Walter Doekes
  Branch: refs/heads/3.0
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 21dae83c2659edfa0b2a10ed3ebe616084cf0b6b
  
https://github.com/OpenSIPS/opensips/commit/21dae83c2659edfa0b2a10ed3ebe616084cf0b6b
  Author: Walter Doekes 
  Date:   2019-04-24 (Wed, 24 Apr 2019)

  Changed paths:
M INSTALL
M Makefile.rules
M modules/seas/event_dispatcher.c

  Log Message:
  ---
  Fix mantainer-clean -> maintainer-clean typo

(cherry picked from commit 884f6305313dfdd6846b5c21c175a060c2fd263d)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] 8f7f8f: Work around a few poor compiler warnings

2019-04-24 Thread Walter Doekes
  Branch: refs/heads/3.0
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 8f7f8f38c53ab240e8eaff9f894b35e045d84614
  
https://github.com/OpenSIPS/opensips/commit/8f7f8f38c53ab240e8eaff9f894b35e045d84614
  Author: Walter Doekes 
  Date:   2019-04-24 (Wed, 24 Apr 2019)

  Changed paths:
M modules/b2b_logic/b2b_logic.c
M modules/rabbitmq/rmq_servers.c
M modules/sip_i/isup.c
M modules/tracer/tracer.c
M modules/usrloc/dlist.c

  Log Message:
  ---
  Work around a few poor compiler warnings

Like:

dlist.c: In function ‘get_all_ucontacts’:
dlist.c:759:37: error: ‘next_hop_host’ may be used uninitialized in this
  function [-Werror=maybe-uninitialized]

And:

In function ‘memcpy’,
  inlined from ‘get_domain_db_ucontacts’ at dlist.c:294:4:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error:
  ‘__builtin_memcpy’: specified size between 18446744071562067968 and
  18446744073709551615 exceeds maximum object size 9223372036854775807
  [-Werror=stringop-overflow=]

And one probable bug:

b2b_logic.c: In function ‘mi_b2b_list’:
b2b_logic.c:1548:10: error: ‘server_item’ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
^- should be client_item

(cherry picked from commit 94c50b7811e1af69ef1400c531b0b6196e3ffb39)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] a9b4c1: proto_hep: Fix HEPv3 IPv6 destination contents (se...

2020-05-11 Thread Walter Doekes
  Branch: refs/heads/2.4
  Home:   https://github.com/OpenSIPS/opensips
  Commit: a9b4c1927ba71358630ed28b842477ee57dc146e
  
https://github.com/OpenSIPS/opensips/commit/a9b4c1927ba71358630ed28b842477ee57dc146e
  Author: Walter Doekes 
  Date:   2020-05-11 (Mon, 11 May 2020)

  Changed paths:
M modules/proto_hep/hep.c

  Log Message:
  ---
  proto_hep: Fix HEPv3 IPv6 destination contents (send DST not SRC addr)

(cherry picked from commit 7667483bbfb43017ccdfc8929ffe91a37c10c71f)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] 46ee34: proto_hep: Fix HEPv3 IPv6 destination contents (se...

2020-05-11 Thread Walter Doekes
  Branch: refs/heads/3.0
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 46ee34b30159d16fcd5aaa234654fdb71db0daec
  
https://github.com/OpenSIPS/opensips/commit/46ee34b30159d16fcd5aaa234654fdb71db0daec
  Author: Walter Doekes 
  Date:   2020-05-11 (Mon, 11 May 2020)

  Changed paths:
M modules/proto_hep/hep.c

  Log Message:
  ---
  proto_hep: Fix HEPv3 IPv6 destination contents (send DST not SRC addr)

(cherry picked from commit 7667483bbfb43017ccdfc8929ffe91a37c10c71f)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] d3d160: usrloc: Update doxygen comment about packing get_a...

2020-09-02 Thread Walter Doekes
  Branch: refs/heads/3.0
  Home:   https://github.com/OpenSIPS/opensips
  Commit: d3d160bab47962520f6b013ace29ef5f5247657c
  
https://github.com/OpenSIPS/opensips/commit/d3d160bab47962520f6b013ace29ef5f5247657c
  Author: Walter Doekes 
  Date:   2020-09-02 (Wed, 02 Sep 2020)

  Changed paths:
M modules/usrloc/dlist.c

  Log Message:
  ---
  usrloc: Update doxygen comment about packing get_all_ucontacts

(cherry picked from commit fc1c3ec32fa285e90cea457096f557e1088b1031)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] dd3db5: usrloc: Update doxygen comment about packing get_a...

2020-09-02 Thread Walter Doekes
  Branch: refs/heads/2.4
  Home:   https://github.com/OpenSIPS/opensips
  Commit: dd3db539bbe0ff98d53ece86a0f06eb1c427f8f1
  
https://github.com/OpenSIPS/opensips/commit/dd3db539bbe0ff98d53ece86a0f06eb1c427f8f1
  Author: Walter Doekes 
  Date:   2020-09-02 (Wed, 02 Sep 2020)

  Changed paths:
M modules/usrloc/dlist.c

  Log Message:
  ---
  usrloc: Update doxygen comment about packing get_all_ucontacts

(cherry picked from commit fc1c3ec32fa285e90cea457096f557e1088b1031)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] c2e824: usrloc: Update doxygen comment about packing get_a...

2020-09-02 Thread Walter Doekes
  Branch: refs/heads/3.1
  Home:   https://github.com/OpenSIPS/opensips
  Commit: c2e8248de7cedec8a8542abd20762cb46a0a8711
  
https://github.com/OpenSIPS/opensips/commit/c2e8248de7cedec8a8542abd20762cb46a0a8711
  Author: Walter Doekes 
  Date:   2020-09-02 (Wed, 02 Sep 2020)

  Changed paths:
M modules/usrloc/dlist.c

  Log Message:
  ---
  usrloc: Update doxygen comment about packing get_all_ucontacts

(cherry picked from commit fc1c3ec32fa285e90cea457096f557e1088b1031)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] df67ba: Fix next_hop crash (seen in nathelper nh_timer) du...

2020-09-02 Thread Walter Doekes
  Branch: refs/heads/3.1
  Home:   https://github.com/OpenSIPS/opensips
  Commit: df67bac58b260ec426c945c58859978a78c6b67d
  
https://github.com/OpenSIPS/opensips/commit/df67bac58b260ec426c945c58859978a78c6b67d
  Author: Walter Doekes 
  Date:   2020-09-02 (Wed, 02 Sep 2020)

  Changed paths:
M modules/usrloc/dlist.c

  Log Message:
  ---
  Fix next_hop crash (seen in nathelper nh_timer) due to reading reused mem

Problem:

- get_domain_db_ucontacts (through get_domain_ucontacts) was handing out
  (next_hop) pointers to memory that was unused. This resulted in a
  crash when this memory was reused before the invalid pointer was
  reused.

Relevant issues and commits:

- #1652 [OpenSIPS crashes since of child that serves rtpproxy]
- e162f5f10 [fix 1652: usrloc: make next_hop point within the shared buffer]
- #1710 [nathelper next_hop off by one for usrloc path]
- 0300eb1d5 [fix 1710 / revert 1652: usrloc: fix next hop compute for ...]

That is: e162f5f10 fixes this exact problem in get_domain_db_ucontacts, in
get_domain_mem_ucontacts and in get_domain_cdb_ucontacts (cdb_pack_ping_data).

But in 0300eb1d5 it is reverted for only get_domain_db_ucontacts.

This fix:

- Rewrites the fix for get_domain_db_ucontacts and
  get_domain_cdb_ucontacts, making it less fragile/bug-prone.
- Adds comments about fragility to get_domain_mem_ucontacts
- Fixed unaligned memcpy that might affect non-intel CPUs:
  `((struct proxy_l *)cp)->name.s = next_hop_host`

Bug reported and fix tested by Jasper Hafkenscheid @hafkensite (VoIPGRID).

(cherry picked from commit 5a6b3abe41a2eaed961a530675f6441a692e8640)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] b261b6: Fix next_hop crash (seen in nathelper nh_timer) du...

2020-09-02 Thread Walter Doekes
  Branch: refs/heads/2.4
  Home:   https://github.com/OpenSIPS/opensips
  Commit: b261b675bffebf0fd3b77503d53da13ce3b6a2c8
  
https://github.com/OpenSIPS/opensips/commit/b261b675bffebf0fd3b77503d53da13ce3b6a2c8
  Author: Walter Doekes 
  Date:   2020-09-02 (Wed, 02 Sep 2020)

  Changed paths:
M modules/usrloc/dlist.c

  Log Message:
  ---
  Fix next_hop crash (seen in nathelper nh_timer) due to reading reused mem

Problem:

- get_domain_db_ucontacts (through get_domain_ucontacts) was handing out
  (next_hop) pointers to memory that was unused. This resulted in a
  crash when this memory was reused before the invalid pointer was
  reused.

Relevant issues and commits:

- #1652 [OpenSIPS crashes since of child that serves rtpproxy]
- e162f5f10 [fix 1652: usrloc: make next_hop point within the shared buffer]
- #1710 [nathelper next_hop off by one for usrloc path]
- 0300eb1d5 [fix 1710 / revert 1652: usrloc: fix next hop compute for ...]

That is: e162f5f10 fixes this exact problem in get_domain_db_ucontacts, in
get_domain_mem_ucontacts and in get_domain_cdb_ucontacts (cdb_pack_ping_data).

But in 0300eb1d5 it is reverted for only get_domain_db_ucontacts.

This fix:

- Rewrites the fix for get_domain_db_ucontacts and
  get_domain_cdb_ucontacts, making it less fragile/bug-prone.
- Adds comments about fragility to get_domain_mem_ucontacts
- Fixed unaligned memcpy that might affect non-intel CPUs:
  `((struct proxy_l *)cp)->name.s = next_hop_host`

Bug reported and fix tested by Jasper Hafkenscheid @hafkensite (VoIPGRID).

(cherry picked from commit 5a6b3abe41a2eaed961a530675f6441a692e8640)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] da4884: Fix next_hop crash (seen in nathelper nh_timer) du...

2020-09-02 Thread Walter Doekes
  Branch: refs/heads/3.0
  Home:   https://github.com/OpenSIPS/opensips
  Commit: da488403c71b3effb994c7e95310f059fa36ff2c
  
https://github.com/OpenSIPS/opensips/commit/da488403c71b3effb994c7e95310f059fa36ff2c
  Author: Walter Doekes 
  Date:   2020-09-02 (Wed, 02 Sep 2020)

  Changed paths:
M modules/usrloc/dlist.c

  Log Message:
  ---
  Fix next_hop crash (seen in nathelper nh_timer) due to reading reused mem

Problem:

- get_domain_db_ucontacts (through get_domain_ucontacts) was handing out
  (next_hop) pointers to memory that was unused. This resulted in a
  crash when this memory was reused before the invalid pointer was
  reused.

Relevant issues and commits:

- #1652 [OpenSIPS crashes since of child that serves rtpproxy]
- e162f5f10 [fix 1652: usrloc: make next_hop point within the shared buffer]
- #1710 [nathelper next_hop off by one for usrloc path]
- 0300eb1d5 [fix 1710 / revert 1652: usrloc: fix next hop compute for ...]

That is: e162f5f10 fixes this exact problem in get_domain_db_ucontacts, in
get_domain_mem_ucontacts and in get_domain_cdb_ucontacts (cdb_pack_ping_data).

But in 0300eb1d5 it is reverted for only get_domain_db_ucontacts.

This fix:

- Rewrites the fix for get_domain_db_ucontacts and
  get_domain_cdb_ucontacts, making it less fragile/bug-prone.
- Adds comments about fragility to get_domain_mem_ucontacts
- Fixed unaligned memcpy that might affect non-intel CPUs:
  `((struct proxy_l *)cp)->name.s = next_hop_host`

Bug reported and fix tested by Jasper Hafkenscheid @hafkensite (VoIPGRID).

(cherry picked from commit 5a6b3abe41a2eaed961a530675f6441a692e8640)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] da98ca: Fix memory corruption in usrloc/ul_evi

2021-06-09 Thread Walter Doekes
  Branch: refs/heads/3.2
  Home:   https://github.com/OpenSIPS/opensips
  Commit: da98caf62251d1e5e72ff22b8c9a2d98f5b64eaf
  
https://github.com/OpenSIPS/opensips/commit/da98caf62251d1e5e72ff22b8c9a2d98f5b64eaf
  Author: Walter Doekes 
  Date:   2021-06-09 (Wed, 09 Jun 2021)

  Changed paths:
M modules/usrloc/ul_evi.c

  Log Message:
  ---
  Fix memory corruption in usrloc/ul_evi

Problem spotted by Liviu Chircu and bisected to fe28d3ea9.

Fixes #2529.

(cherry picked from commit 1c5e895db551c3272568d2c21f55ed14fbbb719e)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] 8da4b5: Reduce db_is_neq_type complexity

2021-07-01 Thread Walter Doekes
  Branch: refs/heads/3.2
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 8da4b56eb89fd304b92626a79526bf860c98f326
  
https://github.com/OpenSIPS/opensips/commit/8da4b56eb89fd304b92626a79526bf860c98f326
  Author: Walter Doekes 
  Date:   2021-07-01 (Thu, 01 Jul 2021)

  Changed paths:
M db/db_ut.c

  Log Message:
  ---
  Reduce db_is_neq_type complexity

The code was correct, but overly verbose. Boil it down to the intention
and rely on the compiler to work its magic.

Reviewed-by: Liviu Chircu
(cherry picked from commit c381060f9b5f67d0a6792fc82d86450ad93501c6)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] fddb7e: Fix crash in db_timer_udomain() when the database ...

2021-04-26 Thread Walter Doekes
  Branch: refs/heads/3.1
  Home:   https://github.com/OpenSIPS/opensips
  Commit: fddb7eafb586a104203cf194a71b2bbc0e90655f
  
https://github.com/OpenSIPS/opensips/commit/fddb7eafb586a104203cf194a71b2bbc0e90655f
  Author: Walter Doekes 
  Date:   2021-04-26 (Mon, 26 Apr 2021)

  Changed paths:
M modules/usrloc/udomain.c

  Log Message:
  ---
  Fix crash in db_timer_udomain() when the database has little work

The previous code, added in 1f0be8f02 but mostly fixed by 0d0909fc1,
added this interesting erroneous pattern:

static db_ps_t my_ps = NULL;
db_key_t keys[2];
db_op_t  ops[2];

if (my_ps == NULL) {
keys[0] = _col;
ops[0] = "<";
...

That is: the initialisation of the stack depended on a global (local
static). Once it was set, the initialisation would be skipped, causing
keys and ops to contain undefined values.

Due to the way the CON_PS_REFERENCE() prepared statement handle code has
become, my_ps would always be reset to NULL after use, hiding this bug.

However, if you have a flaky database connection (for instance
an auto-closing socket on a machine with little traffic) then the
following happens:

CRITICAL:db_mysql:wrapper_single_mysql_stmt_execute: driver error
  (2003): Lost connection to backend server.
ERROR:usrloc:db_timer_udomain: failed to delete from table location
ERROR:usrloc:synchronize_all_udomains: synchronizing cache failed

When this happens, my_ps is _not_ reset to NULL, and the next time this
function is invoked, keys and ops are undefined, causing a segfault
down the road.

This changeset adds an if around use_table() because all the other code
in this module does so. The actual fix is the removal of if(my_ps==NULL).

(An alternative fix could have been to explicitly reset the prepared
statement handle to NULL like 57caa6c03 does. Or to make keys and ops
static too and set them only once.)

(cherry picked from commit 50fe41d2d07fffab91f22034518c2cf1cb631a3d)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] 71d780: Fix crash in db_timer_udomain() when the database ...

2021-04-26 Thread Walter Doekes
  Branch: refs/heads/2.4
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 71d7801e6e64c9061580fc7186d26e3f2b97c599
  
https://github.com/OpenSIPS/opensips/commit/71d7801e6e64c9061580fc7186d26e3f2b97c599
  Author: Walter Doekes 
  Date:   2021-04-26 (Mon, 26 Apr 2021)

  Changed paths:
M modules/usrloc/udomain.c

  Log Message:
  ---
  Fix crash in db_timer_udomain() when the database has little work

The previous code, added in 1f0be8f02 but mostly fixed by 0d0909fc1,
added this interesting erroneous pattern:

static db_ps_t my_ps = NULL;
db_key_t keys[2];
db_op_t  ops[2];

if (my_ps == NULL) {
keys[0] = _col;
ops[0] = "<";
...

That is: the initialisation of the stack depended on a global (local
static). Once it was set, the initialisation would be skipped, causing
keys and ops to contain undefined values.

Due to the way the CON_PS_REFERENCE() prepared statement handle code has
become, my_ps would always be reset to NULL after use, hiding this bug.

However, if you have a flaky database connection (for instance
an auto-closing socket on a machine with little traffic) then the
following happens:

CRITICAL:db_mysql:wrapper_single_mysql_stmt_execute: driver error
  (2003): Lost connection to backend server.
ERROR:usrloc:db_timer_udomain: failed to delete from table location
ERROR:usrloc:synchronize_all_udomains: synchronizing cache failed

When this happens, my_ps is _not_ reset to NULL, and the next time this
function is invoked, keys and ops are undefined, causing a segfault
down the road.

This changeset adds an if around use_table() because all the other code
in this module does so. The actual fix is the removal of if(my_ps==NULL).

(An alternative fix could have been to explicitly reset the prepared
statement handle to NULL like 57caa6c03 does. Or to make keys and ops
static too and set them only once.)

(cherry picked from commit 50fe41d2d07fffab91f22034518c2cf1cb631a3d)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] ec0a7e: Don't forget to release the insertq lock when down...

2021-04-27 Thread Walter Doekes
  Branch: refs/heads/3.1
  Home:   https://github.com/OpenSIPS/opensips
  Commit: ec0a7e6fcabc04463637a20a9919b3c6a429d441
  
https://github.com/OpenSIPS/opensips/commit/ec0a7e6fcabc04463637a20a9919b3c6a429d441
  Author: Walter Doekes 
  Date:   2021-04-27 (Tue, 27 Apr 2021)

  Changed paths:
M db/db_insertq.c
M pt.c

  Log Message:
  ---
  Don't forget to release the insertq lock when downscaling workers

Not sure if this is a problem or of the locks gets freed correctly
after exit(). But it looks nicer this way.

(cherry picked from commit ad7a1c1d45b193bccd4893b24d54d340e6c65fbd)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


[OpenSIPS-Devel] [OpenSIPS/opensips] ba7d6a: Restore registrar 'f' flag behaviour for "sql-only...

2021-03-24 Thread Walter Doekes
  Branch: refs/heads/3.1
  Home:   https://github.com/OpenSIPS/opensips
  Commit: ba7d6a7b21a2450b0d8b1f93125974b685c00f51
  
https://github.com/OpenSIPS/opensips/commit/ba7d6a7b21a2450b0d8b1f93125974b685c00f51
  Author: Walter Doekes 
  Date:   2021-03-24 (Wed, 24 Mar 2021)

  Changed paths:
M modules/usrloc/ul_mod.c

  Log Message:
  ---
  Restore registrar 'f' flag behaviour for "sql-only" db_mode

On 2020-05-25 fix 3a1f9c1e2 for #2118 was introduced into opensips 3.1.
This change also modified things so cid_keys and cid_vals would *not*
be allocated when the database was in "sql-only" mode.

When "sql-only" mode is used, all usrloc records are saved to the DB
immediately, and are loaded from DB immediately.

The relevant settings:

  modparam("usrloc", "working_mode_preset", "sql-only")

Which equals the deprecated db_mode setting 3:

  modparam("usrloc", "db_mode", 3)  # 3 = "sql-only", DEPRECATED

Or, as three separate settings:

  modparam("usrloc", "cluster_mode", "sql-only") # CM_SQL_ONLY
  modparam("usrloc", "restart_persistency", "none")  # RRP_NONE
  modparam("usrloc", "sql_write_mode", "none")   # SQL_NO_WRITE
  # This last option is slightly awkwardly named, but it refers
  # to *additional* SQL writing which is not performed. Because,
  # the is only *direct* SQL reading/writing.

In any case: the changeset removed the access to temporary storage of
cid_keys/cid_vals for the CM_SQL_ONLY case, under the assumption that
it was not needed:
```
   if (rr_persist == RRP_LOAD_FROM_SQL) {
  if (!(sync_lock = lock_init_rw())) {
 LM_ERR("cannot init rw lock\n");
 return -1;
  }
-  }
-   }

-   if (cluster_mode != CM_NONE || rr_persist == RRP_LOAD_FROM_SQL) {
-  cid_keys = pkg_malloc(max_contact_delete *
-(sizeof(db_key_t) + sizeof(db_val_t)));
-  if (!cid_keys) {
- LM_ERR("oom\n");
- return -1;
-  }
+ /* initialize the "merged contact deletes" array */
+ cid_keys = pkg_malloc(max_contact_delete *
+   (sizeof(db_key_t) + sizeof(db_val_t)));
+ if (!cid_keys) {
+LM_ERR("oom\n");
+return -1;
+ }
```
However, those "merged contact deletes" were still needed when the
registrar save() function tries to limit the number of Contacts (using
the 'f' force overwrite flag).

registrar:add_contacts() calls usrloc:release_urecord() with the
contacts that should be removed (from the database). This calls
usrloc:db_only_timer() (and wb_timer) and finally
usrloc:db_multiple_ucontact_delete().

The wb_timer was supposed to populate the cid_keys/cid_vals with the
database IDs passed along from the registrar module. But because that
temporary cid_vals storage was not available, that bit would be skipped:
```
/* Should we remove the contact from the database ? */
if (cid_vals && st_expired_ucontact(t) == 1
```
The result: usrloc:db_multiple_ucontact_delete() had nothing to
delete; the max contacts save settings would be ignored.

This changeset restores the `cluster_mode != CM_NONE` alternative that
initialises cid_keys/cid_vals, restoring the force/max_contacts
behaviour.

(cherry picked from commit 18932e3db8fcb3892d6da6dcbce5517dd8ea529a)



___
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel