Skip to content

Commit

Permalink
first check if the user is already logged in and then try to authenti…
Browse files Browse the repository at this point in the history
…cate via apache, this way we suppress wrong audit log messages about failed login attempts

Signed-off-by: Bjoern Schiessle <[email protected]>
  • Loading branch information
schiessle committed Oct 30, 2018
1 parent ded746f commit 0efd29f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/dav/lib/Connector/Sabre/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,12 @@ private function auth(RequestInterface $request, ResponseInterface $response) {
if($this->twoFactorManager->needsSecondFactor($this->userSession->getUser())) {
throw new \Sabre\DAV\Exception\NotAuthenticated('2FA challenge not passed.');
}
if (\OC_User::handleApacheAuth() ||
if (
//Fix for broken webdav clients
($this->userSession->isLoggedIn() && is_null($this->session->get(self::DAV_AUTHENTICATED))) ||
//Well behaved clients that only send the cookie are allowed
($this->userSession->isLoggedIn() && $this->session->get(self::DAV_AUTHENTICATED) === $this->userSession->getUser()->getUID() && $request->getHeader('Authorization') === null)
($this->userSession->isLoggedIn() && $this->session->get(self::DAV_AUTHENTICATED) === $this->userSession->getUser()->getUID() && $request->getHeader('Authorization') === null) ||
\OC_User::handleApacheAuth()
) {
$user = $this->userSession->getUser()->getUID();
\OC_Util::setupFS($user);
Expand Down

0 comments on commit 0efd29f

Please sign in to comment.