Prevented blank/empty admins from being created. (Bug 3431 r=dvander)
Prevented blank/empty admins from being created. (
Bug 3431 r=dvander)
1.1 --- a/core/AdminCache.cpp Sun Dec 28 19:59:40 2008 -0500
1.2 +++ b/core/AdminCache.cpp Sun Dec 28 23:45:18 2008 -0500
1.3 @@ -1170,6 +1170,11 @@
1.4
1.5 bool AdminCache::BindAdminIdentity(AdminId id, const char *auth, const char *ident)
1.6 {
1.7 + if (ident == NULL || ident[0] == '\0')
1.8 + {
1.9 + return false;
1.10 + }
1.11 +
1.12 AdminUser *pUser = (AdminUser *)m_pMemory->GetAddress(id);
1.13 if (!pUser || pUser->magic != USR_MAGIC_SET)
1.14 {
2.1 --- a/plugins/admin-flatfile/admin-simple.sp Sun Dec 28 19:59:40 2008 -0500
2.2 +++ b/plugins/admin-flatfile/admin-simple.sp Sun Dec 28 23:45:18 2008 -0500
2.3 @@ -216,7 +216,8 @@
2.4 if (!BindAdminIdentity(admin, auth_method, auth[auth_offset]))
2.5 {
2.6 /* We should never reach here */
2.7 - ParseError("Failed to bind identity %s (method %s)", auth[auth_offset], auth_method);
2.8 + RemoveAdmin(admin);
2.9 + ParseError("Failed to bind identity %s (method %s)", auth[auth_offset], auth_method);
2.10 }
2.11 }
2.12 }
3.1 --- a/plugins/admin-flatfile/admin-users.sp Sun Dec 28 19:59:40 2008 -0500
3.2 +++ b/plugins/admin-flatfile/admin-users.sp Sun Dec 28 23:45:18 2008 -0500
3.3 @@ -162,7 +162,9 @@
3.4 id = CreateAdmin(g_CurName);
3.5 if (!BindAdminIdentity(id, g_CurAuth, g_CurIdent))
3.6 {
3.7 + RemoveAdmin(id);
3.8 ParseError("Failed to bind auth \"%s\" to identity \"%s\"", g_CurAuth, g_CurIdent);
3.9 + return SMCParse_Continue;
3.10 }
3.11 }
3.12