Re: [virt-manager PATCH] sshtunnels: resolve the name if host is specified

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/06/2015 08:29 AM, Giuseppe Scrivano wrote:
> bug introduced with commit a2d453f3e20d103a4767394300c5183fde9a6bb4
> 
> Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1218958
> 
> Signed-off-by: Giuseppe Scrivano <gscrivan@xxxxxxxxxx>
> ---
>  virtManager/sshtunnels.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/virtManager/sshtunnels.py b/virtManager/sshtunnels.py
> index 53f43be..263a6ed 100644
> --- a/virtManager/sshtunnels.py
> +++ b/virtManager/sshtunnels.py
> @@ -48,6 +48,8 @@ class ConnectionInfo(object):
>              self._connhost = "127.0.0.1"
>  
>      def _is_listen_localhost(self, host=None):
> +        if host:
> +            host = socket.gethostbyname(host)
>          return ipaddr.IPNetwork(host or self.gaddr).is_loopback
>  
>      def _is_listen_any(self):
> 

gethostbyname will throw an exception if the host name isn't resolvable.

I think we should just wrap the IPNetwork check in try:/except, and if it
errors we return True. This is really just meant to be a best effort check

- Cole

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux