Ejemplo n.º 1
0
        public static void AuthChallengeRequest(IAuthClient client, AuthPacketIn packet)
        {
            packet.SkipBytes(6);             // Skip game name and packet size

            client.ClientInfo = ClientInformation.ReadFromPacket(packet);

            if (!WCellInfo.RequiredVersion.IsSupported(client.ClientInfo.Version))
            {
                OnLoginError(client, AccountStatus.WrongBuild);
            }
            else
            {
                string accName = packet.ReadPascalString();

                s_log.Debug(Resources.AccountChallenge, accName);

                client.CurrentUser = accName;

                var banQuery = QueryFactory.CreateResultQuery
                               (
                    () => Ban.GetBan(client.ClientAddress),
                    AuthChallengeRequestCallback,
                    client
                               );

                client.Server.EnqueueTask(banQuery);
            }
        }
Ejemplo n.º 2
0
        public static void AuthReconnectProof(IAuthClient client, AuthPacketIn packet)
        {
            AuthenticationInfo authInfo;

            if (AuthenticationServer.Instance.GetAuthenticationInfo(client.CurrentUser, out authInfo))
            {
                if (client.Authenticator.IsReconnectProofValid(packet, authInfo))
                {
                    SendAuthReconnectProof(client);
                }
            }
        }
Ejemplo n.º 3
0
        public static void AuthReconnectProof(IAuthClient client, AuthPacketIn packet)
        {
            var authInfo = AuthenticationServer.Instance.GetAuthenticationInfo(client.AccountName);

            if (authInfo != null)
            {
                if (client.Authenticator.IsReconnectProofValid(packet, authInfo))
                {
                    SendAuthReconnectProof(client);
                }
            }
        }
Ejemplo n.º 4
0
        public static void AuthChallengeRequest(IAuthClient client, AuthPacketIn packet)
        {
            client.Info = ClientInformation.ReadFromPacket(packet);

            // Account-names are always sent upper-case by the client (make sure, the tradition is kept alive)
            var accName = packet.ReadPascalString().ToUpper();

            s_log.Debug(resources.AccountChallenge, accName);

            client.AccountName = accName;
            AuthenticationServer.IOQueue.AddMessage(new Message1 <IAuthClient>(client, AuthChallengeRequestCallback));
        }
Ejemplo n.º 5
0
        public static void AuthProofRequest(IAuthClient client, AuthPacketIn packet)
        {
            if (client.Authenticator == null)
            {
                client.Server.DisconnectClient(client);
            }
            else if (client.IsConnected)
            {
                if (client.Authenticator.IsClientProofValid(packet))
                {
                    AuthenticationServer.IOQueue.AddMessage(() =>
                    {
                        LoginClient(client);
                    });
                }
                else
                {
                    s_log.Debug(resources.InvalidClientProof, client.AccountName);

                    OnLoginError(client, AccountStatus.InvalidInformation);
                }
            }
        }
Ejemplo n.º 6
0
		public static void AuthReconnectProof(IAuthClient client, AuthPacketIn packet)
		{
			var authInfo = AuthenticationServer.Instance.GetAuthenticationInfo(client.AccountName);
			if (authInfo != null)
			{
				if (client.Authenticator.IsReconnectProofValid(packet, authInfo))
				{
					SendAuthReconnectProof(client);
				}
			}

		}
Ejemplo n.º 7
0
		public static void AuthReconnectChallenge(IAuthClient client, AuthPacketIn packet)
		{
			SendAuthReconnectChallenge(client);
		}
Ejemplo n.º 8
0
		public static void AuthProofRequest(IAuthClient client, AuthPacketIn packet)
		{
			if (client.Authenticator == null)
			{
				client.Server.DisconnectClient(client);
			}
			else if (client.IsConnected)
			{
                if (client.Authenticator.IsClientProofValid(packet))
                {
                    AuthenticationServer.Instance.AddMessage(() =>
                    {
                    	LoginClient(client);
                    });
                }
                else
                {
                    s_log.Debug(Resources.InvalidClientProof, client.AccountName);

                    OnLoginError(client, AccountStatus.InvalidInformation);
                }
			}
		}
Ejemplo n.º 9
0
		public static void AuthChallengeRequest(IAuthClient client, AuthPacketIn packet)
		{
			packet.SkipBytes(6); // Skip game name and packet size

			client.Info = ClientInformation.ReadFromPacket(packet);

			// Account-names are always sent upper-case by the client (make sure, the tradition is kept alive)
			var accName = packet.ReadPascalString().ToUpper();

			s_log.Debug(Resources.AccountChallenge, accName);

			client.AccountName = accName;
			AuthenticationServer.Instance.AddMessage(new Message1<IAuthClient>(client, AuthChallengeRequestCallback));
		}
Ejemplo n.º 10
0
 public static void AuthReconnectChallenge(IAuthClient client, AuthPacketIn packet)
 {
     SendAuthReconnectChallenge(client);
 }
