[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH master rhel6-branch] Add more sanity checks to the mountpoint (#592185)



Resolves: rhbz#592185
---
 partIntfHelpers.py |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/partIntfHelpers.py b/partIntfHelpers.py
index c2b77f8..9fb2f72 100644
--- a/partIntfHelpers.py
+++ b/partIntfHelpers.py
@@ -83,10 +83,25 @@ def sanityCheckMountPoint(mntpt):
     """Sanity check that the mountpoint is valid.
 
     mntpt is the mountpoint being used.
+
+    The Rules
+        Start with one /
+        Don't end with /
+        No spaces
+        No /../
+        No /./
+        No //
+        Don't end with /..
+        Don't end with /.
     """
     if not mntpt.startswith("/") or \
        (len(mntpt) > 1 and mntpt.endswith("/")) or \
-       " " in mntpt:
+       " " in mntpt or \
+       "/../" in mntpt or \
+       "/./" in mntpt or \
+       "//" in mntpt or \
+       mntpt.endswith("/..") or \
+       mntpt.endswith("/.") :
            return _("The mount point %s is invalid.  Mount points must start "
                     "with '/' and cannot end with '/', and must contain "
                     "printable characters and no spaces.") % mntpt
-- 
1.6.6.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]