1
0
Fork 0
Commit Graph

1822 Commits

Author SHA1 Message Date
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
Jocelyn Turcotte 4e5898efd7 Compile almost all of csync as C++
This will allow us to unify data structures between csync and libsync.

Utility functions like csync_time and c_std are still compiled as C
since we won't need to be coupled with Qt in the short term.
2017-08-22 15:22:56 +02:00
Jocelyn Turcotte 28a0971cdf Move csync to src/csync 2017-08-22 11:18:22 +02:00
Jocelyn Turcotte 5c9827a33c Move csync/tests to test/csync 2017-08-22 11:18:22 +02:00
Jocelyn Turcotte 251f1d0047 Windows: Use the application icon for the sidebar
By setting the icon in Desktop.ini of the root folder, this adds the icon
both when browsing the folder directly and to the sidebar shortcut.

To avoid overwriting any user setting that could exist in Desktop.ini,
only do this if the file doesn't exist. Editing .ini files on Windows
isn't trivial and isn't worth it given that this file won't exist most
of the time.

Fixes #2446
2017-08-15 13:37:33 +02:00
Markus Goetz 4aad318446 Upload: Log the checksum / file hash 2017-08-04 15:42:11 +02:00
Olivier Goffart 6ae88514d8 OAuth: clear refresh token when the server claim not to support oauth
Allow upgrade path when the server removes support for oauth
Relates: https://github.com/owncloud/client/issues/5848#issuecomment-317353049

We also need to force the account to commit the config to the disk,
otherwise we may not register we are no longer using owncloud and we
risk sending the password as the token to the token refresh API call
2017-07-25 12:34:13 +02:00
Olivier Goffart c043840cb1 OAuth: Fix refresh of token after expiration
Before commit d3b00532b1,
fetchFromKeychain was called everytime we detect that the creds are
invalid (in AccountState::slotInvalidCredentials)
But since that commit, AccountState was calling askFromUser directly,
breaking the refresh of the token.

So I made sure AccountState::slotInvalidCredentials still calls
refreshAccessToken.

Another change that was made was too be sure to clear the cookies
in HttpCredentials::invalidateToken even when we are only clearing the
access_token. That's because the session with a cookie may stay valid
longer than the access_token
2017-07-25 12:34:13 +02:00
Olivier Goffart a831164d65 Revert "Revert "Discovery: consider also the "shared by me" as shared""
This reverts commit efa7821dd2.

This reverts the revert, but also add a check that the server version
is bigger than 10.0

Issue #4788
2017-07-25 12:11:33 +02:00
Jocelyn Turcotte a41dc00160 Don't keep the list of touched files for the whole sync
We only want to know if they were touched within the last 15 seconds,
so change the data structure to use a QMultiMap, and sort them by
QElapsedTimer. This allows us to iterate over old entries ordered by
time and to stop once we find a recent entry.

This makes the look-up slower but in most cases the folder watcher
will report any change within milliseconds, and we start from the
most recent. What this really makes slower are actual user file
changes while a fast sync is underways which will need to iterate
over the whole map to find out the file isn't there.

