日期:2014-05-16 浏览次数:21120 次
local authed = false
function read_query( packet )
        if (authed == false) then
           if packet:byte() == proxy.COM_QUERY then
                if(packet:sub(2):lower() == "select 2013 from dual") then
                    authed = true                   
                else                  
                    proxy.response.type = proxy.MYSQLD_PACKET_ERR
                    proxy.response.errmsg = "unauthed connection !!! "
                    return proxy.PROXY_SEND_RESULT
                end
            else
                proxy.response.type = proxy.MYSQLD_PACKET_ERR
                proxy.response.errmsg = "unauthed connection !!!"
                return proxy.PROXY_SEND_RESULT
           end
        end
end