RE: PATCH: Fix use of uninitialized variable (mysql port) in sqlbox

2015-11-10 Thread Rene Kluwen
Patch committed.

 

Van: devel [mailto:devel-boun...@kannel.org] Namens Vyronas Tsingaras
Verzonden: maandag 9 november 2015 16:41
Aan: spameden <spame...@gmail.com>
CC: kannel_dev_mailinglist devel@kannel.org <devel@kannel.org>
Onderwerp: Re: PATCH: Fix use of uninitialized variable (mysql port) in sqlbox

 

Yes and even then, well the signature of mysql_real_connect that is used in 
dbpool_mysql:101 is MYSQL *mysql_real_connect(MYSQL *mysql, const char *host, 
const char *user, const char *passwd, const char *db, unsigned int port, const 
char *unix_socket, unsigned long client_flag). You have to specify a value for 
port and providing '0' instead of an unitialized variable seems best in my 
opinion.

 

Kind Regards,

Vyronas Tsingaras

 

On Mon, Nov 9, 2015 at 5:37 PM, spameden <spame...@gmail.com 
<mailto:spame...@gmail.com> > wrote:

That's correct, host should be 'localhost'.

 

2015-11-09 18:31 GMT+03:00 Vyronas Tsingaras <vtsinga...@amdtelecom.net 
<mailto:vtsinga...@amdtelecom.net> >:

But according to 
https://dev.mysql.com/doc/refman/5.7/en/mysql-real-connect.html only when host 
is either NULL or "localhost" will mysql_real_connect do UNIX socket 
connection. The 'port' argument only applies to TCP/IP connections and thus 
should default to 0 if not specified.

 

Kind Regards,

Vyronas Tsingaras

 

On Mon, Nov 9, 2015 at 5:24 PM, spameden <spame...@gmail.com 
<mailto:spame...@gmail.com> > wrote:

If port wasn't specified that means kannel will use socket instead, so no need 
to specify default port.

 

2015-11-09 17:23 GMT+03:00 Vyronas Tsingaras <vtsinga...@amdtelecom.net 
<mailto:vtsinga...@amdtelecom.net> >:

sqlbox would try to connect to random ports on the mysql host if no port was 
defined due to an uninitialized variable use.

 

Index: sqlbox_mysql.c

===

--- sqlbox_mysql.c (revision 55)

+++ sqlbox_mysql.c (working copy)

@@ -396,6 +396,9 @@

 if (have_port) {

 db_conf->mysql->port = mysql_port;

 }

+else {

+db_conf->mysql->port = 3306;

+}

 

 pool = dbpool_create(DBPOOL_MYSQL, db_conf, pool_size);

 gw_assert(pool != NULL);

 

-- 





Vyronas Tsingaras | IT Department


12th Km Thessaloniki - Liti, Zip.57200, Greece


Tel.: +30.23940.20336, Fax: +30.23940.25922


Skype id: vtsingaras.amdtelecom


E-mail:  <mailto:b...@amdtelecom.net> vtsinga...@amdtelecom.net


 <http://www.amdtelecom.net/> www.amdtelecom.net   
<http://www.linkedin.com/company/amd-telecom-s.a.?trk=company_logo>
<https://www.facebook.com/pages/AMD-Telecom/282439285138965?fref=ts>
<https://www.twitter.com/amdtelecom> 





Please consider the environment before printing this email


This e-mail message and all attachments transmitted with it are confidential 
and are intended solely for the addressee(s). If the reader of this message is 
not the intended recipient, you are hereby notified that any reading, 
dissemination, distribution, copying, or other use of this message or its 
attachment(s) is strictly prohibited.

 





 

-- 





Vyronas Tsingaras | IT Department


12th Km Thessaloniki - Liti, Zip.57200, Greece


Tel.: +30.23940.20336, Fax: +30.23940.25922


Skype id: vtsingaras.amdtelecom


E-mail:  <mailto:b...@amdtelecom.net> vtsinga...@amdtelecom.net


 <http://www.amdtelecom.net/> www.amdtelecom.net   
<http://www.linkedin.com/company/amd-telecom-s.a.?trk=company_logo>
<https://www.facebook.com/pages/AMD-Telecom/282439285138965?fref=ts>
<https://www.twitter.com/amdtelecom> 





Please consider the environment before printing this email


This e-mail message and all attachments transmitted with it are confidential 
and are intended solely for the addressee(s). If the reader of this message is 
not the intended recipient, you are hereby notified that any reading, 
dissemination, distribution, copying, or other use of this message or its 
attachment(s) is strictly prohibited.

 





 

