Code

Updated sudo plugin
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 May 2010 06:57:07 +0000 (06:57 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 May 2010 06:57:07 +0000 (06:57 +0000)
-Allow to add special characters in sudoHost,User & RunAs
 It is now allowed to use *+-!|?'

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@18485 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc

index 97c6cec30831eda3dd4ae325081c700759d49515..c29c124e9cba583b8ab81beee683edf012c7135b 100644 (file)
@@ -320,18 +320,20 @@ class sudo extends plugin
 
     /* User / Host / Runas */ 
     foreach(array("sudoUser","sudoHost","sudoRunAs") as $attr){
-      if($this->acl_is_writeable($attr) && 
-          isset($_POST["add_".$attr]) && 
-          isset($_POST['new_'.$attr]) && 
-          !empty($_POST['new_'.$attr])){
-        if(preg_match("/^[a-z\.0-9]*$/i",$_POST['new_'.$attr])){
-          $attrs = $this->$attr;
-          $attrs[] =  trim($_POST['new_'.$attr]); 
-          $this->$attr = $attrs;
-        }else{
-          msg_dialog::display(_("Error"),msgPool::invalid($attr,$_POST['new_'.$attr],"/[a-z0-9]/"));
+        if($this->acl_is_writeable($attr) && 
+                isset($_POST["add_".$attr]) && 
+                isset($_POST['new_'.$attr]) && 
+                !empty($_POST['new_'.$attr])){
+
+            $c = preg_quote('’ *+-?_|!\'"()','/');
+            if(preg_match("/^[a-z0-9{$c}]*$/i",$_POST['new_'.$attr])){
+                $attrs = $this->$attr;
+                $attrs[] =  trim($_POST['new_'.$attr]);
+                $this->$attr = $attrs;
+            }else{
+                msg_dialog::display(_("Error"),msgPool::invalid($attr,$_POST['new_'.$attr],"/[a-z0-9{$c}]/i"));
+            }
         }
-      }
     }
 
     /* Command */