Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-9599

Windows workaround for checkdnsrr() returns wrong results

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.7-PL1
    • Fix Version/s: 3.0.8-RC1
    • Component/s: Other
    • Labels:
      None
    • Environment:
      Windows Vista

      Description

      The windows workaround in phpbb_checkdnsrr() performs a nslookup via exec. It then assumes that valid responses begin with the hostname we're looking up. This however doesn't seem to be true when looking up A records.

      C:\Users\afischer>nslookup -type=A phpbb.com.
      Server:  fi-network.fischer.local
      Address:  10.100.0.254
       
      Nicht-autorisierende Antwort:
      Name:    phpbb.com
      Address:  140.211.15.9
      

      C:\Users\afischer>nslookup -type=ANY phpbb.com.
      Server:  fi-network.fischer.local
      Address:  10.100.0.254
       
      Nicht-autorisierende Antwort:
      phpbb.com       internet address = 140.211.15.9
      phpbb.com       nameserver = ns3.auth.osuosl.org
      phpbb.com       nameserver = ns1.auth.osuosl.org
      phpbb.com       nameserver = ns2.auth.osuosl.org
       
      phpbb.com       nameserver = ns2.auth.osuosl.org
      phpbb.com       nameserver = ns1.auth.osuosl.org
      phpbb.com       nameserver = ns3.auth.osuosl.org
      ns1.auth.osuosl.org     internet address = 140.211.166.140
      ns2.auth.osuosl.org     internet address = 140.211.166.141
      ns3.auth.osuosl.org     internet address = 216.165.191.53
      

      C:\Users\afischer>nslookup -type=MX phpbb.com.
      Server:  fi-network.fischer.local
      Address:  10.100.0.254
       
      Nicht-autorisierende Antwort:
      phpbb.com       MX preference = 5, mail exchanger = smtp2.osuosl.org
      phpbb.com       MX preference = 5, mail exchanger = smtp3.osuosl.org
      phpbb.com       MX preference = 5, mail exchanger = smtp4.osuosl.org
      phpbb.com       MX preference = 5, mail exchanger = smtp1.osuosl.org
       
      phpbb.com       nameserver = ns1.auth.osuosl.org
      phpbb.com       nameserver = ns2.auth.osuosl.org
      phpbb.com       nameserver = ns3.auth.osuosl.org
      ns1.auth.osuosl.org     internet address = 140.211.166.140
      ns2.auth.osuosl.org     internet address = 140.211.166.141
      ns3.auth.osuosl.org     internet address = 216.165.191.53
      

      C:\Users\afischer>nslookup -type=AAAA www.fsmi.uni-karlsruhe.de.
      Server:  fi-network.fischer.local
      Address:  10.100.0.254
       
      Nicht-autorisierende Antwort:
      Name:    fsmi-www.fsmi.uni-karlsruhe.de
      Address:  2a00:1398:4000::acff:fe16:3ba2
      Aliases:  www.fsmi.uni-karlsruhe.de
      

      C:\Users\afischer>nslookup -type=NS phpbb.com.
      Server:  fi-network.fischer.local
      Address:  10.100.0.254
       
      Nicht-autorisierende Antwort:
      phpbb.com       nameserver = ns2.auth.osuosl.org
      phpbb.com       nameserver = ns3.auth.osuosl.org
      phpbb.com       nameserver = ns1.auth.osuosl.org
       
      ns1.auth.osuosl.org     internet address = 140.211.166.140
      ns2.auth.osuosl.org     internet address = 140.211.166.141
      ns3.auth.osuosl.org     internet address = 216.165.191.53
      

      C:\Users\afischer>nslookup -type=CNAME phpbb.com.
      Server:  fi-network.fischer.local
      Address:  10.100.0.254
       
      phpbb.com
              primary name server = ns1.auth.osuosl.org
              responsible mail addr = hostmaster.osuosl.org
              serial  = 1273685403
              refresh = 3600 (1 hour)
              retry   = 900 (15 mins)
              expire  = 604800 (7 days)
              default TTL = 86400 (1 day)
      

        Issue Links

          Activity

          Hide
          bantu Andreas Fischer added a comment -

          The windows workaround might also return wrong results for domains without an MX record.

          This is on PHP 5.3 now, where checkdnsrr() exists on Windows.

          var_dump(phpbb_checkdnsrr('example.org', 'MX'));
          bool(true) 
           
          var_dump(checkdnsrr('example.org.', 'MX'));
          bool(false)
          

          C:\Users\afischer>nslookup -type=MX example.org.
          Server:  fi-network.fischer.local
          Address:  10.100.0.254
           
          example.org
                  primary name server = dns1.icann.org
                  responsible mail addr = hostmaster.icann.org
                  serial  = 2009100600
                  refresh = 7200 (2 hours)
                  retry   = 3600 (1 hour)
                  expire  = 1209600 (14 days)
                  default TTL = 86400 (1 day)
          

          afischer@fi-network:~$ dig example.org MX
           
          ; <<>> DiG 9.6.1-P2 <<>> example.org MX
          ;; global options: +cmd
          ;; Got answer:
          ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13656
          ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
           
          ;; QUESTION SECTION:
          ;example.org.                   IN      MX
           
          ;; AUTHORITY SECTION:
          example.org.            10674   IN      SOA     dns1.icann.org. hostmaster.icann.org. 2009100600 7200 3600 1209600 86400
           
          ;; Query time: 0 msec
          ;; SERVER: 10.100.0.254#53(10.100.0.254)
          ;; WHEN: Wed May 12 21:21:05 2010
          ;; MSG SIZE  rcvd: 87
          

          Show
          bantu Andreas Fischer added a comment - The windows workaround might also return wrong results for domains without an MX record. This is on PHP 5.3 now, where checkdnsrr() exists on Windows. var_dump(phpbb_checkdnsrr('example.org', 'MX')); bool(true)   var_dump(checkdnsrr('example.org.', 'MX')); bool(false) C:\Users\afischer>nslookup -type=MX example.org. Server: fi-network.fischer.local Address: 10.100.0.254   example.org primary name server = dns1.icann.org responsible mail addr = hostmaster.icann.org serial = 2009100600 refresh = 7200 (2 hours) retry = 3600 (1 hour) expire = 1209600 (14 days) default TTL = 86400 (1 day) afischer@fi-network:~$ dig example.org MX   ; <<>> DiG 9.6.1-P2 <<>> example.org MX ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13656 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0   ;; QUESTION SECTION: ;example.org. IN MX   ;; AUTHORITY SECTION: example.org. 10674 IN SOA dns1.icann.org. hostmaster.icann.org. 2009100600 7200 3600 1209600 86400   ;; Query time: 0 msec ;; SERVER: 10.100.0.254#53(10.100.0.254) ;; WHEN: Wed May 12 21:21:05 2010 ;; MSG SIZE rcvd: 87
          Hide
          bantu Andreas Fischer added a comment -

          Increasing priority because MX lookups return false positives - as per the last comment.

          Show
          bantu Andreas Fischer added a comment - Increasing priority because MX lookups return false positives - as per the last comment.
          Hide
          bantu Andreas Fischer added a comment -

          Reimplemented phpbb_checkdnsrr().

          Show
          bantu Andreas Fischer added a comment - Reimplemented phpbb_checkdnsrr().
          Hide
          A_Jelly_Doughnut A_Jelly_Doughnut added a comment -
          Show
          A_Jelly_Doughnut A_Jelly_Doughnut added a comment - PHP bugs filed as a result of this issue: http://bugs.php.net/bug.php?id=52260 http://bugs.php.net/bug.php?id=51844

            People

            • Assignee:
              bantu Andreas Fischer
              Reporter:
              bantu Andreas Fischer
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development