Ejemplo n.º 1
0
        private static void ProcessAuthentication(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client)
        {
            RMCPacketReply reply;

            switch (rmc.methodID)
            {
            case 2:
                RMCPacketRequestLoginCustomData h = (RMCPacketRequestLoginCustomData)rmc.header;
                switch (h.className)
                {
                case "UbiAuthenticationLoginCustomData":
                    reply             = new RMCPacketResponseLoginCustomData(client.PID);
                    client.sessionKey = ((RMCPacketResponseLoginCustomData)reply).ticket.sessionKey;
                    SendReply(udp, p, rmc, client, reply);
                    break;

                default:
                    WriteLog("Error: Unknown RMC Packet Authentication Custom Data class " + h.className);
                    break;
                }
                break;

            case 3:
                reply = new RMCPacketResponseRequestTicket(client.PID);
                SendReply(udp, p, rmc, client, reply);
                break;

            default:
                WriteLog("Error: Unknown RMC Packet Authentication Method 0x" + rmc.methodID.ToString("X"));
                break;
            }
        }
Ejemplo n.º 2
0
        private static void ProcessAuthentication(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client)
        {
            RMCPacketReply reply;

            switch (rmc.methodID)
            {
            case 2:
                RMCPacketRequestLoginCustomData h = (RMCPacketRequestLoginCustomData)rmc.header;
                switch (h.className)
                {
                case "UbiAuthenticationLoginCustomData":
                    reply = new RMCPacketResponseEmpty();
                    ClientInfo user = DBHelper.GetUserByName(h.username);
                    if (user != null)
                    {
                        if (user.pass == h.password)
                        {
                            reply             = new RMCPacketResponseLoginCustomData(client.PID);
                            client.name       = h.username;
                            client.pass       = h.password;
                            client.sessionKey = ((RMCPacketResponseLoginCustomData)reply).ticket.sessionKey;
                            SendReply(udp, p, rmc, client, reply);
                        }
                        else
                        {
                            SendReply(udp, p, rmc, client, reply, true, 0x80030065);
                        }
                    }
                    else
                    {
                        SendReply(udp, p, rmc, client, reply, true, 0x80030064);
                    }
                    break;

                default:
                    WriteLog(1, "Error: Unknown RMC Packet Authentication Custom Data class " + h.className);
                    break;
                }
                break;

            case 3:
                reply = new RMCPacketResponseRequestTicket(client.PID);
                SendReply(udp, p, rmc, client, reply);
                break;

            default:
                WriteLog(1, "Error: Unknown RMC Packet Authentication Method 0x" + rmc.methodID.ToString("X"));
                break;
            }
        }