1
0
Fork 0
Commit Graph

2188 Commits

Author SHA1 Message Date
Olivier Goffart 5683f1c33d
New Disco Algo: Handle spurious virtual files
Port commit 0b9049e6ff
for issue #6718
2020-12-15 10:58:04 +01:00
Olivier Goffart c3f745fa76
Conflict handling: add the OC-ConflictBasePath header
Issue #6702
2020-12-15 10:58:04 +01:00
Olivier Goffart 73d933115a
Virtual Files: Set the mtime of the virtual file to that of the server
Note: When the server mtime is modified, the mtime of the file is not updated

Issue #6727
2020-12-15 10:58:04 +01:00
Christian Kamm c10f103fb8
Virtual files: Renaming to virtual doesn't delete data #6718
Unfortunately to do this, the local update phase must write to the
database, creating a new side-effect and order dependency (local update
must run before remote update).
2020-12-15 10:58:03 +01:00
Christian Kamm be0fa72fcb
RemotePermissions: Fix empty vs null
Fixes two bugs that appeared since the introduction of the struct:
- when reading permissions from the journal, null ("") was read as
  empty-not-null
- when reading permissinos from the server, empty ("") was read as null

Addresses #4608
2020-12-15 10:58:03 +01:00
Olivier Goffart 732069aaa7
SyncEngine: Fix the "direction" of the "all file delted" message when the server is reset
Using the direction of the "first" item is not enough as it might be a directory
which is a UPDATE_META_DATA,  or there can have been a few changes locally as well.

As reported on https://github.com/owncloud/client/issues/6317#issuecomment-412163113
2020-12-15 10:58:02 +01:00
Christian Kamm f6ca649308
Do not require server replies to contain an mtime
The check was added for #6317 in commit
13eb64584f.

We did see missing mtimes in replies in tests with live servers though.
Possibly those were old incomplete responses cached in the stat cache?
2020-12-15 10:58:02 +01:00
Olivier Goffart 9401273daf
New discovery algorithm: Call FolderDiscovered 2020-12-15 10:58:02 +01:00
Olivier Goffart a36ed56f01
New Discovery algorithm: Refactor a bit the way the signal are emited 2020-12-15 10:58:02 +01:00
Olivier Goffart 8f3ce6e520
Fix TestDownload: _ignore_hidden_files was not properly initialized 2020-12-15 10:58:02 +01:00
Olivier Goffart b6487181c6
New Discovery Phase: fix a few FIXME
Some FIXME were already fixed.
2020-12-15 10:58:02 +01:00
Olivier Goffart 9863500ec1
New discovery algorithm: handle symlinks 2020-12-15 10:58:01 +01:00
Olivier Goffart a9ec521bf1
New discovery algo: Handle Database error 2020-12-15 10:58:01 +01:00
Olivier Goffart 1bcbcd407c
New discovery phase: read the direct download URL and Cookie 2020-12-15 10:58:01 +01:00
Olivier Goffart ca32eb1cf7
More cleanup of csync remains 2020-12-15 10:58:01 +01:00
Olivier Goffart ac24cdbde6
New Discovery Algo: Permsission check 2020-12-15 10:58:01 +01:00
Olivier Goffart 0a6d2d0f46
Remove csync_update and csync_reconcile
I guess some other csync utilities can also be remove dnow but
that will be for later
2020-12-15 10:58:00 +01:00
Olivier Goffart 57068b0fd9
New Discovery Algorithm: handle server errors 2020-12-15 10:58:00 +01:00
Olivier Goffart 4031fb6d5b
Backport 64014dd374 2020-12-15 10:58:00 +01:00
Olivier Goffart 75a1f2d089
Convert p7.pl to a C++ test
This is just a translation of test/scripts/txpl/t7.pl to C++ using the test
framework.
2020-12-15 10:58:00 +01:00
Olivier Goffart f4a5167812
New Discovery Algo: Support the DatabaseAndFilesystem mode for local discovery 2020-12-15 10:57:59 +01:00
Olivier Goffart 370923791d
New Disco algortihm: Fix TestChunkingNG::connectionDroppedBeforeEtagRecieved
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-12-15 10:57:59 +01:00
Olivier Goffart 710934bdbd
New disco algo: Fix TestSyncFileStatusTracker 2020-12-15 10:57:59 +01:00
Olivier Goffart f926248937
New discovery algorithm: More work on virtual files 2020-12-15 10:57:59 +01:00
Olivier Goffart 35e40b58ca
New Disco algorithm: Type change (file to dir) 2020-12-15 10:57:59 +01:00
Olivier Goffart 1e8c37d3d6
New discovery algorithm: Virtual files
The commented tests lines were implementation details
2020-12-15 10:57:59 +01:00
Olivier Goffart 22d989e272
New discovery algorithm: Fix directory deletion
TestAllFilesDeleted passes
2020-12-15 10:57:59 +01:00
Olivier Goffart d54e00488a
New Discovery algorithm
Some error handling. In particular for the case where there is a conflict
between files and directories.

SyncEngineTest and SyncMoveTest passes
2020-12-15 10:57:58 +01:00
Olivier Goffart a384a2d1cb
New Discovery algorithm: Handle of move within a moved directory 2020-12-15 10:57:58 +01:00
Olivier Goffart bdd1e72dda
New discovery algoritmh: more on Renames 2020-12-15 10:57:58 +01:00
Olivier Goffart f43d07dc05
New Discovery algorithm: Check that the original file is still on the server while renaming 2020-12-15 10:57:58 +01:00
Olivier Goffart 7e36cc3fcb
New disco algorithm: Fix some moving
Fix TestSyncMove::testSelectiveSyncMovedFolder
2020-12-15 10:57:58 +01:00
Olivier Goffart 5a57a36729
New discovery algorithm: Local rename 2020-12-15 10:57:58 +01:00
Olivier Goffart f9a9be59e6
New discovery algo: Remote move
TestSyncMove::testRemoteChangeInMovedFolder
2020-12-15 10:57:57 +01:00
Olivier Goffart 92ddc60900
Handle Encoding Problems
TestSyncEngine now passes
2020-12-15 10:57:57 +01:00
Olivier Goffart 501da58b10
Ignore Hidden Files 2020-12-15 10:57:57 +01:00
Olivier Goffart 8bf69cf0cd
Port the invalid napme regexp
TestSyncEngine::testInvalidFilenameRegex
2020-12-15 10:57:57 +01:00
Olivier Goffart 9efd21d70b
More progress
TestSyncEngine::testFakeConflict / TestSyncEngine::testSyncFileItemProperties
2020-12-15 10:57:57 +01:00
Olivier Goffart e934f6b27b
New discovery algo
Make TestSyncEngine::testSelectiveSyncBug pass
2020-12-15 10:57:57 +01:00
Olivier Goffart 4066c1a004
New discovery: TestSyncEngine::testEmlLocalChecksum 2020-12-15 10:57:57 +01:00
Olivier Goffart 9bf417d930
New discovery algorithm
Some progress:
TestSyncEngine::testDirUpload
2020-12-15 10:57:56 +01:00
Olivier Goffart ec681ab2a5
New discovery algorithm: Initial work.
SyncEngineTest testFileDownload is passing
2020-12-15 10:57:56 +01:00
Kevin Ottens ba0d465e47
Revert "Merge pull request #1454 from nextcloud/syncjournal-del-prio"
This reverts commit d9fd9cfef2, reversing
changes made to 2dcf594fc6.
2020-12-15 10:57:56 +01:00
Dominik Schmidt 07f331717f
Rename ocsync library to ${APPLICATION_EXECUTABLE}_csync 2020-12-15 10:57:56 +01:00
Dominik Schmidt aad928a6be
Install libocsync to lib/ without subfolder.
Installing to lib/${APPLICATION_EXECUTABLE} has caused a bunch of
irritations in the past and subtle annoying to fix bugs. To avoid name
clashes with branded clients ${APPLICATION_EXECUTABLE} becomes now
part of the filename instead of the subfolder.

The concrete motivation to change this now is that on Windows there
is no RPATH and it's not possible to run owncloud directly from the
Craft Root folder, which is nice when you're developing on Windows.

It would have been possible to change this just for Windows but as
written earlier this has caused lots of issues and thus I think it's
a good idea to just stay consistent accross platforms when touching it.
2020-12-15 10:57:56 +01:00
Olivier Goffart cf3846c565
csync: refactor csync_s::error_string to avoid valgrind error
The problem here is that we were sometimes allocating the error_string with
qstrdup, which need to be released with delete[] and not free().

Simplify the code by using QString instead.

