summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/files/l10n/ru_RU.php3
-rw-r--r--apps/files/templates/index.php19
-rw-r--r--apps/files_encryption/hooks/hooks.php51
-rw-r--r--apps/files_encryption/lib/util.php58
-rw-r--r--apps/files_encryption/templates/settings-personal.php2
-rw-r--r--apps/files_sharing/lib/updater.php8
-rw-r--r--apps/user_ldap/lib/ldap.php2
7 files changed, 79 insertions, 64 deletions
diff --git a/apps/files/l10n/ru_RU.php b/apps/files/l10n/ru_RU.php
index 649ec594cd5..0df5b9c8c82 100644
--- a/apps/files/l10n/ru_RU.php
+++ b/apps/files/l10n/ru_RU.php
@@ -1,11 +1,14 @@
<?php
$TRANSLATIONS = array(
+"File name cannot be empty." => "Имя файла не может быть пустым.",
"Files" => "Файлы",
"Share" => "Сделать общим",
"Rename" => "Переименовать",
"_%n folder_::_%n folders_" => array("","",""),
"_%n file_::_%n files_" => array("","",""),
"_Uploading %n file_::_Uploading %n files_" => array("","",""),
+"'.' is an invalid file name." => "'.' является неверным именем файла.",
+"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Некорректное имя, '\\', '/', '<', '>', ':', '\"', '|', '?' и '*' не допустимы.",
"Error" => "Ошибка",
"Size" => "Размер",
"Upload" => "Загрузка",
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php
index 99d66ed3f9c..00ec109621f 100644
--- a/apps/files/templates/index.php
+++ b/apps/files/templates/index.php
@@ -69,20 +69,11 @@
<th <?php if (!$_['fileHeader']):?>class="hidden"<?php endif; ?> id="headerDate">
<span id="modified"><?php p($l->t( 'Modified' )); ?></span>
<?php if ($_['permissions'] & OCP\PERMISSION_DELETE): ?>
-<!-- NOTE: Temporary fix to allow unsharing of files in root of Shared folder -->
- <?php if ($_['dir'] == '/Shared'): ?>
- <span class="selectedActions"><a href="" class="delete-selected">
- <?php p($l->t('Unshare'))?>
- <img class="svg" alt="<?php p($l->t('Unshare'))?>"
- src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" />
- </a></span>
- <?php else: ?>
- <span class="selectedActions"><a href="" class="delete-selected">
- <?php p($l->t('Delete'))?>
- <img class="svg" alt="<?php p($l->t('Delete'))?>"
- src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" />
- </a></span>
- <?php endif; ?>
+ <span class="selectedActions"><a href="" class="delete-selected">
+ <?php p($l->t('Delete'))?>
+ <img class="svg" alt="<?php p($l->t('Delete'))?>"
+ src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" />
+ </a></span>
<?php endif; ?>
</th>
</tr>
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index f142f525cfa..7b13ae2a1d0 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -179,9 +179,9 @@ class Hooks {
// the necessary keys)
if (Crypt::mode() === 'server') {
- if ($params['uid'] === \OCP\User::getUser()) {
+ $view = new \OC_FilesystemView('/');
- $view = new \OC_FilesystemView('/');
+ if ($params['uid'] === \OCP\User::getUser()) {
$session = new \OCA\Encryption\Session($view);
@@ -202,36 +202,41 @@ class Hooks {
} else { // admin changed the password for a different user, create new keys and reencrypt file keys
$user = $params['uid'];
- $recoveryPassword = $params['recoveryPassword'];
- $newUserPassword = $params['password'];
+ $util = new Util($view, $user);
+ $recoveryPassword = isset($params['recoveryPassword']) ? $params['recoveryPassword'] : null;
- $view = new \OC_FilesystemView('/');
+ if (($util->recoveryEnabledForUser() && $recoveryPassword)
+ || !$util->userKeysExists()) {
- // make sure that the users home is mounted
- \OC\Files\Filesystem::initMountPoints($user);
+ $recoveryPassword = $params['recoveryPassword'];
+ $newUserPassword = $params['password'];
- $keypair = Crypt::createKeypair();
+ // make sure that the users home is mounted
+ \OC\Files\Filesystem::initMountPoints($user);
- // Disable encryption proxy to prevent recursive calls
- $proxyStatus = \OC_FileProxy::$enabled;
- \OC_FileProxy::$enabled = false;
+ $keypair = Crypt::createKeypair();
- // Save public key
- $view->file_put_contents('/public-keys/' . $user . '.public.key', $keypair['publicKey']);
+ // Disable encryption proxy to prevent recursive calls
+ $proxyStatus = \OC_FileProxy::$enabled;
+ \OC_FileProxy::$enabled = false;
- // Encrypt private key empty passphrase
- $encryptedPrivateKey = Crypt::symmetricEncryptFileContent($keypair['privateKey'], $newUserPassword);
+ // Save public key
+ $view->file_put_contents('/public-keys/' . $user . '.public.key', $keypair['publicKey']);
- // Save private key
- $view->file_put_contents(
- '/' . $user . '/files_encryption/' . $user . '.private.key', $encryptedPrivateKey);
+ // Encrypt private key empty passphrase
+ $encryptedPrivateKey = Crypt::symmetricEncryptFileContent($keypair['privateKey'], $newUserPassword);
- if ($recoveryPassword) { // if recovery key is set we can re-encrypt the key files
- $util = new Util($view, $user);
- $util->recoverUsersFiles($recoveryPassword);
- }
+ // Save private key
+ $view->file_put_contents(
+ '/' . $user . '/files_encryption/' . $user . '.private.key', $encryptedPrivateKey);
+
+ if ($recoveryPassword) { // if recovery key is set we can re-encrypt the key files
+ $util = new Util($view, $user);
+ $util->recoverUsersFiles($recoveryPassword);
+ }
- \OC_FileProxy::$enabled = $proxyStatus;
+ \OC_FileProxy::$enabled = $proxyStatus;
+ }
}
}
}
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 434ed225644..bf7c49504a2 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -101,15 +101,24 @@ class Util {
or !$this->view->file_exists($this->publicKeyPath)
or !$this->view->file_exists($this->privateKeyPath)
) {
-
return false;
-
} else {
-
return true;
-
}
+ }
+ /**
+ * @brief check if the users private & public key exists
+ * @return boolean
+ */
+ public function userKeysExists() {
+ if (
+ $this->view->file_exists($this->privateKeyPath) &&
+ $this->view->file_exists($this->publicKeyPath)) {
+ return true;
+ } else {
+ return false;
+ }
}
/**
@@ -761,7 +770,7 @@ class Util {
\OC\Files\Filesystem::putFileInfo($relPath, array(
'encrypted' => false,
'size' => $size,
- 'unencrypted_size' => $size,
+ 'unencrypted_size' => 0,
'etag' => $fileInfo['etag']
));
@@ -831,32 +840,35 @@ class Util {
// Open enc file handle for binary writing, with same filename as original plain file
$encHandle = fopen('crypt://' . $rawPath . '.part', 'wb');
- // Move plain file to a temporary location
- $size = stream_copy_to_stream($plainHandle, $encHandle);
+ if (is_resource($encHandle)) {
+ // Move plain file to a temporary location
+ $size = stream_copy_to_stream($plainHandle, $encHandle);
- fclose($encHandle);
- fclose($plainHandle);
+ fclose($encHandle);
+ fclose($plainHandle);
- $fakeRoot = $this->view->getRoot();
- $this->view->chroot('/' . $this->userId . '/files');
+ $fakeRoot = $this->view->getRoot();
+ $this->view->chroot('/' . $this->userId . '/files');
- $this->view->rename($relPath . '.part', $relPath);
+ $this->view->rename($relPath . '.part', $relPath);
- // set timestamp
- $this->view->touch($relPath, $timestamp);
+ // set timestamp
+ $this->view->touch($relPath, $timestamp);
- $this->view->chroot($fakeRoot);
+ $encSize = $this->view->filesize($relPath);
- // Add the file to the cache
- \OC\Files\Filesystem::putFileInfo($relPath, array(
- 'encrypted' => true,
- 'size' => $size,
- 'unencrypted_size' => $size,
- 'etag' => $fileInfo['etag']
- ));
+ $this->view->chroot($fakeRoot);
- $encryptedFiles[] = $relPath;
+ // Add the file to the cache
+ \OC\Files\Filesystem::putFileInfo($relPath, array(
+ 'encrypted' => true,
+ 'size' => $encSize,
+ 'unencrypted_size' => $size,
+ 'etag' => $fileInfo['etag']
+ ));
+ $encryptedFiles[] = $relPath;
+ }
}
// Encrypt legacy encrypted files
diff --git a/apps/files_encryption/templates/settings-personal.php b/apps/files_encryption/templates/settings-personal.php
index a4ed89b8a49..1b4239d82cd 100644
--- a/apps/files_encryption/templates/settings-personal.php
+++ b/apps/files_encryption/templates/settings-personal.php
@@ -2,7 +2,7 @@
<fieldset class="personalblock">
<h2><?php p( $l->t( 'Encryption' ) ); ?></h2>
- <?php if ( ! $_["privateKeySet"] && $_["initialized"] ): ?>
+ <?php if ( $_["initialized"] === '1' ): ?>
<p>
<a name="changePKPasswd" />
<label for="changePrivateKeyPasswd">
diff --git a/apps/files_sharing/lib/updater.php b/apps/files_sharing/lib/updater.php
index 44ebb5cd3cd..23ebc9fb811 100644
--- a/apps/files_sharing/lib/updater.php
+++ b/apps/files_sharing/lib/updater.php
@@ -112,8 +112,12 @@ class Shared_Updater {
*/
static public function shareHook($params) {
if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
- $uidOwner = \OCP\User::getUser();
- $users = \OCP\Share::getUsersItemShared($params['itemType'], $params['fileSource'], $uidOwner, true);
+ if (isset($params['uidOwner'])) {
+ $uidOwner = $params['uidOwner'];
+ } else {
+ $uidOwner = \OCP\User::getUser();
+ }
+ $users = \OCP\Share::getUsersItemShared($params['itemType'], $params['fileSource'], $uidOwner, true, false);
if (!empty($users)) {
while (!empty($users)) {
$reshareUsers = array();
diff --git a/apps/user_ldap/lib/ldap.php b/apps/user_ldap/lib/ldap.php
index bc963191722..dda8533c41f 100644
--- a/apps/user_ldap/lib/ldap.php
+++ b/apps/user_ldap/lib/ldap.php
@@ -91,7 +91,7 @@ class LDAP implements ILDAPWrapper {
}
public function setOption($link, $option, $value) {
- $this->invokeLDAPMethod('set_option', $link, $option, $value);
+ return $this->invokeLDAPMethod('set_option', $link, $option, $value);
}
public function sort($link, $result, $sortfilter) {