From c31d31f5c47ef43302928b58276602d49e75cafb Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Sun, 19 Aug 2012 16:46:22 -0400 Subject: [PATCH] Dupe IP fix --- mystic/HISTORY.txt | 8 +++++--- mystic/mis_server.pas | 15 +++++---------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/mystic/HISTORY.txt b/mystic/HISTORY.txt index 3fb0579..4c208c2 100644 --- a/mystic/HISTORY.txt +++ b/mystic/HISTORY.txt @@ -4685,6 +4685,8 @@ an Amiga, for example). Mystic will now properly internally view LHA extensions, as well as properly look for LHA in the archive configuration. - ! Fixed a bug when viewing an archive that is not supported with the - internal view that could cause the lightbar file list display to get - messed up. + ! Fixed a bug when viewing an archive that could cause the lightbar file + list display to not get redrawn after. + + ! Duplicate IP check in MIS was not working properly. It is now. + diff --git a/mystic/mis_server.pas b/mystic/mis_server.pas index 7287fe2..43bc0a9 100644 --- a/mystic/mis_server.pas +++ b/mystic/mis_server.pas @@ -137,6 +137,7 @@ Begin If IoResult = 0 Then Begin While Not Eof(TF) Do Begin ReadLn (TF, Str); + If CheckIP (Client.PeerIP, Str) Then Begin Result := True; Break; @@ -152,19 +153,10 @@ Var Count : Byte; Begin Result := 0; -(* - For Count := 0 to ClientMax - 1 Do - If ClientList[Count] <> NIL Then // use Assigned? - If Client.PeerIP = TIOSocket(ClientList[Count]).PeerIP Then - Inc(Result);*) For Count := 0 to ClientMax - 1 Do If Assigned(ClientList[Count]) Then Begin -// writeln('client ip:', client.peerip); -// writeln('comp ip :', TIOSocket(clientlist[count]).fpeerip); -// waitms(3000); - - If Client.PeerIP = TIOSocket(ClientList[Count]).PeerIP Then + If Client.PeerIP = TServerClient(ClientList[Count]).Client.FPeerIP Then Inc(Result); End; End; @@ -227,18 +219,21 @@ Begin Inc (ClientRefused); Status ('BUSY: ' + NewClient.PeerIP + ' (' + NewClient.PeerName + ')'); If Not NewClient.WriteFile(TextPath + 'busy.txt') Then NewClient.WriteLine('BUSY'); + WaitMS(3000); NewClient.Free; End Else If IsBlockedIP(NewClient) Then Begin Inc (ClientBlocked); Status('BLOCK: ' + NewClient.PeerIP + ' (' + NewClient.PeerName + ')'); If Not NewClient.WriteFile(TextPath + 'blocked.txt') Then NewClient.WriteLine('BLOCKED'); + WaitMS(3000); NewClient.Free; End Else If (ClientMaxIPs > 0) and (DuplicateIPs(NewClient) >= ClientMaxIPs) Then Begin Inc (ClientRefused); Status('MULTI: ' + NewClient.PeerIP + ' (' + NewClient.PeerName + ')'); If Not NewClient.WriteFile(TextPath + 'dupeip.txt') Then NewClient.WriteLine('Only ' + strI2S(ClientMaxIPs) + ' connection(s) per user'); + WaitMS(3000); NewClient.Free; End Else Begin Inc (ClientTotal);