```
==7230== Mismatched free() / delete / delete []
==7230==    at 0x4C2E10B: free (vg_replace_malloc.c:530)
==7230==    by 0x57C2321: csync_s::reinitialize() (csync.cpp:247)
==7230==    by 0x548130F: OCC::SyncEngine::finalize(bool) (syncengine.cpp:1212)
==7230==    by 0x5481223: OCC::SyncEngine::handleSyncError(csync_s*, char const*) (syncengine.cpp:746)
==7230==    by 0x5483E78: OCC::SyncEngine::slotDiscoveryJobFinished(int) (syncengine.cpp:965)
==7230==    by 0x5495E34: QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<int>, void, void (OCC::SyncEngine::*)(int)>::call(void (OCC::SyncEngine::*)(int), OCC::SyncEngine*, void**) (qobjectdefs_impl.h:134)
==7230==    by 0x5495D92: void QtPrivate::FunctionPointer<void (OCC::SyncEngine::*)(int)>::call<QtPrivate::List<int>, void>(void (OCC::SyncEngine::*)(int), OCC::SyncEngine*, void**) (qobjectdefs_impl.h:167)
==7230==    by 0x5495CB5: QtPrivate::QSlotObject<void (OCC::SyncEngine::*)(int), QtPrivate::List<int>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qobjectdefs_impl.h:396)
==7230==    by 0xA9BF2E1: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==    by 0x64BE983: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.11.0)
==7230==    by 0x64C625A: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.11.0)
==7230==    by 0xA994BC8: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==  Address 0x225b2640 is 0 bytes inside a block of size 50 alloc'd
==7230==    at 0x4C2DC6F: operator new[](unsigned long) (vg_replace_malloc.c:423)
==7230==    by 0xA7E8FC8: qstrdup(char const*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==    by 0x53F5750: OCC::DiscoveryJob::remote_vio_opendir_hook(char const*, void*) (discoveryphase.cpp:666)
==7230==    by 0x57E1278: csync_vio_opendir(csync_s*, char const*) (csync_vio.cpp:39)
==7230==    by 0x57D718F: csync_ftw(csync_s*, char const*, int (*)(csync_s*, std::unique_ptr<csync_file_stat_s, std::default_delete<csync_file_stat_s> >), unsigned int) (csync_update.cpp:674)
==7230==    by 0x57C1B05: csync_update(csync_s*) (csync.cpp:109)
==7230==    by 0x53F5BCC: OCC::DiscoveryJob::start() (discoveryphase.cpp:718)
==7230==    by 0x54B8F74: OCC::DiscoveryJob::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_discoveryphase.cpp:494)
==7230==    by 0xA9BF2E1: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==    by 0x64BE983: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.11.0)
==7230==    by 0x64C625A: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.11.0)
==7230==    by 0xA994BC8: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==
```
2020-12-15 10:57:55 +01:00
Olivier Goffart 857afd32df
PropagateDownload: Don't discard the body of error message
We want to keep the body so we can get the message from it
(Issue #6459)

TestDownload::testErrorMessage did not fail because the FakeErrorReply
did not emit readyRead and did not implement bytesAvailable.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-12-15 10:57:55 +01:00
Christian Kamm 6dba2e8b06
Virtual files: Wipe virtual after download completes, not before
Otherwise a interrupted or unsuccessful download would mean that the
download-intend was forgotten. The next sync would reestablish the
virtual file instead.
2020-12-15 10:57:54 +01:00
Christian Kamm 97f7b5abeb
Settings migration: Preserve future settings where possible
See discussion in #6506
2020-12-15 10:57:54 +01:00
Christian Kamm 87ba4e6b9c
Config: Add version flags to accounts and folders
Also, if there is too-new configuration, backup the file, show a
warning message asking the user whether it's ok to discard the
configuration from the future.

See #6504
2020-12-15 10:57:53 +01:00
Christian Kamm aa6f5f59c4
Rename Placeholders to Virtual Files in code #6531 2020-12-15 10:57:53 +01:00
Olivier Goffart 09cacc4cd4
Blacklist: remember the X-Request-ID
Issue #6420
Store the X-Request-ID in the SyncFileItem and also in the blacklist.
Note that for consistency reason, the X-Request-ID is also in the
SyncFileItem if the request succeeds.

Currently there is no UI to access it, but it can be queried with sql
commands
2020-12-15 10:57:53 +01:00
Christian Kamm ddeeecd061
Rename "placeholder" feature 2020-12-15 10:57:53 +01:00
Christian Kamm 8b6ac63ddb
Placeholder: Don't contain "stub" 2020-12-15 10:57:52 +01:00
Christian Kamm 765c12dae1
LocalDiscoveryTracker: Separate from Folder and move to libsync
To allow relevant code to be closer together and for testing in
unittests without having to get a gui Folder.

See #6120
2020-12-15 10:57:51 +01:00
Olivier Goffart 7969067f80
Logger: Guard zlib usage by ZLIB_FOUND
Similar to the use for the checksum.
I know that zlib is required in principle, but i don't have it
in one of my test building environment, and it is easier to just
disable it.
2020-12-15 10:57:51 +01:00
Kevin Ottens b1dc14977f
Get TestDownload to pass
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-12-15 10:57:51 +01:00
Olivier Goffart 4eb8997519
Download: Remove useless code and add a test
From issue #7015, the code is wrong because the path is the file system path and
not the path on the DB.
But since this is a conflict, this means the reconcile will still want to download
the file from the server next sync, so we need not to worry about this case
2020-12-15 10:57:50 +01:00
Olivier Goffart 718843ffce
Download: Use the <s:message> from the reply in the error message if any
Issue: #6459
2020-12-15 10:57:50 +01:00
Christian Kamm 27c8bce0b9
Wizards: Show placeholder option only if showExperimentalOptions is set
This config file option will also control other features in the future.
2020-12-15 10:57:50 +01:00
Christian Kamm 40f2303166
SyncOptions: Add default placeholder suffix
Otherwise each test has to set this up anew.
2020-12-15 10:57:49 +01:00
Christian Kamm d6078f958b
Placeholders: Download from shell integration 2020-12-15 10:57:49 +01:00
Olivier Goffart 91f53521ae
Placeholder: The extension is now a branding option 2020-12-15 10:57:49 +01:00
Christian Kamm b1de184bc8
Placeholders: Safe migration to older client versions
Now the db entries for placeholders will have the full placeholder
paths. That way older clients will, on remote discovery, delete the
placeholders and download the real files.
2020-12-15 10:57:48 +01:00
Olivier Goffart 1049fb74d9
Placeholders: Move the placeholder option from the account to the folder 2020-12-15 10:57:48 +01:00
Christian Kamm f5cf03b6a6
On-demand downloading: Placeholder-file based prototype
- Controled by an option.
- New remote files start out as ItemTypePlaceholder, are created with a
  .owncloud extension.
- When their db entry is set to ItemTypePlaceholderDownload the next
  sync run will download them.
- Files that aren't in the placeholder state sync as usual.
- See test cases in testsyncplaceholders.

Missing:
- User ui for triggering placeholder file download
- Maybe: Going back from file to placeholder?
2020-12-15 10:57:43 +01:00
Dominik Schmidt a50c665051
Simplify Sparkle handling in CMake 2020-11-25 09:43:59 +01:00
Christian Kamm a8ad946758 Settings: Add update channel combobox #6259 2020-11-24 18:22:33 +00:00
allexzander 665a8c4217 Use dynamic path for account online/offline state icon. Refresh GUI on connection state change.
Signed-off-by: Alex Zolotov <alex.zolotov.nextcloud.com>
Signed-off-by: allexzander <blackslayer4@gmail.com>
2020-11-23 17:49:25 +02:00
Kevin Ottens 3427dadaeb
Get rid of FindQt5Keychain.cmake
QtKeychain provides Qt5KeychainConfig.cmake and friends nowadays, so no
need to have a less reliable and outdated find module on our end.

Also this shows that we were including keychain.h in the wrong way and
were not using the link target, so both got fixed as well.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-02 13:19:48 +01:00
Christian Kamm 00e901f5a7
SocketAPI: Introduce conflict resolution actions #6252
For conflicts generally as well as new files in read-only directories
the context menu will now present delete and move options.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 16:40:10 +02:00
Christian Kamm f62be57ef2
FileSystem: make removeRecursively() reusable
We want to use it for deleting directory conflicts.
2020-10-22 16:39:17 +02:00
Christian Kamm e70371f408
FileSystem: Fix bad indentation 2020-10-22 16:39:17 +02:00
Kevin Ottens 7536e4c00b
Expose the branding related members of Theme as properties
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 13:46:04 +02:00
Kevin Ottens 10cb4170c7
Don't use depth infinity anymore to get the folders e2ee status
This way we avoid the expensive SQL query on the server at the price of
more round-trips since we're doing the recursive traversal by hand now.

Also it turns out this depth was used for all the other propfind calls
during sync when we want fresher information regarding a folder. This
was very inefficient in all cases and won't happen anymore.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:59 +02:00
Kevin Ottens b5fdbefb0e
Make sure jobs don't outlive ClientSideEncryption
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:58 +02:00
Kevin Ottens 399b97442e
Factor out the logic to start a new e2ee status job
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:58 +02:00
Kevin Ottens cbc40b5a15
Mention the folder we listed in the debug logs
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:58 +02:00
Kevin Ottens 8e3ca71763
Change the way we store the job result
If there's more than one job we need to unite the maps not simply overwrite
them.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:58 +02:00
Kevin Ottens 9aeb7046d2
Start managing a list of GetFolderEncryptStatusJob
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:58 +02:00
Kevin Ottens cfb66ddadd
Add a way to know which folder was listed for encrypted status
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:58 +02:00
Michael Schuster 61dc4b9137
Update comments
Everyone uses their private mail, so ensure people can get in touch.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-15 02:18:52 +02:00
Kevin Ottens a53a87a3eb
Export the WordList functions
Now that they are used from gui/ they need to be properly exported so
that linking doesn't fail when visibility is activated (only on our
Windows build it seems).

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-08 15:58:29 +02:00
Kevin Ottens ab67741d87 Use setHeader instead of setRawHeader for the user agent
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-08 05:55:47 +00:00
Kevin Ottens 50dd715f4d Don't force user agent if one is already set on the request
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-08 05:55:47 +00:00
Kevin Ottens 607347289e Expose more of the logger state
It is better to rely on the Logger state to know exactly where we're
logging. Indeed due to the the various ways to impact its state the
config alone might not now where we're logging.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 13:33:20 +00:00
Kevin Ottens b0a38816fc Change the defaults for logging
Turn on the logging by default for everyone. Let's use a log dir within
the config directory of the application and have debug logs expiring
after a day.

