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