Repository :
http://git.fedorahosted.org/cgit/
On branch : v1.4
---------------------------------------------------------------
commit e8527c01fe390484e5c272db4200052491979ee4
Author: Matt Domsch <Matt_Domsch(a)dell.com>
Date: Wed Jan 30 22:41:01 2013 -0600
force 1 <= bandwidth_int <= 100000 in cache creation
This handles invalid types as well as out-of-range values before they
can break mirrorlist_server.py. And really, who has servers on the
net with 100Gb pipes yet?
---------------------------------------------------------------
server/mirrormanager/mirrorlist.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/server/mirrormanager/mirrorlist.py b/server/mirrormanager/mirrorlist.py
index 95f9360..ebfd300 100644
--- a/server/mirrormanager/mirrorlist.py
+++ b/server/mirrormanager/mirrorlist.py
@@ -213,7 +213,14 @@ def populate_host_max_connections_cache(cache, host):
return cache
def populate_host_bandwidth_cache(cache, host):
- cache[host.id] = host.bandwidth_int
+ try:
+ i = int(host.bandwidth_int)
+ if i < 1: i = 1
+ elif i > 100000: i = 100000 # max bandwidth 100Gb
+ cache[host.id] = i
+ except:
+ cache[host.id] = 1
+
return cache
def populate_host_country_cache(cache, host):