summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 374a085)
raw | patch | inline | side by side (parent: 374a085)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Aug 2009 10:10:25 +0000 (10:10 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 7 Aug 2009 10:10:25 +0000 (10:10 +0000) |
-Fixed handling of disk sizes
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14001 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14001 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc | patch | blob | history | |
gosa-plugins/fai/admin/fai/class_faiPartition.inc | patch | blob | history |
diff --git a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc
index 6d4448ee439957c13968cb97f733dd6cefd0c344..4d4b42968e94282fed8bd1ee39c32a21dddafda8 100644 (file)
if(preg_match("/[^a-z0-9_\-]/i",$d)){
$message[] = msgPool::invalid(_("Name"),$d,"/[a-z0-9_\-]/i");
}
+
return ($message);
}
diff --git a/gosa-plugins/fai/admin/fai/class_faiPartition.inc b/gosa-plugins/fai/admin/fai/class_faiPartition.inc
index fe1d5277cd3e30fcdcff7025a6cae5e17529b606..059ebda2b7162e13b3b0b4b5c6c27d56ba9d4e60 100644 (file)
* remaining * -
*/
// Fixed
- if(preg_match("/^[0-9]*(KB|MB|GB|TB|PB|%)$/",$this->FAIpartitionSize)){
+ if(preg_match("/^[0-9]{1,}(KB|MB|GB|TB|PB|%|)$/",$this->FAIpartitionSize)){
$this->sizeStart = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\1",$this->FAIpartitionSize);
$this->sizeStart_Type = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\2",$this->FAIpartitionSize);
$this->FAIpartitionSizeType = "fixed";
}else
// Dynamic range
- if(preg_match("/^[0-9]*(KB|MB|GB|TB|PB|%)-[0-9]*(KB|MB|GB|TB|PB|%)$/",$this->FAIpartitionSize)){
+ if(preg_match("/^[0-9]{1,}(KB|MB|GB|TB|PB|%|)-[0-9]{1,}(KB|MB|GB|TB|PB|%|)$/",$this->FAIpartitionSize)){
$this->sizeStart = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%).*$/","\\1",$this->FAIpartitionSize);
$this->sizeStart_Type = preg_replace("/^([0-9]*)(KB|MB|GB|TB|PB|%).*$/","\\2",$this->FAIpartitionSize);
$this->sizeStop = preg_replace("/^[^\-]*\-([0-9]*)(KB|MB|GB|TB|PB|%)$/","\\1",$this->FAIpartitionSize);
}else
// Dynamic range
- if(preg_match("/^\-$/",$this->FAIpartitionSize)){
+ if(preg_match("/^(0|)\-$/",$this->FAIpartitionSize)){
$this->FAIpartitionSizeType = "remaining";
+ }
+ // Ensure that we've a valid value type selected.
+ if(!preg_match("/(KB|MB|GB|TB|PB|%)/",$this->sizeStart_Type)){
+ $this->sizeStart_Type = "MB";
+ }
+ if(!preg_match("/(KB|MB|GB|TB|PB|%)/",$this->sizeStop_Type)){
+ $this->sizeStop_Type = "MB";
}
/* Check for encrypted partitions
$ret['FAIpartitionSize'] = $this->sizeStart.$this->sizeStart_Type."-".
$this->sizeStop.$this->sizeStop_Type;break;
case 'remaining' :
- $ret['FAIpartitionSize'] = "-";break;
+ $ret['FAIpartitionSize'] = "0-";break;
default: trigger_error("Unknown partition size!");
}