Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/owncloud/core into downst…
Browse files Browse the repository at this point in the history
…ream-160609
  • Loading branch information
blizzz committed Jun 9, 2016
2 parents fc3ad7d + 4c26abe commit 9d3183d
Show file tree
Hide file tree
Showing 36 changed files with 424 additions and 75 deletions.
4 changes: 2 additions & 2 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
RewriteRule ^remote/(.*) remote.php [QSA,L]
RewriteRule ^(build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
RewriteRule ^(\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>
<IfModule mod_mime.c>
AddType image/svg+xml svg svgz
Expand Down
1 change: 1 addition & 0 deletions apps/federatedfilesharing/l10n/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ OC.L10N.register(
"federatedfilesharing",
{
"Sharing %s failed, because this item is already shared with %s" : "Współdzielenie %s nie powiodło się, ponieważ element jest już współdzielony z %s",
"File is already shared with %s" : "Plik jest już współdzielony z %s",
"Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "Współdzielenie %s nie powiodło się, nie można odnaleźć %s. Prawdopobnie serwer nie jest teraz osiągalny.",
"Accept" : "Akceptuj",
"Open documentation" : "Otwórz dokumentację",
Expand Down
1 change: 1 addition & 0 deletions apps/federatedfilesharing/l10n/pl.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ "translations": {
"Sharing %s failed, because this item is already shared with %s" : "Współdzielenie %s nie powiodło się, ponieważ element jest już współdzielony z %s",
"File is already shared with %s" : "Plik jest już współdzielony z %s",
"Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "Współdzielenie %s nie powiodło się, nie można odnaleźć %s. Prawdopobnie serwer nie jest teraz osiągalny.",
"Accept" : "Akceptuj",
"Open documentation" : "Otwórz dokumentację",
Expand Down
11 changes: 7 additions & 4 deletions apps/federation/css/settings-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
cursor: pointer;
}

#listOfTrustedServers li:hover {
cursor: pointer;
}

#listOfTrustedServers .status {
margin-right: 10px;
}

#listOfTrustedServers .icon {
cursor: pointer;
display: inline-block;
vertical-align: middle;
margin-left: 10px;
}
13 changes: 7 additions & 6 deletions apps/federation/js/settings-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ $(document).ready(function () {
$('ul#listOfTrustedServers').prepend(
$('<li>')
.attr('id', data.id)
.attr('class', 'icon-delete')
.html('<span class="status indeterminate"></span>' + data.url)
.html('<span class="status indeterminate"></span>' +
data.url +
'<span class="icon icon-delete"></span>')
);
OC.msg.finishedSuccess('#ocFederationAddServer .msg', data.message);
})
Expand All @@ -56,10 +57,10 @@ $(document).ready(function () {
}
});

