Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix to pydio/internal-tracker#108 : webdav upload for remote share ne…
Browse files Browse the repository at this point in the history
…ver had write permissions
  • Loading branch information
ghecquet committed Sep 23, 2016
1 parent 9eaf681 commit 1943345
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
1 change: 0 additions & 1 deletion core/src/core/src/pydio/Core/Http/Dav/AuthBackendBasic.php
Expand Up @@ -131,7 +131,6 @@ public function authenticate(Sabre\DAV\Server $server, $realm)
//AJXP_Logger::debug("Using Cached Password");
}


if (!$cachedPasswordValid && (!$this->validateUserPass($userpass[0],$userpass[1]))) {
Logger::warning(__CLASS__, "Login failed", array("user" => $userpass[0], "error" => "Invalid WebDAV user or password"));
$auth->requireLogin();
Expand Down
4 changes: 2 additions & 2 deletions core/src/plugins/access.fs/FsAccessDriver.php
Expand Up @@ -484,10 +484,10 @@ public function uploadAction(ServerRequestInterface &$request, ResponseInterface
}

// PARTIAL UPLOAD CASE - PREPPEND .dlpart extension
if(isSet($httpVars["partial_upload"]) && $httpVars["partial_upload"] == 'true' && isSet($httpVars["partial_target_bytesize"])){
if(isSet($httpVars["partial_upload"]) && $httpVars["partial_upload"] == 'true' && isSet($httpVars["partial_target_bytesize"])) {
$partialUpload = true;
$partialTargetSize = intval($httpVars["partial_target_bytesize"]);
if(!isSet($httpVars["appendto_urlencoded_part"])){
if(!isSet($httpVars["appendto_urlencoded_part"])) {
$userfile_name .= ".dlpart";
$targetUrl = $destination."/".$userfile_name;
}
Expand Down
6 changes: 1 addition & 5 deletions core/src/plugins/core.access/src/Stream/StreamWrapper.php
Expand Up @@ -70,10 +70,6 @@ public static function register($protocol) {
public function stream_open($path, $mode, $options, &$opened_path) {
$this->stream = self::createStream($path, $mode);

if ($this->stream->isWritable() && !$this->stream->isReadable()) {
$a = 1;
}

return true;
}

Expand Down Expand Up @@ -341,7 +337,7 @@ public static function getResolvedOptionsForNode($node)
*/
public function stream_flush()
{
// TODO: Implement stream_flush() method.
//$this->stream->flush();
}

/**
Expand Down
Expand Up @@ -56,7 +56,6 @@ public function getContents() {
}

public function close() {
//$this->bufferStream->close();
if ($this->size > 0) {
$this->stream->write($this->bufferStream);
}
Expand Down
14 changes: 8 additions & 6 deletions core/src/plugins/core.ocs/src/Server/Dav/AuthSharingBackend.php
Expand Up @@ -68,17 +68,17 @@ public function __construct(ContextInterface $context){
*
* @param string $username
* @param string $password
* @return bool
* @return mixed AJXP_User|bool
*/
protected function validateUserPass($username, $password)
{
try{
if(isSet($this->shareData["PRESET_LOGIN"])){
AuthService::logUser($this->shareData["PRESET_LOGIN"], $password, false, false);
$user = AuthService::logUser($this->shareData["PRESET_LOGIN"], $password, false, false);
}else{
AuthService::logUser($this->shareData["PRELOG_USER"], "", true);
$user = AuthService::logUser($this->shareData["PRELOG_USER"], "", true);
}
return true;
return $user;
}catch (LoginException $l){
return false;
}
Expand Down Expand Up @@ -119,7 +119,9 @@ public function authenticate(DAV\Server $server, $realm) {
$auth->requireLogin();
throw new DAV\Exception\NotAuthenticated('Username or password does not match');
}
if (!$this->validateUserPass($userpass[0],$userpass[1])) {

$user = $this->validateUserPass($userpass[0],$userpass[1]);
if (!$user) {
$auth->requireLogin();
throw new DAV\Exception\NotAuthenticated('Username or password does not match');
}
Expand All @@ -136,7 +138,7 @@ public function authenticate(DAV\Server $server, $realm) {
}

$this->currentUser = $userpass[0];
$this->context->setUserId($this->currentUser);
$this->context->setUserObject($user);

Logger::updateContext($this->context);
TextEncoder::updateContext($this->context);
Expand Down

0 comments on commit 1943345

Please sign in to comment.