Re: [sr-dev] [kamailio/kamailio] Memory leak in sanity module 'proxy require' check (#1990)

2019-06-25 Thread Daniel-Constantin Mierla
Closed #1990.

-- 
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/issues/1990#event-2438938236___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] Memory leak in sanity module 'proxy require' check (#1990)

2019-06-25 Thread Daniel-Constantin Mierla
Thanks! I pushed a fix (commit referenced above), it will be backported to 
stable branches soon. If still an issue, reopen.

-- 
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/issues/1990#issuecomment-505622525___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:ffa2aa43: sanity: free parsed proxy-required header in case of failure

2019-06-25 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: ffa2aa438e2a13e6e8bdbe70dd90827ae18279ce
URL: 
https://github.com/kamailio/kamailio/commit/ffa2aa438e2a13e6e8bdbe70dd90827ae18279ce

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2019-06-25T23:04:00+02:00

sanity: free parsed proxy-required header in case of failure

- reported by GH #1990

---

Modified: src/modules/sanity/sanity.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/ffa2aa438e2a13e6e8bdbe70dd90827ae18279ce.diff
Patch: 
https://github.com/kamailio/kamailio/commit/ffa2aa438e2a13e6e8bdbe70dd90827ae18279ce.patch

---

diff --git a/src/modules/sanity/sanity.c b/src/modules/sanity/sanity.c
index d00eab5d6d..04ad2b86d6 100644
--- a/src/modules/sanity/sanity.c
+++ b/src/modules/sanity/sanity.c
@@ -698,6 +698,10 @@ int check_proxy_require(sip_msg_t* msg) {
}
LM_DBG("checking proxy require failed\n");
if (u) pkg_free(u);
+   if (msg->proxy_require->parsed) {
+   
free_str_list(msg->proxy_require->parsed);
+   msg->proxy_require->parsed = NULL;
+   }
return SANITY_CHECK_FAILED;
}
else {


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:3c84c44f: crypto: fix two small copy and paste errors in comments

2019-06-25 Thread Henning Westerholt
Module: kamailio
Branch: master
Commit: 3c84c44ff2191f71dbb2af8beb211b75e48f9b1d
URL: 
https://github.com/kamailio/kamailio/commit/3c84c44ff2191f71dbb2af8beb211b75e48f9b1d

Author: Henning Westerholt 
Committer: Henning Westerholt 
Date: 2019-06-25T22:32:30+02:00

crypto: fix two small copy and paste errors in comments

---

Modified: src/modules/crypto/api.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/3c84c44ff2191f71dbb2af8beb211b75e48f9b1d.diff
Patch: 
https://github.com/kamailio/kamailio/commit/3c84c44ff2191f71dbb2af8beb211b75e48f9b1d.patch

---

diff --git a/src/modules/crypto/api.h b/src/modules/crypto/api.h
index a3823d443c..fa87923304 100644
--- a/src/modules/crypto/api.h
+++ b/src/modules/crypto/api.h
@@ -49,12 +49,12 @@ inline static int load_crypto_api( struct crypto_binds *cb )
 {
load_crypto_f load_crypto_v;
 
-   /* import the RR auto-loading function */
+   /* import the crypto auto-loading function */
if ( !(load_crypto_v=(load_crypto_f)find_export("load_crypto", 0, 0))) {
LM_ERR("failed to import load_crypto\n");
return -1;
}
-   /* let the auto-loading function load all RR stuff */
+   /* let the auto-loading function load all crypto stuff */
load_crypto_v( cb );
 
return 0;


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] [kamailio/kamailio] DB_UNIXODBC always changes language and context (#1993)

2019-06-25 Thread Ben Kaufman
### Description

Using DB_UNIXODBC with an Azure SQL database works, however when starting 
Kamailio, errors are shown for :

```
26(80403) ERROR: db_unixodbc [connection.c:219]: db_unixodbc_extract_error(): 
unixodbc:SQLDriverConnect=01000:3:5701:[Microsoft][ODBC Driver 17 for SQL 
Server][SQL Server]Changed database context to 'database-name'.
ERROR: db_unixodbc [connection.c:219]: db_unixodbc_extract_error(): 
unixodbc:SQLDriverConnect=01000:2:5703:[unixODBC][Microsoft][ODBC Driver 17 for 
SQL Server][SQL Server]Changed language setting to us_english.
```

Regarding changing the DB context, the database to be used is defined in my 
```odbc.ini``` file

```
[dsnName]
Driver=ODBC Driver 17 for SQL Server
Description=Azure MS SQL Server
Trace=No
Server=tcp:azure-sql-server-name.database.windows.net,1433
Encrypt=yes
TrustServerCertificate=no
Connection Timeout=30
Database=databaseName
```

I'm not able to `USE databaseName` when connecting to an Azure DB.  The default 
language is already US-English, and i'm guessing it's also Azure specific that 
it cannot be changed?

### Troubleshooting

I'm not sure what troubleshooting can be done with this.  The DB connection 
works, it's just these commands that fail, but since the result is already 
correct, it doesn't seem to functionally matter, aside from the errors being 
thrown.

 Reproduction

This can be reproduced using an Azure SQL database.  Create a single database 
and a dedicated user (with db_owner membership), and configure the ODBC 
connection as above.

 Debugging Data

I'm not sure any additional debugging information is available.  I'm happy to 
provide anything specific requested.



 Log Messages



```
26(80403) ERROR: db_unixodbc [connection.c:219]: db_unixodbc_extract_error(): 
unixodbc:SQLDriverConnect=01000:3:5701:[Microsoft][ODBC Driver 17 for SQL 
Server][SQL Server]Changed database context to 'database-name'.
ERROR: db_unixodbc [connection.c:219]: db_unixodbc_extract_error(): 
unixodbc:SQLDriverConnect=01000:2:5703:[unixODBC][Microsoft][ODBC Driver 17 for 
SQL Server][SQL Server]Changed language setting to us_english.
```


### Possible Solutions

I would suspect that a parameter could be added to the DB_UNIXODBC module to 
make each of these behaviors (changing database and changing language) 
optional.  Default config would retain the existing behavior, so it's just an 
override if desired.

### Additional Information

  * **Kamailio Version** - output of `kamailio -v`

```
version: kamailio 5.1.8 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, 
DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, 
F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, 
USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, 
BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 6.3.0
```

* **Operating System**:

```
Debian Stretch:
4.19.0-0.bpo.4-cloud-amd64 #1 SMP Debian 4.19.28-2~bpo9+1 (2019-03-27) x86_64 
GNU/Linux
```


-- 
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/issues/1993___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] db_postgres: fix, insert update should always (2bebdb0)

2019-06-25 Thread Julien Chavanton
This index was wrong, the module was not able to favor unique constraint over 
primary key constraint ...

-- 
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/commit/2bebdb083ba8078fa9eec237fe0b0e2134a21b9b#commitcomment-34073916___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:2bebdb08: db_postgres: fix, insert update should always

2019-06-25 Thread Julien Chavanton
Module: kamailio
Branch: master
Commit: 2bebdb083ba8078fa9eec237fe0b0e2134a21b9b
URL: 
https://github.com/kamailio/kamailio/commit/2bebdb083ba8078fa9eec237fe0b0e2134a21b9b

Author: Julien Chavanton 
Committer: Julien Chavanton 
Date: 2019-06-25T08:49:45-07:00

db_postgres: fix, insert update should always

 favor unique constraint over primary key

---

Modified: src/modules/db_postgres/km_dbase.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/2bebdb083ba8078fa9eec237fe0b0e2134a21b9b.diff
Patch: 
https://github.com/kamailio/kamailio/commit/2bebdb083ba8078fa9eec237fe0b0e2134a21b9b.patch

---

diff --git a/src/modules/db_postgres/km_dbase.c 
b/src/modules/db_postgres/km_dbase.c
index 4ddbe641b9..0ae7dff54d 100644
--- a/src/modules/db_postgres/km_dbase.c
+++ b/src/modules/db_postgres/km_dbase.c
@@ -788,7 +788,7 @@ static char *db_postgres_constraint_get(const db1_con_t *_h)
rows = RES_ROWS(res);
for(x = 0; x < RES_ROW_N(res); x++) {
val = (ROW_VALUES(&rows[x])[0]).val.string_val;
-   type = (ROW_VALUES(&rows[x])[0]).val.string_val;
+   type = (ROW_VALUES(&rows[x])[1]).val.string_val;
LM_DBG("name[%s]type[%s]\n", val, type);
if(type[0] == 'u')
break; // always favor unique constraint over primary 
key constraint


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] uri.param and param.value error when last character is delimiter (#1991)

2019-06-25 Thread geejay101
Hello Daniel,

I receive such URIs from Asterisk 16.3 . This extra delimiter at the end seems 
to appear when Asterisk has stored contact URIs which are bigger than the db 
field. My fullcontact field length was 256 bytes in the Asterisk db, now I 
increased to 512 bytes and the problem went away.

Yes, I chop off the last delimiter in Kamailio now. That prevents the problem.

Thanks for your hints.

Best Gerrit



> On 25 Jun 2019, at 18:05, Daniel-Constantin Mierla  
> wrote:
> 
> From where did you get such URI? Because, afaik, by specs/RFC grammar, the 
> uri must not be terminated by ; -- the last param value must be left without 
> ;.
> 
> I haven't implemented the parser for uri+params, but that's what I understood 
> from the developer long time ago. I know that for some some modparams that 
> use the uri-params parser, I had to check if the last char is ; and skip it 
> when passing the value to the parser to avoid loosing the checks of the 
> parser to break specs requirements.
> 
> The solution right now is to check the last char in such value and skip it 
> using other string transformations such as s.substr.
> 
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub 
> ,
>  or mute the thread 
> .
> 



-- 
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/issues/1991#issuecomment-505497720___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] uri.param and param.value error when last character is delimiter (#1991)

2019-06-25 Thread Daniel-Constantin Mierla
>From where did you get such URI? Because, afaik, by specs/RFC grammar, the uri 
>must not be terminated by `;` -- the last param value must be left without `;`.

I haven't implemented the parser for uri+params, but that's what I understood 
from the developer long time ago. I know that for some some modparams that use 
the uri-params parser, I had to check if the last char is `;` and skip it when 
passing the value to the parser to avoid loosing the checks of the parser to 
break specs requirements.

The solution right now is to check the last char in such value and skip it 
using other string transformations such as s.substr.

-- 
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/issues/1991#issuecomment-505486781___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] KEMI - Missing PVX functions in app_ruby (#1987)

2019-06-25 Thread Daniel-Constantin Mierla
Closed #1987.

-- 
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/issues/1987#event-2437897553___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] KEMI - Missing PVX functions in app_ruby (#1987)

2019-06-25 Thread Daniel-Constantin Mierla
Those functions are in master branch only, the current version being 
5.3.0-dev6, so -dev4 is a bit old. Can you upgrade to latest master branch and 
try again? If still not getting them, reopen.

-- 
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/issues/1987#issuecomment-505484249___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev