You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2004/12/05 04:19:46 UTC

svn commit: r109847 - /incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java

Author: akarasulu
Date: Sat Dec  4 19:19:44 2004
New Revision: 109847

URL: http://svn.apache.org/viewcvs?view=rev&rev=109847
Log:
Changes ...

Found bug where we forgot to filter the values of the Root DSE entry.  This
was causing several clients to fail when accessing the Root DSE for specific
entries.

If we find that we need to do this regularly such as with subschemaSubentries
then we might as well centralize the code for filtering singleton entries 
before returning them.


Modified:
   incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java

Modified: incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java
Url: http://svn.apache.org/viewcvs/incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java?view=diff&rev=109847&p1=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java&r1=109846&p2=incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java&r2=109847
==============================================================================
--- incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java	(original)
+++ incubator/directory/eve/trunk/jndi-provider/src/java/org/apache/eve/RootNexus.java	Sat Dec  4 19:19:44 2004
@@ -88,8 +88,12 @@
 
         // setup that root DSE
         this.rootDSE = rootDSE;
-        Attribute attr = new LockableAttributeImpl( NAMINGCTXS_ATTR );
-        attr.add( "" );
+        Attribute attr = new LockableAttributeImpl( "subschemaSubentry" );
+        attr.add( "cn=schema,ou=system" );
+        rootDSE.put( attr );
+
+        attr = new LockableAttributeImpl( NAMINGCTXS_ATTR );
+        attr.add( SystemPartition.SUFFIX );
         rootDSE.put( attr );
 
         attr = new LockableAttributeImpl( VENDORNAME_ATTR );
@@ -279,7 +283,34 @@
                  searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE &&
                  ( ( PresenceNode ) filter ).getAttribute().equalsIgnoreCase( "objectclass" ) )
             {
-                Attributes attrs = getRootDSE();
+                Attributes attrs = ( Attributes ) getRootDSE().clone();
+
+                String[] ids = searchCtls.getReturningAttributes();
+                if ( ids != null && ids.length > 0 )
+                {
+                    boolean doSwap = true;
+                    Attributes askedFor = new LockableAttributesImpl();
+
+                    for ( int ii = 0; ii < ids.length; ii++ )
+                    {
+                        if ( ids[ii].trim().equals( "*" ) )
+                        {
+                            doSwap = false;
+                            break;
+                        }
+
+                        if ( attrs.get( ids[ii] ) != null )
+                        {
+                            askedFor.put( attrs.get( ids[ii] ) );
+                        }
+                    }
+
+                    if ( doSwap )
+                    {
+                        attrs = askedFor;
+                    }
+                }
+
                 SearchResult result = new SearchResult( "", null, attrs, false );
                 return new SingletonEnumeration( result );
             }