Code

Updated sudo plugin
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 May 2010 06:44:56 +0000 (06:44 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 May 2010 06:44:56 +0000 (06:44 +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/trunk@18484 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index a653edf0d81c964effa8cf5a3821e7f6a9fa1f51..7617b9563dd8e65f2b6c3e68eeeaebed06292c50 100644 (file)
@@ -283,12 +283,14 @@ class sudo extends plugin
                     isset($_POST["add_".$attr]) && 
                     isset($_POST['new_'.$attr]) && 
                     !empty($_POST['new_'.$attr])){
-                if(preg_match("/^[a-z\.0-9]*$/i",$_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]/"));
+                    msg_dialog::display(_("Error"),msgPool::invalid($attr,$_POST['new_'.$attr],"/[a-z0-9{$c}]/i"));
                 }
             }
         }