This obviously means we'll generate quite some logs but with the
automated compression it shouldn't be too horrible. Obviously that
scales with the amount of files and syncs occurring. In our tests with a
large setup we're around 100 MB for a day worth of logs, this shouldn't
be too much of an issue on today's average desktop/laptop.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 13:33:20 +00:00
Kevin Ottens e356acbcee Add sharePublicLinkAskOptionalPassword to Capabilities
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 09:43:47 +00:00
Aldaris1985 ef6773bd60 Update propagateupload.cpp
Typo corrected.
2020-10-01 21:26:17 +00:00
Michael Schuster ce71ffe9f9 Allow server URL to be pre-defined without enforcing it to be used unmodified
APPLICATION_SERVER_URL can be either empty or be specified. This commit adds the new CMake option APPLICATION_SERVER_URL_ENFORCE to decide whether to enforce the
URL's unmodified use (like before, default: ON) or to allow modification by the user (new).

By default APPLICATION_SERVER_URL_ENFORCE is set to ON, to no break with the previous implementation's expectations.

If APPLICATION_SERVER_URL is empty, APPLICATION_SERVER_URL_ENFORCE will be ignored by the Account Wizard.

The previous behaviour confused me a bit with branded builds. When the URL was (usually) specified but not forced, it was simply discarded, forcing the user to
manually supply it.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-09-23 07:21:35 +00:00
Kevin Ottens 80cc196f6f Enable bugprone-narrowing-conversions clang-tidy check
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-01 06:37:03 +00:00
Kevin Ottens c8ea848596 Enable the bugprone-branch-clone clang-tidy check
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-01 06:37:03 +00:00
Kevin Ottens eb76682b1e Use httpd/unix-directory mimetype for E2EE folders
We don't do much with that mimetype on our end, but other clients
somehow don't expect inode/directory to let's lie. ;-)

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-31 10:08:48 +00:00
Michael Schuster 5945f18d5a
Remove remaining QLinkedList includes in addition to #2300
Now the only remaining reference is in:

