private static void AuthChallengeRequestCallback(IAuthClient client, Ban clientBan) { if (clientBan != null) { if (clientBan.IPMinimum != 0 && clientBan.IPMaximum != 0) { if (clientBan.Expires <= DateTime.Now) { // remove the ban since it's expired client.Server.EnqueueTask(QueryFactory.CreateNonResultQuery(clientBan.DeleteAndFlush)); } else { OnLoginError(client, AccountStatus.Failure); return; } } } if (client.Server.IsAccountLoggedIn(client.CurrentUser)) { OnLoginError(client, AccountStatus.AccountInUse); } else { var acctQuery = QueryFactory.CreateResultQuery( () => AccountMgr.GetAccount(client.CurrentUser), QueryAccountCallback, client ); client.Server.EnqueueTask(acctQuery); } }
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); } }
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); } } }