Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java RI failing DCDTv3 discovery testcase: D16 - Certificate discovery in LDAP based on SRV weight value #243

Open
GoogleCodeExporter opened this issue Jun 22, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

The following issue concerns class 
org.nhindirect.stagent.cert.impl.LdapPublicCertUtilImpl

The Java RI is failing DCDTv3 discovery testcase: D16 - Certificate discovery 
in LDAP based on SRV weight value

Existing code used to order the SRV records

protected static class SRVRecordComparitor implements Comparator<Record>
{
        @Override
        public int compare(Record rec1, Record rec2)
        {
                if (((SRVRecord)rec1).getPriority() == ((SRVRecord)rec2).getPriority())
                        return 0;

                return (((SRVRecord)rec1).getPriority() < ((SRVRecord)rec2).getPriority()) ? -1 : 1;
        }
}

While the respective RFC (http://www.ietf.org/rfc/rfc2782.txt) only 
advises/suggests this ordering the DCDTv3 test tool requires this ordering to 
be in place.

Seeing the fix applied to the .Net RI - Revision 4d5d80baf299: "Fixing Priority 
versus Weight ordering bug" and reading http://en.wikipedia.org/wiki/SRV_record 
I think the code should instead look as follows, initial tests of the following 
code are positive

protected static class SRVRecordComparitor implements Comparator<Record>
{
        @Override
        public int compare(Record rec1, Record rec2)
        {
                SRVRecord srv1 = (SRVRecord)rec1;
                SRVRecord srv2 = (SRVRecord)rec2;

                if (srv1.getPriority() == srv2.getPriority() && srv1.getWeight() == srv2.getWeight())
                        return 0;

                return (srv1.getPriority() < srv2.getPriority()) ? -1 : (srv1.getPriority() > srv2.getPriority()) ? 1 : (srv1.getWeight() < srv2.getWeight()) ? 1 : -1;
        }
}

Original issue reported on code.google.com by [email protected] on 23 Jul 2014 at 9:38

@GoogleCodeExporter
Copy link
Author

I was made aware of this issue as soon as the new version of the discovery tool 
came out.  I made a fix for it a few weeks ago, and have not checked it in yet. 
 I will get a fix version of the agent out ASAP.

Original comment by [email protected] on 23 Jul 2014 at 11:08

@GoogleCodeExporter
Copy link
Author

Thanks for the prompt reply Greg

Original comment by [email protected] on 24 Jul 2014 at 3:42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant