Browse Source

Implement the port_check function

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac353@3070 e5f2f494-b856-4b98-b285-d166d9295462
Michal Vaner 14 years ago
parent
commit
df7d7460be
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/lib/python/isc/net/check.py

+ 8 - 1
src/lib/python/isc/net/check.py

@@ -23,7 +23,14 @@ def port_check(port):
     the port as int. If it is not a valid port (the string doesn't contain
     number or it is not in the valid range), it raises ValueError.
     """
-    pass
+    inted = int(port)
+    if inted < 0:
+        raise ValueError("Port value " + str(inted) +
+            " too small, allower range is 0-65535")
+    if inted > 65535:
+        raise ValueError("Port value " + str(inted) +
+            " too large, allowed range is 0-65535")
+    return inted
 
 def addr_check(addr):
     """