src/3rdparty/libcrashreporter-qt/3rdparty/drkonqi-parser/backtraceparser.cpp:269:        || line.functionName().startsWith(QLatin1String("QLinkedList")

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-27 03:12:09 +02:00
Michael Schuster bd519ffe7a
Adapt code style in addition to #2300
- Use "!empty()" instead of "size() > 0" in std::list
- Add comments for namespace brackets

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-27 01:31:06 +02:00
V.C b20ea25201 Code review changes implemented
Code review changes implemented for bandwidthmanager.cpp
1. Use auto instead of size_t
2. Check for empty instead of size comparisions

Signed-off-by: V.C <c******@rediffmail.com>
2020-08-26 02:45:20 +00:00
V.C af1bb7e98c Support client builds on VS2019
Scenario: Build fails on Qt 5.15.0 + VS2019 16.7.2
Root cause: QLinkedList seems to be depreciated. Advise to use std::list instead.
Fix: Used std::list insead of QLinkedList.

Signed-off-by: V.C <c******@rediffmail.com>
2020-08-26 02:45:20 +00:00
Kevin Ottens f6e36523d2 Make sure we don't assert when calling fileStatus
It happens that sometimes we leak a directory path ending with a slash,
but that violates fileStatus' precondition so let's catch it early and
skip such path.

Of course the right fix would be a larger swipe in the sync engine and
around it to not use naked strings anymore but rely on the typesystem.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-18 13:52:28 +02:00
Olivier Goffart a7847a4e82
Upload: Store the size in the UploadInfo, and compare it when resolving potential conflict
This is about the conflicts that happens when the file has been uploaded
correctly to the server, but the etag was not recieved because the connection
was closed before we got the reply.

We used to compare only the mtime when comparing the uploaded file and the
existing file.  However, to be perfectly correct, we also should check the
size.

This was found because TestChunkingNG::connectionDroppedBeforeEtagRecieved is
flaky. Example of faillure found in https://drone.owncloud.com/owncloud/client/481/5
while testing PR #6626

(very trimmed log:)

06-29 07:58:02:015 [ info sync.csync.csync ]:	## Starting local discovery ##
06-29 07:58:02:016 [ info sync.csync.updater ]:	Database entry found, compare: 1530259082 <-> 1530259051, etag:  <-> 1644a8c8750, inode: 1935629 <-> 1935629, size: 301 <-> 300, perms: 0 <-> ff, type: 0 <-> 0, checksum:  <-> SHA1:cc9adedebe27a6259efb8d6ed09f4f2eff559ad1, ignore: 0
06-29 07:58:02:016 [ info sync.csync.updater ]:	file: A/a0, instruction: INSTRUCTION_EVAL <<=
06-29 07:58:02:972 [ warning sync.networkjob ]:	QNetworkReply::NetworkError(OperationCanceledError) "Connection timed out" QVariant(Invalid)
.. next sync...
06-29 07:58:02:980 [ info sync.engine ]:	#### Discovery start ####################################################
06-29 07:58:02:981 [ info sync.csync.csync ]:	## Starting local discovery ##
06-29 07:58:02:983 [ info sync.csync.updater ]:	Database entry found, compare: 1530259082 <-> 1530259051, etag:  <-> 1644a8c8750, inode: 1935629 <-> 1935629, size: 302 <-> 300, perms: 0 <-> ff, type: 0 <-> 0, checksum:  <-> SHA1:cc9adedebe27a6259efb8d6ed09f4f2eff559ad1, ignore: 0
06-29 07:58:02:983 [ info sync.csync.updater ]:	file: A/a0, instruction: INSTRUCTION_EVAL <<=
06-29 07:58:02:985 [ info sync.csync.csync ]:	## Starting remote discovery ##
06-29 07:58:02:985 [ info sync.networkjob ]:	OCC::LsColJob created for "http://localhost/owncloud" + "" "OCC::DiscoverySingleDirectoryJob"
06-29 07:58:02:987 [ info sync.csync.updater ]:	Database entry found, compare: 1530259082 <-> 1530259051, etag: 1644a8c8b26 <-> 1644a8c8750, inode: 0 <-> 1935629, size: 301 <-> 300, perms: ff <-> ff, type: 0 <-> 0, checksum: SHA1:5adcdac9608ae0811247f07f4cf1ab0a2ef99154 <-> SHA1:cc9adedebe27a6259efb8d6ed09f4f2eff559ad1, ignore: 0
06-29 07:58:02:987 [ info sync.csync.updater ]:	file: A/a0, instruction: INSTRUCTION_EVAL <<=
06-29 07:58:02:989 [ info sync.csync.csync ]:	Update detection for remote replica took 0.004 seconds walking 13 files
06-29 07:58:02:990 [ info sync.engine ]:	#### Discovery end ####################################################  9 ms
06-29 07:58:02:990 [ info sync.database ]:	Updating file record for path: "A/a0" inode: 1935629 modtime: 1530259082 type: 0 etag: "1644a8c8b26" fileId: "16383ea4" remotePerm: "WDNVCKR" fileSize: 301 checksum: "SHA1:cc9adedebe27a6259efb8d6ed09f4f2eff559ad1"
06-29 07:58:02:990 [ info sync.csync.reconciler ]:	INSTRUCTION_UPDATE_METADATA    client file: A/a0
06-29 07:58:02:990 [ info sync.csync.csync ]:	Reconciliation for local replica took  0 seconds visiting  13  files.
06-29 07:58:02:990 [ info sync.csync.reconciler ]:	INSTRUCTION_UPDATE_METADATA    server dir:  A
06-29 07:58:02:990 [ info sync.csync.csync ]:	Reconciliation for remote replica took  0 seconds visiting  13  files.
06-29 07:58:02:990 [ info sync.engine ]:	#### Reconcile end ####################################################  9 ms
06-29 07:58:02:990 [ info sync.database ]:	Updating local metadata for: "A/a0" 1530259082 302 1935629
FAIL!  : TestChunkingNG::connectionDroppedBeforeEtagRecieved(small file) '!fakeFolder.syncOnce()' returned FALSE. ()
2020-08-13 16:46:08 +02:00
Christian Kamm c74c0d8e6e
Upload: Add more chunk resuming unit tests #6405 2020-08-13 16:45:55 +02:00
Kevin Ottens 866ffc2a6b Enable the modernize-loop-convert check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-13 12:55:14 +00:00
Kevin Ottens 0e2af4b502 Enable the modernize-deprecated-headers check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-13 14:53:52 +02:00
Kevin Ottens 2f8c29082a Enable the modernize-use-equals-default check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-13 14:19:42 +02:00
Kevin Ottens cdf6e7d72b Enable the modernize-user-nullptr check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 19:45:25 +02:00
Kevin Ottens d58ec4bf70
Enable the modernize-use-using check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 18:18:57 +02:00
Kevin Ottens 3e79e1861b
We don't really need two \ here
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 09:48:33 +02:00
Kevin Ottens ef3c516598
Add support for BASE64 encoded '|' when decrypting
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 13:13:19 +02:00
Kevin Ottens 595eb78c8a
Move the private key salt handling in its own function
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 13:13:19 +02:00
Kevin Ottens d5339265fb
Ignore the salt part of the key during decryption
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 13:13:19 +02:00
Kevin Ottens 54a19945fd
Restore the symmetry between *StringSymmetric functions
If we receive data without base64 encoding for encryption, it makes
sense to get it without base64 encoding out of decryption.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 13:13:19 +02:00
Kevin Ottens 26b88131cc
Add unit tests for the encryption helpers
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 13:13:19 +02:00
Kevin Ottens 66ede652f8 Use PNGs for branded clients
For branded clients try to load a png of the right size, for unbranded
clients use the SVGs. If something fails at load time skip it.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens 72eba2b93d Move the svg rendering part in a lambda
This simplifies the loop body a bit, opening the door to what's next.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens 73c3aa7898 Extract the svg renderer from the loop
No need to recreate it each time for nothing.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens 16a37c6aa0 Branded clients have more size variety for their icons
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens 983c02b6db Switch to for range loop
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens 14ecf535f9 Let Theme tell us if we're branded or not
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens f46276d70d Update our E2E API requirement
Now that we adjusted our protocol to follow the slightly updated server
API, let's make sure we don't try to talk to a server with an older API.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 18:39:29 +02:00
Kevin Ottens c369d33015
Disable parallelism if we think the parent is e2e
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 13:05:54 +02:00
Kevin Ottens cfd3771818
Allow to override the parallelism
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 13:05:11 +02:00
Kevin Ottens 5cfbf34501
Move PropagateRemoteMkdir ctor to the cpp file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 13:03:55 +02:00
Dominique Fuchs 19d46f0541 Merge branch 'fix-delete-base-folders-instr' of https://github.com/Nextcloud/desktop into fix-delete-base-folders-instr 2020-07-09 21:47:34 +02:00
Dominique Fuchs f8920f969f Remove debug variable
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-09 21:47:19 +02:00
Dominique Fuchs 8deb38ac24
Merge branch 'master' into fix-delete-base-folders-instr 2020-07-09 21:38:11 +02:00
Dominique Fuchs d47e570ff3 Prevent empty FileMap in local csync to be processed if folder not empty
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-09 21:23:24 +02:00
Kevin Ottens 3ccac1b1be Properly register folder as encrypted during sync
Turns out that when we added a new e2e folder during sync, we were
passing the wrong path to the e2e object. We have several path
convention in the sync code, just happened to be the wrong one.

I still long for the day when we'll use the type system to deal with
paths. All those strings are error-prone.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 17:16:21 +02:00
Kevin Ottens 26686ecd45 Recover from missing metadata on uploads
Other clients seem to allow creating empty encrypted folders with no
metadata associated to them, so let's get ready to handle it. In case of
a 404 to get the metadata, we create an empty metadata payload and pass
it further down.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 4ef42e53d3 Change the separator in the private key
It used to be a base64 encoded '|', now it is still a '|' but not
encoded, let's adjust accordingly.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 3c20b2414e Prevent parallelism when deleting encrypted files
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 1be869fdc7 Unlock the folder only after we actually deleted the file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 8e0ab5ce47 Allow to specify the e2e-token on DeleteJob
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 0575d0e793 Stop unlocking from within PropagateRemoteDeleteEncrypted
We need to finish deleting the file before we can actually unlock. Also
the token will be necessary for the delete to succeed.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 7e251edd6e Compare the unencrypted filename with the originalName
Otherwise obviously we'd never find the files in the metadata.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 2831b22be4 Use the encrypted path for collection listing
If we use the local path we'll get a 404.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 511a6e66dc Pass e2e-token to PropagateUpload subjobs
The headers() method is used to pass extra headers to the PUT jobs for
instance, definitely needed for uploads now.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 9a4c63404d Pass the e2e-token for encrypted MKCOL
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 01f5501ad8 Allow to pass extraHeaders to a path based MkColJob
We could specify the extra headers with a URL but not a simple path.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens e14ae806b6 E2EE RFC has been updated to use e2e-token instead of token
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Stephan Beyer 293be2c2e6 Remove redundant initialization of HttpCredentials::_keychainMigration
The value gets already initialized by default member initialization,
so there is no need to set it again.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer a9de465927 Remove redundant initialization of SyncFileStatus::_shared attribute
The value gets already initialized by default member initialization,
so there is no need to set it again in the copy constructor.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer ed570d6274 Use default member init for PKeyCtx::_ctx and PKey::_pkey
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Kevin Ottens c2632eb604 Handle properly null avatar
If we try to produce the avatar before we managed to connect we'd end up
trying to paint in a null image. Just return early, which will allow the
caller to do something else instead.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-07 18:07:33 +02:00
Kevin Ottens 217869e95c Decode the href from the XML payload
The XML we get as reply has href entities properly percent encoded.
Since we didn't go through QUrl next we didn't get a properly decoded
version. Make sure we decode it before storage.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-07 15:51:24 +00:00
Kevin Ottens f90d6951c2 No need to compute base at each loop run
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-07 15:51:24 +00:00
Michael Schuster f4d83d02f6
Cleanup auto pointers and qobject casts, refactor KeychainChunk
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:40 +02:00
Michael Schuster 8503226c44
Keychain: Use auto deletion in WebFlowCredentials and ConfigFile
- Also make use of the new KeychainChunk::DeleteJob

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:40 +02:00
Michael Schuster 42eb3388f8
Refactor KeychainChunk to use QEventLoop and add DeleteJob class
- Use QEventLoop for synchronous exec()
- Rename startAwait() to exec()
- Add code for auto deletion
- Add new DeleteJob class
- Cleanup, tweaks

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:40 +02:00
Michael Schuster 81c644e702
ConfigFile security: Migrate Proxy password to keychain
When specified in the config file, the Proxy password will be migrated
to the keychain, for backward compatibility and to allow admins to
overwrite an existing password by rolling out updated config files.

Once migrated to the keychain, the password will be removed from the
config file.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:39 +02:00
Michael Schuster 18cbbc5052
KeychainChunk: Add synchronous method startAwait()
Awaits completion with no need to connect some slot to the finished() signal first,
inspired by the ProxyAuthHandler class.

Also add:
- Job dtor to safely erase passwords
- textData() method
- New ctor overloads to work with arbitrary keys (without Account ptrs)

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:39 +02:00
Michael Schuster 2a3ef044be
Move KeychainChunk class from gui to libsync
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:39 +02:00
asemmar 628a426d22 forgot some indent
Signed-off-by: asemmar <anis.semmar@itron.com>
2020-07-06 09:46:14 +02:00
asemmar d5587e386c fixed bad spelling of word 'retreive' except in sqlite dependancy
Signed-off-by: asemmar <anis.semmar@itron.com>
2020-07-06 09:46:14 +02:00
Kevin Ottens 0b1cf69134 Update the metadata table with encryption info before discovery
When the ClientSideEncryption object is fed, also serialize the
encryption info of the folders inside the metadata table.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 05:27:14 +00:00
Kevin Ottens 287a130044 Also deliver the encrypted status via the ClientEncryption signal
This will turn useful for other consumers of that data. The alternative
would be to expose a method breaking all form of encapsulation.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 05:27:14 +00:00
Kevin Ottens 3520360159 Move the e2e information fetch even earlier
We used to do it when the propagation starts, let's do it even before
the discovery starts. This way we'll have a chance to exploit the
information during the discovery phase.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 05:27:14 +00:00
Kevin Ottens f98c7990ba Split the discovery phase out of startSync()
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 05:27:14 +00:00
Kevin Ottens 5a07a36d06 Avoid job parallelism when uploading to an encrypted folder
With the current design of the file upload this necessarily pushed to a
lock starvation on the folder. Indeed you could end up with N jobs
asking for the lock at the same time. So just avoid parallelizing for
now even though it will be slow.

We could try to optimize but that'd require some serious changes to the
sync logic on the jobs... let's stabilize first and optimize later.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 17:11:57 +00:00
Kevin Ottens 27b982ceaf Override parallelism() for uploads
This way we'll be able to control parallelism for upload jobs.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 17:11:57 +00:00
Kevin Ottens 5e20e2b46f Move PropagateUpload ctor impl to the cpp file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 17:11:57 +00:00
Kevin Ottens d2e8cd4469 Deal properly with encrypted item updates accross connections
In such cases we get a download for which _file is already the demangled
name and _encryptedFileName has the mangled information. This is
different to what we encountered so far where initially _file was
mangled and _encryptedFileName was empty. Let's deal with that case
properly.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens 3204c15911 Better separate between absolute and relative paths on uploads
Yes... I still wish this would be all driven by the type system, would be
much less error-prone.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens 8d5c79c219 Better separate between absolute and relative paths on downloads
I wish this would be all driven by the type system instead of
error-prone string concatenation everywhere. That will be for a (much)
later refactoring hopefully.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens 8a181adb3a Always use an absolute remote path for GetFolderEncryptStatusJob
It turns out this job expected an absolute remote path even in the case
of a subfolder sync point.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens fdceb1f2d2 Allow to control logFlush from the config file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:10:56 +02:00
Kevin Ottens f557dd7792 Allow to control logDir from the config file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:10:53 +02:00
Kevin Ottens be2d9d4838 Allow to control logExpire from the config file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:10:50 +02:00
Kevin Ottens 808fb17809 Allow to control log debug from the config file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 15:56:23 +02:00
Kevin Ottens 7996eaae82 Have a filter rule capturing all of nextcloud debug
This was half broken before that commit and the previous one since some
of the categories would not be captured.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 15:39:52 +02:00
Kevin Ottens 53c31f5fed Make sure all our logging categories start with nextcloud.
Otherwise it was a bit confusing and annoying for filter rules:
e.g. "nextcloud.sync.*" vs "sync.*".

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 15:39:52 +02:00
Kevin Ottens 90f757b96b Repair the log message pattern
At last it will become useful again...

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 15:39:52 +02:00
Hannah von Reth 5a05c2d6cd [Logger] Ensure log file is flushed before crash 2020-07-01 15:13:20 +02:00
Hannah von Reth cd96b4a265 [Logger] Ensure errors are also printed to an attached console 2020-07-01 15:13:20 +02:00
Olivier Goffart 44fc881ced Logger: Remove the thread pointer from the log.
We don't do discovery in a thread or use many threads anymore so this is
just noise.

Also use of QString::sprintf is deprecated, and C cast.
2020-07-01 15:13:20 +02:00
Hannah von Reth 669e42edd1 [Logger] Correctly handle message priority
This fixes the flodded sys log.

Fixes: #7453
2020-07-01 15:13:20 +02:00
Hannah von Reth a57bf0c899 Print critical and fatal messages to stderr
That way we might get a reason why the client crashes (dev setup)
2020-07-01 15:13:20 +02:00
Christian Kamm 039d885b76 LogDir: Compress last logfile on restart
For #7353
2020-07-01 15:13:20 +02:00
Kevin Ottens 09c9a1c5bc Properly guard io.h since it is Windows only
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 15:13:20 +02:00
Dominik Schmidt b171bd991d Make -logfile - work on Windows 2020-07-01 14:54:52 +02:00
Dominik Schmidt fd493a0598 Make qFatal() trigger the crash reporter on Windows 2020-07-01 14:54:32 +02:00
Valdnet d526f9e073 Delete a space character
Delete a space character before the line breaks
2020-07-01 14:10:49 +02:00
Kevin Ottens d7a9a4cd09 Fix parenting issues of PropagateUploadEncrypted
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 3182c613ac Take care of mangled paths on download as well
This means adjusting PropagateDownloadEncrypted so that it knows where
the file will end (otherwise it would create temporary files in non
existant paths for instance).
In turn we have to adjust PropagateDownloadFile accordingly so that it
resolves the local folder the file will end up in.
And last we adjust PropagateLocalMkdir to resolve paths as well and
demangle as needed.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 6dc12166ad Update the item even if we don't call decryptFile()
This way it makes it usable in a directory context.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 2abc3ce2f5 Stop leaking PropagateDownloadEncrypted objects
We give them a parent to make sure they will be destroyed when the jobs
which created them are destroyed themselves.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 710c470c13 Assume that folder paths can be mangled
PropagateUploadEncrypted made the assumption of the folder names never
being mangled. This is not true since the previous commits so make sure
we properly deal with that using the journal db.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 3e13919c35 Use QHash instead of QMap
This is not only a question of performances in our case (complexity
being better on look ups). It also provides a few more services.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 3db267a03b Ensure GetFolderEncryptStatusJob gets all the folders
We ensure the PROPFIND Depth is infinity by explicitly specifying the
header (turns out our implementation just doesn't assume infinity
otherwise). This way we have a clear picture about *all* the folders of
the user, otherwise ClientSideEncryption couldn't be a trustable oracle
on the encryption state for any folder not on the root and all the
encryption code assumes it has a full picture of encryption.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens f93fdafa80 Finally encrypt subdirectories during sync
We catch when a directory is inside a known encrypted folder and in such
a case we now do the following:
 1) we encrypt the folder meta data (its name) properly and create it
    under that mangled name on the server side
 2) we mark the new folder itself as encrypted

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 319e441653 Make PropagateUploadEncrypted reusable in a directory context
It was assuming we'd encrypt only files but directory names also need to
be encrypted. We just skip the writing to temp file part in that case.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 74978a23fb Move the encrypt folder logic in a reusable job class
This way this whole logic isn't stuck into the settings dialog anymore.
Also cleaned up the unused "decrypt folder" logic.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens b3fb730d5a Use the propagator to trigger the e2e info fetch
This is a much better place than the GUI, this way we ensure the
propagator is always operating of up to date information. Previously if
the propagator kicked in without user interaction from startup (not
showing the settings dialog) it would have no E2E information available
whatsoever... unsurprisingly it would thus take wrong information at
every turn.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 5f611d6e39 Get ClientSideEncryption to notify when folder info fetch is done
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 76fbbfefa5 Fix typo
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 5afcf71e68 Fix typo
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Michael Schuster 902963fa10 Fix issue #2108: Default system proxy not working with Account Wizard
Discovered on Windows in conjunction with PAC scripts:
- Already configured accounts worked
- Fresh client account setup did not work

Reason:
- Proxy was reset over and over again in Account::setCredentials

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-22 11:59:13 +02:00
Michael Schuster 92c8d6836b
Fix libsync exports for proxy changes in #1886
Build failed on Windows, missing libsync export for printQNetworkProxy after
moving ClientProxy class from gui to libsync.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-18 21:05:11 +02:00
Michael Schuster 0253e98041
Improve proxy logging: Log type string instead of abstract ID
The format in the client log was: 3://host:port
Now it is shown like:             HttpProxy://host:port

The old ID display was confusing and misleading users (and people debugging it ;p)

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-18 20:13:57 +02:00
Roeland Jago Douma 50dcab5f88
Move the proxyfiles to libsync where they make more sense
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-18 18:38:06 +02:00
Michael Schuster 456c1eadbe
Simplify nullptr comparisons where appropriate
Make the codebase consistent, we already have a lot of implicit pointer comparisons.

Exception: Stay explicit on return's, example:
  return _db != nullptr;

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-11 00:27:30 +02:00
Michael Schuster 221e5c5fc4
Improve command line version info and help display to streamline gui and cmd
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-07 14:20:33 +02:00
Michael Schuster 0fe7a65738
Fix Qt 5.15.0 build error (missing include)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-07 02:43:45 +02:00
Kevin Ottens e3e262e42e Use default member init when applicable
This also fixes a couple of warnings at places (out of order init for
instance) and a potential bug in the webflow credentials / qtkeychain
integration.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-03 16:10:39 +02:00
Camila San 3bae570f29 Do not declare local variables without an initial value.
Signed-off-by: Camila San <hello@camila.codes>
2020-06-03 07:50:40 +00:00
Ivan Čukić c800d9149e Show a broken lock icon for unencrypted subdirectory
The E2E application allows creating unencrypted subdirectories
in an encrypted parent. This is a big privacy problem.

This patch shows a red broken lock icon for these subdirectories
in the NC client UI.

Signed-off-by: Ivan Čukić <ivan.cukic@kde.org>
2020-06-02 15:50:18 +00:00
Ivan Čukić 4fb370275d Introduced RAII classes for other OpenSSL resources 2020-06-02 14:09:06 +00:00
Ivan Čukić c31b1a750d Fixing memory leaks in the encryption module
Due to usage of early-returns, combined with malloc/free,
several buffers that get allocated are leaked when an error
occurs.

Several functions had potential leaks:

 - `encryptStringSymmetric` leaked `ctext`
 - `EncryptionHelper::fileDecryption` leaked `out`
 - `EncryptionHelper::fileEncryption` leaked `out`

Most of the functions had leaks of the cypher context.

This patch uses `QByteArray` as the handler for the dynamically
allocated buffers for openssl to operate on. This also removes
the need for conversions from malloc'd buffers to `QByteArray`
variables previously present in the code.

It also introduces a `CypherCtx` thin wrapper class to provide
a leak-free handling of `EVP_CIPHER_CTX`.
2020-06-02 14:09:06 +00:00
Kevin Ottens 6e62c8b430 Use the return braced init list pattern
This way we avoid repeating the return type while it is already known.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-27 14:36:07 +02:00
Michael Schuster ccc409dbd0
Merge pull request #2024 from nextcloud/use_raw_string_literals
Use raw string literals when appropriate
2020-05-27 05:54:54 +02:00
Michael Schuster 044a4bf6b5
Merge pull request #2021 from nextcloud/use_default_for_trivial_ctor_and_dtor
Use = default for trivial ctors and dtors
2020-05-27 05:17:24 +02:00
Michael Schuster 4b2684cf4a
Merge pull request #2019 from nextcloud/remove_redundant_void_argument
Remove redundant void argument list
2020-05-27 05:07:52 +02:00
Kevin Ottens f5350db078 Use raw string literals when appropriate
This is especially nice for Windows paths.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-26 20:13:51 +02:00
Kevin Ottens a73a1f3927 Use = default for trivial ctors and dtors
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-25 21:33:24 +02:00
Kevin Ottens 65e6c445e5 Remove redundant void argument list
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-25 20:32:55 +02:00
Kevin Ottens 86b1821251 Remove redundant initializer
This is the same value than the initializer value in the header, no need
to repeat it.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-25 20:12:09 +02:00
Stephan Beyer 375fcb8e14 Replace "https://..." hint by "https://host:port"
The new hint is a little more verbose and provides more information
than the old one.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-23 18:32:18 +02:00
Stephan Beyer f46ce2ce98 Show URL placeholder hint in wizard
In owncloudsetupnocredspage.ui, the URL input field leUrl has a
placeholder text saying "https://..." which is a very useful hint
for the user.  However, in the OwncloudSetupPage constructor, the
placeholer text is overwritten by the return string of the theme's
wizardUrlHint() method.  The NextcloudTheme class does not override
this virtual method, so an empty string is used.

