r5213 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Dec 14 11:11:36 EST 2008


Author: div0
Date: 2008-12-14 11:11:35 -0500 (Sun, 14 Dec 2008)
New Revision: 5213

Modified:
   trunk/data/qcsrc/server/ipban.qc
Log:
fix ban enforcing


Modified: trunk/data/qcsrc/server/ipban.qc
===================================================================
--- trunk/data/qcsrc/server/ipban.qc	2008-12-14 15:23:46 UTC (rev 5212)
+++ trunk/data/qcsrc/server/ipban.qc	2008-12-14 16:11:35 UTC (rev 5213)
@@ -333,26 +333,6 @@
 	entity e;
 	string s;
 
-	// Enforce our new ban
-	s = "";
-	FOR_EACH_REALCLIENT(e)
-		if(Ban_IsClientBanned(e, i))
-		{
-			if(s == "")
-				reason = strcat(reason, ": affects ");
-			else
-				reason = strcat(reason, ", ");
-			reason = strcat(reason, e.netname);
-			s = strcat(s, "^1NOTE:^7 banned client ", e.netname, "^7 has to go\n");
-			dropclient(e);
-		}
-	bprint(s);
-
-	if(dosync)
-		if(reason != "")
-			if(substring(reason, 0, 1) != "~") // like IRC: unauthenticated banner
-				OnlineBanList_SendBan(ip, bantime, reason);
-
 	// already banned?
 	for(i = 0; i < ban_count; ++i)
 		if(ban_ip[i] == ip)
@@ -363,7 +343,13 @@
 				ban_expire[i] = time + bantime;
 				print(ip, "'s ban has been prolonged to ", ftos(bantime), " seconds from now\n");
 			}
+
 			// and abort
+			if(dosync)
+				if(reason != "")
+					if(substring(reason, 0, 1) != "~") // like IRC: unauthenticated banner
+						OnlineBanList_SendBan(ip, bantime, reason);
+
 			return FALSE;
 		}
 	// do we have a free slot?
@@ -397,6 +383,27 @@
 
 	Ban_SaveBans();
 
+	// Enforce our new ban
+	s = "";
+	FOR_EACH_REALCLIENT(e)
+		if(Ban_IsClientBanned(e, i))
+		{
+			if(s == "")
+				reason = strcat(reason, ": affects ");
+			else
+				reason = strcat(reason, ", ");
+			reason = strcat(reason, e.netname);
+			s = strcat(s, "^1NOTE:^7 banned client ", e.netname, "^7 has to go\n");
+			dropclient(e);
+		}
+	bprint(s);
+
+	// and abort
+	if(dosync)
+		if(reason != "")
+			if(substring(reason, 0, 1) != "~") // like IRC: unauthenticated banner
+				OnlineBanList_SendBan(ip, bantime, reason);
+
 	return TRUE;
 }
 




More information about the nexuiz-commits mailing list