Added explicit check to make sure each quad component is in range 0-255.
1 parent e51ef47 commit ced4b93cb8c9ebaaa8c8a55f2c3d9f116ef607b4
@tundra tundra authored on 29 Apr 2006
Showing 1 changed file
View
9
tperimeter.py
 
# Program Information
 
PROGNAME = "perimiter.py"
RCSID = "$Id: tperimeter.py,v 1.100 2006/04/28 21:29:13 tundra Exp $"
RCSID = "$Id: tperimeter.py,v 1.101 2006/04/29 07:35:53 tundra Exp $"
 
import os, re, sys
 
#####
if not re.match(IPQuad, address):
Error("You Must Specify Address In IP Quad Format")
 
# Make sure each quad element is in range
 
for q in address.split("."):
if not (0 <= int(q) <= 255):
Error("IP Address Component Is Out Of Range (%s Not Between 0-255)" % q)
 
# Make sure address is not on the forbidden list
 
if address in Forbidden:
Error("You Are Not Permitted To Enable Access For Address: %s" % address)
 
 
#####
# Output Content
#####