From 732310b470664814ce58fcbd221407918694feec Mon Sep 17 00:00:00 2001 From: Roland Lezuo Date: Tue, 11 Feb 2014 20:54:14 +0100 Subject: [PATCH] Fix mangling of username/password containing % char --- lib/ftp.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ftp.php b/lib/ftp.php index b94d7fe..bbc88ea 100644 --- a/lib/ftp.php +++ b/lib/ftp.php @@ -33,7 +33,8 @@ class OC_User_FTP extends OC_User_Backend{ OCP\Util::writeLog('user_external', 'ERROR: Stream wrapper not available: ' . $this->protocol, OCP\Util::ERROR); return false; } - $url = sprintf('%s://%s:%s@%s/', $this->protocol, $uid, $password, $this->host); + // opendir handles the as %-encoded string, but this is not true for usernames and passwords, encode them before passing them + $url = sprintf('%s://%s:%s@%s/', $this->protocol, urlencode($uid), urlencode($password), $this->host); $result=@opendir($url); if(is_resource($result)) { return $uid;