// remove trusted server from list
$( "#listOfTrustedServers" ).on('click', 'li', function() {
var id = $(this).attr('id');
var $this = $(this);
// remove trusted server from list
$( "#listOfTrustedServers" ).on('click', 'li > .icon-delete', function() {
var $this = $(this).parent();
id = $this.attr('id');
$.ajax({
url: OC.generateUrl('/apps/federation/trusted-servers/' + id),
type: 'DELETE',
Expand Down
3 changes: 2 additions & 1 deletion apps/federation/templates/settings-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</p>
<ul id="listOfTrustedServers">
<?php foreach($_['trustedServers'] as $trustedServer) { ?>
<li id="<?php p($trustedServer['id']); ?>" class="icon-delete">
<li id="<?php p($trustedServer['id']); ?>">
<?php if((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?>
<span class="status success"></span>
<?php
Expand All @@ -36,6 +36,7 @@
<span class="status error"></span>
<?php } ?>
<?php p($trustedServer['url']); ?>
<span class="icon icon-delete"></span>
</li>
<?php } ?>
</ul>
Expand Down
1 change: 1 addition & 0 deletions apps/files/l10n/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ OC.L10N.register(
"Unable to determine date" : "Nie można ustalić daty",
"This operation is forbidden" : "Ta operacja jest niedozwolona",
"This directory is unavailable, please check the logs or contact the administrator" : "Ten folder jest niedostępny, proszę sprawdzić logi lub skontaktować się z administratorem.",
"Could not move \"{file}\", target exists" : "Nie można było przenieść „{file}” – plik o takiej nazwie już istnieje",
"Could not move \"{file}\"" : "Nie można było przenieść \"{file}\"",
"Could not create file \"{file}\"" : "Nie można było utworzyć pliku \"{file}\"",
"Could not create file \"{file}\" because it already exists" : "Nie można było utworzyć pliku \"{file}\", ponieważ ten plik już istnieje.",
Expand Down
1 change: 1 addition & 0 deletions apps/files/l10n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"Unable to determine date" : "Nie można ustalić daty",
"This operation is forbidden" : "Ta operacja jest niedozwolona",
"This directory is unavailable, please check the logs or contact the administrator" : "Ten folder jest niedostępny, proszę sprawdzić logi lub skontaktować się z administratorem.",
"Could not move \"{file}\", target exists" : "Nie można było przenieść „{file}” – plik o takiej nazwie już istnieje",
"Could not move \"{file}\"" : "Nie można było przenieść \"{file}\"",
"Could not create file \"{file}\"" : "Nie można było utworzyć pliku \"{file}\"",
"Could not create file \"{file}\" because it already exists" : "Nie można było utworzyć pliku \"{file}\", ponieważ ten plik już istnieje.",
Expand Down
1 change: 1 addition & 0 deletions apps/files_external/l10n/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ OC.L10N.register(
"files_external",
{
"Fetching access tokens failed. Verify that your app key and secret are correct." : "Otrzymano błędne żądanie tokenów. Sprawdź, czy klucz aplikacji oraz klucz poufny są poprawne.",
"Please provide a valid app key and secret." : "Proszę podać prawidłowy klucz aplikacji i klucz sekretny.",
"Step 1 failed. Exception: %s" : "Krok 1 błędny. Błąd: %s",
"Step 2 failed. Exception: %s" : "Krok 2 błędny. Błąd: %s",
"External storage" : "Zewnętrzne zasoby dyskowe",
Expand Down
1 change: 1 addition & 0 deletions apps/files_external/l10n/pl.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ "translations": {
"Fetching access tokens failed. Verify that your app key and secret are correct." : "Otrzymano błędne żądanie tokenów. Sprawdź, czy klucz aplikacji oraz klucz poufny są poprawne.",
"Please provide a valid app key and secret." : "Proszę podać prawidłowy klucz aplikacji i klucz sekretny.",
"Step 1 failed. Exception: %s" : "Krok 1 błędny. Błąd: %s",
"Step 2 failed. Exception: %s" : "Krok 2 błędny. Błąd: %s",
"External storage" : "Zewnętrzne zasoby dyskowe",
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Lib/Storage/Google.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public function stat($path) {
$stat['size'] = 0;
} else {
// Check if this is a Google Doc
if ($this->getMimeType($path) !== $file->getMimeType()) {
if ($this->isGoogleDocFile($file)) {
// Return unknown file size
$stat['size'] = \OCP\Files\FileInfo::SPACE_UNKNOWN;
} else {
Expand Down
1 change: 1 addition & 0 deletions apps/files_sharing/l10n/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ OC.L10N.register(
"Remote share password" : "Hasło do zdalnego zasobu",
"Cancel" : "Anuluj",
"Add remote share" : "Dodaj zdalny zasób",
"No ownCloud installation (7 or higher) found at {remote}" : "Nie znaleziono instalacji ownCloud (w wersji 7 lub nowszej) na {remote}",
"Invalid ownCloud url" : "Błędny adres URL",
"Shared by" : "Udostępniane przez",
"Sharing" : "Udostępnianie",
Expand Down
1 change: 1 addition & 0 deletions apps/files_sharing/l10n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"Remote share password" : "Hasło do zdalnego zasobu",
"Cancel" : "Anuluj",
"Add remote share" : "Dodaj zdalny zasób",
"No ownCloud installation (7 or higher) found at {remote}" : "Nie znaleziono instalacji ownCloud (w wersji 7 lub nowszej) na {remote}",
"Invalid ownCloud url" : "Błędny adres URL",
"Shared by" : "Udostępniane przez",
"Sharing" : "Udostępnianie",
Expand Down
2 changes: 2 additions & 0 deletions apps/systemtags/l10n/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ OC.L10N.register(
{
"Tags" : "Etykiety",
"Tagged files" : "Otagowane pliki",
"Select tags to filter by" : "Wybierz tagi do filtru",
"Please select tags to filter by" : "Proszę wybrać tagi do filtrów",
"No files found for the selected tags" : "Nie znaleziono plików dla wybranych etykiet",
"<strong>System tags</strong> for a file have been modified" : "<strong>System etykiet</strong> dla pliku został zmieniony",
"%1$s assigned system tag %3$s" : "%1$s przypisywalny system etykiet%3$s",
Expand Down
2 changes: 2 additions & 0 deletions apps/systemtags/l10n/pl.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{ "translations": {
"Tags" : "Etykiety",
"Tagged files" : "Otagowane pliki",
"Select tags to filter by" : "Wybierz tagi do filtru",
"Please select tags to filter by" : "Proszę wybrać tagi do filtrów",
"No files found for the selected tags" : "Nie znaleziono plików dla wybranych etykiet",
"<strong>System tags</strong> for a file have been modified" : "<strong>System etykiet</strong> dla pliku został zmieniony",
"%1$s assigned system tag %3$s" : "%1$s przypisywalny system etykiet%3$s",
Expand Down
3 changes: 3 additions & 0 deletions apps/updatenotification/l10n/pl.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
OC.L10N.register(
"updatenotification",
{
"Update notifications" : "Powiadomienia o aktualizacji",
"{version} is available. Get more information on how to update." : "Wersja {version} jest dostępna. Dowiedz się jak zaktualizować.",
"Updated channel" : "Zaktualizowano kanał",
"ownCloud core" : "Rdzeń ownCloud",
"Update for %1$s to version %2$s is available." : "Jest dostępna aktualizacja dla %1$s do wersji %2$s",
"Updater" : "Aktualizator",
"A new version is available: %s" : "Dostępna jest nowa wersja: %s",
"Open updater" : "Otwórz aktualizator",
Expand Down
3 changes: 3 additions & 0 deletions apps/updatenotification/l10n/pl.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{ "translations": {
"Update notifications" : "Powiadomienia o aktualizacji",
"{version} is available. Get more information on how to update." : "Wersja {version} jest dostępna. Dowiedz się jak zaktualizować.",
"Updated channel" : "Zaktualizowano kanał",
"ownCloud core" : "Rdzeń ownCloud",
"Update for %1$s to version %2$s is available." : "Jest dostępna aktualizacja dla %1$s do wersji %2$s",
"Updater" : "Aktualizator",
"A new version is available: %s" : "Dostępna jest nowa wersja: %s",
"Open updater" : "Otwórz aktualizator",
Expand Down
4 changes: 2 additions & 2 deletions core/Command/Encryption/DecryptAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ protected function execute(InputInterface $input, OutputInterface $output) {
}

$uid = $input->getArgument('user');
//FIXME WHEN https://github.com/owncloud/core/issues/24994 is fixed
if ($uid === null) {
if ($uid === '') {
$message = 'your ownCloud';
} else {
$message = "$uid's account";
}


$output->writeln("\n");
$output->writeln("You are about to start to decrypt all files stored in $message.");
$output->writeln('It will depend on the encryption module and your setup if this is possible.');
Expand Down
2 changes: 1 addition & 1 deletion core/css/tooltip.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
padding: 0 5px;
}
.tooltip-inner {
max-width: 200px;
max-width: 350px;
padding: 3px 8px;
color: #ffffff;
text-align: center;
Expand Down
4 changes: 2 additions & 2 deletions core/js/setupchecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
}
var afterCall = function(xhr) {
var messages = [];
if (xhr.status !== 403 && xhr.status !== 307 && xhr.status !== 301 && xhr.responseText === '') {
if (xhr.status !== 403 && xhr.status !== 307 && xhr.status !== 301 && xhr.responseText !== '') {
messages.push({
msg: t('core', 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.'),
type: OC.SetupChecks.MESSAGE_TYPE_ERROR
Expand All @@ -208,7 +208,7 @@

$.ajax({
type: 'GET',
url: OC.linkTo('', oc_dataURL+'/.ocdata'),
url: OC.linkTo('', oc_dataURL+'/htaccesstest.txt?t=' + (new Date()).getTime()),
complete: afterCall
});
return deferred.promise();
Expand Down
2 changes: 1 addition & 1 deletion core/js/tests/specs/setupchecksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe('OC.SetupChecks tests', function() {
it('should return an error if data directory is not protected', function(done) {
var async = OC.SetupChecks.checkDataProtected();

suite.server.requests[0].respond(200);
suite.server.requests[0].respond(200, {'Content-Type': 'text/plain'}, 'file contents');

async.done(function( data, s, x ){
expect(data).toEqual([
Expand Down
1 change: 1 addition & 0 deletions core/l10n/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ OC.L10N.register(
"This means only administrators can use the instance." : "これは、管理者のみがインスタンスを利用できることを意味しています。",
"Contact your system administrator if this message persists or appeared unexpectedly." : "このメッセージが引き続きもしくは予期せず現れる場合は、システム管理者に問い合わせてください。",
"Thank you for your patience." : "しばらくお待ちください。",
"Two-step verification" : "2段階認証",
"You are accessing the server from an untrusted domain." : "信頼されていないドメインからサーバーにアクセスしています。",
"Please contact your administrator. If you are an administrator of this instance, configure the \"trusted_domains\" setting in config/config.php. An example configuration is provided in config/config.sample.php." : "管理者に問い合わせてください。このサーバーの管理者の場合は、\"trusted_domain\" の設定を config/config.php に設定してください。config/config.sample.php にサンプルの設定方法が記載してあります。",
"Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain." : "環境により、下のボタンで信頼するドメインに追加する必要があるかもしれません。",
Expand Down
1 change: 1 addition & 0 deletions core/l10n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@
"This means only administrators can use the instance." : "これは、管理者のみがインスタンスを利用できることを意味しています。",
"Contact your system administrator if this message persists or appeared unexpectedly." : "このメッセージが引き続きもしくは予期せず現れる場合は、システム管理者に問い合わせてください。",
"Thank you for your patience." : "しばらくお待ちください。",
"Two-step verification" : "2段階認証",
"You are accessing the server from an untrusted domain." : "信頼されていないドメインからサーバーにアクセスしています。",
"Please contact your administrator. If you are an administrator of this instance, configure the \"trusted_domains\" setting in config/config.php. An example configuration is provided in config/config.sample.php." : "管理者に問い合わせてください。このサーバーの管理者の場合は、\"trusted_domain\" の設定を config/config.php に設定してください。config/config.sample.php にサンプルの設定方法が記載してあります。",
"Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain." : "環境により、下のボタンで信頼するドメインに追加する必要があるかもしれません。",
Expand Down
12 changes: 6 additions & 6 deletions lib/private/AppFramework/Middleware/Security/CORSMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@

use OC\AppFramework\Middleware\Security\Exceptions\SecurityException;
use OC\AppFramework\Utility\ControllerMethodReflector;
use OC\User\Session;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
use OCP\IUserSession;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Middleware;
use OCP\IRequest;

/**
* This middleware sets the correct CORS headers on a response if the
Expand All @@ -53,18 +53,18 @@ class CORSMiddleware extends Middleware {
private $reflector;

/**
* @var IUserSession
* @var Session
*/
private $session;

/**
* @param IRequest $request
* @param ControllerMethodReflector $reflector
* @param IUserSession $session
* @param Session $session
*/
public function __construct(IRequest $request,
ControllerMethodReflector $reflector,
IUserSession $session) {
Session $session) {
$this->request = $request;
$this->reflector = $reflector;
$this->session = $session;
Expand All @@ -89,7 +89,7 @@ public function beforeController($controller, $methodName){
$pass = $this->request->server['PHP_AUTH_PW'];

$this->session->logout();
if(!$this->session->login($user, $pass)) {
if(!$this->session->logClientIn($user, $pass)) {
throw new SecurityException('CORS requires basic auth', Http::STATUS_UNAUTHORIZED);
}
}
Expand Down
7 changes: 6 additions & 1 deletion lib/private/Files/Utils/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ public function scan($dir = '') {
if ($storage->instanceOfStorage('\OC\Files\Storage\Home') and
(!$storage->isCreatable('') or !$storage->isCreatable('files'))
) {
throw new ForbiddenException();
if ($storage->file_exists('') or $storage->getCache()->inCache('')) {
throw new ForbiddenException();
} else {// if the root exists in neither the cache nor the storage the user isn't setup yet
break;
}

}
$relativePath = $mount->getInternalPath($dir);
$scanner = $storage->getScanner();
Expand Down
28 changes: 27 additions & 1 deletion lib/private/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,32 @@ class Log implements ILogger {
/** @var Normalizer */
private $normalizer;

protected $methodsWithSensitiveParameters = [
// Session/User
'login',
'checkPassword',
'updatePrivateKeyPassword',
'validateUserPass',

// TokenProvider
'getToken',
'isTokenPassword',
'getPassword',
'decryptPassword',
'logClientIn',
'generateToken',
'validateToken',

// TwoFactorAuth
'solveChallenge',
'verifyChallenge',

//ICrypto
'calculateHMAC',
'encrypt',
'decrypt',
];

/**
* @param string $logger The logger that should be used
* @param SystemConfig $config the system config object
Expand Down Expand Up @@ -286,7 +312,7 @@ public function logException($exception, array $context = array()) {
'File' => $exception->getFile(),
'Line' => $exception->getLine(),
);
$exception['Trace'] = preg_replace('!(login|checkPassword|updatePrivateKeyPassword|validateUserPass)\(.*\)!', '$1(*** username and password replaced ***)', $exception['Trace']);
$exception['Trace'] = preg_replace('!(' . implode('|', $this->methodsWithSensitiveParameters) . ')\(.*\)!', '$1(*** sensitive parameters replaced ***)', $exception['Trace']);
$msg = isset($context['message']) ? $context['message'] : 'Exception';
$msg .= ': ' . json_encode($exception);
$this->error($msg, $context);
Expand Down
32 changes: 30 additions & 2 deletions lib/private/User/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,39 @@ public function createSessionToken(IRequest $request, $uid, $loginName, $passwor
$name = isset($request->server['HTTP_USER_AGENT']) ? $request->server['HTTP_USER_AGENT'] : 'unknown browser';
try {
$sessionId = $this->session->getId();
$this->tokenProvider->generateToken($sessionId, $uid, $loginName, $password, $name);
$pwd = $this->getPassword($password);
$this->tokenProvider->generateToken($sessionId, $uid, $loginName, $pwd, $name);
return true;
} catch (SessionNotAvailableException $ex) {
// This can happen with OCC, where a memory session is used
// if a memory session is used, we shouldn't create a session token anyway
return false;
}
}

/**
* Checks if the given password is a token.
* If yes, the password is extracted from the token.
* If no, the same password is returned.
*
* @param string $password either the login password or a device token
* @return string|null the password or null if none was set in the token
*/
private function getPassword($password) {
if (is_null($password)) {
// This is surely no token ;-)
return null;
}
try {
$token = $this->tokenProvider->getToken($password);
try {
return $this->tokenProvider->getPassword($token, $password);
} catch (PasswordlessTokenException $ex) {
return null;
}
} catch (InvalidTokenException $ex) {
return $password;
}
return true;
}

/**
Expand Down
Loading

0 comments on commit 9d3183d

Please sign in to comment.