directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shawn McKinney (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FC-165) [ fortress-core ] getRootDn bug with tenant context
Date Sat, 02 Apr 2016 13:37:25 GMT
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)

Mime
View raw message