To make available the "https://..." hint, it is moved from the
UI file to NextcloudTheme::wizardUrlHint().  Note that, if a
theme is used which does not allow a custom server URL, the
placeholder text is now empty.  This makes sense because the
input field is disabled in that case.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-23 18:32:15 +02:00
Kevin Ottens 712869db9a Use auto to avoiding repeating type names
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-20 03:54:41 +02:00
Kevin Ottens dea6ebaa35 Use nullptr when appropriate
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-20 02:21:26 +02:00
Kevin Ottens 4d1ff01654 Properly handle denormalized href
In case of denormalized paths in the dav href (presence of . or .. in
the path) simple string startsWith comparison wasn't enough to know if
said href ended up in the right namespace. That's why we're now using
QUrl (pretending local file since we don't have a full URL in the href)
to normalize the path before comparison.

This could happen with broken proxies for instance where we would
wrongly validate the dav information resulting in potentially surprising
syncing and name collisions.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-18 19:33:34 +02:00
Kevin Ottens 9000a880cb Don't silently kill debug messages
The message handler globally installed by the logger silently drop
messages if the logger is not logging. On top of it, it doesn't log
debug messages by default.

Anything not logged is currently silently discarded. This can come as a
surprise to a developer trying to contribute for the first time and
adding some debug message for some reason.

We're thus trying to strike a middle ground which is that debug messages
get a regular output if the logger isn't interested in them.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-12 17:33:13 +02:00
Sandro Knauß 6cdae6c19e Fix typos.
Debian has a list of known typos in their checking tools.

Signed-off-by: Sandro Knauß <hefee@debian.org>
2020-05-04 18:11:36 +00:00
István Váradi 3d44a71755 Qt 5.5 compatibility #ifdef
Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
2020-04-23 20:22:30 +02:00
Nicolas Fella 1afda2b875 Fix container detaching
Found by clazy

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-03-21 01:24:37 +01:00
Michael Schuster 78776f81e4
Merge pull request #1847 from nextcloud/enh/updater
Updater: Enhance UI, make build optional
2020-03-10 15:53:47 +01:00
Michael Schuster c043a4e55c Updater UI: Implement auto-update option and update button
- Add checkbox and button to UI
- Add new parameter autoUpdateCheck to ConfigFile

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-09 02:34:55 +01:00
Michael Schuster 2adde0fcca
Settings dialog About section: Show minimal version info
- Application name, version number, OS

  Example: Nextcloud Desktop Client
           Version 2.6.4 (macOS)

- Keep previous version info in new method Theme::aboutDetails()

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-07 06:38:09 +01:00
Michael Schuster a471868d88
Version parameter: Show Qt platform plugin, OS and CPU arch
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-07 06:31:14 +01:00
Michael Schuster f90f31756a
Fix build with older Qt: Disable http2 for now due to Qt bug, add env var (upstream)
Disable http2 for now due to Qt bug but allow enabling it via env var, see: https://github.com/owncloud/client/pull/7620
  and: https://github.com/nextcloud/desktop/pull/1806
Issue: https://github.com/nextcloud/desktop/issues/1503

Co-authored-by: XNG <Milokita@users.noreply.github.com>
Co-authored-by: Hannah von Reth <hannah.vonreth@owncloud.com>

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-02 01:47:00 +01:00
XNG e2066b317b
Disable http2 for now due to Qt bug
So that user may continue to use http2 on their webpage

Signed-off-by: XNG <Milokita@users.noreply.github.com>
(cherry picked from commit dad95d4e4617211360bf2b4391e29c341e939844)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-02 01:27:04 +01:00
Michael Schuster 5b2877a63e
Merge branch 'master' into resource-cleanup
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-01 05:34:12 +01:00
Michael Schuster 9c8a0204e5
Updater: Add query-parameter 'updatesegment' to the update check
Used to throttle down desktop release rollout in order to keep the update servers alive at peak times.

See: https://github.com/nextcloud/client_updater_server/pull/36

Targeted issues: #1795, #1800

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-02-21 21:28:42 +01:00
Michael Schuster 5554488dd8
Merge pull request #1768 from nextcloud/umlaut-sync-fix
Fix wrong encoding when specifying extra header with if-match path
2020-02-17 01:49:48 +01:00
Michael Schuster 640655ea10
Code cleanup
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-02-14 03:00:20 +01:00
Dominique Fuchs c69aba9b44 Fix wrong encoding when specifying extra header with if-match path
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-02-02 13:35:16 +01:00
Dominique Fuchs bb757c6a27 Merge branch 'master' into resource-cleanup
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-01-19 20:44:59 +01:00
Michael Schuster 8c2d77c68f
Merge pull request #1699 from Milokita/test-file-fix
apply http2 qt resend patch from owncloud
2020-01-19 18:11:36 +01:00
Dominique Fuchs 01e9343d8b Cleanup/Removal/Adaption/Update to resource files and crresponding code, esp. regarding svg usage
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-01-18 17:47:17 +01:00
Michael Schuster 45b39cdbc1
Add support for the directEditing capability
- Fetch in ConnectionValidator::slotCapabilitiesRecieved
- Add editors to a list made of the new DirectEditor class

TODO:
- Add support for re-fetch and continously check for changes (ETag)

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-01-18 15:07:51 +01:00
Michael Schuster 9447a10716
JsonApiJob: Add method usePOST to allow anonymous POST requests
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-01-18 15:03:21 +01:00
Michael Schuster 2039872ee5
Merge pull request #1565 from nextcloud/qml-tray-menu
New tray window
2020-01-18 13:18:45 +01:00
Dominique Fuchs 9b5bb1365c Code maintenance - correct some syntax, fix some warnings.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-01-18 10:30:34 +01:00
Brandon d10bc1bb14 Correct wrong variable
Signed-off-by: Brandon <brandon.yeow@websparks.sg>
2020-01-15 23:07:14 +01:00
Brandon 18a88fcecf Correct wrong variable
Signed-off-by: Brandon <me@branbit.com>
Signed-off-by: Brandon <brandon.yeow@websparks.sg>
2020-01-15 23:07:14 +01:00
ritsute c92f520423 Handle broken shared file error gracefully
Signed-off-by: Brandon <me@branbit.com>
Signed-off-by: Brandon <brandon.yeow@websparks.sg>
2020-01-15 23:07:14 +01:00
Dominique Fuchs 330ff96ee2 Code cleanup regarding context menu. Pause/resume logic implemented. Halfway through remodeling account menu.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-01-05 21:06:42 +01:00
Dominique Fuchs b32310b8a6 Gigantic ton of changes and deletions: ActivityListModel, tray GUI, Account logic.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-01-03 13:09:29 +01:00
XNG 314c00a8b7 apply http2 qt resend patch from owncloud
Signed-off-by: XNG <Milokita@users.noreply.github.com>
2019-12-25 13:59:15 +08:00
Michael Schuster 6adfff1f13 Add new Theme helper method to custom-colourize links
Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-12-19 22:07:30 +01:00
Michael Schuster 7d542d7989 Change Dark Mode link colour
Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-12-19 22:07:30 +01:00
Michael Schuster be4fc6b887 Implement and move some colour-aware helper methods into the Theme class
This introduces a new method to change the colours in the links in QLabel's.
Utilizes a custom crafted RegEx function to replace already-coloured links.

Moved code is based on stuff from the SettingsDialog class.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-12-09 21:37:21 +01:00
Michael Schuster 6a49e787bb Fix Remote Wipe keychain storage
In certain cases don't write the app password in Account::writeAppPasswordOnce:
- id() is empty: This always happend once the Account Wizard showed the folder selection
- appPassword is empty: Caused by Logout -> Relaunch, preventing remote wipe on relaunch

Implement some logging to ease debugging in the future.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-12-08 02:47:22 +01:00
Michael Schuster 0c5f4a1525 Remote Wipe: Implement hack to allow deleting all keychain entries (SSL certs & keys)
Client SSL certificates and keys cannot be deleted at this time because there is
no UI for selecting them on re-login.

We introduce this dirty hack here, to allow deleting them upon Remote Wipe.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-12-08 02:47:22 +01:00
Roeland Jago Douma 363e62f8fa Fall back to old login flow on GS as this is not yet ready
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-12-06 21:03:01 +01:00
Joas Schilling 9ce2491d67 Use … instead of 3 dots
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-12-03 09:06:06 +01:00
Michael Schuster 76c7ab499f Use ReadPasswordJob::finished for ReadPasswordJob
Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-11-29 13:53:52 +01:00
Michael Schuster dcc84d3508 Fix remote wipe keychain storage (issue #1592)
The app password for the remote wipe was constantly being written in
WebFlowCredentials::slotFinished to the keychain, leading to unnecessary
write and log overhead on the system.

This fix introduces a check to only store the app password once in
a lifetime of the Account class. Also the method used to store the
password will be renamed from setAppPassword to writeAppPasswordOnce
to be more expressive.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-11-29 13:53:52 +01:00
Michael Schuster 5131463644
Fix: Apply http2 patch from owncloud #1573 - only with Qt >= 5.8
Drone builds failed with Qt 5.7 and we introduce a new ifdef here
to avoid patching specifically for Ubuntu Xenial only.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-11-14 02:39:06 +01:00
XNG cf1532acf1 Apply http2 patch from owncloud
Signed-off-by: XNG <Milokita@users.noreply.github.com>
2019-11-01 09:35:10 +08:00
Michael Schuster 25076f2ddc
tab formatting (just a little more ;p)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-10-27 17:03:23 +01:00
Dominique Fuchs 66912071a8 Merge branch 'syncjournal-del-prio' of https://github.com/nextcloud/desktop into syncjournal-del-prio 2019-10-27 16:56:07 +01:00
Dominique Fuchs e9438549f4 tab formatting
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-10-27 16:55:37 +01:00
Dominique Fuchs d001d9d1a3
Merge branch 'master' into syncjournal-del-prio 2019-10-27 15:38:43 +01:00
Michael Schuster 4f1e4e149f
Merge branch 'master' into fix/too-low-default-poll-interval 2019-10-19 03:40:21 +02:00
Camila San 19491ff85f
Once client gets 401/403 from the server, check if remote wipe was requested.
- When the the users logs because of 401 or 403 errors, it checks if the
server requested the remote wipe. If yes, locally deletes account and folders
connected to the account and notify the server. If no, proceeds to ask the
user to login again.
- The app password is restored in the keychain.
- WIP: The change also includes a test class for RemoteWipe.

Signed-off-by: Camila San <hello@camila.codes>
2019-10-17 20:11:31 +02:00
Felix Eckhofer ace142bb23
Use user-provided username in `displayName()`
This replaces `davUser()`, which is replaced by a numeric ID when using
LDAP, by the username that was actually used for logging in.

Fixes #836

Signed-off-by: Felix Eckhofer <felix@eckhofer.com>
2019-09-30 17:56:14 +02:00
Andreas Wunderlich f293dbfeeb Revert default remote poll interval back from 5 seconds to 30 seconds
Signed-off-by: Andreas Wunderlich <code@andwun.me>
2019-09-29 00:58:35 +02:00
Dominique Fuchs 10a5e75cd8 Harmonizing sorting algorithm (again)
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-28 09:17:12 +02:00
Dominique Fuchs 26f7848821 Fix logic for DELETE prio, now (hopefully) in harmony with destination sorting
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-27 12:21:02 +02:00
Dominique Fuchs f81e5be119 Implemented second sorting step for SyncFileVector (merged trees) to prioritize DELETEs
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-27 09:34:49 +02:00
Mariusz Wasak dcc33f3417 Fix for #1382 "linux client crashes for no discernable reason"
There in no "return" in
PropagateUploadFileCommon::slotStartUpload in if (prevModtime != _item-
>_modtime) {... }

There is possibility that
PropagateItemJob::done(status, errorString)
maybe called two times from PropagateUploadFileCommon::slotStartUpload
1. in if (prevModtime != _item->_modtime) {... }
2. in if (fileIsStillChanging(*_item)) {..}
if changes in files are frequent the second call is possible.

This two calls has effect in PropagatorCompositeJob::slotSubJobFinished
and job is removed two times in _runningJobs.remove(i);
(the second time with argumetnt -1 (because first call removed job).

This return was removed in commit
efc039863b - by accident I think.

Good simulation is to synchronize firefox profile with frequent page
refresh.

Signed-off-by: Mariusz Wasak <mawasak@gmail.com>
2019-09-18 18:18:12 +02:00
Michael Schuster 207de071f4
Add warning for failed chown in libsync/propagatedownload.cpp
In addition to PR 1409 generate warnings if chown fails.

See: https://github.com/nextcloud/desktop/pull/1409

Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-09-16 20:26:18 +02:00
Michael Schuster b40e3e7b4e
Merge branch 'master' into msvc-warn-audit 2019-09-16 16:55:42 +02:00
Camila Ayres 82a67a44c4
Merge branch 'master' into bugfixing-slideshow 2019-09-15 18:18:46 +02:00
Dominique Fuchs a35b346e62 Fixed e2e key transmission issue after generation (forgotten content type on sendrequest())
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-15 11:53:57 +02:00
Dominique Fuchs ace3da841c (Maybe) finished implementation of themed wizard buttons and accessibility refinements and thus implementation of helper fct. to retrieve themed QIcons.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-13 17:26:39 +02:00
Dominique Fuchs 39df36c247 Use return type to prevent warning and determine chown success. Added TODO
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-09 18:06:29 +02:00
Dominique Fuchs c585e81530 Moved macro definition due to timing issues while compiling when relying on header inheritance
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 19:46:08 +02:00
Dominique Fuchs cc07ed1ee8 commit 222b2d did the trick. now streamlined use of https://doc.qt.io/qt-5/qtglobal.html#QT_VERSION_CHECK
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 19:22:40 +02:00
Dominique Fuchs 222b2d8645 Further testing of cond. include of Qt library > 5.9. Utilized different macro.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 19:17:00 +02:00
Dominique Fuchs 48097801e8 Fixed logic error in QTLEGACY macro and added forgottin #if clause for header file
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 18:42:40 +02:00
Dominique Fuchs dca83aad45 Added macro definition and compile-time condition to support Qt < 5.9
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 17:33:34 +02:00
Dominique Fuchs a2d47cdec4 Qt: Fixed numerous deprecated calls by adapting newer ones
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 15:40:49 +02:00
Dominique Fuchs d6af025a46 Numoerous safe conversions implemented. Added additional Utility::convertSizeToDWORD for windows builds.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2019-09-08 11:33:20 +02:00
Camila Ayres d36ddb752a
Merge branch 'master' into per-directory-ignore 2019-09-06 13:35:28 +02:00
Michael Schuster aa93a04fd6
fix comment typo in httpcredentials.cpp
Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-08-26 20:03:15 +02:00
Michael Schuster 12f2ea6728
Login Flow V2: remove static test url
Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-08-26 20:03:15 +02:00
Michael Schuster 2742411abd
Login Flow V2: 1st test-implementation
Signed-off-by: Michael Schuster <michael@schuster.ms>
2019-08-26 20:03:15 +02:00
Samir Benmendil 14279104ae Read .sync_exclude.lst in each subdirectory
Signed-off-by: Samir Benmendil <me@rmz.io>
2019-08-15 03:00:26 +01:00
Camila San 3ea472d9f2
Minor text change in the link to help in the tab 'General'.
Also uses helpUrl() retrieve the correct APPLICATION_HELP_URL
instead of APPLICATION_DOMAIN.

Signed-off-by: Camila San <hello@camila.codes>
2019-07-24 16:39:21 +02:00
Camila San bb7d330516
Add error category for http file lock error status 423.
It filters the error out of the list of blocking errors. It now shows up
in the Activities and Notificattions list as a warning.

Signed-off-by: Camila San <hello@camila.codes>
2019-06-11 23:32:10 +02:00
Ivan Čukić db7e5e01b3 Merge branch 'master' into ivan/encryption-initial-setup 2019-05-11 19:19:00 +02:00
shobha 188374f60c updated default remote poll to 5 seconds #1115
Signed-off-by: shobha <tyagishobha@gmail.com>
2019-05-10 09:15:09 +05:30
Ivan Čukić 7af786fde9 Added a nice UI for the E2E-enabled account first connect
Instead of immediately popping up the mnemonic dialogue,
only show a notification bar on the account setup page.

For the cases where the user does not want to use E2E,
this is significantly less intrusive than the old approach.
2019-05-09 00:37:24 +02:00
Christoph Wurst c2e3cbca31
Fix memory leak with device pointer
Downstream of https://github.com/owncloud/client/pull/6856

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-05-08 19:41:48 +02:00
Camila Ayres 4d61a7c263
Merge branch 'master' into tuchfarber/fix_empty_file_error_wording 2019-04-12 16:51:36 +02:00
Camila San 7f3c3f6eb6
Uses configuraion to determine if it should show empty folder popup.
Configuration default value is set to false because  users are getting
the popup message too often.

Signed-off-by: Camila San <hello@camila.codes>
2019-04-12 16:22:07 +02:00
Matt Tuchfarber 0862d6cfb0 Fix empty file wording in error log
Changing empty file error text so that it reads correctly.
2019-03-07 00:18:12 -05:00
Roeland Jago Douma e2293eddce
Allow to specifiy server url via CMAKE
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-01-31 11:28:46 +01:00
Roeland Jago Douma b34708da29
Move help URL also to CMAKE
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-01-31 11:28:46 +01:00
Roeland Jago Douma 0c21852bc3
No need to overwrite customMedia in the theme
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-01-31 11:28:46 +01:00
Roeland Jago Douma 944f9e9668
Move wizard options to CMAKE as well
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-01-31 11:28:38 +01:00
Roeland Jago Douma 5c2996deb7
Use the provided updater URL
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-01-31 09:52:16 +01:00
Roeland Jago Douma 8b64db6344
Merge branch 'master' into fix/566/do_not_read_system_exclude 2018-11-27 11:19:20 +01:00
Roeland Jago Douma 6cc496633f
Do not read system exclude list if user exclude is present
For #566

Since we only showed the user exclude list (and some extra items) the
system exclude list was still used.

This copies over the system exclude list (if it isn't there).
If it fails we use the system one still.

However if you now remove items from your own list it will really be
gone.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-11-19 15:35:32 +01:00
Roeland Jago Douma 1d0bf08a1c
Do not fetch activities if they are not enabled
Fixes #788
Fixes #834

If the activity app is not enabled we should not try to fetch the
activities at all.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-11-19 14:13:51 +01:00
J-P Nurmi 1af9bf8abc libsync: run clang-tidy modernize-use-nullptr 2018-11-12 18:46:39 +01:00
J-P Nurmi 0d1c15a768 libsync: run clang-tidy modernize-use-override 2018-11-12 18:43:58 +01:00
J-P Nurmi 48acaec66f libsync: search'n'replace "Q_DECL_OVERRIDE" with "override" 2018-11-12 18:39:50 +01:00
Roeland Jago Douma 3a0c7f64c0
Use a format that supports alpha channels for avatars
If we use the source format it can result in fully black images. As the
basic generated avatar doesn't have an alpha channel.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-11-09 13:01:28 +01:00
Aleksandr Borisenko bb2d31a2bd Removed explicit initialization; Fixed RAND_bytes not found 2018-11-08 11:24:39 +03:00
Roeland Jago Douma af8a2819be
Merge pull request #768 from nextcloud/fix/766/copy_over_old_windows_config
Copy over config file to new location on windows
2018-11-02 21:01:22 +01:00
Roeland Jago Douma e01cb108e1
Merge pull request #754 from kevin147147/patch-1
theming for general settings ui
2018-11-02 10:08:18 +01:00
Roeland Jago Douma 188a1a6e24
Copy over config file to new location on windows
Fixes #766

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-11-01 15:02:31 +01:00
Roeland Jago Douma 5cfdc71ca5
Merge branch 'master' into upstream/pr/6671 2018-10-31 21:13:10 +01:00
Roeland Jago Douma ef3aeb65cc
Merge pull request #658 from nextcloud/upstream/pr/6698
OAuth: Fix infinite loop when the refresh token is expired
2018-10-30 23:04:09 +01:00
kevin147147 30032f9c0c
i18n for general settings ui 2018-10-30 17:32:52 +01:00
Dominik Schmidt cddb9aa8ba
Support higher resolution theme icons 2018-10-23 23:07:17 +02:00
Roeland Jago Douma f3529e3dd7
Merge branch 'master' into upstream/pr/6674 2018-10-23 21:43:13 +02:00
Roeland Jago Douma c37186cc56
Merge branch 'master' into upstream/issue/6581 2018-10-23 21:08:51 +02:00
Roeland Jago Douma 1c8307f264
Merge branch 'master' into fix-issue-268 2018-10-23 12:04:14 +02:00
Roeland Jago Douma 156308c72e
Merge branch 'master' into upstream/issue/6581 2018-10-21 14:19:07 +02:00
Roeland Jago Douma 2dc7ff7332
Merge branch 'master' into upstream/pr/6360 2018-10-19 16:13:09 +02:00
Camila San 45ff3385c7
Uses QByteArray to store private key.
Removes QSslkey. See #268

Signed-off-by: Camila San <hello@camila.codes>
2018-10-15 00:21:08 +02:00
Olivier Goffart 08e4ba3363
Data-Fingerprint: Fix backup detection when fingerprint is empty
Add a test to test the data fingerprint feature make me realize it was broken.
The code was relying in the distinction between empty and null QByteArray,
but this was a bad idea as this difference is lost when going through QString.
2018-09-10 20:44:03 +02:00
Olivier Goffart 3b2c6d2202
OAuth: Fix infinite loop when the refresh token is expired
The server reply with a code 400 when the token is invalid,
the client was understanding this error as a network error, and was retying
again with the same token.

Instead, we must rely on what the json is saying, even if the reply is
not a 200 code.

Issue https://github.com/owncloud/enterprise/issues/2777
2018-09-10 20:22:40 +02:00
Christian Kamm 5b228d1afd
Do not require server replies to contain an mtime
The check was added for #6317 in commit
13eb64584f.

We did see missing mtimes in replies in tests with live servers though.
Possibly those were old incomplete responses cached in the stat cache?
2018-09-10 17:33:53 +02:00
Christian Kamm cba0627a9c
Ensure GETFileJob notices finishing #6581
It could happen that readyRead was emitted for incoming data while the
download was not yet finished. Then the network job could finish with
no more data arriving - so readyRead wasn't emitted again.

To fix this, the finished signal also gets connected to the readyRead
slot.
2018-09-09 11:50:00 +02:00
Roeland Jago Douma c4d7f97e00
Add legal notice button to about dialog
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-08-02 22:17:11 +02:00
Christian Kamm d549c77af6
Issues: Show link to conflicts doc if there are some #6396
The link url is themed.
2018-07-03 10:18:18 +02:00
Roeland Jago Douma ce545b1e47
propage*encrypted Q_UNUSED
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-07-02 12:45:44 +02:00
Roeland Jago Douma e871359453
Remove unneeded ;
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-07-02 11:03:58 +02:00
Roeland Jago Douma b952fa64ee
Restore logger installation
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-07-02 11:01:52 +02:00
Roeland Jago Douma d2b75cabb2
Remove default trademark text
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-06-29 21:36:18 +02:00
Roeland Jago Douma 595cbfaa16
Update urls
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-06-28 12:46:47 +02:00
Camila San 4c7b7dfcaa
Restores previous text in the about section.
Signed-off-by: Camila San <hello@camila.codes>
2018-06-28 12:33:40 +02:00
Olivier Goffart c5ace2338c
Theme: unify ownCloudTheme and Theme classes
The goal is to avoid confusion described in issue #6422 by removing
duplicates between the Theme and owncloudTheme.

 - Use the about from ownCloudTheme everywhere
 - Create default applicationIcons() and condifFileName() that should work
   everywhere
 - trayFolderIcon was removed as it is not used
 - the helpUrl from the default Theme now points to the owncloud client
   documentation. Before there was no help entry by default for branded
   client if the function was not overriden.
 - Do not merge functions that would otherwise break compatibility with
   theme that did not override them. For example colors or customMedia.
2018-06-28 12:33:39 +02:00
Roeland Jago Douma 48a6ef37b2
Add a button to E2E accounts to show the mnemonic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-06-21 19:52:27 +02:00
Julius Härtl 4ba40a6ce1
Move information icon to warning icon
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2018-06-20 16:06:19 +02:00
Roeland Jago Douma f7bf8c7577
Thread local storage don't work properly on OSX
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-06-14 21:26:07 +02:00
Christian Kamm d304fcbda7
Rename local discovery option for clarity
It's using full relative filepaths, not just dir paths.
2018-06-11 14:50:01 +02:00
Roeland Jago Douma dc41f8a16e Fix windows build
* Reorder openssl header import
* not => !

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-06-08 16:53:56 +02:00
Olivier Goffart 7c9ec4a55a
Credentials: Retry fetching from the keychain in case the keychain is still starting
When owncloud is restored, at boot time, it might be started before the
crendential manager. So if we detect an error, wait 10 seconds and hopefully
it'd be loaded by then.

Issues: #4274, #6522
2018-06-07 15:18:40 +02:00
Christian Kamm 5f793c151c
Upload: Adjust timeout for final job based on size #6527
Some servers have virus scanners and the like that can delay the
response of the final chunked upload assembly significantly, often
breaking the current 5min (!) timeout. See owncloud/enterprise#2480
for details.
2018-06-07 09:38:16 +02:00
Christian Kamm 4fa762b5ce
Propagation: Connection closed is a normal error #6516
Because it sometimes appears in conjunction with server bugs and we
don't want to halt all syncing for other files in these cases.
2018-06-07 09:12:46 +02:00
Olivier Goffart 14ff3534a8
Fix compilation warning
propagateuploadng.cpp:500:10: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
2018-06-07 08:53:12 +02:00
Christian Kamm d9640dd79e
PropagateUpload: Fix miscount in abort() #6516
Previously it tried to abort even jobs that had already finished, which
was not going to work as they wouldn't emit finished() again.

Also, in some cases the abortCount would never go to zero and that case
wasn't well documented.
2018-06-07 08:53:12 +02:00
Christian Kamm 96126a53d3
PropagateUpload: Remove unused PropagateUploadFileCommon::abort 2018-06-07 08:53:10 +02:00
Markus Goetz 367d0c39e8
Logging: Avoid the word "Error"
The old code printed "QNetworkReply::NoError"
2018-06-06 20:24:32 +02:00
Olivier Goffart 073a5184cb
Use std::chrono::milliseconds to represent milliseconds 2018-06-06 17:26:53 +02:00
Olivier Goffart 012c638d4e
Uploads: Don't delete unexisting chunks
Since commit 4dc49ff3, we store an entry in the upload info table even
for non chunked uploads. However, if this fails we don't want to remove
non-existant stale chunks if the upload fails.

Without this commit, we would send a DELETE command to clean non-existant
chunks in the dav/uploads/ namespace.
2018-06-06 09:52:02 +02:00