1
0
Fork 0
Commit Graph

2384 Commits

Author SHA1 Message Date
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
Markus Goetz de1032ebd7
Q_UNUSED: Sprinkle around 2018-06-05 20:45:51 +02:00
Christian Kamm 4a81ae75cf
Logging: Add persistent auto-logdir option #6442 2018-06-05 20:07:53 +02:00
Christian Kamm 428cfc5e1c
LogDir: Compress log when switching files #6442 2018-06-05 20:07:53 +02:00
Christian Kamm 09f83f4fa9
SyncJournal: Clear etag filter before sync
Before, we only cleared the _avoidReadFromDbOnNextSyncFilter *after* a
sync which meant that we had to sync twice after selective sync setup.

Now, we clear the filter *before* a sync as well which allows the actual
next sync to write the correct etags to the db again - instead of only
the sync after that one.

Also expand on comments and rename _avoidReadFromDbOnNextSyncFilter to
_etagStorageFilter.
2018-06-05 12:00:20 +02:00
Christian Kamm c57e4dcf03
Blacklisting must prevent parent etag updates #6411 2018-06-05 10:12:11 +02:00
Roeland Jago Douma 4bd6f2b26d
Merge pull request #323 from nextcloud/upstream/upload-finished-flag
Upload: Simplify 'finished' flag
2018-06-04 17:14:17 +02:00
Roeland Jago Douma 3a1dc44ec8
Merge pull request #320 from nextcloud/upstream/issue/6403
propagateuploadv1: don't finalize after a done()
2018-06-04 17:12:52 +02:00
Roeland Jago Douma c49597d9d8
Merge pull request #319 from nextcloud/upstream/issue/4424
Folder: normalize the local path.
2018-06-04 16:02:49 +02:00
Roeland Jago Douma 321e8c0264
Merge pull request #317 from nextcloud/upstream/issue/3146
SslButton: Add HTTP/2 info #3146
2018-06-04 16:01:44 +02:00
Olivier Goffart 393f6c2310
SyncEngine: remove the "CSync" wording from the error messages
They are confusing for the user.
Example in issue #6274
2018-06-04 15:41:38 +02:00
Olivier Goffart 5f30177bfc
CSync: Remove unused error codes
None of the removed ERRNO code were ever set.
So none of the removed error hapenned anymore
2018-06-04 15:41:38 +02:00
Olivier Goffart 15e93c8a31
CSync: reconcile never returns an error 2018-06-04 15:41:38 +02:00
Olivier Goffart be29fc2f69
csync: remove CSYNC_PARAM_ERROR
It does not make sense to report such error to the user.
Its goal was to show invalid use of the csync API, but this is now done
with asserts.
2018-06-04 15:41:38 +02:00
Olivier Goffart 0443f8dd4d
csync: Simplify csync_walk_local_tree/csync_walk_remote_tree
Small refactoring
2018-06-04 15:41:38 +02:00
Roeland Jago Douma f96206705a
Merge pull request #315 from nextcloud/upstream/pr/6379
Discovery: Error if properties are missing #6317
2018-06-03 19:58:21 +02:00
Roeland Jago Douma 1262cbf4ef
Merge pull request #314 from nextcloud/upstream/pr/6373
Make sure ignored and conflict files show up in the issues tab even with partial local discovery
2018-06-02 20:20:19 +02:00
Olivier Goffart 4d7617d64b
Propagator: remove a bunch of code related to the 'Shared' directory
This no longer exists since the owncloud server 7.0 which we no longer
allow to connect to
2018-06-01 13:17:20 +02:00
Olivier Goffart 8484b493e4
ConnectionValidator: change the minimum server version
Forbit connection with server older than 7.0. These server did not have
permission.

Also warn for anything older than 9.1. 9.0 is end of life according to
https://github.com/owncloud/core/wiki/Maintenance-and-Release-Schedule
2018-06-01 13:17:11 +02:00
Olivier Goffart 311307e8cb
Move ClientProxy and ConnecitonValidator to gui
They are using the ConfigFile and are used to control
when to sync rather than for the sync itself
2018-05-31 21:56:55 +02:00
Roeland Jago Douma c6ef8eec0a
Merge pull request #305 from nextcloud/upstream/pr/6363
SyncEngine: Use separate state for two unicode conversions
2018-05-30 08:04:05 +02:00
Roeland Jago Douma 86741de622
Merge pull request #299 from nextcloud/upstream/pr/6349
Don't delete contents behind directory junctions #6322
2018-05-30 08:03:04 +02:00
Roeland Jago Douma 1dc3c156d4
Merge pull request #304 from nextcloud/upstream/pr/6364
Conflicts: Add user name to conflict file name #6325
2018-05-18 13:56:14 +02:00
Julius Härtl 0283e1bfaa
Merge pull request #295 from nextcloud/upstream/pr/6329
Tray: Change icon for unresolved conflicts #6277
2018-05-18 08:53:49 +02:00
Roeland Jago Douma 33555292ae
Merge pull request #301 from nextcloud/upstream/pr/6353
HTTP2: Only from Qt 5.9.4 #6285
2018-05-17 15:39:09 +02:00
Roeland Jago Douma 36572b79c3
Merge pull request #298 from nextcloud/upstream/no-shibboleth
NO_SHIBBOLETH: Fix warning
2018-05-17 15:38:04 +02:00
Christian Kamm a2675b559b
Upload: Simplify 'finished' flag
* Sometimes there was 'finished' and '_finished'
* Make each done() call automatically set _finished to true
2018-05-16 20:57:26 +02:00
Olivier Goffart ad276a4bce
Folder: normalize the local path.
We otherwise normalize all path in the C form, so we must have
the Folder's path normalized the same. Or all comparizon will fail
(such as knowing if a file from the SocketAPI or the FilesystemWatcher
are part of the folder)

Issue #4424
2018-05-16 20:26:09 +02:00
Olivier Goffart 3506c52be9
propagateuploadv1: don't finalize after a done()
Should fix an assert when "Server does not support X-OC-MTime"
(Which only happens with owncloud 5)

Issue #6403
2018-05-16 20:23:47 +02:00
Markus Goetz 434f093f98
SslButton: Add HTTP/2 info #3146 2018-05-16 20:10:51 +02:00
Christian Kamm a0d5e31423
INSTRUCTION_IGNORE now carries a direction
This allows IssuesWidget to selectively wipe only the 'Up' ignores
during selective local discovery.
2018-05-16 16:48:31 +02:00
Christian Kamm 800f1ace0c
SyncResult: Make sure the number of conflicts is correct #6226
If the SyncResult incorrectly believes that there are no conflicts, the
tray icon won't be correct and there will be no warning about unresolved
conflicts on the account.

Nevertheless, it's pretty awkward that the IssuesWidget is better
informed about pending conflicts than the Folder itself. This kind of
backwards data flow is very confusing.

