summaryrefslogtreecommitdiffstats
path: root/support/export/hostname.c
Commit message (Collapse)AuthorAgeFilesLines
* nfs: fix host_reliable_addrinfoJeff Layton2011-06-221-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to Neil Brown: The point of the word 'reliable' is to check that the name we get really does belong to the host in question - ie that both the forward and reverse maps agree. But the new code doesn't do that check at all. Rather it simply maps the address to a name, then discards the address and maps the name back to a list of addresses and uses that list of addresses as "where the request came from" for permission checking. This bug is exploitable via the following scenario and could allow an attacker access to data that they shouldn't be able to access. Suppose you export a filesystem to some subnet or FQDN and also to a wildcard or netgroup, and I know the details of this (maybe showmount -e tells me) Suppose further that I can get IP packets to your server.. Then I create a reverse mapping for my ipaddress to a domain that I own, say "black.hat.org", and a forward mapping from that domain to my IP address, and one of your IP addresses. Then I try to mount your filesystem. The IP address gets correctly mapped to "black.hat.org" and then mapped to both my IP address and your IP address. Then you search through all of your exports and find that one of the addresses: yours - is allowed to access the filesystem. So you create an export based on the addrinfo you have which allows my IP address the same access as your IP address. Fix this by instead using the forward lookup of the hostname just to verify that the original address is in the list. Then do a numeric lookup using the address and stick the hostname in the ai_canonname. Reviewed-by: NeilBrown <neilb@suse.de> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Remove all uses of AI_ADDRCONFIGChuck Lever2010-11-011-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was reported that, if only "lo" is up, mount.nfs 127.0.0.1:/export /mount fails with "Name or service not known". "man 3 getaddrinfo" says this: If hints.ai_flags includes the AI_ADDRCONFIG flag, then IPv4 addresses are returned in the list pointed to by res only if the local system has at least one IPv4 address configured, and IPv6 addresses are only returned if the local system has at least one IPv6 address configured. The man page oversimplifies here. A review of glibc shows that getaddrinfo(3) explicitly ignores loopback addresses when deciding whether an IPv4 or IPv6 address is configured. This behavior around loopback is a problem not just for mount.nfs, but also for RPC daemons that have to start up before a system's networking is fully configured and started. Given the history of other problems with AI_ADDRCONFIG and the unpredictable behavior it introduces, let's just remove it everywhere in nfs-utils. This fix addresses: https://bugzilla.linux-nfs.org/show_bug.cgi?id=191 Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Enable IPv6 support in hostname.cChuck Lever2010-09-161-16/+15
| | | | | | | | | | | | If --enable-ipv6 is specified when building nfs-utils, libexport's host_foo() helpers can now return both IPv4 and IPv6 addresses. This means IPv6 presentation addresses and IPv6 DNS resolution results are handled properly in the mountd cache and /etc/exports, but does not yet enable IPv6 mountd listeners. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Remove unused hostent-based DNS helper functionsChuck Lever2010-06-221-305/+16
| | | | | | | | | | | Clean up: Get rid of hostent-based DNS helper functions in libexport.a that have been replaced by addrinfo-based DNS helpers. None of the original code remains, so replace the copyright notice as well. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Add helpers to manage DNS lookupsChuck Lever2010-06-221-0/+351
| | | | | | | | | | | | | | | Introduce DNS query helpers based on getaddrinfo(3) and getnameinfo(3). These will eventually replace the existing hostent-based functions in support/export/hostname.c. Put some of these new helpers to immediate use, where convenient. As they are part of libexport.a, I've added the forward declarations for these new functions in exportfs.h rather than misc.h, where the hostent-based forward declarations are currently. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Autogen updateneilbrown2005-12-201-4/+6
|
* * support/export/hostname.c (get_reliable_hostbyaddr): Fix crashchip2003-09-091-23/+22
| | | | on invalid reverse DNS.
* Define and use get_reliable_hostbynameneilbrown2003-05-211-0/+52
|
* 2000-07-04 Neil Brown <neilb@cse.unsw.edu.au>hjl2000-07-051-3/+3
| | | | | * support/export/hostname.c (hostent_dup): Handle the NULL h_aliases field.
* Initial revisionhjl1999-10-181-0/+262