Commit Graph

36 Commits

Author SHA1 Message Date
Andrius Štikonas 551654de0d Also rename source/targetFirstByte ot offsets in function declarations. 2020-11-29 13:08:53 +00:00
Andrius Štikonas 32d146eed3 externalcommandhelper: Make copy direction an enum. 2020-11-26 23:26:31 +00:00
Andrius Štikonas d16d9e8019 Do not reuse QProcess object in externalcommandhelper for different invocations. 2020-11-26 22:05:25 +00:00
Andrius Štikonas 6cff70567b Fix signals between helper and client. 2020-10-12 20:23:37 +01:00
Andrius Štikonas cd4d9b1985 Rename helper interfaces. 2020-10-12 20:23:37 +01:00
Andrius Štikonas a2ee82e021 Simplify createFile function, it was checking for authorization twice. 2020-10-12 20:23:37 +01:00
Andrius Štikonas 2dff59260c Remove exit call from the helper. It is no longer used.
BUG: 412887
2020-10-12 20:23:04 +01:00
Andrius Štikonas 296f281ffb WIP: cleanup polkit port: licenses, dead code and kauth removal, add TODO about signals. 2020-10-12 20:18:55 +01:00
David Edmundson edfabb90dc WIP: port to polkit 2020-10-12 20:18:55 +01:00
Andrius Štikonas d68ffeadef REUSE: SPDX style license headers for src/util. 2020-10-01 00:33:19 +01:00
Andrius Štikonas 5b80c6045c Fix fstab editing functionality.
In the old code QByteArray fstabContents was actually empty.
Also, writeData function was opening file in append mode,
thus nothing was actually written.

Split writeData function into two:
  * one for block devices
  * another for writing fstab file

BUG: 417205
2020-09-10 23:54:23 +01:00
Shubham Jangra d1a82f65d4 Revert "Remove redundant includes and refactor"
This reverts commit 4229b02fd2.
2019-06-12 22:11:11 +05:30
Shubham Jangra 4229b02fd2 Remove redundant includes and refactor 2019-06-10 23:07:06 +05:30
Shubham Jangra a7532d4041 Scrap Public Key Cryptography code based on QCA as QDbus is secure enough
Summary: QDbus already provides enough security to the calls made by the application to the helper. Hence no need to encrypt, sign the requests of the application and verify their integrity at the helper side.

Reviewers: stikonas, cjlcarvalho

Reviewed By: stikonas

Subscribers: #kde_partition_manager

Tags: #kde_partition_manager

Differential Revision: https://phabricator.kde.org/D21275
2019-05-19 22:53:13 +05:30
Shubham Jangra 07b2ce3054 Remove superflous variables
Reviewers: stikonas

Reviewed By: stikonas

Subscribers: #kde_partition_manager

Tags: #kde_partition_manager

Differential Revision: https://phabricator.kde.org/D21272
2019-05-18 18:54:20 +05:30
Shubham Jangra 9c5b582ed0 Constantify function parameters
Summary: Even though constantifying these parameters won't change anything(since they are being passed by value), it is done to assure they conform to rest of the coding style

Reviewers: stikonas, cjlcarvalho, #kde_partition_manager

Reviewed By: cjlcarvalho

Subscribers: #kde_partition_manager

Tags: #kde_partition_manager

Differential Revision: https://phabricator.kde.org/D20106
2019-03-29 11:52:55 -06:00
Andrius Štikonas 80f5a32dc0 Remove remaining cases of call to dd binary.
BUG: 398154
2018-11-29 22:32:07 +00:00
Andrius Štikonas 09e4d47e07 Do not use external process dd.
BUG: 398154
2018-11-25 20:50:22 +00:00
Andrius Štikonas 2007f2b8ea Allow copyblocks to be used together with small QByteArrays.
Add CopyTargetByteArray. CopySourceByteArray is not implemented yet.

This is only suitable for reading small amount of data such as GPT header
or FAT boot sector location. Not meant for copying whole partition because
data has to be transfered over DBus.

Differential Revision: https://phabricator.kde.org/D16487
2018-10-29 00:02:12 +00:00
Andrius Štikonas a7b640da4c Delay creation of QEventLoop object until after QCoreApplication starts
Fixes: QEventLoop: Cannot be used without QApplication
2018-08-03 19:49:32 +01:00
Andrius Štikonas 938ec7fa8b Make ExternalCommandHelper::getNonce() reentrant.
Store previously generated values of nonce, and remove them from
the container when they are used.

BUG: 396312
2018-07-21 11:03:25 +01:00
Andrius Štikonas c50e04c9d1 Use cryptographic nonce instead of counters. 2018-07-20 21:12:13 +01:00
Andrius Štikonas e5b63b0d6f Fix support for QProcess::ProcessChannelMode. 2018-07-15 17:37:29 +01:00
Andrius Štikonas 231bfbd331 Cryptographically sign copyblocks and exit KAuth helper calls. 2018-04-13 14:24:05 +03:00
Andrius Štikonas 24e1e83152 Try to fix QString encoding issues in KAuth helper.
For now set text codec to UTF-8
Needs more investigation if locale of the GUI program is not UTF-8.
2018-04-13 02:44:12 +03:00
Andrius Štikonas 428ee5b6c8 First attempt at using RSA to sign requests to KAuth helper. 2018-04-13 00:43:12 +03:00
Andrius Štikonas 5e85f0b974 Remove ping interface in KAuth helper as it is blocking KPM GUI. 2018-03-31 18:01:00 +01:00
Andrius Štikonas f04416beba Simplify Qtimer code in ExternalCommandHelper. 2018-03-23 22:47:21 +00:00
Caio Carvalho 47a1519699 - Including Watchdog Timer in CoreBackendManager to ping DBus service.
- Including ExternalCommandHelper::ping slot to receive pings.
- Including timer to watch last ping in the service to unregister it after reaching 42 seconds without pings.
2018-03-23 18:19:33 -03:00
Andrius Štikonas 2cef3f6ec6 Cleanup ExternalCommand interface:
* Remove a separate constructor for copyblocks.
 * Remove kauthThread and finished() signal.
2018-03-22 17:29:40 +00:00
Andrius Štikonas 4b91f2c07e Convert copyblocks dbus call to asynchronous call. 2018-03-21 21:51:30 +01:00
Andrius Štikonas bd54ba7c5d Convert copyblocks code from KAuth to DBus calls to helper daemon. 2018-03-21 18:01:40 +01:00
Andrius Štikonas 645e16bb20 WIP: add some experimental code where helper is used as daemon
Caveats:
 * copyblocks are not converted yet, but should be similar.
 * There is no signaling back to main application which tells when even loop has started, so after password is entered, you need to click F5 to rescan devices
 * There are some security checks but are they sufficient
2018-03-19 11:42:49 +01:00
Andrius Štikonas f426f59799 Use QFile for writing data in ExternalCommandHelper::writeData
dd works much slower when writing to files, especially files on SSD.
Thanks to Huzaifa Faruqui for suggestion.
2018-02-03 15:58:36 +00:00
Huzaifa Faruqui e42a5c9289 Implement copyblocks function in KAuth helper.
Switch BackupFileSystemJob to thenew copyblocks function.

Reviewed and cleaned up by: Andrius Štikonas
2018-01-24 15:22:42 +00:00
Andrius Štikonas 47429dd1bf Proof of concept attempt to implement KAuth. 2017-12-10 17:36:39 +00:00