-- 





Vyronas Tsingaras | IT Department


12th Km Thessaloniki - Liti, Zip.57200, Greece


Tel.: +30.23940.20336, Fax: +30.23940.25922


Skype id: vtsingaras.amdtelecom


E-mail:  <mailto:b...@amdtelecom.net> vtsinga...@amdtelecom.net


 <http://www.amdtelecom.net/> www.amdtelecom.net   
<http://www.linkedin.com/company/amd-telecom-s.a.?trk=company_logo>
<https://www.facebook.com/pages/AMD-Telecom/282439285138965?fref=ts>
<https://www.twitter.com/amdtelecom> 





Please consider the environment before printing this email


This e-mail message and all attachments transmitted with it are confidential 
and are intended solely for the addressee(s). If the reader of this message is 
not the intended recipient, you are hereby notified that any reading, 
dissemination, distribution, copying, or other use of this message or its 
attachment(s) is strictly prohibited.

 



Re: PATCH: Fix use of uninitialized variable (mysql port) in sqlbox

2015-11-09 Thread Vyronas Tsingaras
Amended.

sqlbox would try to connect to random ports on the mysql host if no port
was defined due to an uninitialized variable use.

Index: sqlbox_mysql.c
===
--- sqlbox_mysql.c (revision 55)
+++ sqlbox_mysql.c (working copy)
@@ -396,6 +396,9 @@
 if (have_port) {
 db_conf->mysql->port = mysql_port;
 }
+else {
+db_conf->mysql->port = 0;
+}

 pool = dbpool_create(DBPOOL_MYSQL, db_conf, pool_size);
 gw_assert(pool != NULL);

On Mon, Nov 9, 2015 at 4:23 PM, Vyronas Tsingaras  wrote:

> sqlbox would try to connect to random ports on the mysql host if no port
> was defined due to an uninitialized variable use.
>
> Index: sqlbox_mysql.c
> ===
> --- sqlbox_mysql.c (revision 55)
> +++ sqlbox_mysql.c (working copy)
> @@ -396,6 +396,9 @@
>  if (have_port) {
>  db_conf->mysql->port = mysql_port;
>  }
> +else {
> +db_conf->mysql->port = 3306;
> +}
>
>  pool = dbpool_create(DBPOOL_MYSQL, db_conf, pool_size);
>  gw_assert(pool != NULL);
>
> --
> *Vyronas Tsingaras **| IT Department*
> 12th Km Thessaloniki - Liti, Zip.57200, GreeceTel.: +30.23940.20336, Fax:
> +30.23940.25922Skype id: vtsingaras.amdtelecomE-mail:
> vtsinga...@amdtelecom.net www.amdtelecom.net
> 
> 
> 
> Please consider the environment before printing this email
>
> This e-mail message and all attachments transmitted with it are
> confidential and are intended solely for the addressee(s). If the reader of
> this message is not the intended recipient, you are hereby notified that
> any reading, dissemination, distribution, copying, or other use of this
> message or its attachment(s) is strictly prohibited.
>



-- 
*Vyronas Tsingaras **| IT Department*
12th Km Thessaloniki - Liti, Zip.57200, GreeceTel.: +30.23940.20336, Fax:
+30.23940.25922Skype id: vtsingaras.amdtelecomE-mail:
vtsinga...@amdtelecom.net www.amdtelecom.net



Please consider the environment before printing this email

This e-mail message and all attachments transmitted with it are
confidential and are intended solely for the addressee(s). If the reader of
this message is not the intended recipient, you are hereby notified that
any reading, dissemination, distribution, copying, or other use of this
message or its attachment(s) is strictly prohibited.


Re: PATCH: Fix use of uninitialized variable (mysql port) in sqlbox

2015-11-09 Thread Cezary Siwek

Hi,

I recall that bearerbox and sqlbox use unix socket when no port was 
specified in the config. Using unix socket is usually a bit faster than 
TCP but of course the database must be installed on the same machine.
Perhaps the behaviour is different with more recent library versions and 
I'm unable to confirm that.


regards,
C.

On 09/11/2015 14:23, Vyronas Tsingaras wrote:
sqlbox would try to connect to random ports on the mysql host if no 
port was defined due to an uninitialized variable use.


Index: sqlbox_mysql.c
===
--- sqlbox_mysql.c(revision 55)
+++ sqlbox_mysql.c(working copy)
@@ -396,6 +396,9 @@
 if (have_port) {
 db_conf->mysql->port = mysql_port;
 }
