Code

Allow to escape '$' replacement in filters.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 8 Jan 2010 09:15:49 +0000 (09:15 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 8 Jan 2010 09:15:49 +0000 (09:15 +0000)
- Enables to search for ((objectClass=sambaSamAccount)(cn=*$))

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

gosa-core/include/class_filter.inc

index 9b2fed5458381bcf79bba4e76752ac552e2b6042..6a6a4216efff52f5c61a9a59d8c889acb8339bca 100644 (file)
@@ -400,10 +400,12 @@ class filter {
         }
 
         if ($this->elementValues[$tag] == "") {
-          $e_unset= preg_replace('/\$/', normalizeLdap($this->elementValues[$tag]), $e_unset);
+          $e_unset= preg_replace('/[^\\\\]\$/', normalizeLdap($this->elementValues[$tag]), $e_unset);
+          $e_unset= preg_replace('/\\\\\$/','$', $e_unset);
           $filter= preg_replace("/\\$$tag/", $e_unset, $filter);
         } else {
-          $e_set= preg_replace('/\$/', normalizeLdap($this->elementValues[$tag]), $e_set);
+          $e_set= preg_replace('/[^\\\\]\$/', normalizeLdap($this->elementValues[$tag]), $e_set);
+          $e_set= preg_replace('/\\\\\$/','$', $e_set);
           $filter= preg_replace("/\\$$tag/", $e_set, $filter);
         }
       }