Code

Updated FAI template entry.
[gosa.git] / gosa-plugins / fai / admin / fai / class_faiPartitionTableEntry.inc
index 82be755250140e9f9cacbc7fe84a19940303e923..0efc24c103d918707367f568079cf81cc2846e8c 100644 (file)
@@ -366,9 +366,13 @@ class faiPartitionTableEntry extends plugin
     $message= plugin::check();
   
     /* Check for an empty disk name */
-    if(empty($this->DISKcn)){
+    $d = trim($this->DISKcn);
+    if($d == "" ){
       $message[] = msgPool::required(_("Name"));
     }
+    if(preg_match("/[^a-z0-9_\-]/i",$d)){
+      $message[] = msgPool::invalid(_("Name"),$d,"/[a-z0-9_\-]/i");
+    }
        
     /* check every partition.
      * if there is an invalid value defined, append an errorstr to message
@@ -419,9 +423,9 @@ class faiPartitionTableEntry extends plugin
                 break;
                 
         case 2:
-                if((!tests::is_id($tmp[0]))&&(!tests::is_id($tmp[1])) &&(!empty($tmp[1]))){
+                if( !tests::is_id($tmp[0]) && !tests::is_id($tmp[1]) && !empty($tmp[1]) ){
                   $message[]= msgPool::invalid(sprintf(_("partition %s size"),$key));
-                }elseif($tmp[0]>=$tmp[1]){
+                }elseif(!empty($tmp[1]) && $tmp[0]>=$tmp[1]){
                   $message[]= msgPool::invalid(sprintf(_("partition %s size"),$key));
                 }
                 break;