Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-51342

__nss_configure_lookup() doesn't work when called multiple times on RHEL8

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-8.10
    • glibc
    • No
    • None
    • sst_pt_libraries
    • ssg_platform_tools
    • 1
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • None

      What were you trying to do that didn't work?

      NetworkManager spawns a process that calls __nss_configure_lookup() multiple times to try the resolution with different NSS services. This works well on RHEL9 but doesn't work on RHEL8, as it seems that only the first call to __nss_configure_lookup()  has effect.

      Please provide the package NVR for which bug is seen:

      glibc-2.28-251.el8_10.2.x86_64

      How reproducible:

      Always.

      Steps to reproduce

      1. Add an "172.16.16.16 foobaz" entry to /etc/hosts
      2. Clear the content of /etc/resolv.conf
      3. Use the attached program to resolve the address using different NSS services:resolve.c

      Expected results

      When using the "dns" service, the resolution should fail. When using the "files" service, the program should return "foobaz". When using multiple services, it should give the expected result for each service, like in:

       

      [root@localhost ~]# ./resolve dns files
      * Resolving via 'dns'
      getnameinfo() failed: -3 (Temporary failure in name resolution)
      * Resolving via 'files'
      foobaz
      

       

      Actual results

      On RHEL 8, the program works as expected when using a single service. However, when using multiple services in the same process it seems that only the first call to __nss_configure_lookup() has effect.

      [root@localhost ~]# ./resolve dns files
       * Resolving via 'dns'
      getnameinfo() failed: -3 (Temporary failure in name resolution)
       * Resolving via 'files'
      getnameinfo() failed: -3 (Temporary failure in name resolution)
      [root@localhost ~]# ./resolve files dns
       * Resolving via 'files'
      foobaz
       * Resolving via 'dns'
      foobaz
      

      Notes

      The same test program works as expected on RHEL9.

      fweimer@redhat.com mentioned on slack that the glibc code in this area in RHEL 8 and RHEL 9 is very different, so it could be a bug fixed by accident.

        1. resolve.c
          1 kB
          Beniamino Galvani

            Unassigned Unassigned
            bgalvani@redhat.com Beniamino Galvani
            Platform Tools - Libraries Bot Platform Tools - Libraries Bot
            qe-baseos-tools-bugs@redhat.com qe-baseos-tools-bugs@redhat.com qe-baseos-tools-bugs@redhat.com qe-baseos-tools-bugs@redhat.com
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: