* floppy disks are now unsupported

* ram disks are supported
This commit is contained in:
age 2008-02-17 16:36:43 +00:00
parent 5aba14b469
commit 22eaddc496
3 changed files with 9 additions and 14 deletions

View file

@ -2,8 +2,8 @@
# comma separated list of possible prefixes for accesible devices
# beware: .e.g "/dev/hd" grants access to _all_ harddisks
AllowedDevices = /dev/loop, /dev/ubdb, /dev/md_d127
#AllowedDevices = /dev/
# (floppy disks are not supported, does anyone still use them?)
AllowedDevices = /dev/ram, /dev/ubdb, /dev/md_d127
# use separate config partition? (1=yes / 0=no)
UseConfigPartition = 1

View file

@ -3,6 +3,7 @@
# comma separated list of possible prefixes for accesible devices
# beware: .e.g "/dev/hd" grants access to _all_ harddisks
# take care, that the user 'cryptobox' has write access to these devices
# (floppy disks are not supported)
AllowedDevices = /dev/loop, /dev/ubdb
# use separate config partition? (1=yes / 0=no)

View file

@ -45,8 +45,8 @@ LOGGER = logging.getLogger("CryptoBox")
DEFAULT_SYSBLOCK_DIR = '/sys/block'
DEFAULT_DEVNODE_DIR = '/dev'
MINIMUM_STORAGE_SIZE = 10
MAJOR_DEVNUM_RAM = 1
MAJOR_DEVNUM_LOOP = 7
MAJOR_DEVNUM_FLOPPY = 2
MAJOR_DEVNUM_MD_RAID = 9
## cache settings
@ -157,7 +157,7 @@ class Blockdevice:
def is_valid(self):
"""check if the device is usable and valid
causes of invalidity: ram device, loop device, removable device
causes of invalidity: unused loop device, floppy device
@rtype: boolean
@return: 'True' for a valid blockdevice
@ -169,14 +169,12 @@ class Blockdevice:
major, minor = self.devnum
if (major == 0) and (minor == 0):
return False
## ram devices are ignored
if major == MAJOR_DEVNUM_RAM:
return False
## loop devices are ignored
## loop devices are ignored, if they are unused
if (major == MAJOR_DEVNUM_LOOP) and (self.size == 0):
return False
## removable devices are ignored (due to long timeouts)
if self.is_removable():
## floppy disks are totally ignored
## otherwise we would have a long timeout, while reading the devices
if (major == MAJOR_DEVNUM_FLOPPY):
return False
except TypeError:
return False
@ -203,10 +201,6 @@ class Blockdevice:
## extended partition, unused loop device
CACHE.set(cache_link, False)
return False
if self.devnum[0] == MAJOR_DEVNUM_RAM:
## ram device
CACHE.set(cache_link, False)
return False
## are we the device mapper of a luks device?
for slave in self.slaves:
if get_blockdevice(slave, self.sysblock_dir,