Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-14806

localhostAuthBypass jstest can fail for specific ifconfig outputs

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.7.5
    • Affects Version/s: None
    • Component/s: Testing Infrastructure
    • Labels:
    • Environment:
      OpenSUSE 13.1 x86_64
    • Linux
    • Hide

      1) Use OpenSUSE 13.1
      2) Run jstests/auth/localhostAuthBypass.js with smoke.py

      1) Use OpenSUSE 13.1 2) Run jstests/auth/localhostAuthBypass.js with smoke.py

      The localhostAuthBypass test uses the get_ipaddr method from jstests/libs/host_ipaddr.js to obtain the host's ipv4 address. get_ipaddr works on Unix systems by calling /sbin/ifconfig and performing some text processing on the output. An example of this output is as follows:

      inet addr: Bcast: Mask:

      get_ipaddr greps for all ifconfig lines containing the string "inet", filters out all lines containing "" and then removes the first occurrence of the string "addr:". The address is found using a regular expression which returns all characters after the string "inet " until whitespace is encountered.

      This process can fail if ifconfig returns a result which, when grepped, looks like:

      inet6 addr: ::1/128 Scope:Host
      inet addr: Bcast: Mask:
      inet6 addr: fe80::3e15:c2ff:fedc:4994/64 Scope:Link

      When ifconfig returns an IPv6 address before an IPv4 address the "addr:" string will be removed from the leading IPv6 entry, which is subsequently ignored by the regular expression. This results in get_ipaddr returning an IPv4 address prefixed by "addr:", which is invalid.

            spencer.jackson@mongodb.com Spencer Jackson
            spencer.jackson@mongodb.com Spencer Jackson
            0 Vote for this issue
            2 Start watching this issue