Jelajahi Sumber

HPCC-15382 LDAPSecMgr sometimes creates conflicting LDAP entries

Each instance of the LDAP security manager attempts to create the OU
structure found in the ESP configuration file.  There are collisions that
end up causing LDAP to create conflict entries by appending a GUID
to the end of the OU name
  U=eclwatch_mdm\0ACNF:4ec443c6-4041-4374-b085-c1111c99c0f8
This PR ensures that only one instance of the sec mgr creates these entries

Signed-off-by: Russ Whitehead <william.whitehead@lexisnexis.com>
Russ Whitehead 9 tahun lalu
induk
melakukan
917df0e28e
1 mengubah file dengan 10 tambahan dan 0 penghapusan
  1. 10 0
      system/security/LdapSecurity/ldapconnection.cpp

+ 10 - 0
system/security/LdapSecurity/ldapconnection.cpp

@@ -1121,6 +1121,13 @@ public:
     virtual void init(IPermissionProcessor* pp)
     {
         m_pp = pp;
+        static CriticalSection  lcCrit;
+        static bool createdOU = false;
+        if (!createdOU)
+        {
+            CriticalBlock block(lcCrit);
+            if (!createdOU)
+            {
         if(m_ldapconfig->getServerType() == OPEN_LDAP)
         {
             try
@@ -1145,6 +1152,9 @@ public:
 
         createLdapBasedn(NULL, m_ldapconfig->getUserBasedn(), PT_ADMINISTRATORS_ONLY);
         createLdapBasedn(NULL, m_ldapconfig->getGroupBasedn(), PT_ADMINISTRATORS_ONLY);
+                createdOU = true;
+            }
+        }
     }
 
     virtual LdapServerType getServerType()