+else {
+  db_conf->mysql->port = 3306;
+}
 pool = dbpool_create(DBPOOL_MYSQL, db_conf, pool_size);
 gw_assert(pool != NULL);

--

*Vyronas Tsingaras **| IT Department*
12th Km Thessaloniki - Liti, Zip.57200, Greece
Tel.: +30.23940.20336, Fax: +30.23940.25922
Skype id: vtsingaras.amdtelecom
E-mail: vtsinga...@amdtelecom.net 
www.amdtelecom.net  
 
 





Please consider the environment before printing this email

This e-mail message and all attachments transmitted with it are 
confidential and are intended solely for the addressee(s). If the 
reader of this message is not the intended recipient, you are hereby 
notified that any reading, dissemination, distribution, copying, or 
other use of this message or its attachment(s) is strictly prohibited.






PATCH: Fix use of uninitialized variable (mysql port) in sqlbox

2015-11-09 Thread Vyronas Tsingaras
sqlbox would try to connect to random ports on the mysql host if no port
was defined due to an uninitialized variable use.

Index: sqlbox_mysql.c
===
--- sqlbox_mysql.c (revision 55)
+++ sqlbox_mysql.c (working copy)
@@ -396,6 +396,9 @@
 if (have_port) {
 db_conf->mysql->port = mysql_port;
 }
+else {
+db_conf->mysql->port = 3306;
+}

 pool = dbpool_create(DBPOOL_MYSQL, db_conf, pool_size);
 gw_assert(pool != NULL);

-- 
*Vyronas Tsingaras **| IT Department*
12th Km Thessaloniki - Liti, Zip.57200, GreeceTel.: +30.23940.20336, Fax:
+30.23940.25922Skype id: vtsingaras.amdtelecomE-mail:
vtsinga...@amdtelecom.net www.amdtelecom.net



Please consider the environment before printing this email

This e-mail message and all attachments transmitted with it are
confidential and are intended solely for the addressee(s). If the reader of
this message is not the intended recipient, you are hereby notified that
any reading, dissemination, distribution, copying, or other use of this
message or its attachment(s) is strictly prohibited.


Re: PATCH: Fix use of uninitialized variable (mysql port) in sqlbox

2015-11-09 Thread Vyronas Tsingaras
Yes and even then, well the signature of mysql_real_connect that is used in
dbpool_mysql:101 is MYSQL *mysql_real_connect(MYSQL *mysql, const char
*host, const char *user, const char *passwd, const char *db, unsigned int
port, const char *unix_socket, unsigned long client_flag). You have to
specify a value for port and providing '0' instead of an unitialized
variable seems best in my opinion.

Kind Regards,
Vyronas Tsingaras

On Mon, Nov 9, 2015 at 5:37 PM, spameden  wrote:

> That's correct, host should be 'localhost'.
>
> 2015-11-09 18:31 GMT+03:00 Vyronas Tsingaras :
>
>> But according to
>> https://dev.mysql.com/doc/refman/5.7/en/mysql-real-connect.html only
>> when host is either NULL or "localhost" will mysql_real_connect do UNIX
>> socket connection. The 'port' argument only applies to TCP/IP connections
>> and thus should default to 0 if not specified.
>>
>> Kind Regards,
>> Vyronas Tsingaras
>>
>> On Mon, Nov 9, 2015 at 5:24 PM, spameden  wrote:
>>
>>> If port wasn't specified that means kannel will use socket instead, so
>>> no need to specify default port.
>>>
>>> 2015-11-09 17:23 GMT+03:00 Vyronas Tsingaras 
>>> :
>>>
 sqlbox would try to connect to random ports on the mysql host if no
 port was defined due to an uninitialized variable use.

 Index: sqlbox_mysql.c
 ===
 --- sqlbox_mysql.c (revision 55)
 +++ sqlbox_mysql.c (working copy)
 @@ -396,6 +396,9 @@
  if (have_port) {
  db_conf->mysql->port = mysql_port;
  }
 +else {
 +db_conf->mysql->port = 3306;
 +}

  pool = dbpool_create(DBPOOL_MYSQL, db_conf, pool_size);
  gw_assert(pool != NULL);

 --
 *Vyronas Tsingaras **| IT Department*
 12th Km Thessaloniki - Liti, Zip.57200, GreeceTel.: +30.23940.20336,
 Fax: +30.23940.25922Skype id: vtsingaras.amdtelecomE-mail:
 vtsinga...@amdtelecom.net www.amdtelecom.net
 
 
 
 Please consider the environment before printing this email

 This e-mail message and all attachments transmitted with it are
 confidential and are intended solely for the addressee(s). If the reader of
 this message is not the intended recipient, you are hereby notified that
 any reading, dissemination, distribution, copying, or other use of this
 message or its attachment(s) is strictly prohibited.

