Description:
We are doing some experimentation on the viability of using MySQL as part of a plugin for some applications. We have hit a problem which (it could be argued) requires a bug-fix on either side. From our point of view, a fix in MySQL will make more sense, and would (I think) be an internal change and nothing else.
Basically, the problem boils down to a conflict with the function 'rnd()'. The host application we are trying to interface to, defines it's own version of rnd() within that application. This function is exposed and is available to all plugins as a C function.
As a result, when I link our test plugins with MySQL, it will consistently fail to establish a connection to a MySQL database server. The reason is that MySQL internally uses a C function, rnd(), to do the password hashing. This is where the conflict lies. If I remove the password from the database account, the connection succeeds.
How to repeat:
Link mysql routines with an application which defines an rnd() function of it's own, which is used internally.
Suggested fix:
One of two possible fixes:
- Assuming rnd() is used exclusively within password.c, and nowhere else within the code, then it should be made 'static'. This should force the compiler to use the rnd() function in that file to be available only to that file. The compiler should then link this function when building the client library.
- Alternatively, rename rnd() within password.c (and any other references to it) to something like mysql_rnd() to be sure of no conflicts.
I think that this will resolve the problem and have an extremely minimal impact on any applications which use MySQL. I don't think that the rnd() function is exposed as a publically accessible symbol available as part of the mysql client library, so it's (hopefully) unlikely that any applications are using rnd() from the mysql client library.