https://bugzilla.novell.com/show_bug.cgi?id=727360 https://bugzilla.novell.com/show_bug.cgi?id=727360#c0 Summary: glibc's HOSTALIASES does not work as described (for non suid/sgid binaries) Classification: openSUSE Product: openSUSE 11.2 Version: Final Platform: All OS/Version: SLES 11 Status: NEW Severity: Normal Priority: P5 - None Component: Development AssignedTo: pth@suse.com ReportedBy: brian.cain@gmail.com QAContact: qa@suse.de Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.106 Safari/535.2 The HOSTALIASES environment variable does not modify gethostbyname() as documented, but it is effective on other distros (with earlier upstream glibc releases). Is there a way to override this behavior on SLES, or has glibc been built such as to disable the feature entirely? Reproducible: Always Steps to Reproduce: ~~~~~~~ cat <<EOF > lookup.c #include <netdb.h> #include <stdlib.h> #include <stdio.h> int main(int argc, const char *argv[]) { const char *hostname_to_lookup = "z"; setenv("HOSTALIASES", "fakehosts", 1); struct hostent *foo = gethostbyname(hostname_to_lookup); if (!foo) { herror("error in hostname resolution"); } else { printf("w00t\n"); } return 0; } EOF echo "z localhost" > fakehosts gcc -o lookup lookup.c stat -c '%A' ./lookup -rwxrwxr-x /lookup ~~~~~~~ gethostbyname(3) excerpt: ~~~~~~~ .. in_addr equivalent into the h_addr_list[0] field of the returned hostent structure. If name doesn't end in a dot and the environment variable HOSTALIASES is set, the alias file pointed to by HOSTALIASES will first be searched for name (see hostname(7) for the file format). The current domain and its parents are searched unless name ends in a dot. .. ~~~~~~~ Actual Results: Fails (prints "error in hostname resolution") Expected Results: Succeeds (prints "w00t") on CentOS 5.6 (glibc 2.5) and Red Hat Linux release 9 (Shrike) w/glibc 2.3.3. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.