Commit graph

540 commits

Author SHA1 Message Date
Laurent Montel
6957b6aa39 GIT_SILENT: add missing override 2021-10-27 06:53:06 +02:00
Vladimir Panteleev
b706750af8
Use device ID from client SSL certificate, not UDP packet
Consider the following scenario:

1. We send a UDP broadcast
2. We receive a reply from 192.168.0.1 with device ID "foo"
3. We connect to 192.168.0.1, and find that the device's certificate
   is actually for a different ID "bar". This could be because the
   packet did not actually originate from 192.168.0.1, or this host is
   malicious / malfunctioning.
4. We remember that device ID "foo" has certificate with common name "bar".
5. When we finally attempt to connect to the real device ID "foo", we
   reject their certificate (common name "foo"). We can now never
   successfully connect to "foo".

On some network (mis-)configurations, this completely prevents
kdeconnectd from connecting to any peers, because a reply which is
seen as originating from the local interface address will cause
kdeconnectd to immediately connect to itself and remember its own
certificate.

Address this by using the certificate display name of the peer, which
will match the real device ID.
2021-09-25 12:51:59 +00:00
Weixuan XIAO
664da445ee Empty capabilities in identity packet for UDP
To avoid incomplete UDP transmission on macOS
2021-07-04 19:13:21 +00:00
Aleix Pol
042fdd368a Fix warnings 2021-03-03 15:20:24 +01:00
Kai Uwe Broulik
8dae6772e0 Fix CompositeFileTransferJob speed calculation
The `QElapsedTimer` was never started. Clean it up somewhat and use a dedicated
250ms timer for reporting transferred bytes periodically (like KIO does it) and
1000ms for calculating speed so it's not as erratic.

Furthermore, report final numbers in `slotResult` rather than complicating
`slotProcessedAmount` for that.

Also, fix typo "send" -> "sent"
2021-01-31 23:50:14 +01:00
Kai Uwe Broulik
daa6f7fc14 Clean up FileTransferJob description
* Set magic `destUrl` property to let it know the job destination in case of
  multiple files being transferred
* Set a normal "Receiving File(s)" title like we do with "Copying" title
* Set device name and destination path as details
2021-01-31 22:22:36 +01:00
Nicolas Fella
9082ed4699 Fix build with bluetooth enabled
We need to implement this pure virtual method.

This is just a placeholder and lacks a proper implementation.
2020-11-30 20:11:47 +01:00
Albert Vaca Cintora
e7518493df Add a verification key that's displayed when pairing
The key is a sha256 of both devices' certificates. Both should generate the
same key, so hey user can check they are pairing against the right device.

Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-11-26 11:28:49 +01:00
Nicolas Fella
1060c1a81a Add API for opening the KCM to daemon
We have a few places that open the KCM, with different arguments.

Centralize the implementation in one place.

