Hi Cyril,
I'm happy, because i knew there are better developer than me on this list.
This is why i decide to send my code to willy (even if it is not
perfect) because i knew this wake up you guys ;)
I will try your "start of reflection" on "old" mysql server, stay up
Hervé.
On 01/14/2010 12:28 AM, Cyril Bonté wrote:
Hi again Hervé,
Le Mercredi 13 Janvier 2010 12:56:30, Hervé COMMOWICK a écrit :
Hi Cyril,
I know the check is not perfect, because it doesn't handle a correct
disconnection.
Mysql expect the client to talk, and i think it's weird... in the
future, i think it will be better to do a *real* mysql ping, but at the
moment, the checks API doesn't let me handle this in a cleaner way.
This is not a patch but a start of reflection :
In the function event_srv_chk_r(int fd),
after this condition :
if (trash[4] != -1) {
I added this quick and dirty reply :
char handshake[] =
"\x22\x00\x00" /* packet length */
"\x01" /* packet number */
"\x00\x00" /* client capabilities */
"\x00\x00" /* extended client capabilities */
"\x00\x00\x00\x01" /* max packet */
"\x08" /* charset */
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
/* reserved (23 bytes) */
"\x00" /* username (null terminated
string) */
"\x00"; /* empty password */
send(fd, handshake, sizeof(handshake), MSG_DONTWAIT | MSG_NOSIGNAL);
After several tests, this finishes the handshake correctly.
Note that this packet is only valid for mysql>= 4.1 (haproxy would have to
check the version to decide which reply to send).
At the moment, I have no mysql 4.0 to validate the other reply type.
For more information :
http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#Client_Authentication_Packet
I hope this will be helpful.
--
Hervé COMMOWICK, EXOSEC (http://www.exosec.fr/)
ZAC des Metz - 3 Rue du petit robinson - 78350 JOUY EN JOSAS
Tel: +33 1 30 67 60 65 - Fax: +33 1 75 43 40 70
mailto:hcommow...@exosec.fr
* , __,
_/^\_ ( | _, _ , _ ,
< > _|(_)\/(/_(_|/_)(/_/_)
* /.-.\ * ( _/
* `/&\` ________)
,@.*;@, (--|__ _ |_ _ ,
/_o.I %_\ * _| (/_| (/_/_)
* (`'--:o(_@; (
/`;--.,__ `') *
;@`o % O,*`'`&\
* (`'--)_@ ;o %'()\ *
/.,_ `''-...- `) *
`"""==,,.,="="= "`
####
""""