Changeset 1029

Show
Ignore:
Timestamp:
09/13/07 00:35:23 (3 years ago)
Author:
lars
Message:

do not ignore used loop devices (size > 0)
fixed tests.cryptobox.py

Location:
trunk/src/cryptobox
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/cryptobox/core/blockdevice.py

    r1028 r1029  
    167167                return False 
    168168            ## loop devices are ignored 
    169             if major == MAJOR_DEVNUM_LOOP: 
     169            if (major == MAJOR_DEVNUM_LOOP) and (self.size == 0): 
    170170                return False 
    171171            ## removable devices are ignored (due to long timeouts) 
     
    775775        if dev.startswith(devnode_dir): 
    776776            ## it is the name of a devicenode (e.g.: '/dev/hda1') 
     777            ## simplify the path first 
     778            dev = os.path.realpath(dev) 
    777779            found_dev = [ a_dev for a_dev in Blockdevices( 
    778780                            sysblock_dir, devnode_dir).get_devices() 
  • trunk/src/cryptobox/tests/test.cryptobox.py

    r1011 r1029  
    4343        '''is_device_allowed should accept permitted devices''' 
    4444        self.assertTrue(self.cb.is_device_allowed("/dev/loop1")) 
    45         self.assertTrue(self.cb.is_device_allowed("/dev/usb/../loop1")) 
     45        self.assertTrue(self.cb.is_device_allowed("/dev/pts/../loop1")) 
    4646 
    4747 
    4848    def test_denied_devices(self): 
    4949        '''is_device_allowed should fail with not explicitly allowed devices''' 
    50         self.assertFalse(self.cb.is_device_allowed("/dev/hda")) 
    51         self.assertFalse(self.cb.is_device_allowed("/dev/loopa/../hda")) 
     50        self.assertFalse(self.cb.is_device_allowed("/dev/hdc")) 
     51        self.assertFalse(self.cb.is_device_allowed("/dev/loopa/../hdc")) 
    5252        self.assertFalse(self.cb.is_device_allowed("/")) 
    5353        ## this device does not exist -> no permission check possible