You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Shawn McKinney (JIRA)" <ji...@apache.org> on 2016/04/02 15:37:25 UTC

[jira] [Created] (FC-165) [ fortress-core ] getRootDn bug with tenant context

Shawn McKinney created FC-165:
---------------------------------

             Summary: [ fortress-core ] getRootDn bug with tenant context
                 Key: FC-165
                 URL: https://issues.apache.org/jira/browse/FC-165
             Project: FORTRESS
          Issue Type: Bug
    Affects Versions: 1.0.0-RC42
            Reporter: Shawn McKinney
             Fix For: 1.0.0


getRootDn throwing string out of bounds with tenant context.

It's job is to return the dn of the currrent context and container.  For example with a root of 'People', and 'HOME' context:
ou=People,[suffix]

for same under tenant of '123'
ou=123,ou=People,[suffix]

Changed below idx > 0 from indx != -1.  


    protected String getRootDn( String contextId, String root )
    {
        String szDn = Config.getProperty( root );

        // The contextId must not be null, or "HOME" or "null"
        if ( StringUtils.isNotEmpty( contextId ) && !contextId.equalsIgnoreCase( GlobalIds.NULL ) && !contextId
            .equals( GlobalIds.HOME ) )
        {
          int idx = szDn.indexOf( Config.getProperty( GlobalIds.SUFFIX ) );
          if ( idx > 0 )
            {
                // Found. The DN is ,ou=<contextId>,
                StringBuilder dn = new StringBuilder();
                dn.append( szDn.substring( 0, idx - 1 ) ).append( "," ).append( SchemaConstants.OU_AT ).append( "=" )
                    .append(
                        contextId ).append( "," ).append( szDn.substring( idx ) );

                return dn.toString();
            }
            else
            {
                return "";
            }
        }
        else
        {
            return szDn;
        }
    }




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)