aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2012-03-06 10:15:00 +0000
committerBryn M. Reeves <bmr@redhat.com>2012-03-19 17:53:30 +0000
commit0c469d3db70eb2f2bc5c44324e883be55116e5b9 (patch)
treeb3487790d76d62cd95b64802474d483cacc45d7e
parenta4a7942531a2034b2408422f10587190e2e9bdc1 (diff)
downloadsos-0c469d3db70eb2f2bc5c44324e883be55116e5b9.tar.gz
Do not accept embedded forward slashes in RHN usernames
Resolves: bz771393
-rwxr-xr-xsos/policyredhat.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/sos/policyredhat.py b/sos/policyredhat.py
index 3b313922..13ec5627 100755
--- a/sos/policyredhat.py
+++ b/sos/policyredhat.py
@@ -60,6 +60,12 @@ def memoized(function):
return result
return f
+def sanitizeReportName(report_name):
+ return re.sub(r"[^-a-zA-Z.0-9]", "", report_name)
+
+def sanitizeTicketNumber(ticket_number):
+ return re.sub(r"[^0-9]", "", ticket_number)
+
class SosPolicy:
"This class implements various policies for sos"
def __init__(self):
@@ -208,10 +214,7 @@ class SosPolicy:
if not self.cInfo['cmdlineopts'].batch:
try:
self.reportName = raw_input(_("Please enter your first initial and last name [%s]: ") % localname)
- self.reportName = re.sub(r"[^a-zA-Z.0-9]", "", self.reportName)
-
self.ticketNumber = raw_input(_("Please enter the case number that you are generating this report for: "))
- self.ticketNumber = re.sub(r"[^0-9]", "", self.ticketNumber)
print
except:
print
@@ -222,11 +225,12 @@ class SosPolicy:
if self.cInfo['cmdlineopts'].customerName:
self.reportName = self.cInfo['cmdlineopts'].customerName
- self.reportName = re.sub(r"[^a-zA-Z.0-9]", "", self.reportName)
if self.cInfo['cmdlineopts'].ticketNumber:
self.ticketNumber = self.cInfo['cmdlineopts'].ticketNumber
- self.ticketNumber = re.sub(r"[^0-9]", "", self.ticketNumber)
+
+ self.reportName = sanitizeReportName(self.reportName)
+ self.ticketNumber = sanitizeTicketNumber(self.ticketNumber)
return