public override void Process(CmdTrigger <AuthServerCmdArgs> trigger) { var mask = trigger.Text.NextWord(); var bytes = BanMgr.GetBytes(mask); if (BanMgr.IsInvalid(bytes)) { trigger.Reply("Invalid Mask: " + mask); return; } var bans = BanMgr.GetBanList(mask); if (bans.Count > 0) { foreach (var ban in bans) { ban.DeleteAndFlush(); } trigger.Reply("Deleted {0} matching Ban(s): " + bans.ToString(", "), bans.Count); } else { trigger.Reply("No BanEntries found matching Mask: " + mask); } }
public override void Process(CmdTrigger <AuthServerCmdArgs> trigger) { var mask = trigger.Text.NextWord(); ICollection <BanEntry> bans; if (mask.Length > 0) { bans = BanMgr.GetBanList(mask); } else { bans = BanMgr.AllBans; } trigger.Reply("Found {0} {1}{2}", bans.Count, bans.Count == 1 ? "Entry" : "Entries", bans.Count > 0 ? ":" : "."); var i = 0; foreach (var ban in bans) { i++; trigger.Reply("{0}. {1}", i, ban); } }
/// <summary> /// Check for bans and already logged in Accounts, else continue the journey /// </summary> /// <param name="client"></param> private static void AuthChallengeRequestCallback(IAuthClient client) { if (!client.IsConnected) { // Client disconnected in the meantime return; } if (BanMgr.IsBanned(client.ClientAddress)) { OnLoginError(client, AccountStatus.AccountBanned); } //else if (client.Server.IsAccountLoggedIn(client.AccountName)) //{ // OnLoginError(client, AccountStatus.AccountInUse); //} else { var acctQuery = new Action(() => { var acc = AccountMgr.GetAccount(client.AccountName); QueryAccountCallback(client, acc); }); AuthenticationServer.IOQueue.AddMessage(acctQuery); } }
private static void AuthChallengeRequestCallback(IRealmClient client) { if (!client.IsConnected) { // Client disconnected in the meantime return; } if (BanMgr.IsBanned(client.ClientAddress)) { OnLoginError(client, AccountStatus.CloseClient); } else { var acctQuery = new Action(() => { var acc = AccountMgr.GetAccount(client.AccountName); //if(acc != null && DateTime.Now - acc.LastLogin < new TimeSpan(0,0,0,30)) // return; if (acc == null) { if (RealmServerConfiguration.AutocreateAccounts) { QueryAccountCallback(client, null); } else { OnLoginError(client, AccountStatus.WrongLoginOrPass); } } else { if (acc.Password != client.Password) { if (client.ClientAddress != null) { Log.Create(Log.Types.AccountOperations, LogSourceType.Account, (uint)acc.AccountId) .AddAttribute("operation", 1, "login_wrong_pass") .AddAttribute("name", 0, acc.Name) .AddAttribute("ip", 0, client.ClientAddress.ToString()) .Write(); } OnLoginError(client, AccountStatus.WrongLoginOrPass); } else { QueryAccountCallback(client, acc); } } }); RealmServer.IOQueue.AddMessage(acctQuery); } }
public override void Process(CmdTrigger <AuthServerCmdArgs> trigger) { var mask = trigger.Text.NextWord(); var bytes = BanMgr.GetBytes(mask); if (BanMgr.IsInvalid(bytes)) { trigger.Reply("Invalid Mask: " + mask); return; } var time = trigger.Text.NextTimeSpan(); var reason = trigger.Text.Remainder; var ban = BanMgr.AddBan(time, mask, reason); trigger.Reply("Added new Ban: " + ban); }
private static void AuthChallengeRequestCallback(IRealmClient client) { if (!client.IsConnected) { return; } if (BanMgr.IsBanned(client.ClientAddress)) { AuthenticationHandler.OnLoginError(client, AccountStatus.CloseClient); } else { ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() => { Account account = AccountMgr.GetAccount(client.AccountName); if (account == null) { if (RealmServerConfiguration.AutocreateAccounts) { AuthenticationHandler.QueryAccountCallback(client, (Account)null); } else { AuthenticationHandler.OnLoginError(client, AccountStatus.WrongLoginOrPass); } } else if (account.Password != client.Password) { if (client.ClientAddress != null) { Log.Create(Log.Types.AccountOperations, LogSourceType.Account, (uint)account.AccountId) .AddAttribute("operation", 1.0, "login_wrong_pass") .AddAttribute("name", 0.0, account.Name) .AddAttribute("ip", 0.0, client.ClientAddress.ToString()).Write(); } AuthenticationHandler.OnLoginError(client, AccountStatus.WrongLoginOrPass); } else { AuthenticationHandler.QueryAccountCallback(client, account); } })); } }