This makes it easier to switch to invoking systemsettings5 in the future (once https://invent.kde.org/plasma/systemsettings/-/merge_requests/11 is in).

It also makes sure the relevant device is selected when clicking on a pairing notification.

The function is exposed to DBus for the Plasmoid and potential third-party users.

CCBUG: 425660
2020-10-18 18:40:48 +00:00
Albert Vaca Cintora
e05769e6de Fix initial set of devices not being emitted in dbus 2020-10-02 12:52:08 +02:00
Albert Vaca Cintora
bd27aec9d2 Do not replace connections for a given deviceId if the certs have changed
Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-10-02 12:52:08 +02:00
Albert Vaca Cintora
ce0f00fc2d Limit the ports we try to connect to to the port range of KDE Connect
So we can't trigger connections to other services.

Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-10-02 12:52:08 +02:00
Albert Vaca Cintora
613899be24 Do not remember more than a few identity packets at a time
To prevent the kdeconnect process from using too much memory.

Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-10-02 12:52:08 +02:00
Albert Vaca Cintora
542d94a70c Limit number of connected sockets from unpaired devices
Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-10-02 12:52:08 +02:00
Aleix Pol
8112729eb0 Don't brute-force reading the socket
The package will arrive eventually, and dataReceived will be emitted.
Otherwise we just end up calling dataReceived to no end.

Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-10-02 12:52:08 +02:00
Aleix Pol
024e5f23db Do not let lanlink connections stay open for long without authenticating
If there's no information received, close the socket to try again.

Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-10-02 12:52:08 +02:00
Aleix Pol
4fbd01a3d4 Limit identity packets to 8KiB
Healthy identity packages shouldn't be that big and we don't want to
allow systems around us to send us ever humongous packages that will
just leave us without any memory.

Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-10-02 12:52:08 +02:00
Matthias Gerstner
7e47d04053 Fix use after free in LanLinkProvider::connectError()
If QSslSocket::connectToHost() hasn't finished running.

Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-10-02 12:52:08 +02:00
Albert Vaca Cintora
aa84aa5dcb Do not leak the local user in the device name.
Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-10-02 12:52:08 +02:00
Albert Vaca Cintora
7b904f47b3 Do not ignore SSL errors, except for self-signed cert errors.
Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-10-02 12:52:08 +02:00
Aleix Pol
bf089f3461 Remove unused variable 2020-09-24 18:31:11 +02:00
Aleix Pol
d4cf48901c SocketLineReader: don't call packets bytes 2020-09-16 02:16:06 +02:00
Nicolas Fella
400c800deb [app] Add plugin settings page
Include a page that allows (de)selecting and configuring plugins

This is one of the last missing pieces for feature parity with the KCM.
2020-09-08 20:33:20 +02:00
Richard Liebscher
8d16d05c8a Custom devices 2020-08-18 21:55:24 +02:00
Nicolas Fella
87db95b22f Convert license headers to SPDX expressions 2020-08-17 09:48:10 +00:00
Piyush Aggarwal
771c9dcd22 fix code indentation in lanlinkprovider 2020-08-07 21:22:28 +00:00
Piyush Aggarwal
e3225a1430 fix QSslKey::ca-certificate deprecated warning 2020-08-07 21:22:28 +00:00
Richard Liebscher
f1b3c0e0ca Better device name in Sailfish OS 2020-08-02 19:19:27 +00:00
Richard Liebscher
f3656d962c Save changed device name and type 2020-08-02 18:34:02 +02:00
Nicolas Fella
79164ca8ba Replace manual include dir handling with interface target
We use kdeconnect-version.h in several places and therefore it needs to be in the include path. We currently do this by setting target_include_path in a few places. Replace this with an interface library that we can link against that sets up the correct include path. IMO it is cleaner this way.
2020-07-30 10:53:48 +02:00
Antonio Larrosa
1d36164230 Use ecm_qt_declare_logging_category to declare the logging categories
This automatizes the generation of logging categories so a
kdeconnect-kde.categories is generated and installed to
/usr/share/qlogging-categories5/ so kdebugsettings can use it.

Also, sets the default logging level to Warning. So now the logs
of users won't be filled with debug messages but they can
modify the configuration easily with kdebugsettings.
2020-05-26 18:55:47 +02:00
Nicolas Fella
93e68756bc Port away from deprecated error signal 2020-05-09 17:21:14 +00:00
Nicolas Fella
4254b23d5d trim some whitespace 2020-05-09 16:46:52 +02:00
Nicolas Fella
9277cc537a Implement basic device type detection 2020-04-24 12:24:56 +00:00
Abdel-Rahman Abdel-Rahman
2728f8d864 Close all sockets before suspension 2020-04-16 22:32:57 +00:00
Nicolas Fella
1a9c2dbc4c Fix coding style 2020-04-10 23:43:06 +02:00
Nicolas Fella
28e7e99100 Merge branch 'release/20.04' 2020-03-21 21:21:02 +01:00
Nicolas Fella
eac1e07e29 Revert "Make default name and device type customizable"
This causes a crash described in https://invent.kde.org/kde/kdeconnect-kde/-/merge_requests/206#note_37534

This reverts commit a39a2d562d.
2020-03-21 21:13:41 +01:00
Nicolas Fella
2c8cf96a6c Read payload size as qint64 2020-03-20 19:54:47 +00:00
Richard Liebscher
e066ef9236 Vergotten include in !190 2020-03-10 19:49:41 +00:00
Richard Liebscher
a39a2d562d Make default name and device type customizable 2020-03-01 20:55:40 +00:00
Richard Liebscher
bb5539c8c3 Make plugins work in SailfishConnect 2020-03-01 20:00:40 +00:00
Nicolas Fella
6025f7cc48 Remove usused includes 2020-01-20 22:35:37 +01:00
Richard Liebscher
456d4830fe Made code more explicit and additional tests. 2020-01-04 14:13:36 +01:00
Richard Liebscher
5c0ad3fb85 Remove payload keys when no payload exists 2020-01-03 15:48:48 +01:00
Yuri Chornoivan
ba8ee54558 Fix minor typos 2019-12-22 10:15:58 +02:00
Yuri Chornoivan
01c4d0411b Fix minor EBN issues 2019-12-22 09:49:55 +02:00
Yuri Chornoivan
88fd5eb63d Do not extract messages from the non-existent .ui and .rc files 2019-12-21 10:04:31 +02:00
Kai Uwe Broulik
5da0ae7903 Set total amount of files
Ensures the progress dialog can show the total number of files
and offer additional actions for when a single file was copied.
2019-12-19 15:58:05 +01:00
Richard Liebscher
ba34672cbd Make build for SailfishConnect possible 2019-12-09 22:14:19 +00:00