vos: GetServer search for non-loopback address
GetServer() is used to obtain an IP address for the 'aname' parameter.
'aname' can be either a dotted address or a host name. If it is a dotted
address, it is returned immediately. If it is a host name, then
gethostbyname() is used to obtain an IP address.
The prior version of this function had two failings:
1. It assumed that a struct hostent only contained a single address.
It used the former h_addr field. For all platforms supported by
OpenAFS h_addr is a macro referencing the first address in the
h_addr_list array. If h_addr was a loopback address, it would
ignore any additional addresses that might be in the list.
2. It assumed that if gethostbyname(aname) returned a loopback
address as h_addr that 'aname' must be referring to the machine
that the vos command is being executed on. It therefore used
gethostname() to obtain an alternate name to use for a gethostbyname()
query. The results of this query were not checked to be a loopback.
As a result, a loopback address could be returned to the caller which
in turn could be set into the VLDB.
Change-Id: Ib8d513be9daf650045e9c40718b0187f6b9770a2
Reviewed-on: http://gerrit.openafs.org/10585
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Harald Barth <haba+gerrit@kth.se>
Tested-by: BuildBot <buildbot@rampaginggeek.com>