>>>
>>>
>>
>>
>> --
>> *Vyronas Tsingaras **| IT Department*
>> 12th Km Thessaloniki - Liti, Zip.57200, GreeceTel.: +30.23940.20336,
>> Fax: +30.23940.25922Skype id: vtsingaras.amdtelecomE-mail:
>> vtsinga...@amdtelecom.net www.amdtelecom.net
>> 
>> 
>> 
>> Please consider the environment before printing this email
>>
>> This e-mail message and all attachments transmitted with it are
>> confidential and are intended solely for the addressee(s). If the reader of
>> this message is not the intended recipient, you are hereby notified that
>> any reading, dissemination, distribution, copying, or other use of this
>> message or its attachment(s) is strictly prohibited.
>>
>
>


-- 
*Vyronas Tsingaras **| IT Department*
12th Km Thessaloniki - Liti, Zip.57200, GreeceTel.: +30.23940.20336, Fax:
+30.23940.25922Skype id: vtsingaras.amdtelecomE-mail:
vtsinga...@amdtelecom.net www.amdtelecom.net



Please consider the environment before printing this email

This e-mail message and all attachments transmitted with it are
confidential and are intended solely for the addressee(s). If the reader of
this message is not the intended recipient, you are hereby notified that
any reading, dissemination, distribution, copying, or other use of this
message or its attachment(s) is strictly prohibited.


Re: PATCH: Fix use of uninitialized variable (mysql port) in sqlbox

2015-11-09 Thread spameden
That's correct, host should be 'localhost'.

2015-11-09 18:31 GMT+03:00 Vyronas Tsingaras :

> But according to
> https://dev.mysql.com/doc/refman/5.7/en/mysql-real-connect.html only when
> host is either NULL or "localhost" will mysql_real_connect do UNIX socket
> connection. The 'port' argument only applies to TCP/IP connections and thus
> should default to 0 if not specified.
>
> Kind Regards,
> Vyronas Tsingaras
>
> On Mon, Nov 9, 2015 at 5:24 PM, spameden  wrote:
>
>> If port wasn't specified that means kannel will use socket instead, so no
>> need to specify default port.
>>
>> 2015-11-09 17:23 GMT+03:00 Vyronas Tsingaras :
>>
>>> sqlbox would try to connect to random ports on the mysql host if no port
>>> was defined due to an uninitialized variable use.
>>>
>>> Index: sqlbox_mysql.c
>>> ===
>>> --- sqlbox_mysql.c (revision 55)
>>> +++ sqlbox_mysql.c (working copy)
>>> @@ -396,6 +396,9 @@
>>>  if (have_port) {
>>>  db_conf->mysql->port = mysql_port;
>>>  }
>>> +else {
>>> +db_conf->mysql->port = 3306;
>>> +}
>>>
>>>  pool = dbpool_create(DBPOOL_MYSQL, db_conf, pool_size);
>>>  gw_assert(pool != NULL);
>>>
>>> --
>>> *Vyronas Tsingaras **| IT Department*
>>> 12th Km Thessaloniki - Liti, Zip.57200, GreeceTel.: +30.23940.20336,
>>> Fax: +30.23940.25922Skype id: vtsingaras.amdtelecomE-mail:
>>> vtsinga...@amdtelecom.net www.amdtelecom.net
>>> 
>>> 
>>> 
>>> Please consider the environment before printing this email
>>>
>>> This e-mail message and all attachments transmitted with it are
>>> confidential and are intended solely for the addressee(s). If the reader of
>>> this message is not the intended recipient, you are hereby notified that
>>> any reading, dissemination, distribution, copying, or other use of this
>>> message or its attachment(s) is strictly prohibited.
>>>
>>
>>
>
>
> --
> *Vyronas Tsingaras **| IT Department*
> 12th Km Thessaloniki - Liti, Zip.57200, GreeceTel.: +30.23940.20336, Fax:
> +30.23940.25922Skype id: vtsingaras.amdtelecomE-mail:
> vtsinga...@amdtelecom.net www.amdtelecom.net
> 
> 
> 
> Please consider the environment before printing this email
>
> This e-mail message and all attachments transmitted with it are
> confidential and are intended solely for the addressee(s). If the reader of
> this message is not the intended recipient, you are hereby notified that
> any reading, dissemination, distribution, copying, or other use of this
> message or its attachment(s) is strictly prohibited.
>