Unfortunately the only alternative I see is to either keep track of
this information in two places (also in Folder), or create a common
data-holding class that can serve as a model instance for the issues
view as well as provide data directly to the Folder - which would
have been a much larger change.
2018-05-16 16:47:27 +02:00
Christian Kamm 75194d1821
SyncEngine: Make "local discovery?" question available
Also fix the minor bug that was mentioned and add tests.
2018-05-16 16:46:40 +02:00
Christian Kamm 2defaf099d
Issues tab: Invalidate issues selectively #6226
Everything is invalidated later: after discovery, not before. In
addition entries that should only be invalidated when new local
discovery is done have that behavior now.
2018-05-16 16:45:39 +02:00
Christian Kamm 01f83ff398
ProgressInfo: Add information for local vs remote discovery 2018-05-16 16:45:13 +02:00
Christian Kamm 8077748c9d
slotFolderDiscovered: Fix 'local' always being false
It was unused, so no harm done.
2018-05-16 16:44:36 +02:00
Christian Kamm 687b6f5655
Discovery: Error if properties are missing #6317 2018-05-16 16:42:20 +02:00
Christian Kamm f244cc4d4a
SyncEngine: Use separate state for two unicode conversions
It's unlikely that there were interaction effects but still seems safer
to use different conversion state for the path and rename_path.
2018-05-15 22:44:10 +02:00
Christian Kamm 17d174e6fa
Conflicts: Add user name to conflict file name #6325
For the case of uploading conflict files only.
2018-05-15 22:38:35 +02:00
Markus Goetz e82869d10e
HTTP2: Only from Qt 5.9.4 #6285 2018-05-15 19:23:11 +02:00
Olivier Goffart 88347a985f
Adjust the Move To Trash patch
(PR #6265)

 - Remove the UI completely
 - Move the #ifdef inside the FileSystem::moveToTrash function, so it is easier to
   implement on other platforms
 - Q_OS_UNIX includes mac, so we need to disable it. (not using Q_OS_LINUX because of
   other BSD that uses XDG spec as well
 - Translate the error messages
 - Add a couple of doc comments
2018-05-15 19:10:41 +02:00
Christian Kamm 2d1d651fcd
Don't delete contents behind directory junctions #6322
QFileInfo::isSymLink() does detect reparse points that are symlinks but
returns false for junctions. The new function FileSystem::isJunction()
can detect those and is used to not recursively delete files inside
directories that are junctions.

See also https://bugreports.qt.io/browse/QTBUG-45344 and the
discussion in the PR https://codereview.qt-project.org/#/c/113019/.
2018-05-15 18:42:44 +02:00
Markus Goetz d33692cdc7
NO_SHIBBOLETH: Fix warning 2018-05-15 18:31:12 +02:00
Christian Kamm ad750f569c
Tray: Change icon for unresolved conflicts #6277 2018-05-15 17:58:10 +02:00
Oleg Solovyov f9fe24feb9
Move remote-deleted files to trash
Squashed from https://github.com/owncloud/client/pull/6265

Linux only, Hidden option, disabled by default
2018-05-15 17:23:38 +02:00
Roeland Jago Douma c763a6e7fb
Show webview with page
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-05-02 22:50:48 +02:00
Camila Ayres 64cbc88474
Merge pull request #251 from nextcloud/clientSideEncryptionV4
Client side encryption v4.
2018-04-26 19:56:55 +02:00
Adrien 8e52f1237b Fix Use of Deprecated trUtf8 2018-04-19 12:02:26 +02:00
Tomaz Canabrava 7432d6a814 Merge branch 'master' into clientSideEncryptionV4 2018-04-10 16:18:58 +02:00
Daniel Nicoletti 3e05bd1da0 Do not detach encrypted files vector 2018-04-09 13:23:52 +02:00
Daniel Nicoletti 3eb3535d0f Fix downloading NEW encrypted files 2018-04-09 13:23:52 +02:00
Daniel Nicoletti defe2d7631 Fix matching encrypted data for downloading 2018-04-09 13:23:52 +02:00
Daniel Nicoletti b12066f1aa Properly remove encryption data from JSON of deleted file 2018-04-09 13:23:52 +02:00
Daniel Nicoletti a9208f6581 Remove unused encrypted property 2018-04-09 13:23:52 +02:00
Daniel Nicoletti 6e63a538b7 Make sure bool _currentLockingInProgress is first defined to false 2018-04-09 13:23:52 +02:00
Daniel Nicoletti a7a8de8787 Fix matching encrypted file for download 2018-04-09 13:23:52 +02:00
Daniel Nicoletti d3b6aacf3f Fix merging remote and local trees when e2e files are involved
When populating the tree from the filesystem we need to fill
the e2eMangledName from DB and we when trying to find another
match on the oposite tree we need to take in account that names
don't match and search with the mangled name information
2018-04-09 13:23:52 +02:00
Daniel Nicoletti c0ef36b8fa Use QUuid to generate random names 2018-04-09 13:23:52 +02:00
Daniel Nicoletti 60fc5d6dd4 Fix upload of existing encrypted files by matching only filename 2018-04-09 13:23:52 +02:00
Daniel Nicoletti d5ab642e46 Fix sync status running when encryption data is missing
When a file on the server of an encrypted folder do
not have a matching entry on the JSON metadata, we
need to report an error and be done with the job
so that Sync status is not "running".

This eventually should cause the file to be removed
from the server as it can not be recovered anymore.
2018-04-09 13:23:52 +02:00
Tomaz Canabrava b4b3e422de Handle gracefully failures in file decryption 2018-03-27 09:18:54 +02:00
Tomaz Canabrava ed6f56257e Dont use new with QFiles. 2018-03-26 22:18:07 +02:00
Tomaz Canabrava 461aeca200 Do not crash when failing to decrypt the metadata 2018-03-26 22:02:46 +02:00
Tomaz Canabrava 6c88367ac6 Do not crash if there was an error encrypting the file. 2018-03-26 21:44:46 +02:00
Tomaz Canabrava 5fe9717598 Potentially fix crash acessing a deleted pointer. 2018-03-26 21:37:13 +02:00
Tomaz Canabrava ec28465e01 Correctly handle systems without client side encryption 2018-03-26 20:51:14 +02:00
Tomaz Canabrava 11684682e6 Return empty metadata in case of error, Display error to the user. 2018-03-25 22:31:49 +02:00
Tomaz Canabrava 96115be0c6 Unlock folder in case of error 2018-03-25 21:54:08 +02:00
Camila San 2e4472a4db
Enables server notifications by default.
Signed-off-by: Camila San <hello@camila.codes>
2018-03-03 22:44:24 +01:00
Camila San 3c778980df
Makes sure JsonApiJob::finished won't throw a JSON error when status code is 304.
Signed-off-by: Camila San <hello@camila.codes>
2018-03-03 22:24:16 +01:00
Camila San 621596f45a
Saves notifications ETag response header to use to request only new notifications.
Signed-off-by: Camila San <hello@camila.codes>
2018-03-01 22:19:04 +01:00
Camila San 112c5e10b6
Removes Server Activities option from General settings.
Signed-off-by: Camila San <hello@camila.codes>
2018-02-26 12:02:34 +01:00
Camila San 1a0edc1cd0
Sync activities notifications are never shown unless there is an error. Server activities and notifications are off by default.
Signed-off-by: Camila San <hello@camila.codes>
2018-02-23 12:08:37 +01:00
Tomaz Canabrava 7da0764b8d Don't class what's not a class 2018-02-18 01:23:59 +01:00
Tomaz Canabrava 176a42a062 Return the error reported by openssl 2018-02-18 01:13:23 +01:00
Tomaz Canabrava 5faeca1b82 Move BIO2ByteArray to annonymous namespace
This has no use outside of the clientsidenecryption.cpp
2018-02-18 01:04:44 +01:00
Camila San ab7185a6c7
Changes notification text in the checkboxes and adds tooltips with explanation about it.
- Changes the configuration name in ConfigFile and GeneralSettings
accordingly with the new text.
- Makes sure the user sees error and conflict messages even if the
setting is disabled.

Signed-off-by: Camila San <hello@camila.codes>
2018-02-15 20:21:35 +01:00
Camila San bfc7aa16c6
Adds option to toggle display of Sync and Activity notifications.
Signed-off-by: Camila San <hello@camila.codes>
2018-02-14 20:38:15 +01:00
Daniel Nicoletti 99117078f3 Remove table for e2e and add an e2eMangledName column (#169)
If the code was not complex enough syncing two tables
already started to give UNIQUE constrains errors on
simple sync operations, this also adds initial support
remote delete of an encrypted file
2018-02-12 12:50:51 +01:00
Roeland Jago Douma 1eb7ba72f0
Use standardized filename
See https://github.com/nextcloud/end_to_end_encryption_rfc/issues/13

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-02-09 11:40:06 +01:00
Roeland Jago Douma d85c2bf025
Fix building on windows
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-30 11:10:03 +01:00
Roeland Jago Douma 296f46356e
If the metadata is empty we should store (and not update).
Android only creates the metadata file when the first encrypted file is
added. We assumed it would be there.

This hacky code makes us store the metadata if there wasn't any yet.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-29 22:04:50 +01:00
Tomaz Canabrava dcc9ac7d2e [Buildfix] Fix build from last merge 2018-01-29 14:17:52 +01:00
Tomaz Canabrava d24a1e542e Merge branch 'master' into clientSideEncryptionV3 2018-01-29 14:06:12 +01:00
Tomaz Canabrava 682bb2ad43 [CSE] Save the encrypted name relation on downloads 2018-01-28 23:50:12 +01:00
Tomaz Canabrava e8849a2cf9 [CSE] Save the relation of the file / encrypted file names on the db 2018-01-28 22:26:07 +01:00
Tomaz Canabrava e9a7a56359 [CSE] Store the encrypted file name on the SyncFilePtr 2018-01-28 18:37:01 +01:00
Roeland Jago Douma 48bce4c6b0
Merge remote-tracking branch 'oc/master' into oc_up 2018-01-25 11:17:04 +01:00
Roeland Jago Douma 4892b0ec43
Properly fill EncryptedFile
* Add a mimetype (mobile clients need this)
* Add the tag unencoded as we encode it when we send the metadata
already

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-23 21:31:00 +01:00
Roeland Jago Douma 21d55c3321
No sharing in metadata yet and PEM as PKCS#8
* Don't store the metadata yet this crashes android
  - Yes android should be fixed but for now this is quicker ;)
* QSslKey exports PEM as PKCS#1
  - This is not handled properly on android so use PKCS#8 helper

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-23 21:02:52 +01:00
Olivier Goffart 72b9beb79c Merge remote-tracking branch 'origin/2.4'
Conflicts:
	shell_integration/nautilus/syncstate.py
2018-01-23 14:08:15 +01:00
Roeland Jago Douma 7ce009ef49
If status.php fails check <server>/nextcloud/status.php
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-23 13:43:44 +01:00
Christian Kamm d831369f86 Protocol: Remove entries for auto resolved conflicts #6316 2018-01-23 12:01:22 +01:00
Roeland Jago Douma a2b8724adf
Hacky way to drop duplicates (we should really use the fileid!)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-23 11:58:05 +01:00
Roeland Jago Douma bb85e2ab2c
Reuse existing EncryptedFile
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-23 11:36:15 +01:00
Olivier Goffart c3dbb20ce3 Logger: --logdebug only show owncloud's debug message
Recent Qt version show way too many debug messages, spamming the console.
So filter only messages that comes from the client.
2018-01-22 21:13:15 +01:00
Roeland Jago Douma 33beb7aade
Don't generate values after we use them
* Pregerenate IV
* Pregenerate key
* Pregenerate filename

TODO:
  - Reuse existing file entries and update (we might need logic in the
  metadatahandling to do this properly).
2018-01-22 15:24:54 +01:00
Tomaz Canabrava cae6bbc853 [CSE] Start the download process 2018-01-22 14:08:32 +01:00
Tomaz Canabrava cf2fa2ea35 [CSE] Get the tag of the encrypted file to feed the metadata
Also, change the logging cattegory
2018-01-21 21:59:19 +01:00
Tomaz Canabrava 5d6817e165 [CSE] Save the tag while encrypting. 2018-01-21 21:49:24 +01:00
Tomaz Canabrava 261cedce3f [CSE] Do not quit if encryption fails
It's much more reasonable to return failure and handle it.
2018-01-21 21:40:53 +01:00
Tomaz Canabrava 2d872f2a8d [CSE] Add missing files 2018-01-21 21:26:05 +01:00
Tomaz Canabrava 009562da1e [CSE] Remove lambas with lambdas
It's hard to reason with lambdas with lambdas, so transform
them into actuall signal / slot calls.
2018-01-21 21:25:06 +01:00
Tomaz Canabrava d5a76ea70d [CSE] Remove the DecryptionJob
Transform it into an Static function - it was blocking anyway
and this way it's easier to transform it into a thread in the
future.
2018-01-21 21:24:02 +01:00
Tomaz Canabrava 4a2d0ab9e9 [CSE] Move code to display minemonic out of the libsync
The libsync should not contain Qt Widget related code.
2018-01-21 19:50:40 +01:00
Olivier Goffart b8539eb329 Get rid of the StopWatch in the PropagateUpload job
For issue #6318

The StopWatch is using memory, and we are not really using it.
2018-01-19 13:37:48 +01:00
Christian Kamm b9c7aa8df3 Sync: Deal with file/folder conflicts #6312
Previously conflicts with a different type on both ends lead to sync
errors. Now they are handled in the expected way: the local item gets
renamed and the remote item gets propagated downwards.

This also adds a unittest for the TYPE_CHANGE case. That one looks like
parts of it might be unified with CONFLICT cases.
2018-01-19 09:47:49 +01:00
Roeland Jago Douma 6d613fb4d5
Quick and dirty way of showing the mnemonic for now
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-18 22:10:55 +01:00
Roeland Jago Douma 5722d29e42
Double encode the metadatakeys
This is required by a misunderstanding of the RFC.
You need to resetup your test user.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-15 11:26:06 +01:00
Olivier Goffart 3ae327ea8e Modernize out CMakeLists.txt
Mainly uses target_include_directories instead of include_directories
so libraries public include directory get automatically added when adding
the target in target_link_library
2018-01-13 13:58:17 +01:00
Olivier Goffart 5d0aa5f039 Remove unused c_path 2018-01-13 13:58:17 +01:00
Olivier Goffart 1c11778693 Remove the unusued csync_file_locked_or_open test in csync_reconcile
It is unused. Also remove the corresponding error code
2018-01-13 13:58:17 +01:00
Olivier Goffart 3ddd4b6f16 Get rid of csync_log
We use Qt's debugging code everywhere
2018-01-13 13:58:17 +01:00
Olivier Goffart 257d8142b1 Build system: Get rid of QtVersionAbstraction.cmake
Use modern cmake with target_link_libraries and Qt5:: that
automatically add the include path and compile flags
2018-01-13 13:58:17 +01:00
Olivier Goffart 9613f6437d Merge remote-tracking branch 'origin/2.4'
Conflicts:
	src/libsync/networkjobs.cpp
2018-01-11 10:46:50 +01:00
Christian Kamm 883deb1c5d Fix potential crash in Composite job destruction
Sentry:
https://sentry.io/owncloud/desktop-win-and-mac/issues/427476987/
2018-01-09 13:53:57 +01:00
Christian Kamm e389fcaecb Avatars: Use old location for servers <10 #6279 2018-01-09 11:34:56 +01:00
Daniel Nicoletti a7ee1a95a6 Download and decrypt file if parent folder is marked as encrypted 2018-01-08 21:08:31 +01:00
Daniel Nicoletti 3abbbab6a0 Faster way to detecting CSE capability 2018-01-08 21:08:31 +01:00
Daniel Nicoletti e2c895e61f Fix encrypted file location on the server 2017-12-29 17:28:35 +01:00
Daniel Nicoletti ca92c46970 Add category logging to PropagateUploadEncrypted 2017-12-29 17:28:35 +01:00
Daniel Nicoletti 50916bcda5 Mark ClientSideEncryption::isFolderEncrypted() as const 2017-12-29 17:28:35 +01:00
Daniel Nicoletti fdc96d3a4f Fix deprecated use of QUrl::setQueryItems() 2017-12-29 17:28:35 +01:00
Daniel Nicoletti e06e04ee93 Fix parsing list of encrypted folders 2017-12-29 17:28:35 +01:00
Daniel Nicoletti a63d34f870 Prepend "nextcloud" for all logging categories
Thus making easier to exclude logging from kio, qt
and only enable "nextcloud.*"
2017-12-28 17:33:10 -02:00
Tomaz Canabrava efc039863b [CSE] Tons of debugs. 2017-12-24 17:08:04 +01:00
Tomaz Canabrava da9f1c412d [CSE] Remove debug 2017-12-24 16:36:57 +01:00
Tomaz Canabrava 06c34ed617 [CSE] Assorted fixes
- Unlock the folder even on error
- Use the correct name of the file for upload
2017-12-24 16:30:39 +01:00
Tomaz Canabrava 60ef722b60 [CSE] Update the metadata when a file is being uploaded. 2017-12-22 23:05:39 +01:00
Tomaz Canabrava e70bf44aaf [CSE] Fix the generation of the data for the update Metadata 2017-12-22 22:39:45 +01:00
Tomaz Canabrava 124a7253a4 [CSE] Create job to Update Metadata 2017-12-22 22:02:16 +01:00
Roeland Jago Douma 65dfc47ac7
Set public key once certificate is retrieved
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-21 10:20:03 +01:00
Roeland Jago Douma 0dc7831336
Key is already base64 decoded
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-21 09:49:31 +01:00
Tomaz Canabrava b72113a53d [CSE] Prepare the beginning of the upload.
I still need to send the metadata.
2017-12-21 00:35:23 +01:00
Tomaz Canabrava df5fd3fbe6 [CSE] More debug output, fix input file path 2017-12-21 00:00:27 +01:00
Tomaz Canabrava 7be5f0a736 [CSE] Update the finished signal 2017-12-20 23:36:49 +01:00
Tomaz Canabrava d87648c99a [CSE] Use the metadata as pointer. 2017-12-20 23:30:51 +01:00
Tomaz Canabrava 25d58ccd58 Revert "Store metadata keys as keys"
This commit broke decryption.

This reverts commit b9f094cd94.
2017-12-20 23:16:42 +01:00
Tomaz Canabrava dd0528037d [CSE] Generate a random name for the temporary file 2017-12-20 23:09:28 +01:00
Tomaz Canabrava 7e83f0591b [CSE] Create the Encrypted File on Disk 2017-12-20 22:32:38 +01:00
Tomaz Canabrava 3760b86e07 [CSE] Mobe fileEncryption to a static function
and I'll move all of those to a namespace latter.
2017-12-20 22:28:01 +01:00
Tomaz Canabrava 20198c5c7b Merge branch 'clientSideEncryptionV3' of github.com:nextcloud/client into clientSideEncryptionV3 2017-12-20 22:11:46 +01:00
Roeland Jago Douma 3c301a8282
Add missing FolderMetadata functions
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-20 22:08:57 +01:00
Roeland Jago Douma 74bc9213c5
Generate encrypted metadata on the fly
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-20 22:04:26 +01:00
Tomaz Canabrava 679bb1f18e [CSE] Expose EncryptionHelper 2017-12-20 21:33:25 +01:00
Tomaz Canabrava 14b18b146d Merge branch 'clientSideEncryptionV3' of github.com:nextcloud/client into clientSideEncryptionV3 2017-12-20 21:29:54 +01:00
Roeland Jago Douma 5e23ca9658
FolderMetaData: store metadataKeys in a QMap
* This allows us to pick the right key for files

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-20 21:25:27 +01:00
Roeland Jago Douma b9f094cd94
Store metadata keys as keys
Don't store them base64 encoded. But store them directly useable
2017-12-20 21:17:41 +01:00
Roeland Jago Douma c35b57cfba
Parse the files in the metadata
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-20 20:49:16 +01:00
Tomaz Canabrava 1e899f4172 [CSE] Do not create QPointer from raw pointers 2017-12-20 20:00:59 +01:00
Tomaz Canabrava 0347cf4e9e [CSE] Store the sharing keys in memory 2017-12-20 19:40:58 +01:00
Roeland Jago Douma fc73ad7476
Salt should not be hardcoded
We append the salt (just like the IV) to the ciphertext of the private
key. This means we also have to split it off properly.

This breaks compartibility with currently stored keys on your server.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-20 16:07:33 +01:00
Roeland Jago Douma b924ad7282
Lower mnemonic when generating password
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-20 15:41:38 +01:00
Roeland Jago Douma 4551bbe0e0
Forget key + cert + mnemonic on account removal
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-20 15:35:23 +01:00
Roeland Jago Douma a48a3e0acc
Cleanup old functions
Those functions had no use anymore since we store the key and cert in
the keychain. Removed them so we don't use them by accident.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-20 13:41:13 +01:00
Roeland Jago Douma ee281963fe
Base64 magic:
* metadata keys: bin -> b64 -> enc -> b64
* sharing metadat: string -> b64 -> enc -> b64

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-20 10:22:35 +01:00
Tomaz Canabrava ab89231ca2 [CSE] Remove unused debug 2017-12-20 00:25:56 +01:00
Tomaz Canabrava d26ade1870 [CSE] Fix the result of the decryption
However the text still looks like encrypted.
2017-12-20 00:25:39 +01:00
Tomaz Canabrava a1e6901ecc [CSE] Decrypt correctly the metadata
There's a bug that's returning an empty bytearray, need to look
into that.
2017-12-20 00:20:27 +01:00
Tomaz Canabrava 494ae31de9 [CSE] Fix correct json object 2017-12-19 23:09:39 +01:00
Tomaz Canabrava a02246dc65 [CSE] Fix Metadata bugs p1
The RFC was misleading, I took the chance to fix a few
inconsistencies regarding the QJsonDocument.
2017-12-19 22:47:05 +01:00
Tomaz Canabrava 5609a1dbe8 [CSE] Remove old debug code so I can focus. 2017-12-19 17:02:23 +01:00
Tomaz Canabrava aa36cc4a5c [CSE] Reduce probability of conflicts when rebasing
Creates a new file/class to handle upload,
propagateuploadencrypted.h/cpp. This should have all the logic to deal
with the encryption and upload.
2017-12-17 22:38:43 +01:00
Tomaz Canabrava b9cdc8e922 [CSE] Fix the url to delete the metadata 2017-12-17 21:19:32 +01:00
Christian Kamm 83e94c3ec7 Fix compile after rebase 2017-12-15 18:05:44 +01:00
Christian Kamm a7c0cfc8eb Upload conflict files #4557
If the server has the 'uploadConflictFiles' capability conflict
files will be uploaded instead of ignored.

Uploaded conflict files have the following headers set during upload
  OC-Conflict: 1
  OC-ConflictBaseFileId: 172489174instanceid
  OC-ConflictBaseMtime: 1235789213
  OC-ConflictBaseEtag: myetag
when the data is available. Downloads accept the same headers in return
when downloading a conflict file.

In the absence of server support clients will identify conflict files
through the file name pattern and attempt to deduce the base fileid.
Base etag and mtime can't be deduced though.

The upload job for a new conflict file will be triggered directly from
the job that created the conflict file now. No second sync run is
necessary anymore.

This commit does not yet introduce a 'username' like identifier that
automatically gets added to conflict file filenames (to name the files
foo_conflict-Fred-1345.txt instead of just foo_conflict-1345.txt).
2017-12-15 18:03:53 +01:00
Christian Kamm 8eebc53728 Unify item type enum
Previously, there was csync_ftw_type_e and SyncFileItem::Type. Having
two enums lead to a bug where Type::Unknown == Type::File that went
unnoticed for a good while.

This patch keeps only a single enum.
2017-12-15 18:02:04 +01:00
Tomaz Canabrava 2e516dfc67 Merge branch 'clientSideEncryptionV3' of github.com:nextcloud/client into clientSideEncryptionV3 2017-12-15 15:05:51 +01:00
Tomaz Canabrava 250c8ff1bf [CSE] Add job to delete metadata
This is needed for the correct functioning of the Set Folder
as Decrypted
2017-12-15 15:02:43 +01:00
Tomaz Canabrava 5607e27f20 [CSE] Actually save the http response result 2017-12-15 14:25:57 +01:00
Tomaz Canabrava 43332d3ac7 [CSE] Properly update UI status to encrypted / decrypted 2017-12-15 14:00:42 +01:00
Klaas Freitag 3b96097cf6 Config: Look for exclude file in a relative path.
If the application binary is not installed in /usr/bin the client
with this patch considers to check the relative location
../../etc/owncloud-client/ to find the system exclude.

This is an important bit for AppImage based packages of the client,
as this runs from a temporar mountpoint and the system file can not
be found under /etc.
2017-12-15 09:54:40 +01:00
Roeland Jago Douma 99b4381591
Don't try to decrypt twice
The DecryptMetaDataKeys already base64 decoded

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-14 23:11:40 +01:00
Roeland Jago Douma 69a201a62d
Percentencode the json we send so special chars don't cause trouble
The + sign was lost in transfer.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-14 23:11:07 +01:00
Roeland Jago Douma 56028759d5
Merge branch 'master' into clientSideEncryptionV3 2017-12-14 20:47:05 +01:00
Roeland Jago Douma be3afd1291
Add FileEncryptJob and FileDecryptJob
This handles encryption and decryption of files.
Just create the job and start off.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-14 16:54:56 +01:00
Olivier Goffart 4dc49ff3b0 SyncEngine: Recover when the PUT reply (or chunkin's MOVE) is lost
This can happen if the upload of a file is finished, but we just got
disconnected right before recieving the reply containing the etag.
So nothing was save din the DB, and we are not sure if the server
recieved the file properly or not. Further local update of the file
will cause a conflict.

In order to fix this, store the checksum of the uploading file in
the uploadinfo table of the local db (even if there is no chunking
involved).  And when we have a conflict, check that it is not because
of this situation by checking the entry in the uploadinfo table.

Issue #5106
2017-12-14 11:56:12 +01:00
Roeland Jago Douma fe4bb52a6d
Merge remote-tracking branch 'oc/master' into oc_up 2017-12-14 10:27:11 +01:00
Tomaz Canabrava c592871f94 [CSE] Do not handle b64 inside of the decrypt function
the decrypt function should deal with the raw data always.
2017-12-13 16:37:52 +01:00
Tomaz Canabrava 9916583ffa [CSE] More verbose output 2017-12-12 21:50:30 +01:00
Roeland Jago Douma 25734afd39
First base64 decode
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-12 21:42:37 +01:00
Tomaz Canabrava ea3558faf6 [CSE] Fix strings 2017-12-12 21:29:06 +01:00
Tomaz Canabrava 159c0e138f [CSE] Add a DecryptAsync method
Also, cleanup a bit of the old calls. One particular difference
is that I used to set padding to 1 and it should actually be
PKCS1_OAEP_PADDING
2017-12-12 21:23:02 +01:00
Tomaz Canabrava aca298ca64 [CSE] Be explicit that async encryption uses publicKey 2017-12-12 20:14:31 +01:00
Tomaz Canabrava 2127b2629d [CSE] Move encryption related network jobs to its own file
Move encryption related network jobs to it's own file,
the original file was starting to be just way too big.
2017-12-12 19:36:47 +01:00
Tomaz Canabrava f6f078d1ee [CSE] Rename Variable 2017-12-12 16:15:05 +01:00
Tomaz Canabrava ce37235cc4 [CSE] Retrieve the Private Key from the KeyChain
This fixes one thing and exposes a bug.
the MetadataKeys are not being correctly unencrypted.
2017-12-12 16:09:49 +01:00
Tomaz Canabrava 0a58ea76e5 [CSE] Start the work with an existing metadata 2017-12-12 15:35:53 +01:00
Olivier Goffart 02283fc686
Merge pull request #6224 from owncloud/deprecated
Remove use of deprecated Qt API
2017-12-12 11:48:04 +01:00
Tomaz Canabrava e6f835d138 [CSE] Unlock the folder after a lock
This makes sure the folder will be unlocked for next tests
2017-12-12 11:26:54 +01:00
Tomaz Canabrava 33b1fcfe66 Merge branch 'master' into clientSideEncryptionV3 2017-12-12 10:46:43 +01:00
Olivier Goffart 8c652e061d Remove uses of deprecated QString::fromAscii 2017-12-08 16:15:48 +01:00
Olivier Goffart 263668b1cb Remove use of deprecated translate call 2017-12-08 16:15:38 +01:00
Olivier Goffart 3df65460f5 Remove usage of QString::null
Replaces by "QString()"
2017-12-08 16:15:22 +01:00
Olivier Goffart 74672d493d Utility: use QUrlQuery
For QUrl::setQuery is deprecated in Qt5
2017-12-08 16:15:17 +01:00
Tomaz Canabrava 0a83d3e743 [CSE] Fix reading the public key for the metadata
This broke when we started to use QSslKey and the Qt Keychain
framework.
2017-12-08 11:24:22 +01:00
Tomaz Canabrava a08a32ceca [CSE] Fetch the metadata for the upload. 2017-12-08 10:32:05 +01:00
Tomaz Canabrava 6745777ca3 [CSE] Save folder id and token for the lock
So we can unlock it later. - perhaps we should store this
on the disk or something, to make it harder to lose.
2017-12-08 10:19:56 +01:00
Tomaz Canabrava 70d562668c [CSE] Add handling for side-by-side uploads. 2017-12-07 21:51:42 +01:00
Tomaz Canabrava ccd8cff4db [CSE] Try to lock repeteadly the folder if needed.
The upload is made in an event loop with more than one
upload at the same time, this confuses the hell out of the
folder locking mechanism.

We need to lock the folder and ask the other trials to try
again in a few seconds in the future to give time for the
uploader to actually upload the current file that's locking
the folder.
2017-12-07 21:31:20 +01:00
Tomaz Canabrava 9f678652f8 [CSE] Lock the folder to upload a file. 2017-12-07 20:52:54 +01:00
Tomaz Canabrava 76916b6c48 [CSE] Request the Folder ID. 2017-12-07 19:39:30 +01:00
Tomaz Canabrava 4878e824e5 [CSE] Fix reading encrypted status of folders. 2017-12-07 19:04:12 +01:00
Tomaz Canabrava 893ca66af8 [CSE] Fix indentation
Parts of the code are indented by spaces, other parts by tabs.
This needs to run in the whole codebase.
2017-12-07 18:12:25 +01:00
Tomaz Canabrava 19120fde9f [CSE] Don't query for files on GetFolderEncryptStatusJob
The request for folders whas also replying for files.
2017-12-07 18:10:14 +01:00
Tomaz Canabrava 7fe4dd2163 [CSE] Renane GetFolderEncryptStatus to GetFolderEncryptStatusJob
it's a network job after all
2017-12-07 18:06:55 +01:00
Olivier Goffart 4581d708ff Account: remove dependency with ConfigFile
Part of #6213
2017-12-07 17:39:16 +01:00
Olivier Goffart e0a14cac5b ConfigFile: use QStandardPaths::AppConfigLocation for the config file
Also use appName instead of appNameGui in order to compute the path

Issue: #2245

The reason is to respect the XDG spec on Unix (#1601) and might help
on windows roaming profiles (#684)
2017-12-07 17:39:16 +01:00
Olivier Goffart ac844a2a45 AbstractNetworkJob: move the httpTimeout from the propagator to the network job
Remove one dependency from the config file for the sync engine.
Part of issue #6213
2017-12-07 17:39:16 +01:00
Olivier Goffart 7230fa6b4f SyncOptions: move to its own file
It does not really belong in the discoveryphase.h as it is used also for
propagator option.

Also use C++11 style member initializer
2017-12-07 17:35:38 +01:00
Tomaz Canabrava 863e86138f [CSE] Pass the folder to the GetEncryptionStatus
Sometimes we are only interested in folders.
2017-12-07 17:32:35 +01:00
Christian Kamm 7ab127ad53 Excludes: Refactor for pending improvements
Make ExcludedFiles something that is instantiated outside of
the CSYNC context and then given to it as a hook.

ExcludedFiles still lives in csync_exclude and the internal
workings haven't been touched.
2017-12-07 14:38:21 +01:00
Olivier Goffart dd91f4a86e Merge remote-tracking branch 'origin/2.4'
Conflicts:
	src/csync/csync.cpp
2017-12-07 09:37:50 +01:00
Christian Kamm ceac18c554 Reconcile: Rename maps are consistent with update phase #6212
For duplicate file ids the update phase and reconcile phase determined
the rename mappings independently. If they disagreed (due to different
order of processing), complicated misbehavior would result.

This patch fixes it by letting reconcile try to use the mapping that the
update phase has computed first.
2017-12-06 16:42:11 +01:00
Olivier Goffart ed5385faa3 Merge remote-tracking branch 'origin/2.4'
Conflicts:
	src/libsync/connectionvalidator.cpp
     	src/libsync/networkjobs.cpp
2017-12-05 15:58:13 +01:00
Tomaz Canabrava 66aecb9626 [CSE] Handle normal uploads in CSE enabled instances 2017-12-04 22:45:10 +01:00
Tomaz Canabrava 6f35cbff6b [CSE] Fetch the Folder information for encryption status 2017-12-04 22:27:13 +01:00
Tomaz Canabrava 387737d908 [CSE] Start to create the upload logic. 2017-12-04 21:33:43 +01:00
Tomaz Canabrava 8c4928d9f6 Merge branch 'uploadImprovements' into clientSideEncryptionV3 2017-12-03 18:15:33 +01:00
Tomaz Canabrava 35eb071874 [uploadImprovements] use the new struct on PropagateUploadNg
use the new struct on PropagateUploadNg to make the algorithm
more future proof.
2017-11-28 22:58:52 +01:00
Tomaz Canabrava a64bd6059b [uploadImprovements] fix struct hole 2017-11-28 22:22:37 +01:00
Tomaz Canabrava a623b14209 [uploadImprovements] use the new struct info in PropagateUploadV1
Add a new member for the UploadFileInfo in PropagateUploadCommon
to hold the full file path - as it can change if we use a temporary
file to upload.

Adapt propagateuploadv1 to use the new calls.
2017-11-28 22:17:29 +01:00
Tomaz Canabrava f609336bfc Split file to upload from the file on disk
They can be conceptually equal - I can upload the file
on disk, and that's what I do right now. But if we want
to accept filters in the future, filters that change
the file on disk like shrinking an image, the current
information used is wrong and we need a way to separate those.

This patch introduces a new struct that holds the *actual*
file that will be uploaded, be it a temporary one or
the original file.
2017-11-28 21:28:06 +01:00
Tomaz Canabrava 2cacf2547e Merge branch 'master' into clientSideEncryptionV3 2017-11-28 20:12:57 +01:00
Roeland Jago Douma 0f60deb043
Store and retrieve keys in keychain
* Store privatekey, certificate and mnemonic in keychain
* Retrieve private + public key from server
  - ask for mnemonic to decrypt private key

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-11-28 12:36:35 +01:00
Tomaz Canabrava c4d3d0987d [CSE] Find the start of the upload 2017-11-27 22:20:24 +01:00
Tomaz Canabrava 47b5cd0fbb [CSE] Shows correctly Encrypt / Decrypt in the menu 2017-11-27 21:19:54 +01:00
Tomaz Canabrava dd903d447f [CSE] Store the encryption status without the webdav url
The Folder information on the desktop client doesn't
knows about the webdav layout aparently.
2017-11-27 21:09:13 +01:00
Tomaz Canabrava d2d2df4c75 [CSE] Try to find the webdav url of a folder. 2017-11-27 21:06:38 +01:00
Roeland Jago Douma ffb9f69cf6
Start with moving data to the keychain
* Check for cert + privateKey in keychain
* Work with QSslKey and QSslCertificate
* Abstract reading the BIO's a bit more

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-11-27 16:21:53 +01:00
Roeland Jago Douma 74c4d27ea0
Indent
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-11-27 16:12:56 +01:00
Tomaz Canabrava e3050f7456 [CSE] Pass by reference, return by value.
Also, Do not create variables in the heap to change it's value
via reference, prefer an aggregation value. use a Typedef to
fully specify what you want in return.
2017-11-27 15:21:29 +01:00
Roeland Jago Douma 9cbe795045
Move more encryption functions to encryption helper
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-11-25 21:43:15 +01:00
Roeland Jago Douma e0fbdfe175
Remove obsolete encryption functions
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-11-25 15:50:47 +01:00
Olivier Goffart 753d7addb4 libsync: Fix compilation with TOKEN_AUTH_ONLY
This means we cannot use QtGui in libsync.
So this mostly disable the avatar from the account and the avatarjob

Note that there is one logic change: in ConnectionValidator::slotUserFetched
we do the avatar job even if the user is empty. Otherwise we would end up in
a invalid state. This restore the 2.3.x behavior that was broken in
commit e05d6bfcdc
2017-11-25 12:57:16 +01:00
Roeland Jago Douma 12adff76e2
Properly decrypt private key and send it to the server
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-11-24 22:10:28 +01:00
Roeland Jago Douma 6d145a676b
Added EncryptionHelper
This is to move generic encryption methods out of the main code and into
small helper functions. So we don't scatter the encryption code all over
the place.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-11-24 21:05:21 +01:00
Tomaz Canabrava 45d9323653 [CSE] Update encryption status when folder is updated 2017-11-23 16:55:12 +01:00
Tomaz Canabrava 57e0d7abcb [CSE] Fix pointer to e2e
Qt expects things to be pointers even if they are stack
variables.
2017-11-23 16:54:45 +01:00
Olivier Goffart 72809ef5b1 csync_update: ignore remote files that cannot be encoded
This is mainly for linux, whose local is not UTF-8.
For example, in latin1, it is not possible to encode emoji or chinese character.
If there are such character in the filename, Qt would just save the file using
the replacement character ('?'). Then, on the next sync, client would rename
the files using this replacement character.

Avoid this by ignoring the files which cannot be downloaded because the
filename cannot be represented with the user's locale

Relates to issue #5676 and #5719
2017-11-23 12:51:28 +01:00
Christian Kamm e9907bc8ae AvatarJob improvements
* Drop AvatarJob2
* Allow AvatarJob to retrieve different sizes and users
* Make creating a circular avatar into a function
  (maybe all avatars should be made into that shape in the first place)
2017-11-21 16:33:03 +01:00
Christian Kamm d949ec6877 Protocol: Introduce context menu with "open in browser" #6121
To do this conveniently a bunch of functionality that's common to
IssueWidget and ProtocolWidget is moved to ProtocolItem.

Also the convenience function to asynchronously retrieve the private
link url is moved from the socket api to the network jobs.
2017-11-21 12:42:10 +01:00
Tomaz Canabrava a118419f0c [CSE] buildfix, use the correct type. 2017-11-21 09:55:44 +01:00
Tomaz Canabrava d31aa7836a [CSE] Add job to find what folders are encrypted.
This still needs to be correctly setuped in the call chain.
The job returns a QVariantMap with the folder-webdav-url
and the encrypted status.
2017-11-20 21:38:17 +01:00
Tomaz Canabrava 34e6534813 Merge branch 'clientSideEncryptionV3' of github.com:nextcloud/client into clientSideEncryptionV3 2017-11-20 18:01:48 +01:00
Tomaz Canabrava 6d464d9dc6 Merge branch 'master-nextcloud' into clientSideEncryptionV3 2017-11-20 18:00:58 +01:00
Roeland Jago Douma 9878559002
Move to NC theme
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-11-20 15:46:18 +01:00
Christian Kamm aafe7c4732 Merge remote-tracking branch 'origin/2.4' 2017-11-20 11:54:56 +01:00
Olivier Goffart 480932a58a Checksum: Ignore unkown OC-Checksum header when downloading...
And if there are several checksums, pick the "best" one.

The case of several checksum was reported in
https://github.com/nextcloud/client_theming/issues/213
2017-11-20 10:51:15 +01:00
Christian Kamm e694ffcd03 PropagateDownload: Adjustments to skipping downloads #6153
Previously we required matching mtimes but that's actually
unnecessary when the question is about whether to skip the
download. We will still update the file's metadata.

Also, adjust behavior when the checksum is weak (Adler32):
in these cases we still depend on equal mtimes.
2017-11-16 13:31:54 +01:00
Roeland Jago Douma 9394fe6e84
Use openssl functions to get random words
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-11-16 10:45:57 +01:00
Olivier Goffart 9a1ea67a35 Theme: Update the wizard size on high dpi screen
Issue #6156
2017-11-15 10:46:08 +01:00
Christian Kamm bff24ffd2f PropagateDownload: Fix GET with redirects #6159
The GET jobs were redirected, but the custom incremental handling
in readyRead didn't propagate to the follow-up job.
2017-11-15 10:11:15 +01:00
Christian Kamm b0f986c740 Private links: Account for overwritehost #6146
Retrieve ocs/v1.php/config to determine the desired host and build the
private link urls with that instead.
2017-11-14 12:14:11 +01:00
Christian Kamm 3ae2071129 DetermineAuth: Remove concept of Unknown #6148
This restores 2.3 behavior. Some servers reply 404 to GETs and PROPFINDs
to the remote.php/webdav/ url and used to work. Being more picky would
break them.
2017-11-14 12:10:35 +01:00
Tomaz Canabrava 14aeb6921b [CSE] Fix invalid memory access 2017-11-13 18:15:08 +01:00
Tomaz Canabrava a0f0e5617a [CSE] Move the e2e object to the Account
This is important as a lot of the code would start
to rely in direct access to the client side encryption
and there are different keys for different accounts.
2017-11-13 17:22:09 +01:00
Tomaz Canabrava 6351c01ee7 [CSE] Remember the token for folders 2017-11-13 17:04:02 +01:00
Tomaz Canabrava 22a2ab8999 [CSE] Start to send the metadata to the server 2017-11-13 16:46:30 +01:00
Tomaz Canabrava 4755b8c8a3 [CSE] More warnings 2017-11-12 13:03:52 +01:00
Tomaz Canabrava 19d64e6308 [CSE] Remove warnings 2017-11-12 12:55:12 +01:00
Tomaz Canabrava 685ceacace [CSE] Memleaks 2017-11-11 16:25:38 +01:00
Tomaz Canabrava ee4a848d9a [CSE] Correctly Unlock the Folder
Wireshark is love, and life.
2017-11-06 20:58:30 +01:00
Tomaz Canabrava 7290cf2813 [CSE] Adjust the CN accordingly to the server 2017-11-06 20:57:50 +01:00
Christian Kamm 9af6e29f42 DetermineAuthType: Adjustments for tight firewalls #6135
With some firewalls we can't GET /remote.php/webdav/. Here we keep the
GET request to detect shibboleth through the redirect pattern but then
use PROPFIND to figure out the http auth method.

Currently we prefer OAuth to Shibboleth to Basic auth.

This also restores the fallback behavior of assuming basic auth
when no auth type can be determined.
2017-11-06 13:09:10 +01:00
Roeland Jago Douma 131fd4e483
Fix encryptJSON and descryptJSON
Now working with tag
Basically we called EVP_*Update to much which resulted in weird output.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-11-03 18:00:05 +01:00
Tomaz Canabrava be9cd358d4 [CSE] Bypass Qt DELETE Bug
It appears that Qt implementation of the DELETE http request
does not send bodyData, and we need that for Nextcloud.
Currently I changed the http request on the server side
to accept a POST instead of a DELETE, so I can actually
develop.

Also, I already poked the Qt developers that did this code.
2017-11-03 17:00:28 +01:00
Tomaz Canabrava 6ad6852045 [CSE] Cleanup - remove commented metadata. 2017-11-03 16:59:39 +01:00
Tomaz Canabrava 5514f14e88 [CSE] Get and send the lock - token 2017-11-03 15:12:12 +01:00
Tomaz Canabrava b53003792f [CSE] Removed lambdas for Metadata / Lock / Unlock 2017-11-03 12:34:30 +01:00
Tomaz Canabrava 6facd29663 [CSE] Start to break the lambdas
Lambda within a lambda is a terrible idea,
Use default signal / slot connections with a
method instead.
2017-11-03 12:00:25 +01:00
Tomaz Canabrava d7e05c9b05 [CSE] Comment out broken code.
But why it's broken?
2017-11-03 11:20:44 +01:00
Christian Kamm c9d5a9cea2 HttpCreds: Don't create empty client cert keychain entries #5752
This doesn't do anything about deleting the client cert keychain
entries when the whole account is removed though.
2017-11-03 10:28:56 +01:00
Roeland Jago Douma 8e3e3a4575
Be java compatible and store the tag at the end of the cipher text
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-11-02 12:39:42 +01:00
Tomaz Canabrava 8d537fdd3c [CSE] Get Metadata from the server 2017-11-01 18:32:33 +01:00
Tomaz Canabrava 4a66cf11d2 [CSE] Send Metadata to the server 2017-11-01 18:21:30 +01:00
Tomaz Canabrava 2698759525 [CSE] Implement the Folder Unlock api job 2017-11-01 17:54:17 +01:00
Tomaz Canabrava 1b1add5ead [CSE] Add api to lock file 2017-11-01 17:36:54 +01:00
Christian Kamm 6ac44f05cd Credentials: Namespace windows cred keys #6125
The application name is prepended to the key. QtKeychain doesn't
do that automatically on the platform.
2017-11-01 17:03:30 +01:00
Tomaz Canabrava e5fdcd2f38 [CSE] Add TODO: 2017-11-01 16:48:19 +01:00
Tomaz Canabrava ef2529ca44 [CSE] Set padding to 0 for the Rsa encryption
Also, commented out the finalization of the decrypt operation
because that was messing with the encryption. There's something
wrong here but I need to get this working and I can fix stuff
later.
2017-11-01 16:13:17 +01:00
Tomaz Canabrava 1a891423e5 [CSE] Call the decryption function to test. 2017-11-01 15:48:40 +01:00
Tomaz Canabrava 41ebcd0b7e [CSE] Decryption of the metadata blob 2017-11-01 15:29:14 +01:00
Tomaz Canabrava 77ec3b086d [CSE] Remember to finalize encryption 2017-11-01 15:24:19 +01:00
Tomaz Canabrava 88d87bf0ca [CSE] Convert encrypted bitearray to Base64
also, start the decrypt.
2017-11-01 14:46:32 +01:00
Tomaz Canabrava eb43fa1459 [CSE] Internal metadata encryption working 2017-10-31 17:52:01 +01:00
Tomaz Canabrava 8793fdbc69 [CSE] Remember to actually use the correct variable 2017-10-31 16:06:01 +01:00
Tomaz Canabrava 4bb7ebb6aa [CSE] Convert the base64 data to raw, for the decyrption 2017-10-31 13:17:22 +01:00
Tomaz Canabrava 3628f3739d [CSE] Start the decryption of the metadata 2017-10-31 13:06:20 +01:00
Tomaz Canabrava b28b4705de [CSE] Correctly store the encrypted metadata
Missing the conversion to base64.
2017-10-31 12:07:47 +01:00
Tomaz Canabrava c7d9abbea3 [CSE] Rework pubkeyPath to be able to fetch pubKey 2017-10-30 20:02:55 +01:00
Tomaz Canabrava a986532442 [CSE] Generate a random password for the metadata. 2017-10-30 19:08:03 +01:00
Tomaz Canabrava cf56d58241 [CSE] Start the encryption of the metadataKey 2017-10-30 19:05:55 +01:00
Tomaz Canabrava c695c50c33 [CSE] Implement the empty metadata
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2017-10-30 15:40:05 +01:00
Tomaz Canabrava 5420741edb Merge branch 'master' into clientSideEncryptionV3 2017-10-30 11:21:36 +01:00
Christian Kamm 05c1bfb6cf Merge remote-tracking branch 'origin/2.4' 2017-10-27 10:29:31 +02:00
Jocelyn Turcotte 10c6951438 Windows: Add a setting to enable/disable the explorer navigation pane integration
Issue #5295
2017-10-24 16:10:53 +02:00
Roeland Jago Douma 238f0b3610
Add note
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-10-24 15:53:17 +02:00
Roeland Jago Douma 817baf292d
Use EVP_aes_128_gcm
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-10-24 15:51:53 +02:00
Roeland Jago Douma ca6fa7b341
Update decryp function
* Do not use AAD
* Do not try to decrypt the last 16 bytes as Android adds the tag there
by default

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-10-24 15:51:53 +02:00
Roeland Jago Douma bacbf337d2
Update encryption function
* Do not use padding
* Do not use the ADD data
* Append the tag to the ciphertext to be compatible with Android

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-10-24 15:51:53 +02:00
Olivier Goffart ee63b36ed3 SyncFileStatusTracker: Detect changed in the shared flag
... even if the file is not changed.

We get an UPDATE_METADATA in that case, so make sure we let the
SyncFileStatusTracker know about it.
That means we need to filter out UPDATE_METADATA in the other listeners
of this signal.

Issue #6098
2017-10-24 15:50:14 +02:00
Olivier Goffart 35d28294cd SyncEngine: remove SyncEngine::syncItemDiscovered
It is unused.
2017-10-24 15:50:14 +02:00
Christian Kamm e85a339d94 Local discovery: Use db instead of filesystem
We mostly trust the file watchers meaning that we don't re-scan the
local tree if we have done that recently and no file watcher events
have arrived. If the file watchers invalidate a subtree, we rescan
only that subtree.

Since we're not entirely sure the file watchers are reliable, we still
do full local discoveries regularly (1h by default). There is a config
file setting as well as an environment variable to control the interval.
2017-10-24 10:00:20 +02:00
Tomaz Canabrava 476fe66043 [CSE] Add beginnign of the code to deal with the metadata 2017-10-23 21:06:26 +02:00
Tomaz Canabrava 23f5bb7ed9 [CSE] Move network jobs out of networkjobs.h
Since those networkjobs are all about client side
encryption, mvoe them to clientsideencryption.h
This will help with fewer conflicts with the origin.
2017-10-23 21:06:26 +02:00
Olivier Goffart a9761a8976 Use qEnvironmentVariable* instead of qgetenv when appropriate
Now that we use Qt5, we should do that. It is slightly more efficient
and declares the intent.
(Modified using clazy)
2017-10-19 13:57:49 +02:00
Tomaz Canabrava 1a47052aa3
[CSE] Remove unused function
This is already being called from somwhere else.
2017-10-18 21:51:39 +02:00
Tomaz Canabrava e0988f482c
[CSE] Build fix
- change the name of one Qt Message Handler
- changed parameter from int to QString
2017-10-18 21:51:39 +02:00
Tomaz Canabrava d83e8819ce
[CSE] SetEncryptionFlagApiJob
This new job sets the Encryption Flag in a folder.
2017-10-18 21:51:39 +02:00
Tomaz Canabrava 623eb29845
[CSE] Helper functions for the URL's 2017-10-18 21:51:39 +02:00
Tomaz Canabrava 1436d5bac1
[CSE] Better debug output 2017-10-18 21:51:39 +02:00
Tomaz Canabrava 0b50afe915
[CSE] Correctly Set's the client as connected
If we manage to encrypt and upload the private key
to the server, the client is in it's connected state.
2017-10-18 21:51:39 +02:00
Tomaz Canabrava cfb6e3be8c
[CSE] Send the Private Key to the server 2017-10-18 21:51:38 +02:00
Tomaz Canabrava 78136a10b0
[CSE] Debug statements to help find the encrypt error 2017-10-18 21:51:38 +02:00
Tomaz Canabrava 08dfe86f37
[CSE] Adjust the calls to ent-to-end encryption
We changed the name.
2017-10-18 21:51:38 +02:00
Tomaz Canabrava 0f1480728e
[cse] Use fake data to verify the encryption
beware, this is broken.
2017-10-18 21:51:38 +02:00
Tomaz Canabrava ba3d2a61d5
[cse] Call the encrypt and decrypt functions on fake data 2017-10-18 21:51:38 +02:00
Tomaz Canabrava e0d368cbb3
[cse] Update the encrypt and decrypt algorithm to GCM 2017-10-18 21:51:38 +02:00
Tomaz Canabrava 4f7265c04f
[aes] Create the Decrypt function. 2017-10-18 21:51:38 +02:00
Tomaz Canabrava 6b53b4f257
[cse] Add the crypt method, based on OpenSSL Wiki 2017-10-18 21:51:38 +02:00
Tomaz Canabrava 77c0309e02
[cse] use PKCS5_PBKDF2_HMAC_SHA1 on the random-word passphrase 2017-10-18 21:51:38 +02:00
Tomaz Canabrava 5395fc56b1
[cse] Start the encryption algorithm for the Private Key 2017-10-18 21:51:38 +02:00
Tomaz Canabrava fd00e180f5
[aes] fix out of bounds access. 2017-10-18 21:51:38 +02:00
Tomaz Canabrava 418401a33c
[cse] new method, getUnifiedString
Enter a string list, return a string.
2017-10-18 21:51:38 +02:00
Tomaz Canabrava 2111aeaac1
[cse] Add wordlist & related methods. 2017-10-18 21:51:37 +02:00
Tomaz Canabrava 69c709714d
[cse] Save signed key on disk 2017-10-18 21:51:37 +02:00
Tomaz Canabrava 090336c928
[cse] Correctly send the CSR
finally.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2017-10-18 21:51:37 +02:00
Tomaz Canabrava 307dfd195c
[cse] Call the CSR job.
There's something wrong on the CSR job that I need to discover.
2017-10-18 21:51:37 +02:00
Tomaz Canabrava 304231811d
[cse] Start the job to sign the public key. 2017-10-18 21:51:37 +02:00
Tomaz Canabrava ecb05020a9
[cse] Do not save the certificate on disk
Store it on memory, and discard it as soon as no longer
needed.
2017-10-18 21:51:37 +02:00
Tomaz Canabrava d2992d92ba
[cse] Generate the CSE
I still need to send it to the server. It's been a long
learning with the OpenSSL library.
2017-10-18 21:51:37 +02:00
Tomaz Canabrava c358980448
[cse] Link Against OpenSSL
For some reason, this was working untill I added a call
to X509_REQ_get_subject_name, then the linking suddenly
stopped working (even tougth I'm using a ton of other
OpenSSL calls)

Force to link against 1.0
2017-10-18 21:51:37 +02:00
Tomaz Canabrava 42a3098595
[cse] s/scr/csr 2017-10-18 21:51:37 +02:00
Tomaz Canabrava 58e2e6b30b
[cse] Generate the public / private keys and store locally
Now I need to understand what the hell I need to do
to send this to the server.
2017-10-18 21:51:37 +02:00
Tomaz Canabrava 8c342cb1dd
[cse] Generate the KeyPair
Not stored anywhere yet, but it's correctly running.
2017-10-18 21:51:37 +02:00
Tomaz Canabrava 17693a75e5
[cse] Request public key from server
This is the first step needed to properly communicate.
Next, get private key.
2017-10-18 21:51:37 +02:00
Tomaz Canabrava f4bbec1019
[bugfix] Return the error code, don't discard it. 2017-10-18 21:51:37 +02:00
Tomaz Canabrava 29b64640fa
[cse] Start to fetch the basics to fetch the key from the server 2017-10-18 21:51:37 +02:00
Tomaz Canabrava 3f4d915a17
[cse] Add files to handle client side encryption
This will be the responsible for encryption,
decryption and talking with the server.
2017-10-18 21:51:36 +02:00
Tomaz Canabrava 7e2085375f
[cse] Invalid read of 1 2017-10-18 21:51:36 +02:00
Tomaz Canabrava 1c85f94b00
[cse] Use server capabilities to query for cse 2017-10-18 21:51:36 +02:00
Tomaz Canabrava 920047fa70
[CSE] Remove uneeded includes 2017-10-18 21:51:36 +02:00
Tomaz Canabrava 5b51346e83
[CSE] New Network Job: DeleteApiJob
This network job does a DELETE http request on a URL. It's the
second class that does basically the same, but this one returns
the http return code, and it's set to do a api call.
2017-10-18 21:51:36 +02:00
Tomaz Canabrava 9870f39dcb
[CSE] Fetch file-id for subfolders
File id is a must if we want to call any API.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2017-10-18 21:51:36 +02:00
Tomaz Canabrava 9318c487b9
[CSE] Display menu for encrytp / decryot folders
If the server supports client syde encryption, display
a menu on right click that should display encrypt and decrypt.
ideally it would show the encrypt if the folder is decrypted, and
decrypt if the folder is encrypted but currently there's no way
for the client to know that.
2017-10-18 21:51:36 +02:00
Tomaz Canabrava 1c32f6bb2e
[CSE] Check the server for client side encryption
Call the apps api and check if the response has
the client_side_encryption key.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2017-10-18 21:51:36 +02:00
Christian Kamm bf39343920 Sync: Add capability for invalid filename regexes #6092 2017-10-17 17:15:49 +02:00
Christian Kamm b2a8ffc577 Abort: Fix crash with early aborts
_chunkCount could be 0, leading to a floating point exception

I also added initializers for several uninitialized integers in the
upload jobs.
2017-10-17 09:44:52 +02:00
Christian Kamm e2711224ed Propagator: Avoid duplicate async abort 2017-10-17 09:44:52 +02:00
Christian Kamm 111bb485ec UploadNG: Avoid div-by-zero for super fast uploads 2017-10-17 09:44:52 +02:00
Piotr Mrowczynski e10775d34f Fix paused sync file move issue #5949
Dont abort final chunk immedietally

Use sync and async aborts
2017-10-17 09:44:52 +02:00
Christian Kamm f598ac89ac HttpCreds: Fix retry after wrong password #5989
This is an ugly solution.
2017-10-13 14:24:37 +02:00
Christian Kamm 01c2ffe2ae PropagateDownload: Read Content-md5 header #6088 2017-10-11 09:06:23 +02:00
Thomas Müller 315e38e814 Use display-name from the ocs call in the settings dialog 2017-10-06 10:59:20 +02:00
Markus Goetz 3a1a56c7ad Excludes: During directory traversal, use QRegularExpression
On Mac, this halves the time spent in csync_excluded_traversal
when using check_csync_excluded_performance. A similar performance
increase is seen on linux.
2017-10-05 10:19:48 +02:00
Olivier Goffart 800b9cf167 SyncEngine: _hasNoneFiles should be set when there are INSTRUCTION_UPDATE_METADATA 2017-09-28 11:15:36 +02:00
Olivier Goffart d68b07dfc7 Fix encoding of version string 2017-09-27 12:06:49 +02:00
Dominik Schmidt a2ce739192 Set CMAKE_INSTALL_RPATH as RPATH for installed executables 2017-09-27 09:13:44 +02:00
Christian Kamm 844bfc5f25 Move the --version output text to Theme #5957
Extracted and adjusted from packaging.diff by @jnweiger and @dschmidt
2017-09-27 09:13:44 +02:00
Olivier Goffart 13e0cc6b50 Use QDateTime::currentDateTimeUtc instead of the non utc version
QDateTime::currentDateTime is terribly slow.
2017-09-26 16:14:17 +02:00
Jocelyn Turcotte 54c522c861 SyncJournalDb: Reimplement the db_is_empty logic from csync
This reduces the initial sync local discovery time from
2.0 to 0.6 seconds in LargeSyncBench on my machine.
2017-09-26 11:03:23 +02:00
Jocelyn Turcotte a034ee894c Use SyncJournalDb in csync
This gets rid of the csync_statedb sqlite layer and use
the same code and same connection as the rest of the SyncEngine.

Missing functions are added to SyncJournalDb and change a few minor
things (like changing SyncJournalFileRecord::_modtime to be an int64
instead of a QDateTime, like it was in csync).
2017-09-26 11:03:23 +02:00
Jocelyn Turcotte 6f46764daa SyncJournalDB: Allow callers of getFileRecord if the query failed
The current implementation would return the same value whether the query failed
or if no row would be found. This is something that is currently checked by csync
and needs to be provided if we want to use SyncJournalDB there.

Adjusted all call sites to also check the return value even though they
could still just rely on rec.isValid(), but makes it more explicit as to what
happens for database errors in those cases, if we ever want to gracefully handle
them.
2017-09-26 11:03:23 +02:00
Olivier Goffart 090abdee87 bandwidthmanager: Fix unregistering devices on delete
from the destroyed signal, qobject_cast won't work because the object
is already destroyed. One must use reinterpret_cast then
2017-09-25 12:56:20 +02:00
Olivier Goffart ce04a76b17 PropagateUpload: Fix another non-normalized connect that appears while profiling 2017-09-25 12:49:55 +02:00
Olivier Goffart 0cec6f08ca OAuth2: Fix double slash in URL
We need to use concatPath to avoid possible double '/' in the URLs if the
account url() ends with '/'.

This has become even more of a problem since commit
d1b8370a4a which was resolving the url after
a redirect where most server actually add a '/' if the url is a folder
2017-09-23 10:10:40 +02:00
Christian Kamm eae3f7ce0a SyncEngine: Adjust free space messaging
Before, the way the info message was phrased implied a failure. And
since the large numbers can be hard to compare that can be confusing.
2017-09-22 11:07:27 +02:00
Olivier Goffart 95d23b1914 RemotePermissions: Store in a class rather than in a QByteArray to save memory
Create a specific type that parses the permissions so we can store
it in a short rather than in a QByteArray

Note: in RemotePermissions::toString, we make sure the string is not
empty by adding a space, this was already existing before commit
e8f7adc7ca where it was removed by mistake.
2017-09-22 09:29:08 +02:00
Olivier Goffart 35e4fe061d Port to new signal-slot syntax what cannot be done automatically
Some slot were protected or private but needed to be public.
Some needed a static_cast (can't use qOverload because it is in Qt 5.7)

This is not only a partial change.
2017-09-21 14:05:39 +02:00
Olivier Goffart 02924ad83e DiscoveryPhase: use the new syntax in disconnect
Since we used the new syntax in connect, we need to use it in disconnect
2017-09-21 14:05:39 +02:00
Olivier Goffart ff4213b59f Use the Qt5 connection syntax (automated with clazy)
This is motivated by the fact that QMetaObject::noralizeSignature takes 7.35%
CPU of the LargeSyncBench. (Mostly from ABstractNetworkJob::setupConnections and
PropagateUploadFileV1::startNextChunk). It could be fixed by using normalized
signature in the connection statement, but i tought it was a good oportunity
to modernize the code.

This commit only contains calls that were automatically converted with clazy.
2017-09-21 14:05:39 +02:00
Olivier Goffart 1218a38f2c Include <QAuthenticator> from code that connect to signal that uses it
The new connection syntax will need that
2017-09-21 14:05:39 +02:00
Christian Kamm 53195b064a Conflicts: Upload them files if env variable says so
Set OWNCLOUD_UPLOAD_CONFLICT_FILES=1 to trigger this behavior.

Note that this is experimental and unsupported. The real feature is
likely to end up in 2.5.

Uploading conflict files is simply done by removing the pattern from
csync_exclude. The rest here deals with making the conflict notification
ui approximately work.

There are still some concerns about where an uploaded conflict file
appears in the sync protocol and issues list (it should be in both, but
is only in one of them currently!).

See #4557.
2017-09-19 11:45:38 +02:00
Christian Kamm dca2664707 Private links: Retrieve link through propfind property #6020
* The sharing ui does a propfind anyway: use that to query the new
property as well!
* For the socket api, asynchronously query the server for the right url
when an action that needs it is triggered.

The old, manually generated URL will be used as fallback in case the
server doesn't support the new property or the property can't be
retrieved for some reason.

Depends on owncloud/core#29021
2017-09-19 10:51:03 +02:00
Jocelyn Turcotte 2e90e9c35b Fix the build (make install) 2017-09-18 15:32:05 +02:00
Jocelyn Turcotte a1f1775d15 Move SyncJournalDB to src/common 2017-09-18 14:00:52 +02:00
Jocelyn Turcotte 5fbed0d1cd Reverse the dependency between SyncJournalFileRecord and SyncFileItem
This will allow us to also use the SyncJournalDB in csync.
2017-09-18 14:00:52 +02:00
Jocelyn Turcotte bd25225045 Move non-csync-dependent parts of FileSystem to src/common
This keep the csync-dependent parts in src/libsync, slitting the namespace
over two files.
This will allow moving SyncJournalDB to src/common as well.
2017-09-18 14:00:52 +02:00
Christian Kamm 78212e03d6 Checksums: Clearer behavior and added testing 2017-09-18 12:52:09 +02:00
Jocelyn Turcotte a8ea7b0858 Remove SyncFileItem::_isDirectory
It's always equivalent to _type == SyncFileItem::Directory.
2017-09-18 11:46:09 +02:00
Jocelyn Turcotte 0e97770c47 Remove SyncFileItem::log
This remove the remaining "other" fields of the sync log to save a
bit of memory.

other_etag and other_fileId don't give much information to the users
and other_instruction will always be INST_NONE anyway.

other_modtime and other_size are kept since they are sometimes used.
They were renamed to have a bit more meaningful name.

SyncEngine::checkPermissions will now fetch its information from the
csync trees since they are now preserved until right after this point.

Fixes #3213
2017-09-18 11:46:09 +02:00
Jocelyn Turcotte 3d7bd7583b Remove SyncEngine::_remotePerms
Now that csync is using a more convenient data structure for
its file trees, wait a little bit longer before destroying them and
fetch the remote permissions from the remote tree there instead.
2017-09-18 11:46:09 +02:00
Jocelyn Turcotte d66c2b5fae Replace the custom rbtree by a std::map 2017-09-18 11:46:09 +02:00
Christian Kamm be5d5aea6d AbstractNetworkJob: Allow relative redirect
Previously all redirects were considered absolute.
2017-09-15 15:25:10 +02:00
Christian Kamm 8635b8ac84 Reduce timeout for some admin jobs
The oauth token jobs and the wizard redirect check job shouldn't have
5min timeouts.
2017-09-15 15:25:10 +02:00
Christian Kamm 1f57fd0407 HttpCreds: Remove migration code from 1.7 2017-09-15 09:29:05 +02:00
Christian Kamm 671599c8b2 Credentials: Use per-account keychain entries #5830
This requires a lot of migration code: the old entries need to be read,
saved to the new locations and then deleted.
2017-09-15 09:29:05 +02:00
Christian Kamm 0b4fd52d63 Journal: Second attempt at journal mode fallback #5723
Some filesystems, vms or other limitations make using the WAL journal
mode impossible. We are notified of this problem through an sqlite
IOERR for SHMMAP. In that case We want to attempt to fall back to the
DELETE journal mode.
2017-09-15 09:28:35 +02:00
Christian Kamm e05f5fc50d OAuth: Don't use implicit POST bodies
The query args of POST requests become the request body. If there's a
redirect, the redirected url will therefore not contain the query
arguments. Use an explicit request body to make the redirection work.
2017-09-15 09:28:03 +02:00
Christian Kamm 7d075cdcb7 OAuth: Use redirectable jobs for oauth token management 2017-09-15 09:28:03 +02:00
Christian Kamm 3a55ff2119 PropagateUpload: Model of remote quota, avoid some uploads #5537
When we see a 507 error, assume that quota is < uploaded size.
2017-09-15 09:27:07 +02:00
Christian Kamm b5b055e1ae SyncOptions/Propagator: Parallelism as an option
Very useful for changing it on a per-test basis.
2017-09-15 09:27:07 +02:00
Christian Kamm 0c99673581 Make DetailError different from BlacklistedError
It's quite different in regard to blacklist handling and overall
sync failure changes.
2017-09-15 09:27:07 +02:00
Helmut K. C. Tessarek 709aa27031 remove qt4 code 2017-09-15 07:11:05 +02:00
Christian Kamm 70aafd74a8 Journal: Fall back to DELETE on IO error #5723
Also add logging of extended error codes for this IO error, maybe we can
become more specific about which situations should trigger a journal
mode switch.
2017-09-12 14:12:24 +02:00
Christian Kamm 09173fb727 Update server url in case of permanent redirection #5972
This is the first time the account url may update outside of
account setup.

Summary of redirection handling:
1. During account setup (wizard)
   - status.php gets permanently redirected -> adjust url
   - authed PROPFIND gets *any* redirection -> adjust url
2. During connectivity ping (ConnectionValidator)
   - status.php gets permanently redirected -> adjust url (new!)

All other redirections should be followed transparently and
don't update the account url in the settings.
2017-09-11 19:27:36 +02:00
Christian Kamm de5de6284c Use DetermineAuthTypeJob in HttpCredentials
* Move it to networkjobs
* Minor adjustments to its logic
* Fixes redirect handling for oauth/basic http auth check #6003
2017-09-11 19:15:43 +02:00
Jocelyn Turcotte 715b8c4683 Fix build after C++ conversion of csync
Use the same macro as in SyncFileItem for bitfields on enums.

Fixes #5993
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte b1bb7ec1a8 Use a C++ contructor and destructor for CSYNC
Merge csync_create and csync_init into the constructor and
replace csync_destroy with the destructor.

Also use a QByteArray for csync_s::root_perms and flatten
csync_rename_s as a rename sub-struct of csync_s since it
can now handle C++ types.
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte cb49635231 Replace TREE_WALK_FILE with csync_file_stat_t
Just expose csync_file_stat_t since we don't need an abstraction layer
anymore. Also pass the nodes of both trees directly to the visitor
function.

Issue #1817
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte e8f7adc7ca Replace csync_vio_file_stat_t with csync_file_stat_t
Also move csync_normalize_etag to common/utility since we
don't need the char* function anymore.

Remove the single space file_stat->remotePerm codepath since
this won't be used in csync anymore since
8de3bda0b1.

Issue #1817
2017-09-06 13:08:23 +02:00
Jocelyn Turcotte 704ca366b3 Make csync_file_stat_t public and partly convert to C++
This is the first commit trying to unify csync_file_stat_s,
csync_vio_file_stat_s and csync_tree_walk_file_s. Use QByteArray
and unique_ptr already since I'm not used to track memory allocations
and this will make the transition easier.

Issue #1817
2017-09-05 17:25:19 +02:00
Jocelyn Turcotte cf15cbf0b3 Move Utility to a new common static library
Now that csync builds as C++, this will avoid having to implement
functionalities needed by csync mandatorily in csync itself.

This library is built as part of libocsync and symbols exported
through it.
This requires a relicense of Utility as LGPL. All classes moved into
this library from src/libsync will need to be relicensed as well.
2017-09-05 17:25:19 +02:00
Jocelyn Turcotte 48d2fc1599 StatusTracker: Fix different case paths not matching (#5981)
Use a custom std::map comparator functor to do all comparisons
on contained QStrings using Qt::CaseInsensitive on macOS and Windows.

Issue #5257
2017-08-31 13:32:00 +02:00