This reduces the growth of the memory usage when downloading a large
amount of files.
2017-07-24 17:54:29 +02:00
Jocelyn Turcotte 5a1bf7d8fe windows: Fix a memory leak in FileSystem::longWinPath
Also use c_path_to_UNC directly instead of doing an extra
UTF-8->wchar conversion.
2017-07-24 17:54:29 +02:00
Olivier Goffart d9813dbc90 Propagator: fix a qMax which should have been a qMin 2017-07-18 08:58:07 +02:00
Olivier Goffart 3cea550d08 PropagateUpload: Remove the Qt workaround against data corruption
This was only for Qt <= 5.4, which we don't really support anymore.
And even then, the data corruption is happens very seldomly anyway.
2017-07-17 10:12:48 +02:00
Olivier Goffart b1363d1a79 AccessManager: Disable HTTP/2 without TLS
Qt would otherwise still try to do HTTP/2 connection even over "http://".
And that does not work with server that does not support it
2017-07-17 08:20:17 +02:00
Olivier Goffart 520923b5a7 HTTP/2 Support
We need Qt 5.9 for HTTP2 because, even if Qt 5.8 already has support
for it, there is some critical bug in the HTTP2 implementation which
make it unusable [ https://codereview.qt-project.org/186050 and
https://codereview.qt-project.org/186066 ]

When using HTTP2, we can use many more parallel network request, this
is especially good for small file handling

Lower the priority of the GET and PUT propagation jobs, so the quota
or selective sync ui PROPFIND will not be blocked by them
2017-07-17 08:20:17 +02:00
Markus Goetz 1fb68e8711 X-Request-ID: Send per request not per account #5853 2017-07-14 09:14:01 +02:00
Christian Kamm 1c2d5f16c8 Account: Send a X-Request-ID header #5853 2017-07-13 18:06:40 +02:00
Christian Kamm 2cdf5517cb Conflicts: Detect and show in issues tab
Incidentally fixes a potential issue where conflicts were silently-
ignored and thus deleted if the parent folder was deleted.
2017-07-13 11:48:10 +02:00
Christian Kamm da54b3d7e5 Merge remote-tracking branch 'origin/2.3' 2017-07-12 10:06:04 +02:00
Christian Kamm 971abaea80 IssuesWidget: Add button to retry 507 errors #5537
Since these errors are blacklisted, it can take up to 24h to retry items
that had a 507 error for a while. This way users can intervene and cause
an upload attempt immediately.
2017-07-12 09:04:27 +02:00
Christian Kamm cd1b89475c PropagateUpload: Better messaging for 507 #5537
It now produces a summary error message indicating the problem.

Adjust blacklist database table to contain 'errorCategory'. This is
useful for two things:
  - Reestablishing summary messages based on blacklisted errors. For
    example if we don't retry a 507ed file, we still want to show the
    message about space on the server
  - Selectively wiping the blacklist: When we have ui for something like
    "I deleted some files, please retry all files now!", we want to
    delete all blacklist entries of a specific category only.
2017-07-12 09:04:27 +02:00
Christian Kamm 5d90b48790 PropagateUpload: Put upload error handling in one function 2017-07-12 09:04:27 +02:00
Christian Kamm c3cb186952 ProgressInfo: Carry a sync status
* A bunch of code was determining sync status by ad-hoc comparing some
  progress info fields. It can now just check the status, making it
  easier to comprehend.
* There's a clear indication for "a new sync is starting", which helps
  wiping the issues tab at the right time.
2017-07-12 09:04:27 +02:00
Christian Kamm 5ca743dd25 SyncEngine: Introduce overall errors that are not tied to a file #5746
For now we use them for:
* csync errors: This allows them to appear in the sync issues tab
* insufficient local disk space, as a summary of individual file errors

Insufficient remote space will use them too, as might other issues that
are bigger than a single sync item.
2017-07-12 09:04:27 +02:00
Christian Kamm a5ace5e71d Account/Credentials: Have identical lifetimes
The QNAM may continue to outlive both.

Rename Credentials::getQNAM() to createQNAM() while we're at it - it's
used to make a new QNAM that will subsequently be owned by the Account
object.

See d01065b9a1 for rationale.

Relates to
d40c56eda5
147cf798a6
2017-07-08 13:07:13 +02:00
Christian Kamm e54be1c4ee Link shares: Add "show file listing" option #5837 2017-07-07 11:23:32 +02:00
Christian Kamm 0238a29c7c Introduce private link sharing #5023
* SocketAPI has COPL_LOCAL_LINK / EMAIL_LOCAL_LINK commands
* The nautilus and dolphing shell integrations show a submenu from which
  one can share as well as access the private link.
* The SocketAPI provides a new GET_STRINGS command to access localized
  strings.
* The private link can also be accessed from the user/group sharing
  dialog.
* The numeric file id is extracted from the full id to create the
  private link url.
2017-07-07 10:49:51 +02:00
Christian Kamm d01065b9a1 Fix crash on account deletion
Calling forgetSensitiveData() on account deletion leads to a timer for
clearQNAMCache() being queued. Then the Account object is deleted. The
Credentials object stays alive for now because it has a deleteLater
deleter.

If the timer calls into a slot on the Credentials object, the _account
pointer will be invalid at this time.

As a workaround, move the target slot to Account - that way it will not
be called as the account object is already destroyed.

However since Account and Credentials are mutually dependent, it would
be much preferable if their lifetimes were linked, avoiding this
category of bugs.

The current behavior was introduced in
d40c56eda5 and I currently don't
understand why - maybe there's another way of dealing with the problem
that existed then.
2017-07-06 14:34:02 +02:00
Christian Kamm b1aaf055b1 Blacklist: Don't let errors become warnings #5516
Before, blacklisted errors were set to FileIgnored status and hence
displayed as warnings. Now, they have their own BlacklistedError
category which allows them to appear as errors in the issues list and in
the shell integration icons.
2017-07-04 13:07:51 +02:00
Markus Goetz f4d1a07b72 SyncEngine: Keep local size in SyncItem #5855 2017-07-04 11:42:44 +02:00
Piotr Mrowczynski d1e00099dc Classify chunked items correctly. Issue #5850 2017-07-03 14:41:53 +02:00
Samuel Alfageme aeea27b57b Update central.owncloud.org link
Desktop client category was renamed, old link was 404 - see: https://central.owncloud.org/t/new-central-categories-you-decide
2017-06-29 17:54:42 +02:00
Samuel Alfageme 0f70bd7913 Update central.owncloud.org link
Desktop client category was renamed, old link was 404 - see: https://central.owncloud.org/t/new-central-categories-you-decide
2017-06-29 17:52:00 +02:00
Christian Kamm 15ee7b39ac Merge remote-tracking branch 'origin/2.3' 2017-06-22 14:06:31 +02:00
Christian Kamm 4291ea47f7 Journal: Don't use a ._ path if it won't work #5633
When synchronizing a folder on a samba share, creating files that begin
with ._ is often forbidden. This prevented the client from creating
its ._sync_abcdef.db file.

Now, it'll check whether the preferred filename is creatable, and if
it isn't it'll use .sync_abcdef.db instead.

The disadvantage is that this alternative path won't be ignored by
older clients - that was the reason for the ._ prefix.
2017-06-20 13:35:34 +02:00
Jocelyn Turcotte 5d24a2dc0f Remove debug messages by default from sync.engine
Other categories were already set properly.
2017-06-15 20:10:30 +02:00
Christian Kamm 8160963110 Compare the hash of files with identical mtime/size #5589
* For conflicts where mtime and size are identical:

  a) If there's no remote checksum, skip (unchanged)
  b) If there's a remote checksum that's a useful hash, create a
     PropagateDownload job and compute the local hash. If the hashes
     are identical, don't download the file and just update metadata.

