Uploaded image for project: 'Directory ApacheDS'
  1. Directory ApacheDS
  2. DIRSERVER-1093

the ResourceRecordEncoder and QuestionRecordEncoder have bug for empty domainName:(

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.5.1
    • 2.0.0-M7
    • dns
    • None
    • Windows XP , apacheds-protocol-dns-1.5.1.jar

    Description

      When I use dig trace for Test the apache dns server. the QuestionRecord and ResourceRecord not encoded right for the empty Domain Name.

      my Test command is:

      E:\bind>dig @10.108.20.126 618119.com +trace

      Then found this bug is caeused by the method "encodeDomainName" in QuestionRecordEncoder.java and "putDomainName" in ResourceRecordEncoder.java.

      follow code can be test to get "labels.length == 1";

      [code]
      String s = "";
      String[] labels = new String[0];
      labels = s.split("
      .");
      System.out.println("labels.length == " + labels.length);
      [/code]

      so i fix this bug by follow change :

      [code]
      String[] labels = domainName.split( "
      ." );
      [/code]

      change to:

      [code]
      String[] labels = new String[0];
      if (domainName != null && domainName.length() > 0)

      { labels = domainName.split("\\."); }

      [/code]

      Please fix the bug

      Attachments

        1. testcommand.jpg
          86 kB
          lizongbo
        2. error4trace.jpg
          182 kB
          lizongbo
        3. correct4trace.jpg
          173 kB
          lizongbo

        Activity

          People

            enriquer9 Enrique Rodriguez
            lizongbo lizongbo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: