From 6e2d4178af239bb07199e73204239b8ab924934a Mon Sep 17 00:00:00 2001 From: wolffc Date: Thu, 16 Sep 2010 14:38:38 +0000 Subject: [PATCH] Check for invalid names first before trimming name, catching trailing spaces at the end or beginning git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@19721 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_faiScriptEntry.inc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiScriptEntry.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiScriptEntry.inc index db8366b1b..7600ac934 100644 --- a/trunk/gosa-plugins/fai/admin/fai/class_faiScriptEntry.inc +++ b/trunk/gosa-plugins/fai/admin/fai/class_faiScriptEntry.inc @@ -137,14 +137,13 @@ class faiScriptEntry extends plugin $message[] = msgPool::duplicated(_("Name")); } - $c = trim($this->cn); - if($c == ""){ - $message[] = msgPool::required(_("Name")); - } - if(preg_match("/[^a-z0-9_\-]/i",$c)){ - $message[] = msgPool::invalid(_("Name"),$c,"/[a-z0-9_\-]/i"); + if(preg_match("/[^a-z0-9_\-]/i",$this->cn)){ + $message[] = msgPool::invalid(_("Name"),$this->cn,"/[a-z0-9_\-]/i"); } + if(trim($this->cn) == ""){ + $message[] = msgPool::required(_("Name")); + } $s = trim($this->FAIscript); if($s == ""){ $message[]= msgPool::required(_("Script")); -- 2.30.2