View Single Post
Author Message
showdax
Senior Member
Join Date: Dec 2004
Old 12-17-2005 , 12:55   STEAM_ID_PENDING Kicker
Reply With Quote #1

I quickly made this plugin to handle the apparent new exploit that allows players to join and stay on a server with a pending steamid. A pending steamid means that the server hasn't finished validating the player's steamid. The exploit takes advantage of this and their steamid never validates. This can make banning them more annoying and any scripts that ban solely by steamid will be confused by them.

The plugin works around this by kicking clients that go active (spawn) with a pending steamid. 99.9% of the time a player's steamid will be validated before they spawn.

Here's the only interesting bit of code from the plugin:
Code:
void CServerPluginPending_ClientActive(edict_t *entity, bool bLoadGame)
{
        if (!entity)
                RETURN_META(MRES_IGNORED);

        int userid = g_Engine->GetPlayerUserId(entity);
        if (userid < 1)
                RETURN_META(MRES_IGNORED);

        const char *steamid = g_Engine->GetPlayerNetworkIDString(entity);
        if (!steamid || !Q_stristr(steamid, "PENDING"))
                RETURN_META(MRES_IGNORED);

        /* "kickid " = 7, kick message = 40, \0 = 1, + 1 for int length thing */
        int length = ((int) log10((float) userid)) + 49;
        char *command = (char *) malloc(length);
        Q_snprintf(command, length, "kickid %d Network ID didn't validate. Reconnect.\n", userid);
        g_Engine->ServerCommand(command);
        free(command);

        RETURN_META(MRES_HANDLED);
}
Oh, and it's for SourceMM, of course. Linux binary, Windows binary and source code are in the attached archive. Everything is public domain. The Linux binary does not require libstdc++ whatsoever. Just shove the file in mod/addons/ and run "meta load addons/pending_mm".
Attached Files
File Type: zip pending_mm.zip (33.7 KB, 2955 views)
showdax is offline
Send a message via MSN to showdax