Exemplo n.º 1
0
 def test_check_safe_path(self):
     if not tests_utils.coreutils_readlink_available():
         self.skipTest("coreutils readlink(1) unavailable")
     vfs = vfsimpl.VFSLocalFS("dummy.img")
     vfs.imgdir = "/foo"
     ret = vfs._canonical_path('etc/something.conf')
     self.assertEqual(ret, '/foo/etc/something.conf')
Exemplo n.º 2
0
 def test_check_unsafe_path(self):
     if not tests_utils.coreutils_readlink_available():
         self.skipTest("coreutils readlink(1) unavailable")
     vfs = vfsimpl.VFSLocalFS("dummy.img")
     vfs.imgdir = "/foo"
     self.assertRaises(exception.Invalid, vfs._canonical_path,
                       'etc/../../../something.conf')
Exemplo n.º 3
0
 def test_check_unsafe_path(self):
     if not tests_utils.coreutils_readlink_available():
         self.skipTest("coreutils readlink(1) unavailable")
     vfs = vfsimpl.VFSLocalFS("dummy.img")
     vfs.imgdir = "/foo"
     self.assertRaises(exception.Invalid,
                       vfs._canonical_path,
                       'etc/../../../something.conf')