From: Maxim Mamontov <faust.madf@gmail.com>
Date: Mon, 12 Sep 2011 08:10:25 +0000 (+0300)
Subject: Check IP in USERS_IMPL::Authorize as early as possible
X-Git-Tag: 2.408-rc1~87
X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/e470c81abda3653a5ef2e3cff7b610aa823fe9b4

Check IP in USERS_IMPL::Authorize as early as possible
---

diff --git a/projects/stargazer/users_impl.cpp b/projects/stargazer/users_impl.cpp
index 7b110431..6b87b5a9 100644
--- a/projects/stargazer/users_impl.cpp
+++ b/projects/stargazer/users_impl.cpp
@@ -280,9 +280,6 @@ if (FindByNameNonLock(login, &iter))
     return false;
     }
 
-if (iter->Authorize(ip, enabledDirs, auth))
-    return false;
-
 if (FindByIPIdx(ip, iter))
     {
     if (iter->GetLogin() != login)
@@ -292,9 +289,14 @@ if (FindByIPIdx(ip, iter))
                      iter->GetLogin().c_str());
         return false;
         }
+    if (iter->Authorize(ip, enabledDirs, auth))
+        return false;
     return true;
     }
 
+if (iter->Authorize(ip, enabledDirs, auth))
+    return false;
+
 AddToIPIdx(iter);
 return true;
 }