diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-07-20 21:24:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-20 21:24:19 +0200 |
commit | a17ba2f4889c92e7113606e17cc6b9f66512264f (patch) | |
tree | bc0f77e97a21d93bc892f22f1756298e557438b4 /apps/user_ldap/lib | |
parent | 78cad699fe48e29889145c394d2d86dfa35ea805 (diff) | |
parent | 7c0de08cc44e0b04f23d6f3fa2d6030991935c54 (diff) | |
download | nextcloud-server-a17ba2f4889c92e7113606e17cc6b9f66512264f.tar.gz nextcloud-server-a17ba2f4889c92e7113606e17cc6b9f66512264f.zip |
Merge pull request #466 from nextcloud/escape-special-characters
Escape special characters (#25429)
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/Access.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/Mapping/AbstractMapping.php | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index 4d0753696ff..cdf12331477 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -623,7 +623,7 @@ class Access extends LDAPUtility implements IUserTools { * "Developers" */ private function _createAltInternalOwnCloudNameForGroups($name) { - $usedNames = $this->groupMapper->getNamesBySearch($name.'_%'); + $usedNames = $this->groupMapper->getNamesBySearch($name, "", '_%'); if(!($usedNames) || count($usedNames) === 0) { $lastNo = 1; //will become name_2 } else { diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index 54fe7db366f..67fbd9fe851 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -138,16 +138,18 @@ abstract class AbstractMapping { /** * Searches mapped names by the giving string in the name column * @param string $search + * @param string $prefixMatch + * @param string $postfixMatch * @return string[] */ - public function getNamesBySearch($search) { + public function getNamesBySearch($search, $prefixMatch = "", $postfixMatch = "") { $query = $this->dbc->prepare(' SELECT `owncloud_name` FROM `'. $this->getTableName() .'` WHERE `owncloud_name` LIKE ? '); - $res = $query->execute(array($search)); + $res = $query->execute(array($prefixMatch.$this->dbc->escapeLikeParameter($search).$postfixMatch)); $names = array(); if($res !== false) { while($row = $query->fetch()) { |