|Anonymous | Login | Signup for a new account||2019-01-18 22:51 WET|
|Main | My View | View Issues | Change Log | Roadmap | Docs | My Account|
|Viewing Issue Simple Details|
|ID||Category||Severity||Reproducibility||Date Submitted||Last Update|
|0000035||[MyDNS-NG] Global||major||always||2009-09-04 09:19||2009-11-15 19:29|
|Summary||0000035: lose port information|
This bug comes from mydns 1.0.0 and is present in all mydns-ng versions (I've not checked it but I'm pretty sure it is).
You can specify custom port number for database connection in db-host statement as hostname:port definition. Initially mydns would connect to specified port number but after loosing connection to database it will reconnect to standard port number. So the information about port number is lost.
In file sql.c, in function sql_open on line 48 we have group of assignments which saves connection information for reconnect. Earlier on line 43 there is assignment which cuts off the port number part from host string (*portp = '\0'). So when it comes to save information only the hostname part is saved in _sql_host variable. When function sql_reopen is called, there is no port information in _sql_host and it will try to connect to standard port of mysql or pgsql.
I think enough solution is to move whole block (lines: 47-55) above line 41.
|Additional Information||Checked only in mydns 1.1.0 with mysql database but code hasn't changed much since that so I think it is still present .|
|Tags||No tags attached.|
|Attached Files||sql.c.diff [^] (1,692 bytes) 2009-10-17 22:53|
I ran into this as well. Here is a propsed patch.
There are other issues here as well, I think.
portp on line 41 is a char * which will point into a const char *. *portp will then be modified on line 43 which means we are modifying a const char * which is illegal.
Second, at the end of the function (line 95), the *portp which is set to '\0' on line 43 is supposed to be restored, however, since portp was increased on line 44, this ':' will be written in the wrong place.
I have uploaded a proposed fix. I'm not used to generating patches, this was done with:
mydns-1.2.8/src/lib$ diff -u sql-orig.c sql.c >sql.c.diff
Against version 126.96.36.199.
|Added on trunk and 1.2.8 tag. Thanks.|
|2009-09-04 09:19||pawelpanek||New Issue|
|2009-09-07 15:17||jorge||Status||new => assigned|
|2009-09-07 15:17||jorge||Assigned To||=> howardwilkinson|
|2009-10-17 22:53||erl||File Added: sql.c.diff|
|2009-10-17 22:54||erl||Note Added: 0000087|
|2009-10-17 22:54||erl||Issue Monitored: erl|
|2009-11-15 19:29||jorge||Note Added: 0000107|
|2009-11-15 19:29||jorge||Status||assigned => resolved|
|2009-11-15 19:29||jorge||Fixed in Version||=> 1.2.8|
|2009-11-15 19:29||jorge||Resolution||open => fixed|
|Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group|