Commit 24434a62 authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

Fix user_exists methods in auth plugins (bug #761549)



Thanks to Darryl Hamilton.

Change-Id: If0b30cd991d8efdf0ade123399bd355873ccbe39
Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
parent f6101a74
...@@ -213,7 +213,7 @@ abstract class Auth { ...@@ -213,7 +213,7 @@ abstract class Auth {
*/ */
public function user_exists($username) { public function user_exists($username) {
$this->must_be_ready(); $this->must_be_ready();
if (record_exists('usr', 'LOWER(username)', strtolower($username))) { if (record_exists_select('usr', 'LOWER(username) = ?', array(strtolower($username)))) {
return true; return true;
} }
throw new AuthUnknownUserException("\"$username\" is not known to Auth"); throw new AuthUnknownUserException("\"$username\" is not known to Auth");
......
...@@ -400,12 +400,12 @@ class AuthXmlrpc extends Auth { ...@@ -400,12 +400,12 @@ class AuthXmlrpc extends Auth {
// The user is likely to be associated with the parent instance // The user is likely to be associated with the parent instance
if (is_numeric($this->config['parent']) && $this->config['parent'] > 0) { if (is_numeric($this->config['parent']) && $this->config['parent'] > 0) {
$_instanceid = $this->config['parent']; $_instanceid = $this->config['parent'];
$userrecord = get_record('usr', 'LOWER(username)', strtolower($username), 'authinstance', $_instanceid); $userrecord = record_exists_select('usr', 'LOWER(username) = ? and authinstance = ?', array(strtolower($username), $_instanceid));
} }
if (empty($userrecord)) { if (empty($userrecord)) {
$_instanceid = $this->instanceid; $_instanceid = $this->instanceid;
$userrecord = get_record('usr', 'LOWER(username)', strtolower($username), 'authinstance', $_instanceid); $userrecord = record_exists_select('usr', 'LOWER(username) = ? and authinstance = ?', array(strtolower($username), $_instanceid));
} }
if ($userrecord != false) { if ($userrecord != false) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment