Prevented blank/empty admins from being created. (Bug 3431 r=dvander)

This commit is contained in:
Liam 2008-12-28 23:45:18 -05:00
parent 1577fab93a
commit 7705e88b57
3 changed files with 9 additions and 1 deletions

View File

@ -1170,6 +1170,11 @@ bool AdminCache::GetMethodIndex(const char *name, unsigned int *_index)
bool AdminCache::BindAdminIdentity(AdminId id, const char *auth, const char *ident)
{
if (ident == NULL || ident[0] == '\0')
{
return false;
}
AdminUser *pUser = (AdminUser *)m_pMemory->GetAddress(id);
if (!pUser || pUser->magic != USR_MAGIC_SET)
{

View File

@ -216,7 +216,8 @@ ReadAdminLine(const String:line[])
if (!BindAdminIdentity(admin, auth_method, auth[auth_offset]))
{
/* We should never reach here */
ParseError("Failed to bind identity %s (method %s)", auth[auth_offset], auth_method);
RemoveAdmin(admin);
ParseError("Failed to bind identity %s (method %s)", auth[auth_offset], auth_method);
}
}
}

View File

@ -162,7 +162,9 @@ public SMCResult:ReadUsers_EndSection(Handle:smc)
id = CreateAdmin(g_CurName);
if (!BindAdminIdentity(id, g_CurAuth, g_CurIdent))
{
RemoveAdmin(id);
ParseError("Failed to bind auth \"%s\" to identity \"%s\"", g_CurAuth, g_CurIdent);
return SMCParse_Continue;
}
}