* Avoid exposing the existence of checksumTypeId beyond the database
  layer. This makes handling checksums easier in general because they
  can usually be treated as a single blob.

  This change was prompted by the difficulty of producing file_stat_t
  entries uniformly from PROPFINDs and the database.
2017-06-15 13:54:16 +02:00
Olivier Goffart 5100a2daf1 OAuth: cleanup debug messages
- Add category to the all messages (they did not have it was merged right after
the patch to add category everywhere, but this code did not have it.)

- Make sure there is no warnings in the normal flow. (The wizard does a request
without authentication to determine the auth type)
2017-06-13 12:08:24 +02:00
Olivier Goffart 6e57b0219e Don't link dirrectly against openssl
All our crypto code is handled by qt nodaways.
No need to carry this dependency.

Especially since it causes warnings on system where there are
twp openssl version installed:
/usr/bin/ld: warning: libcrypto.so.1.0.0, needed by /usr/lib/libQt5Network.so.5.9.0, may conflict with libcrypto.so.1.1
2017-06-13 11:27:23 +02:00
Olivier Goffart 3314a472c3 SyncEngine: SelectiveSync: Remove local files of undelected folder despite other modified files
Issue #5783

When the directry that should be removed by selective sync contains changes,
we ignore the whole sub tree instead of only ignoreing new files.
We cannot ignore the whole directory, we need to ignore only the directory
that do not have files to remove
2017-06-08 14:53:54 +02:00
Christian Kamm aeeb408c74 Merge branch '2.3' 2017-06-08 13:02:34 +02:00
Olivier Goffart 18c39197e5 ownsql: fix build on jenkins
sqlite3_system_errno was only added in sqlite 3.12

