kubo / ruby-oci8

Ruby-oci8 - Oracle interface for ruby
Other
169 stars 75 forks source link

Ruby-oci8 2.1.4 crashes while connecting to an Oracle instance if password is an empty string #31

Closed srilumpa closed 11 years ago

srilumpa commented 11 years ago

I have the following behaviour in the IRB console as well as in my Rails app running with apache with Passenger.

When trying to connect to an oracle instance without password, the IRB console crashes (like in "crash!", i'm kicked back to my terminal and forced to restart the console).

It took me a while to figure it out but if the password is an empty String (""), I have a return from the gem stating a OCI-21500 Oracle error and then the console die. When the empty string is replaced by nil, I just get a ruby TypeError Exception saying it can not be converted to a String.

Here is the tests I ran in the IRB console:

> db = OCI8.new(my_login, "some_password", my_tns)
OCIError: ORA-01017: invalid username/password; logon denied
> db = OCI8.new(my_login, nil, my_tns)
TypeError: can't convert nil into String
> db = OCI8.new(src.login, "", src.tns)
Errors in file :
OCI-21500: internal error code, arguments: [kpuqinit-0], [], [], [], [], [], [], []
����������[... snip ...]�����`~C��`~C��`~C��`~C��`~C��`~C��`~C��`~C��Errors in file :
OCI-21500: internal error code, arguments: [kgepop: no error frame to pop to], [], [], [], [], [], [], []
OCI-21500: internal error code, arguments: [kpuqinit-0], [], [], [], [], [], [], []
������[... snip ...]�� }C�� }C�� }C�� }C�� }C�� }C�� }C�� }C��Errors in file :
OCI-21500: internal error code, arguments: [kgepop: no error frame to pop to], [], [], [], [], [], [], []
OCI-21500: internal error code, arguments: [kpuqinit-0], [], [], [], [], [], [], []
�F���F���F���F���[... snip ...]��P~C��P~C��P~C��P~C��P~C��P~C��P~C��P~C��mad@madness:~$
kubo commented 11 years ago

Use ruby-oci8 2.1.5. It raises ORA-01005: null password given; logon denied for both nil and an empty string "" password.

srilumpa commented 11 years ago

Great! Sorry, I didn't think to upgrade the gem.