Added logic to handle blank input fields.
1 parent f1c081c commit 209ad9d7242b651830c650537a8b20a63d2480b2
@tundra tundra authored on 24 Jun 2008
Showing 1 changed file
View
20
tperimeter.py
#!/usr/local/bin/python
# tperimeter.py
# Copyright (c) 2006 TundraWare Inc. All Rights Reserved.
# Copyright (c) 2006-2008 TundraWare Inc. All Rights Reserved.
# For Updates See: http://www.tundraware.com/Software/tperimeter
 
# Program Information
 
PROGNAME = "tperimeter.py"
RCSID = "$Id: tperimeter.py,v 1.110 2006/09/25 19:56:37 tundra Exp $"
RCSID = "$Id: tperimeter.py,v 1.111 2008/06/24 19:20:12 tundra Exp $"
 
import os, re, sys, syslog
 
#####
#####
 
Forbidden = ["0.0.0.0", "255.255.255.255"] # Forbidden IP addresses
Services = ["sshd"] # Services we can open up
 
DefSvc = "sshd" # Default service to open if none specified
 
#####
# Print Routine
#####
#####
# Validate Number And Content Of Passed Parameters
#####
 
# Make sure both parameters were passed
# If no service passed explicitly, use default
 
if not (service and address):
Error("You Must Specify Both A Service Name And Address")
if not service:
service = DefSvc
 
 
# Make sure requested service is one of the ones allowed
 
elif service not in Services:
if service not in Services:
Error("You Are Not Permitted To Change Access To %s" % service)
 
 
# If no address passed explictly, use the requestor's
 
if not address:
address = requestor
 
 
# Make sure address is in quad format