Re: PATCH: Fix use of uninitialized variable (mysql port) in sqlbox

2015-11-09 Thread spameden
If port wasn't specified that means kannel will use socket instead, so no
need to specify default port.

2015-11-09 17:23 GMT+03:00 Vyronas Tsingaras :

> sqlbox would try to connect to random ports on the mysql host if no port
> was defined due to an uninitialized variable use.
>
> Index: sqlbox_mysql.c
> ===
> --- sqlbox_mysql.c (revision 55)
> +++ sqlbox_mysql.c (working copy)
> @@ -396,6 +396,9 @@
>  if (have_port) {
>  db_conf->mysql->port = mysql_port;
>  }
> +else {
> +db_conf->mysql->port = 3306;
> +}
>
>  pool = dbpool_create(DBPOOL_MYSQL, db_conf, pool_size);
>  gw_assert(pool != NULL);
>
> --
> *Vyronas Tsingaras **| IT Department*
> 12th Km Thessaloniki - Liti, Zip.57200, GreeceTel.: +30.23940.20336, Fax:
> +30.23940.25922Skype id: vtsingaras.amdtelecomE-mail:
> vtsinga...@amdtelecom.net www.amdtelecom.net
> 
> 
> 
> Please consider the environment before printing this email
>
> This e-mail message and all attachments transmitted with it are
> confidential and are intended solely for the addressee(s). If the reader of
> this message is not the intended recipient, you are hereby notified that
> any reading, dissemination, distribution, copying, or other use of this
> message or its attachment(s) is strictly prohibited.
>


Re: PATCH: Fix use of uninitialized variable (mysql port) in sqlbox

2015-11-09 Thread Vyronas Tsingaras
But according to
https://dev.mysql.com/doc/refman/5.7/en/mysql-real-connect.html only when
host is either NULL or "localhost" will mysql_real_connect do UNIX socket
connection. The 'port' argument only applies to TCP/IP connections and thus
should default to 0 if not specified.

Kind Regards,
Vyronas Tsingaras

On Mon, Nov 9, 2015 at 5:24 PM, spameden  wrote:

> If port wasn't specified that means kannel will use socket instead, so no
> need to specify default port.
>
> 2015-11-09 17:23 GMT+03:00 Vyronas Tsingaras :
>
>> sqlbox would try to connect to random ports on the mysql host if no port
>> was defined due to an uninitialized variable use.
>>
>> Index: sqlbox_mysql.c
>> ===
>> --- sqlbox_mysql.c (revision 55)
>> +++ sqlbox_mysql.c (working copy)
>> @@ -396,6 +396,9 @@
>>  if (have_port) {
>>  db_conf->mysql->port = mysql_port;
>>  }
>> +else {
>> +db_conf->mysql->port = 3306;
>> +}
>>
>>  pool = dbpool_create(DBPOOL_MYSQL, db_conf, pool_size);
>>  gw_assert(pool != NULL);
>>
>> --
>> *Vyronas Tsingaras **| IT Department*
>> 12th Km Thessaloniki - Liti, Zip.57200, GreeceTel.: +30.23940.20336,
>> Fax: +30.23940.25922Skype id: vtsingaras.amdtelecomE-mail:
>> vtsinga...@amdtelecom.net www.amdtelecom.net
>> 
>> 
>> 
>> Please consider the environment before printing this email
>>
>> This e-mail message and all attachments transmitted with it are
>> confidential and are intended solely for the addressee(s). If the reader of
>> this message is not the intended recipient, you are hereby notified that
>> any reading, dissemination, distribution, copying, or other use of this
>> message or its attachment(s) is strictly prohibited.
>>
>
>


-- 
*Vyronas Tsingaras **| IT Department*
12th Km Thessaloniki - Liti, Zip.57200, GreeceTel.: +30.23940.20336, Fax:
+30.23940.25922Skype id: vtsingaras.amdtelecomE-mail:
vtsinga...@amdtelecom.net www.amdtelecom.net



Please consider the environment before printing this email

This e-mail message and all attachments transmitted with it are
confidential and are intended solely for the addressee(s). If the reader of
this message is not the intended recipient, you are hereby notified that
any reading, dissemination, distribution, copying, or other use of this
message or its attachment(s) is strictly prohibited.