Ejemplo n.º 11
0
        public static void AuthProofRequest(IAuthClient client, AuthPacketIn packet)
        {
            if (client.Authenticator == null)
            {
                client.Server.DisconnectClient(client);
            }
            else
            {
                if (client.Authenticator.IsClientProofValid(packet))
                {
                    if (client.IsAutocreated)
                    {
                        // Their stuff matched, which means they gave us the same password
                        // as their username, which is what must occur to autocreate. Create
                        // the account for them before proceeding.

                        s_log.Debug(Resources.AutocreatingAccount, client.CurrentUser);

                        string role;
                        if (IPAddress.IsLoopback(client.ClientAddress))
                        {
                            // local users get the highest role
                            role = RoleGroupInfo.HighestRole.Name;
                        }
                        else
                        {
                            // remote users get default role
                            role = AuthServerConfiguration.DefaultRole;
                        }

                        var acctCreateQuery = QueryFactory.CreateResultQuery(
                            () => AccountMgr.Instance.CreateAccount(
                                client.CurrentUser,
                                client.Authenticator.SRP.Credentials.GetBytes(20),
                                null,
                                role,
                                ClientId.Wotlk
                                ),
                            AutocreateAccountCallback,
                            client
                            );

                        client.Server.EnqueueTask(acctCreateQuery);
                    }
                    else
                    {
                        // The following was sent twice
                        var authInfo = new AuthenticationInfo {
                            SessionKey        = client.Authenticator.SRP.SessionKey.GetBytes(40),
                            Salt              = client.Authenticator.SRP.Salt.GetBytes(32),
                            Verifier          = client.Authenticator.SRP.Verifier.GetBytes(),
                            SystemInformation = ClientInformation.Serialize(client.ClientInfo)
                        };

                        client.Server.StoreAuthenticationInfo(client.CurrentUser, authInfo);

                        SendAuthProofSuccessReply(client);
                    }
                }
                else
                {
                    s_log.Debug(Resources.InvalidClientProof, client.CurrentUser);

                    OnLoginError(client, AccountStatus.InvalidInformation);
                }
            }
        }
Ejemplo n.º 12
0
		public static void AuthReconnectProof(IAuthClient client, AuthPacketIn packet)
		{
			AuthenticationInfo authInfo;
			if (AuthenticationServer.Instance.GetAuthenticationInfo(client.CurrentUser, out authInfo))
			{
				if (client.Authenticator.IsReconnectProofValid(packet, authInfo))
				{
					SendAuthReconnectProof(client);
				}
			}

		}
Ejemplo n.º 13
0
		public static void AuthProofRequest(IAuthClient client, AuthPacketIn packet)
		{
			if (client.Authenticator == null)
			{
				client.Server.DisconnectClient(client);
			}
			else
			{
				if (client.Authenticator.IsClientProofValid(packet))
				{
					if (client.IsAutocreated)
					{
						// Their stuff matched, which means they gave us the same password
						// as their username, which is what must occur to autocreate. Create
						// the account for them before proceeding.

						s_log.Debug(Resources.AutocreatingAccount, client.CurrentUser);

						string role;
						if (IPAddress.IsLoopback(client.ClientAddress))
						{
							// local users get the highest role
							role = RoleGroupInfo.HighestRole.Name;
						}
						else
						{
							// remote users get default role
							role = AuthServerConfiguration.DefaultRole;
						}

						var acctCreateQuery = QueryFactory.CreateResultQuery(
							() => AccountMgr.Instance.CreateAccount(
							          client.CurrentUser,
							          client.Authenticator.SRP.Credentials.GetBytes(20),
							          null,
							          role,
							          ClientId.Wotlk
							          ),
							AutocreateAccountCallback,
							client
							);

						client.Server.EnqueueTask(acctCreateQuery);
					}
					else
					{
						// The following was sent twice
						var authInfo = new AuthenticationInfo {
							SessionKey = client.Authenticator.SRP.SessionKey.GetBytes(40),
							Salt = client.Authenticator.SRP.Salt.GetBytes(32),
							Verifier = client.Authenticator.SRP.Verifier.GetBytes(),
							SystemInformation = ClientInformation.Serialize(client.ClientInfo)
						};

						client.Server.StoreAuthenticationInfo(client.CurrentUser, authInfo);

						SendAuthProofSuccessReply(client);
					}
				}
				else
				{
					s_log.Debug(Resources.InvalidClientProof, client.CurrentUser);

					OnLoginError(client, AccountStatus.InvalidInformation);
				}
			}
		}
Ejemplo n.º 14
0
		public static void AuthChallengeRequest(IAuthClient client, AuthPacketIn packet)
		{
			packet.SkipBytes(6); // Skip game name and packet size

			client.ClientInfo = ClientInformation.ReadFromPacket(packet);

			if (!WCellInfo.RequiredVersion.IsSupported(client.ClientInfo.Version))
			{
				OnLoginError(client, AccountStatus.WrongBuild);
			}
			else
			{
				string accName = packet.ReadPascalString();

				s_log.Debug(Resources.AccountChallenge, accName);

				client.CurrentUser = accName;

				var banQuery = QueryFactory.CreateResultQuery
					(
				    () => Ban.GetBan(client.ClientAddress),
					AuthChallengeRequestCallback,
					client
					);

				client.Server.EnqueueTask(banQuery);
			}
		}