From 22eaddc496633849014bb2c3ab6cdf74cc5a5e06 Mon Sep 17 00:00:00 2001 From: age Date: Sun, 17 Feb 2008 16:36:43 +0000 Subject: [PATCH] * floppy disks are now unsupported * ram disks are supported --- bin/cryptobox.conf | 4 ++-- conf-examples/cryptobox.conf | 1 + src/cryptobox/core/blockdevice.py | 18 ++++++------------ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/bin/cryptobox.conf b/bin/cryptobox.conf index 73242a5..bc4d4e9 100644 --- a/bin/cryptobox.conf +++ b/bin/cryptobox.conf @@ -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 diff --git a/conf-examples/cryptobox.conf b/conf-examples/cryptobox.conf index 4d2bc23..eb4e9d2 100644 --- a/conf-examples/cryptobox.conf +++ b/conf-examples/cryptobox.conf @@ -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) diff --git a/src/cryptobox/core/blockdevice.py b/src/cryptobox/core/blockdevice.py index ada7024..04479bf 100644 --- a/src/cryptobox/core/blockdevice.py +++ b/src/cryptobox/core/blockdevice.py @@ -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,