From 3435a8d1bebf5c00911281adf7c8f1ff4180dcf3 Mon Sep 17 00:00:00 2001 From: Mike Fulbright Date: Thu, 1 Aug 2002 04:08:12 +0000 Subject: be more picky about what we allow as a volume or logical volume name --- partIntfHelpers.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/partIntfHelpers.py b/partIntfHelpers.py index 597f5b2f7..c7b838a98 100644 --- a/partIntfHelpers.py +++ b/partIntfHelpers.py @@ -41,9 +41,12 @@ def sanityCheckVolumeGroupName(volname): if volname in badNames: return _("Error - the volume group name %s is not valid." % (volname,)) - if string.find(volname, '/') != -1 or string.find(volname, ' ') != -1: - return _("Error - the volume group name contains illegal characters " - " or spaces.") + for i in range(0, len(volname)): + rc = string.find(string.letters + string.digits + '.' + '_', volname[i]) + if rc == -1: + return _("Error - the volume group name contains illegal " + "characters or spaces. Acceptable characters " + "are letters, digits, '.' or '_'.") return None def sanityCheckLogicalVolumeName(logvolname): @@ -62,10 +65,12 @@ def sanityCheckLogicalVolumeName(logvolname): return _("Error - the logical volume name %s is not " "valid." % (logvolname,)) - if (string.find(logvolname, '/') != -1 or - string.find(logvolname, ' ') != -1): - return _("Error - the logical volume name contains illegal " - "characters or spaces.") + for i in range(0, len(logvolname)): + rc = string.find(string.letters + string.digits + '.' + '_', logvolname[i]) + if rc == -1: + return _("Error - the logical volume name contains illegal " + "characters or spaces. Acceptable characters " + "are letters, digits, '.' or '_'.") return None def sanityCheckMountPoint(mntpt, fstype, preexisting): -- cgit