Bug #45074 Doc: auth.* is replaced by proxy.connection.server.* / proxy.connection.client.*
Submitted: 25 May 19:17 Modified: 20 Aug 18:46
Reporter: Diego Medina
Status: Closed
Category:Proxy: Docs Severity:S3 (Non-critical)
Version:0.7.1 OS:Any
Assigned to: MC Brown Target Version:

[25 May 19:17] Diego Medina
Description:
This url
http://dev.mysql.com/doc/refman/5.0/en/mysql-proxy-scripting-read-handshake.html

shows how to see the mysqld-version, thread-id and other values, but if you use version
0.7.0 or greater, you do not get any values.

How to repeat:
1- Save the example file as a lua script and start the proxy using that file.
2- Send any query through the proxy port 4040
3- Look at the terminal where you started the proxy and you will see different errors.

Suggested fix:
Use this instead

function read_handshake( auth )
        print("<-- let's send him some information about us")
        print("    mysqld-version: " .. proxy.connection.server.mysqld_version)
        print("    thread-id     : " .. proxy.connection.server.thread_id)
        print("    scramble-buf  : " .. string.format("%q",
proxy.connection.server.scramble_buffer))
        print("    server-addr   : " .. proxy.connection.server.dst.name)
        print("    client-addr   : " .. proxy.connection.client.dst.name)
        

        if not proxy.connection.client.dst.name:match("^127.0.0.1:") then
                proxy.response.type = proxy.MYSQLD_PACKET_ERR
                proxy.response.errmsg = "only local connects are allowed"

                print("we don't like this client");

                return proxy.PROXY_SEND_RESULT
        end
end
[3 Jun 17:23] Kay Roepke
duplicated by bug#42631
[20 Aug 18:46] MC Brown
Documentation has been updated in this example for the new layout and structures.
[20 Aug 19:03] MC Brown
Documentation has been updated in this example for the new layout and structures.