[gnome-db] calling gda_client_find_connection twice with null username/passwords combos
- From: Alan Knowles <alan akbkhome com>
- To: gnome-db-list <gnome-db-list gnome org>
- Subject: [gnome-db] calling gda_client_find_connection twice with null username/passwords combos
- Date: Wed, 18 Aug 2004 22:51:32 +0800
I have a config something like this:
gda_config_save_data_source ("test", "MySQL","DATABASE=test","test",
"me","");
One of the situations I have is, that I need to call
gda_client_open_connection twice - I could use find connection, but
open_connection calls it anyway..
The trouble occurs if I'm using null username/password combo's for
open_connection. It will segfault.
#0 0x403ff8b4 in strcmp () from /lib/libc.so.6
No symbol table info available.
#1 0x425993de in gda_client_find_connection () from /usr/lib/libgda-2.so.1
No symbol table info available.
#2 0x42598f24 in gda_client_open_connection () from /usr/lib/libgda-2.so.1
....
Anyway looking at the code for find connection it's pretty clear why
it's failing:
if (((!tmp_dsn && !dsn_info->name) || !strcmp (tmp_dsn, dsn_info->name)) &&
((!tmp_usr && !username) || !strcmp (tmp_usr, username)) &&
((!tmp_pwd && !password) || !strcmp (tmp_pwd, password))) {
gda_config_free_data_source_info (dsn_info);
return cnc;
}
comming in: username = null, password = null, all the others have values..
((!tmp_usr && !username) || !strcmp (tmp_usr, username))
will evaluate:
((!true && !false) || !strcmp("alan", null) <-- oops explode baby...
Basically find connection is not overlaying the username/password from
the source info:
adding something like this to start of find_connection should fix it?
dsn_info = gda_config_find_data_source (dsn);
username = username ? username : dsn_info->username;
password = password ? password : dsn_info->password;
Regards
Alan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]