Bläddra i källkod

Signed-off-by: Russ Whitehead <william.whitehead@lexisnexis.com>

Russ Whitehead 9 år sedan
förälder
incheckning
68b191f768
1 ändrade filer med 23 tillägg och 26 borttagningar
  1. 23 26
      system/security/LdapSecurity/ldapconnection.cpp

+ 23 - 26
system/security/LdapSecurity/ldapconnection.cpp

@@ -1118,42 +1118,39 @@ public:
         //m_defaultWorkunitScopePermission = -2;
     }
 
+    static CriticalSection  lcCrit;
     virtual void init(IPermissionProcessor* pp)
     {
         m_pp = pp;
-        static CriticalSection  lcCrit;
         static bool createdOU = false;
+        CriticalBlock block(lcCrit);
         if (!createdOU)
         {
-            CriticalBlock block(lcCrit);
-            if (!createdOU)
+            if(m_ldapconfig->getServerType() == OPEN_LDAP)
             {
-                if(m_ldapconfig->getServerType() == OPEN_LDAP)
+                try
+                {
+                    addDC(m_ldapconfig->getBasedn());
+                }
+                catch(...)
+                {
+                }
+                try
+                {
+                    addGroup("Directory Administrators", m_ldapconfig->getBasedn());
+                }
+                catch(...)
                 {
-                    try
-                    {
-                        addDC(m_ldapconfig->getBasedn());
-                    }
-                    catch(...)
-                    {
-                    }
-                    try
-                    {
-                        addGroup("Directory Administrators", m_ldapconfig->getBasedn());
-                    }
-                    catch(...)
-                    {
-                    }
                 }
-                createLdapBasedn(NULL, m_ldapconfig->getResourceBasedn(RT_DEFAULT), PT_ADMINISTRATORS_ONLY);
-                createLdapBasedn(NULL, m_ldapconfig->getResourceBasedn(RT_FILE_SCOPE), PT_ADMINISTRATORS_ONLY);
-                createLdapBasedn(NULL, m_ldapconfig->getResourceBasedn(RT_WORKUNIT_SCOPE), PT_ADMINISTRATORS_ONLY);
-                createLdapBasedn(NULL, m_ldapconfig->getResourceBasedn(RT_SUDOERS), PT_ADMINISTRATORS_ONLY);
-
-                createLdapBasedn(NULL, m_ldapconfig->getUserBasedn(), PT_ADMINISTRATORS_ONLY);
-                createLdapBasedn(NULL, m_ldapconfig->getGroupBasedn(), PT_ADMINISTRATORS_ONLY);
-                createdOU = true;
             }
+            createLdapBasedn(NULL, m_ldapconfig->getResourceBasedn(RT_DEFAULT), PT_ADMINISTRATORS_ONLY);
+            createLdapBasedn(NULL, m_ldapconfig->getResourceBasedn(RT_FILE_SCOPE), PT_ADMINISTRATORS_ONLY);
+            createLdapBasedn(NULL, m_ldapconfig->getResourceBasedn(RT_WORKUNIT_SCOPE), PT_ADMINISTRATORS_ONLY);
+            createLdapBasedn(NULL, m_ldapconfig->getResourceBasedn(RT_SUDOERS), PT_ADMINISTRATORS_ONLY);
+
+            createLdapBasedn(NULL, m_ldapconfig->getUserBasedn(), PT_ADMINISTRATORS_ONLY);
+            createLdapBasedn(NULL, m_ldapconfig->getGroupBasedn(), PT_ADMINISTRATORS_ONLY);
+            createdOU = true;
         }
     }