Hey,

In case the namingContexts field contains more than one naming context, we have 
no way of knowing which one is the required one.
We take the first one. In active directory, for example (and as far as I 
understand in the newest free-ipa) you have a defaultNamingContext field, and 
if so we take it, and it contains only one naming context. 

As you see in the code below, we have a "special" treatment for RHDS, as it 
always contains "o=netscaperoot" in the namingContexts field (not necessary at 
the beginning of the list), so we filter it out.

It was enough for now, but I agree that if adding new LDAP providers, which 
usually have a more complex and unpredictable data in the namingContext field, 
then we would probably need to ask the user to specify the naming context for 
us, and if he didn't specify it then assume it is identical to the domain name.

Oved

----- Original Message -----
> From: "Sharad Mishra" <snmis...@linux.vnet.ibm.com>
> To: engine-devel@ovirt.org
> Sent: Saturday, April 28, 2012 2:51:25 AM
> Subject: [Engine-devel] namingcontexts getting ignored.
> 
> 
> Hi,
> 
>     I enter "getDefaultNamingContextFromNamingContexts()" with
> namingContexts set to -
> 
> namingcontexts: CN=SCHEMA, CN=LOCALHOST, CN=IBMPOLICIES, O=IBM.COM,
> O=DELETED.IBM.COM
> 
>     But this method only takes the first case "CN=SCHEMA" and ignores
> the rest. Actually I am interested in "O=IBM.COM".
>     Is this working as designed or needs improvement?
> 
> -Sharad Mishra
> IBM
> 
> public class RootDSEData {
>      private String domainDN = null;
>      private LdapProviderType ldapProviderType = null;
>      private final static String RHDS_NAMING_CONTEXT =
>      "o=netscaperoot";
> 
>      public static String
> getDefaultNamingContextFromNamingContexts(Attribute namingContexts) {
>          for (int index = 0; index < namingContexts.size(); ++index)
>          {
>              String namingContext;
>              try {
>                  namingContext = (String) namingContexts.get(index);
>              } catch (NamingException e) {
>                  return null;
>              }
>              if
>              (!RHDS_NAMING_CONTEXT.equalsIgnoreCase(namingContext))
>              {
>                  return namingContext;
>              }
>          }
>          return null;
>      }
> 
> _______________________________________________
> Engine-devel mailing list
> Engine-devel@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/engine-devel
> 
_______________________________________________
Engine-devel mailing list
Engine-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-devel

Reply via email to