From 239d15f8ec14702f77a1573e1777c516398ba788 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 17 May 2010 06:57:07 +0000 Subject: [PATCH] Updated sudo plugin -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 --- .../sudo/admin/sudo/class_sudoGeneric.inc | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc index 97c6cec30..c29c124e9 100644 --- a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc +++ b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc @@ -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 */ -- 2.30.2