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

Re: [PATCH 2/4] Clean up sanityCheckHostname() in network.py (#559626)



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/06/2010 10:45 PM, dcantrell redhat com wrote:
> From: David Cantrell <dcantrell redhat com>
> 
> Hostnames can start with digits.  Removed inStrRange() since
> it seemed a little redundant.  Left hostname length check at
> 64 characters, but put a comment reminding me that POSIX
> sets this limit to 255, so we should examine this in the
> future again.
> ---
>  network.py |   25 ++++++++++++-------------
>  1 files changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/network.py b/network.py
> index 0327ef9..0feb8fd 100644
> --- a/network.py
> +++ b/network.py
> @@ -37,26 +37,25 @@ class IPError(Exception):
>  class IPMissing(Exception):
>      pass
>  
> -def inStrRange(v, s):
> -    if string.find(s, v) == -1:
> -	return 0
> -    else:
> -	return 1
> -
>  def sanityCheckHostname(hostname):
>      if len(hostname) < 1:
>  	return None
>  
> +    # XXX: POSIX says this limit is 255, but Linux also defines HOST_NAME_MAX
> +    # as 64, so I don't know which we should believe.  --dcantrell
>      if len(hostname) > 64:
> -	return _("Hostname must be 64 or less characters in length.")

In RHEL6 this has been changed to 255


- -- 
Brian C. Lane <bcl redhat com>
Red Hat / Port Orchard, WA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Remember Lexington Green!

iQEVAwUBTGA7YxF+jBaO/jp/AQJnTAf/XZT3nVvV/2FPoL+we5g0997V6u8sIRsJ
Zbq2eg16PQG6aQlCciPnqsABUUq0MJLtpsKNKJIPTZLJmdkRfh2ZCUT5YZ9ZlBn9
vpUjxPG9E6IIWWP6A9W3cCUN4cVsAtK04zwVW8cSiMAObl/PNmiuqvPgEyrvT1oU
6YtpTwJ1739Vgs90Mh4EyFgZ+VrQBBjM1+Ng7KyRd8S6USj4D8NLYn1uliFOhFLy
GeX8YZmw9k1JI2zWptgwTmkwCMdCccz/w8rgHXg/p0zZQgqLvQOXzbcmg2SFJ1AV
8w78zJdZRSHakTwkUGiepG25jZN4fpVNHxfiGGIRQoL0Iz5S0n7a7w==
=60lQ
-----END PGP SIGNATURE-----


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