Prevented blank/empty admins from being created. (Bug 3431 r=dvander)
This commit is contained in:
parent
1577fab93a
commit
7705e88b57
@ -1170,6 +1170,11 @@ bool AdminCache::GetMethodIndex(const char *name, unsigned int *_index)
|
|||||||
|
|
||||||
bool AdminCache::BindAdminIdentity(AdminId id, const char *auth, const char *ident)
|
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);
|
AdminUser *pUser = (AdminUser *)m_pMemory->GetAddress(id);
|
||||||
if (!pUser || pUser->magic != USR_MAGIC_SET)
|
if (!pUser || pUser->magic != USR_MAGIC_SET)
|
||||||
{
|
{
|
||||||
|
@ -216,7 +216,8 @@ ReadAdminLine(const String:line[])
|
|||||||
if (!BindAdminIdentity(admin, auth_method, auth[auth_offset]))
|
if (!BindAdminIdentity(admin, auth_method, auth[auth_offset]))
|
||||||
{
|
{
|
||||||
/* We should never reach here */
|
/* 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,9 @@ public SMCResult:ReadUsers_EndSection(Handle:smc)
|
|||||||
id = CreateAdmin(g_CurName);
|
id = CreateAdmin(g_CurName);
|
||||||
if (!BindAdminIdentity(id, g_CurAuth, g_CurIdent))
|
if (!BindAdminIdentity(id, g_CurAuth, g_CurIdent))
|
||||||
{
|
{
|
||||||
|
RemoveAdmin(id);
|
||||||
ParseError("Failed to bind auth \"%s\" to identity \"%s\"", g_CurAuth, g_CurIdent);
|
ParseError("Failed to bind auth \"%s\" to identity \"%s\"", g_CurAuth, g_CurIdent);
|
||||||
|
return SMCParse_Continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user