1
0
Fork 0
Commit Graph

157 Commits

Author SHA1 Message Date
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 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 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 c8d0f788e0 Apply clang-format 2017-05-17 12:26:27 +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
Christian Kamm c922015521 SSL error handling: Remove unnecessary confusing code
I'm confident this is unnecessary. The original bug in #3283 was
to call ignoreSslErrors() without an argument in the 'accept'
case, which meant ignoring *all* subsequent SSL errors.

With that fixed, explicitly aborting the reply and resetting QNAM
is not needed since not ignoring the error will lead to the SSL
handshake failing.

See also:
  75b38d1a2f (workaround introduced)
  89376e14d6 (real fix)
  76ce5adbf0 (cherry-pick of workaround)
2017-05-04 09:19:01 +02:00
Christian Kamm cd4e647816 Merge remote-tracking branch 'origin/2.3' 2017-04-24 10:32:53 +02:00
Kiril Vladimiroff 3a31694147 Remove all conditional checks for Qt 4.x (#5505) 2017-04-21 18:13:32 +02:00
ckamm 543e8a224c Fix a crash in ProxyAuthHandler (#5711)
See
https://sentry.io/owncloud/desktop-win-and-mac/issues/243433178/activity/
https://sentry.io/owncloud/desktop-win-and-mac/issues/234182688/activity/

The problem was that an account's QNetworkAccessManager can be deleted
when reentering the event loop.
2017-04-20 09:21:33 +02:00
Olivier Goffart 8cb3a77022 Merge remote-tracking branch 'origin/avatar_pics'
Also fix compilation because of 22370fdbdadd06f0cacd249a8d7a32f0d3c1374e

Pull request #5482
2017-04-13 11:54:28 +02:00
Christian Kamm b98876e265 Account server version: Helper to create versions
Hex literals don't work well with version 10: 0x100000 doesn't do
the right thing.
2017-03-15 16:30:08 +01:00
Klaas Freitag 5e33898a08 Avatar: Use QImage instead of QPixmap to avoid dep on QApplication.
That fixes the test suite.
2017-03-09 22:34:36 +01:00
Christian Kamm 4a1a5fa076 AbstractNetworkJob: Improve redirect handling #5555
* For requests:
  - reuse the original QNetworkRequest, so headers and attributes
    are the same as in the original request
  - determine the original http method from the reply and the request
    attributes
  - keep the original request body around such that it can be sent
    again in case the request is redirected

* Simplify the interface that is used for creating new requests in
  AbstractNetworkJob.
2017-03-07 13:18:01 +01:00
Christian Kamm 4c1fdf1dee Double check usage of asserts #5429
A few are supposed to be fatal.
2017-02-08 15:15:19 +01:00
Markus Goetz e859d220be Cookies: Use different DB for different accounts (#5490)
This is a follow up to #5469
2017-01-26 10:54:03 +01:00
Klaas Freitag e05d6bfcdc Make the Account store the avatar pixmap.
The avatar pixmap is fetched from the server by the Connectionvalidator,
once it has validated the user name, it queries the avatar pixmap.

If the server does not have the avatar route, an empty pixmap is stored.
2017-01-22 13:55:08 +01:00
Christian Kamm 084146756b Account: Fix displayName() #5413
This displayName() seemed to be based on Account::user() which used
to call _credentials->user(). But then we repurposed user() to be
davUser() and this usage wasn't updated to point back to the username
used for the credentials.
2017-01-03 13:54:59 +01:00
Olivier Goffart d433f0e08e HTTPCreds: remove all cookies when logging out (#5383)
Some custom server use persistent cookies with the auth token. So we should
clear all the cookies when disconnecting.
Account::clearCookieJar is only called from the HTTPCredentials. This funciton
is not used for shibboleth.
There is probably no reasons to keep the HTTP cookie anyway.

Issue #5370
2017-01-03 11:39:10 +01:00
Markus Goetz c6f4f44619 Fix up SSL client certificates #5213 #69 (#5289)
The re-enables the UI, uses Qt API for importing and
stores the certificate/key in the system keychain.
People who had set up client certs need to re-setup the account. This is ok
since it was an undocumented feature anyway.
2017-01-02 08:34:02 +01:00
Olivier Goffart c5b90d9507 Account::slotHandleSslErrors: add guards in case the reply gets deleted in the dialog event loop
Since slotHandleSslErrors will show a dialog with an eventloop, it could be
That the reply gets deleted. Guard against that.

(#5329)
2016-12-14 14:13:47 +01:00
Olivier Goffart 19d2677db1 libsync: use the new webdav url if the server reports it
The rules to select the webdav url are now:

 - If the server reports that the new chunking algorithm is working,
   always use remote.php/dav/files/<username>
   This capability can be overriden with an environment variable

 - Otherwise, use the dav path provided by the theme, which defaults to
   remote.php/webdav

This means that with the newer server, the branding can no longer override
the webdav URL. If there is still an usecase for the branding to do so, we
need to find another way to override it. But it is now more complicated to
configure as might need include the username and need different endpoint
depending on the operations (chunks or not)

Issue #4007
2016-11-29 16:16:20 +01:00
Christian Kamm 045498c71a Account: Rename user() to davUser()
Avoids potential confusion with credentials->user()
2016-11-23 17:08:17 +01:00
ckamm ec7333a4bf Merge pull request #5272 from owncloud/licensefix-pending
License: Adjust license of GPLv2 source files to GPLv2+
2016-11-18 15:14:47 +01:00
Olivier Goffart 8ca3eb7883 Merge remote-tracking branch 'origin/master' into chunking-ng 2016-10-31 11:09:12 +01:00
Christian Kamm 5f47c01346 Account: Rearrange for readability 2016-10-25 13:20:23 +02:00
Christian Kamm 10644d3568 Move concatUrl and settingsWithGroup to Utility
There was little reason to keep them cluttering Account.
2016-10-25 12:05:28 +02:00
Christian Kamm 9ee3144358 Account: Remove wasMigrated/setMigrated
It was unused since early in the multi-account work:
a932eac832
2016-10-25 11:43:06 +02:00
Christian Kamm cf48ea2e00 Remove unused functions
Account::changed and AbstractCredentials::changed have not been needed
in a long while.
2016-10-25 11:33:38 +02:00
Christian Kamm db24f60ae3 License: Adjust license of GPLv2 source files to GPLv2+
See #5180
2016-10-25 11:06:54 +02:00
Olivier Goffart 4c79ce2ae6 ConnectionValidator: fetch the account name.
This is needed for the new webdav path used by the new chunking.
The user might not be the same as the one used to connect
2016-09-16 15:49:43 +02:00
Olivier Goffart a1558100b8 WIP: new chunking algorithm
Current limitations of this WiP
 - No resuming implemented yet
 - No parallel chunks
 - Hackish way to get the webdav paths
2016-08-31 10:28:15 +02:00
Jocelyn Turcotte 5d71ad83ec Fix the Qt4 build
QSharedPointer::reset doesn't exist in Qt4.
2016-06-21 12:04:26 +02:00
Jocelyn Turcotte 147cf798a6 Attempt to fix the Account::slotHandleSslErrors crash
Events from the crash reporter suggest that the QNAM and its
child replies might get deleted before returning from this method
and the only possible cause we can see is that the inner event
loop has something to do with it.

Try keeping a ref on the QNAM while in this method to make sure
that it won't get deleted by the inner event loop.
2016-06-15 18:12:02 +02:00
Jocelyn Turcotte d40c56eda5 Account: Use smart pointers to hold its credentials and QNAM objects
Also make sure that both use QObject::deleteLater as their delete
function.
2016-06-15 18:12:01 +02:00
ckamm 0e2c16e827 Certs: Re-ask for different cert after rejection #4898 (#4911)
Previously rejecting any kind of certificate meant that the user
was never asked again, even if the certificate changed.

Now we keep track of which certificates were rejected and ask again
if the ones mentioned in the ssl errors change.

mitmproxy is excellent for testing this.
2016-05-27 12:08:42 +02:00
Klaas Freitag 0eb1041290 AbstractNetworkJob: Add a delete job.
It is needed to easily send delete requests which happen
through the notify API.
2016-03-10 17:22:36 +01:00
Markus Goetz a14b495864 Old servers: Don't nag if version still undetected #4523 2016-03-09 15:57:45 +01:00
Christian Kamm f66c28900a Add warnings for old server versions #4523
* A tray message on every start up
* Red message in account settings
* Folders are paused when the server version switches to
  an unsupported one
2016-03-02 12:54:22 +01:00
Christian Kamm d521232587 AccountState: Allow storing state in settings
This will be useful if we ever want to store account-level gui state.
I built this originally because I thought a paused account would be
this kind of state.
2016-03-01 16:08:23 +01:00
Christian Kamm e3b53b7e74 Log: Remove scary messages :) 2015-12-10 11:50:19 +01:00
Niels van Adrichem 8f5658bc01 Added Non Shibboleth WebDAV authentication and Dav Path customization to `owncloudcmd` 2015-11-02 22:57:17 +01:00
Markus Goetz ccec186b98 ETagJob: Depth 0 for server >= 8.1 #3730 2015-10-19 15:31:27 +02:00
Phil Davis f0e17fd9c0 libtypos comment and message typos for master 2015-10-05 09:05:09 +05:45
Christian Kamm efefc2d986 Merge branch '2.0'
Conflicts:
	doc/images/menu.png
	doc/images/settings_network.png
2015-10-02 15:44:50 +02:00
Markus Goetz 1de4d96ab1 Account: Also display non-standard port in tray menu
For #3658
2015-09-10 19:27:16 -04:00
Klaas Freitag 93e1ad088c Account: Make sure that davPath() always comes with trailing slash. 2015-09-10 15:38:40 +02:00
Klaas Freitag 16d6418d10 Use a themable WebDAV path all over.
This is needed for enterprise#481
2015-09-10 13:04:26 +02:00
Jocelyn Turcotte 6d027ebd40 Separate the credential dialog from their fetch #3350
This moves the responsibility of asking the user or not for
credentials from the Credentials classes back to the AccountState.
fetch() now only extract credentials from the keychain, reports
the result to the AccountState which then decides if askFromUser()
should be called or not. The result is once more reported to the
AccounState.

This also replaces the HttpCredentials::queryPassword virtual
which now lets HttpCredentialsGui and HttpCredentialsText do it
the way that they prefer.
2015-09-05 16:00:45 +02:00
Jocelyn Turcotte 89f69209dd Simplify the authentication code paths #3350
The AccountState is now the only class responsible for triggering credentials
fetching from the keychain or from the user.

With the ShibbolethRefresher out of the question it's possible
to remove the invalidateAndFetch virtual and manually call invalidateToken.
This also allows us to move that code from Account to AccountState.
In the end this also allows us to move the fetch() call from the
ConnectionValidator and use the same code path as for invalid credentials.
2015-09-05 16:00:45 +02:00
Markus Goetz 38b8508f15 Account: Save accepted SSL certs immediatly #3617 2015-08-14 11:31:01 +02:00
Klaas Freitag 76ce5adbf0 Abort the request and reset the QNAM if user does not ACK a new cert.
This is supposed to fix bug #3283

(cherry picked from commit 75b38d1a2f)
2015-08-14 10:31:20 +02:00
Olivier Goffart 07ddf18b3b Account Capabilities: style fixup
- Remove the copy constructor. The default constructor is fine. Having
   a user defined copy constructor inhibit the move constructor.
 - Pass QVariantMap arguments via const references
 - Do not return a pointer to Capabilities from the account. It is a
   value type and should not be used by pointer.
2015-07-29 12:07:57 +02:00
Markus Goetz dccaba98af Merge pull request #3439 from rullzer/use_caps
Use server capabilities for share dialog
2015-07-29 11:50:35 +02:00
Roeland Jago Douma 6c8ff7c61a Added capabilities class 2015-07-28 12:04:24 +02:00
Christian Kamm 2124098f84 System proxy: Ask for credentials if needed.
The proxyAuthenticationRequired() signal now goes to the
ProxyAuthHandler class. That class will try to read the proxy settings
from the keychain or ask the user about them.

We won't ask the user for credentials for explicitly configured proxies.
It also does not change how the credentials for explicitly configured
proxies are stored. (see #261)
2015-07-17 11:54:46 +02:00
Daniel Molkentin a1b6571d53 Revert "Do not use std::unique_ptr"
This reverts commit 2db7ab5c46.
2015-07-02 13:31:42 +02:00
Olivier Goffart 2db7ab5c46 Do not use std::unique_ptr
The class is not existing on all platform we support
(namely macos 10.7)
2015-07-02 12:55:54 +02:00
Daniel Molkentin 0735aa1fbd Structure developer documentation
- rename target "doc-dev"
- group into modules
- move to doc/dev
2015-06-29 18:43:21 +02:00
Olivier Goffart 29fecb029e Merge remote-tracking branch 'origin/1.8'
Conflicts:
	VERSION.cmake
        src/gui/accountsettings.cpp
	src/gui/accountsettings.h
2015-06-25 12:30:52 +02:00
Jocelyn Turcotte 9a9897ea1e Shibboleth: Let the webview use its own QNAM #3359
Since we periodically recreatet the QNAM owned by the Account,
the web view could end up holding a dangling pointer to it.

Let the web view use its own QNAM, but make sure that the cookie
jars are shared so that we can grab the session token given
by the server.
2015-06-19 12:33:11 +02:00
Olivier Goffart 7f0735a955 Account: don't use the Theme from the account
The Theme will be moved to GUI
The server URL is anyway overriden by the wizard or the accountmanager
2015-06-15 17:39:28 +02:00
Olivier Goffart ce0a0e3f0d Credential: move the implementation to the gui 2015-06-15 17:39:28 +02:00
Olivier Goffart 6e337ad242 Move Account::settings to AccountState::settings
It is only used by the GUI. Also return a unique_ptr to make the ownership clearer
2015-06-15 17:39:28 +02:00
Olivier Goffart 139b28b471 Merge branch 'master' into new-ui
Conflicts:
	src/gui/folder.cpp
        src/gui/folder.h
	src/gui/folderman.cpp
2015-06-10 15:57:55 +02:00
Christian Kamm 89376e14d6 Nicer fix for the security issue #3283. 2015-06-03 11:37:26 +02:00
Christian Kamm e32bd5a59f Merge remote-tracking branch 'origin/1.8' 2015-06-03 11:36:52 +02:00
Klaas Freitag 75b38d1a2f Abort the request and reset the QNAM if user does not ACK a new cert.
This is supposed to fix bug #3283
2015-06-02 12:21:49 +02:00
Olivier Goffart 716b0c68da Merge remote-tracking branch 'origin/master' into new-ui 2015-05-12 15:20:40 +02:00
Markus Goetz 3b34d5b54e Account: Fix Qt4 compile 2015-05-12 13:49:07 +02:00
Daniel Molkentin a36df4aa4b Merge remote-tracking branch 'origin/1.8' into 1.9 2015-05-12 09:57:22 +02:00
Markus Goetz f2004da867 SSL: Re-use encryption session for different TCP connections #3159
This also improves the SSL configuration creation and fixes #3027
2015-05-08 14:21:27 +02:00
Christian Kamm b9eafaaf24 Wizard: Allow SSL cert dialog to show twice. #3168
Normally we never ask twice for the same url, but in the setup wizard
it makes sense to do so.
2015-05-08 12:32:14 +02:00
Daniel Molkentin bceb40ed80 Disable setSslConfiguration calls for older Qt version
This is only required for client certs, which currently have
no GUI anyway and are experimental.
2015-05-06 11:20:16 +02:00
Christian Kamm 27159104a9 Folders: Store inside account config. 2015-04-24 13:42:35 +02:00
Christian Kamm a13a974e2d Account: Generate shorter account ids. 2015-04-24 09:54:42 +02:00
Christian Kamm 11927d625d Fix crash on exit by not making Account parent of AccountState. 2015-04-23 16:08:20 +02:00
Christian Kamm abfdc574d4 Add a basic random Account::id() 2015-04-23 15:47:49 +02:00
Christian Kamm 28306e5dfb Move AccountState::displayName to Account. 2015-04-23 15:47:49 +02:00
Christian Kamm 89bb58ac30 Ensure 'user' is available early enough for ui in httpcreds 2015-04-23 15:47:49 +02:00
Olivier Goffart 2da3bfb96f Merge branch 'master' into new-ui 2015-04-16 12:50:21 +02:00
Olivier Goffart afdd01488f AccountManager: Move out of libsync
The AccountManager does not belong in the libsync because it is not
part of the synchronisation algorithm, but is just an helper class
for the UI to maintain the account and read/save the config
2015-04-09 16:19:17 +02:00
Olivier Goffart 50ba73860c Merge remote-tracking branch into 1.8 2015-04-07 08:02:55 +02:00
Markus Goetz 750cdc1910 AbstractSslErrorHandler: Also give QSslConfiguration 2015-04-06 21:46:03 +02:00
Christian Kamm 5483682281 CookieJar: Don't accidentally overwrite cookies. #2808
Calling save() in the CookieJar destructor was problematic. For instance
we sometimes create a new QNAM with a new CookieJar and then call
setCookieJar() on it to assign some other jar. That destroy the fresh
jar and potentially overwrite cookies.

Also explicitly saving the account's cookies when the account is saved
is more explicit and thus more reliable than counting on the Account
destructor to do it.
2015-03-27 10:49:24 +01:00
Christian Kamm 2a8c23aac3 Account: Destroy on exit.
During shutdown we want the account object to be deleted and
therefore we need to be able to remove the strong reference
in AccountManager.
2015-03-27 10:43:14 +01:00
Christian Kamm 57c14a0eba Windows: Reset QNAM as a workaround. #2899 #2895 #2973
The QNetworkAccessManager is reset when we are disconnected, just
before attempting to fetch the server's status.php.

This may help fix the problem described in various issues where we
get 'Connection closed' or timeout errors after the OS has woken
from sleep.
2015-03-19 11:40:47 +01:00
Christian Kamm 40dbc78407 concatUrl: Remove manual parsing, add test. #2817 2015-02-13 14:53:55 +01:00
Olivier Goffart 438c4fe72e Account: put the server version in the account 2015-02-12 14:50:42 +01:00
Klaas Freitag d45d3892cb Account: Fix path assembling with QUrl, add query items separately.
Otherwise Qt does encode the delimiter between path and query items.
This fixes bug #2804
2015-02-10 17:13:27 +01:00
Olivier Goffart 856df4c5f6 libsync: Get the capabilities and store it in the account 2015-02-05 15:42:56 +01:00
Daniel Molkentin 332601ed26 Remove noisy debug output 2015-01-29 15:37:21 +01:00
Joachim Schiele 9abc3e1333 fixes required by upstream 2015-01-23 19:22:56 +00:00
Nourredine ba8b1bbe06 adds 'SSL client certificate' support from n.octeau with qknight changes as:
* removed broken QSsl::SslV3 default
* rewrote slotHandleErrors(): no longer claim errors which are none.
* hack reverted: lib64 was not the cause for NixOS issues related to libraries.
* refactored csync/src/csync_owncloud.c and discovered+fixed why the dav_connect was never getting the certPath+certPassoword
* cleanup of code but seems this crushed the ssl client certificate support
* fixes the https://github.com/owncloud/client/issues/69#issuecomment-69358377 issue
* lots of cleanup
* From TODO list : translate all french comments into english
* changed _pemCertificate type from QString to QByteArray
2015-01-21 23:55:11 +00:00
Christian Kamm aa6a5e4ac2 Credentials: Use the bound account everywhere.
This is preparation for multiaccount.
2015-01-16 15:22:56 +01:00
Christian Kamm 38ebfec1fb Use global Account/AccountState less.
* Use a shared pointer to Account everywhere to ensure
  the instance stays alive long enough for a sync to terminate
* Folder is now tied to an AccountState
* SyncEngine and OwncloudPropagator tie to an Account and use that
  for all jobs they run

Issue: Since the setup wizard currently always replaces the
account, it will always wipe all folder definitions, even when
the actual changes to the account were minor.
2014-12-18 15:39:51 +01:00
Christian Kamm 6c7acd585e Account: Split into libsync/Account and gui/AccountState.
This allows all the account state information to live in gui
while the sync-relevant data stays in libsync.

I also moved quotainfo to gui since it depends on the account state.
2014-12-18 15:39:51 +01:00
Christian Kamm a006c6962c Move account state related logic into Account.
The account state is now managed mostly by the Account itself
instead of through Application. The gui can still control whether
an account is signed out or not.
2014-12-17 12:01:10 +01:00