(cherry picked from commit e2e56f45af)
2017-06-08 12:53:45 +02:00
Christian Kamm 7eb8219419 Add extra logging for SQLITE_CANTOPEN errors #5633
(cherry picked from commit 05c1dcef9b)
2017-06-08 12:52:58 +02:00
Olivier Goffart 63c40b45e4 OAuth: Fix the secret to the one from commit 05fd985f9f in the oauth2 repository
05fd985f9f
2017-06-06 14:49:34 +02:00
Olivier Goffart e2e56f45af ownsql: fix build on jenkins
sqlite3_system_errno was only added in sqlite 3.12
2017-06-06 14:47:11 +02:00
Christian Kamm 05c1dcef9b Add extra logging for SQLITE_CANTOPEN errors #5633 2017-06-06 12:59:57 +02:00
Christian Kamm cc5fe558ba Fix maintenance mode detection #5755
The server sends "maintenance": "true" which isn't a json boolean...
2017-06-06 10:45:41 +02:00
Olivier Goffart 3d93527a8e Authentication with OAuth2
When the OAuth2 app (https://github.com/owncloud/oauth2) is enabled,
We will open a browser and perform the OAuth2 authentication

Issue: #4798 and https://github.com/owncloud/platform/issues/17
2017-06-01 10:39:33 +02:00
Christian Kamm 577a2715bd Download: Retrigger folder discovery on 404
See owncloud/enterprise#1966

If the server and the client's database go out of sync, there could be
persistent 404 errors. This change ensures that the problem corrects
itself eventually by triggering a remote discovery of the file's
parent folders.

It does not address the root cause that might have lead to the
divergence.
2017-05-29 21:41:10 +02:00
Olivier Goffart f88431adbf Don't call QElapsedTimer::restart on uninitialized timer
That's an undefined behavior.
Since we don't use the return value anyway, we should just use start()
2017-05-29 10:51:05 +02:00
Christian Kamm d3b00532b1 Credentials: Simplify credential flow #5728
And as a side effect: don't ask for user password when we can't
connect to the server in the first place.
2017-05-22 10:52:18 +02:00
Christian Kamm 5eaae83a01 Merge remote-tracking branch 'origin/2.3' 2017-05-17 13:10:19 +02:00
Christian Kamm c8d0f788e0 Apply clang-format 2017-05-17 12:26:27 +02:00
Christian Kamm ae263d60bd Reformatting: Reformat some lines that would become really long 2017-05-17 12:26:27 +02:00
Christian Kamm df3fe25702 Reformatting: Adjust trailing comments
These would otherwise be line-wrapped by clang-format,
and then consecutive reformattings remove the aligned
comment indentation

Example:

int a; // too long comment

->

int a; // too long
       // comment

->

int a; // too long
// comment
2017-05-17 12:26:27 +02:00
Christian Kamm c5a0ce5a43 Selective sync: Skip excluded folders when reading db
When a new folder becomes selective-sync excluded, we already mark it
and all its parent folders with _invalid_ etags to force rediscovery.

That's not enough however. Later calls to csync_statedb_get_below_path
could still pull data about the excluded files into the remote tree.

That lead to incorrect behavior, such as uploads happening for folders
that had been explicitly excluded from sync.

To fix the problem, statedb_get_below_path is adjusted to not read the
data about excluded folders from the database.

Currently we can't wipe this data from the database outright because we
need it to determine whether the files in the excluded folder can be
wiped away or not.

See owncloud/enterprise#1965
2017-05-16 13:58:45 +02:00
Jocelyn Turcotte 7fd2f292e7 Promote a few more logs to info/warning 2017-05-11 17:22:59 +02:00
Jocelyn Turcotte cf058bc537 Add the possiblility to enable debug logging categories
Add a checkbox in the log window as well as a --logdebug command-line
option that should have the same effect.

Issue #5647
2017-05-11 17:22:59 +02:00
Jocelyn Turcotte cc9680c1e8 Also pass csync logs through QMessageLogger
This allows using logging rules and custom message patterns with csync.
This also pass the a relative verbosity to the message logger.

Issue #5647
2017-05-11 17:22:59 +02:00
Jocelyn Turcotte b7553d5bdf Upgrade some qCDebug to qCInfo or qCWarning
Use qCInfo for anything that has general value for support and
development. Use qCWarning for any recoverable error and qCCritical
for anything that could result in data loss or would identify a serious
issue with the code.

Issue #5647
2017-05-11 17:22:59 +02:00
Jocelyn Turcotte 4ad190a558 Use Qt logging categories for logging
This gives more insight about the logs and allow setting fine-tuned
logging rules. The categories are set to only output Info by default
so this allows us to provide more concise logging while keeping the
ability to extract more information for a specific category when
developping or debugging customer issues.

Issue #5647
2017-05-11 17:22:59 +02:00
Jocelyn Turcotte 3a193655b3 Improve the logging message pattern
Add the log level and category name in the output. Only output the
thread ID and function name for qCDebug statements as they are not
necessary for general use and make the log harder to read.

Also make sure that the message pattern is set when NO_MSG_HANDLER is
used. Using an environment variable should have priority over it anyway.
2017-05-11 17:22:59 +02:00
Christian Kamm 4b6edaa01a Detect maintenance mode #4485
When we first detect a 503 (probably from a PROPFIND) and enter the
ServiceUnavailable state, we new trigger a status.php query that will
switch the state to MaintenanceMode if necessary.
2017-05-11 11:39:49 +02:00