[Pkg-owncloud-commits] [owncloud-client] 159/219: Permissions: If a top level shared dir is removed, do not restore files in it

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:22 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 172295289e37b629961bac17b677593fc3765380
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Thu Sep 25 15:36:28 2014 +0200

    Permissions: If a top level shared dir is removed, do not restore files in it
    
    A top level shared dir can always be removed on the client, even if it is
    read only shared. In that case, the removal means "unsharing". Fixed the
    permission check accordingly.
    
    See bug #1918 for more information.
---
 src/mirall/syncengine.cpp | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/mirall/syncengine.cpp b/src/mirall/syncengine.cpp
index 081ef88..4da1b7e 100644
--- a/src/mirall/syncengine.cpp
+++ b/src/mirall/syncengine.cpp
@@ -884,7 +884,8 @@ void SyncEngine::checkForPermission()
                 if (perms.isNull()) {
                     // No permissions set
                     break;
-                } if (!perms.contains("D")) {
+                }
+                if (!perms.contains("D")) {
                     qDebug() << "checkForPermission: RESTORING" << it->_file;
                     it->_should_update_etag = true;
                     it->_instruction = CSYNC_INSTRUCTION_NEW;
@@ -915,6 +916,29 @@ void SyncEngine::checkForPermission()
                         }
                     }
                 }
+                if(perms.contains("S") && perms.contains("D")) {
+                    // this is a top level shared dir which can be removed to unshare it,
+                    // regardless if it is a read only share or not.
+                    // To avoid that we try to restore files underneath this dir which have
+                    // not delete permission we fast forward the iterator and leave the
+                    // delete jobs intact. It is not physically tried to remove this files
+                    // underneath, propagator sees that.
+                    if( it->_isDirectory ) {
+                        SyncFileItemVector::iterator it_prev = it - 1;
+                        const QString path = it->_file + QLatin1Char('/');
+
+
+                        // put a more descriptive message if really a top level share dir is removed.
+                        if( it_prev != _syncedItems.begin() && !(path.startsWith(it_prev->_file)) ) {
+                            it->_errorString = tr("Local files and share folder removed.");
+                        }
+
+                        for (SyncFileItemVector::iterator it_next = it + 1;
+                             it_next != _syncedItems.end() && it_next->_file.startsWith(path); ++it_next) {
+                            it = it_next;
+                        }
+                    }
+                }
                 break;
             }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list