Bug 3240 - Banning and lan mode
Banning and lan mode
Status: UNCONFIRMED
Product: AMX Mod X
Classification: Unclassified
Component: Core
trunk
PC All
: P4 major
Assigned To: amxmodx-bugs@alliedmods.net
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-24 21:30 PDT by GoD2.0
Modified: 2008-08-24 21:30 PDT (History)
3 users (show)

See Also:


Attachments

Description GoD2.0 2008-08-24 21:30:31 PDT
There are a few bugs regarding banning and lan mode.

One should not be allowed to use amx_ban when server is with sv_lan 1, because it ends up banning STEAM_ID_LAN and all get banned. Sugestion is to add the following to cmdBan, to make it ban by IP:


	if( get_cvar_num("sv_lan") != 0 )
	{
		cmdBanIP(id, level, cid)
		
		return PLUGIN_HANDLED
	}


There are also some checks in admincmd.sma for banning STEAM_ID_LAN in function cmdAddBan that don't always work corectly:

amx_addban STEAM_ID_LAN 0
Cannot ban STEAM_ID_LAN
amx_addban "STEAM_ID_LAN " 0
[AMXX] Authid "STEAM_ID_LAN " added to ban list

And STEAM_ID_LAN gets banned again.
Sugestion is to replace equali(arg, "STEAM_ID_LAN") with containi(arg, "STEAM_ID_LAN") >= 0

Also, some checks should be made even if user has RCON (example now allowing to ban STEAM_ID_LAN or 0.0.0.0)

Another problem would be if amx_addban. If you use it in conjuction with amx_last and by mistake enter the user's name and you have RCON access, STEAM_ID_LAN or 0.0.0.0 get's banned. The problem is the following

if (contain(arg, ".") != -1)
{
			isip = true;
}

The test if a string is an IP address should be taken more serios, by checking if it has 4 numbers below 255 separated by three dots. Although not perfect, I could be replaced with the following:

	new bool:isip = false;

	new bool:done = false;
	new left[5];
	new right[30];
	new times=0;

	copy(right, 30, arg);
	do{
		strtok(right, left, 5, right, 25, '.')

		if(!is_str_num(left))
		{
			done=true
		}
		else
		{
			new val = str_to_num(left)
			if( val > 255 || val < 0) 
				done=true
			else
				times=times+1
		}
		if(times==4)
		{
			done=true
			isip=true
		}
	}while(!done);
	if(strlen(right) > 0)
		isip=false

Note You need to log in before you can comment on or make changes to this bug.