Commit Graph
237 Commits
Author SHA1 Message Date
Kenneth Skovhede 7a993421f2 Fixed bug with scheme detection
This PR fixes a reported issue with strings that are less than 3 characters.

This is unlikely, but happens if the code tries to get the scheme of a path, like `/a` or `/`.

The updated logic returns the scheme if one exists, and it is less than 15 characters (to avoid leaking sensitive information).
2026-02-07 16:13:52 +01:00
Kenneth Skovhede 05ea1dfafe Check free temporary space
This PR adds checks for free temporary space when starting the server and when restoring.

On systems that have limited space in the temp folder a warning will now be shown.

This is intended to capture issues on some Docker systems where /tmp is mounted in memory instead of being disk backed.

It will also detect the issue on other systems that are space constrained.
2026-02-06 10:37:27 +01:00
Kenneth Skovhede ca7dff57f3 Updated restore flow to use the IRestoreDestinationProvider interface for accessing files 2026-01-14 10:11:24 +01:00
Kenneth Skovhede 1523f730e3 Added support for storing metadata in the database 2026-01-14 10:01:20 +01:00
Kenneth Skovhede 83779a9486 Minor fixes
- Added Cloudflare to list of known S3 provider domains.
- Removed AWS specific naming on the help texts.
- Fixed an edge case where calculating how many files to test with an empty list would crash
- Fixed a bug with getting a safe display url for very short urls
2026-01-06 09:48:23 +01:00
Kenneth Skovhede d7ab1b03ac Merge remote-tracking branch 'origin/HEAD' into feature/duplicati-storage-backend
Streamlined the use of SharedRemoteOperation
2025-12-10 15:33:35 +01:00
Kenneth Skovhede 5cfa9724d7 Added support for loading remote backup names in Duplicati Storage 2025-12-09 21:17:01 +01:00
Kenneth Skovhede 6d9826df06 Initial implementation of write-support for SecretProviders
This updates the MacOS secret provider to use PInvoke for a more stable API than the secrets tool that was used before.
2025-11-30 23:01:57 +01:00
Kenneth Skovhede 43d38efdd3 Fixed remaining warnings 2025-11-14 16:09:05 +01:00
Kenneth Skovhede 4b3ccde3f7 Fixed parsing enum flags
This fixes #6574
2025-10-31 11:38:06 +01:00
Kenneth Skovhede 39cca5c24f Simplified calling code to not rely on extension methods 2025-09-25 11:33:56 +02:00
Kenneth Skovhede 230d80642a Fixed invariant formatting helpers
This fixes an issue with formatting for invariant values that was caused by incrorrect function overload selection.

To avoid future issues, the two similar functions have been renamed to clarify what they are working for.
2025-09-25 11:14:54 +02:00
Carl Johnsen 7670ea9a58 Ensured that all values that are passed to interpolation strings have been passed through FormatInvariant to prevent SQLite errors related to string formatting cultures. 2025-09-05 14:11:05 +02:00
Carl Johnsen 1a5fef36d7 Removed whitespace 2025-09-05 14:07:58 +02:00
Carl Johnsen b3fe276a13 Ensured that all temporary tables uset the same type of generated guid name 2025-09-05 14:06:55 +02:00
Kenneth Skovhede a673bd0fab Fixed pre-calc SHA256 on AWS S3
This fixes pre-calculating the SHA256 hash for AWS SDK requests to S3.
This fixes an issue where a throttled stream would not be throttled correctly, because the AWS library would read the throttled stream twice (once for hashing, and once for transmitting).

To ensure compatibility with Wasabi S3, the hash is also lowercased.
2025-08-15 10:59:38 +02:00
Kenneth Skovhede 1cfacca794 Enabled nullable for FilterExpression and Options
This adds nullability to FilterExpression and Options.
It also updates almost all properties in Options to use a common format that enforces uniform parsing of the values.

A few options have been updates to have the default values specified as a constant, to avoid replicating the value in two places.
2025-05-20 14:36:39 +02:00
Kenneth Skovhede ef631a1199 Added feature to suppress warnings
This PR adds the option to suppress warnings by their log id. Warning IDs that are supplied to `--suppress-warnings` will be converted to information messages before being logged.

If a specific warning is disabled, such as `CompressionReadErrorFallback`, this will then no longer count as a warning for the job, and the log file will see the warning as an information message.

This PR also adds two simpler filter options that makes it possible to filter log messages by supplying the log IDs. This can already be achieved with log filters, but the ID filter is a bit simpler to apply, as you only need to know the ID.

Finally, this PR also adds common logging for errors in the categories:
- Permission denied, id = `PermissionDenied`
- File locked, id = `FileLocked`
- Path not found, id = `PathNotFound`
- Path too long, id = `PathTooLong`

These new log ids makes it simpler to ignore warnings about locked or inaccesible files.
2025-05-20 14:26:10 +02:00
Kenneth Skovhede 42c3ecd009 Fix throttle stream issues
Some providers, B2, Idrivee2, JottaCloud and S3 (AWS version) needs a checksum for the content.

To calculate this content the libraries will calculate the hash by reading the stream. But since the stream can be throttled, the hash calculation is throttled.

In some cases the contents are buffered, so the transfer is done at full speed, but the hashing at throttled speed. The average speed is the same, but network traffic is bursty, which it should not be with a throttle.

Also added option to disable signing with AWS Sigv4 as that interferes with the throttled stream. It is not currently possible to pass the sha-256 hash to the Sigv4 code, so it will always read the entire (potentially throttled) stream before sending the contents, causing unwanted delays. Use the new option `--s3-disable-payload-signing` to disable v4 signing.
2025-05-09 13:46:45 +02:00
Kenneth Skovhede 072f89c747 Remove WorkerThread class
This removes the WorkerThread class and many of the complications around it.

Instead of having a generic worker, there is now the `QueueRunnerService` which takes on all the resposibilities for handling queued tasks.

This is one step towards removing `FIXMEGlobal`
2025-05-03 15:01:09 +02:00
Kenneth SkovhedeandGitHub a15c3262be Merge branch 'master' into fix-regexp-combine 2025-04-30 16:14:17 +02:00
Kenneth Skovhede 8aee23c278 Updated Minio to 6.0.4 2025-04-15 00:00:55 +02:00
Kenneth Skovhede 53ee9526ca Fixed some nullability warnings 2025-03-24 17:10:15 +01:00
Kenneth Skovhede edb4747181 Merge commit 'ae59ed294f6511ca014386d30c48eaabd27aca5b' into feature/improve-auth-parsing-helper 2025-03-21 10:06:10 +01:00
Kenneth Skovhede a163f53dba Handle stop exceptions
This adds a common way to catch stop exceptions and handles them so error resilient logic does not continue when a stop exception is thrown.

Previously, the logic would only check for `ThreadAbortException` which was used to signal a stop prior to .NET8.
2025-03-20 22:32:04 +01:00
Kenneth Skovhede be8de849fb Mapping timeouts to correct exceptions 2025-03-20 12:02:09 +01:00
Kenneth Skovhede 8f38c82f1e Changed order of function arguments for improved readability 2025-03-19 15:48:01 +01:00
Kenneth Skovhede 6c7843b332 Unified options
This PR adds a unified way of supplying timeouts to each of the backends.

It also adds an opt-in way of adding commonly used options, so parsing and usage can be standardized across multiple backends.
2025-03-19 15:27:02 +01:00
Kenneth Skovhede e37f20aedd Added retries for HTTP messages
This adds a retry count and a retry delay for posting backup reports via HTTP requests. This will make the report delivery more reliable if the network is unstable or server is briefly unreachable.
2025-03-16 16:52:30 +01:00
Kenneth Skovhede bb1aa8e1f7 Cosmetic cleanup
Removed superfluous namespaces.
Using `var` most places.
Using extension methods for common setup of commands.
2025-03-14 14:34:56 +01:00
Kenneth Skovhede f342d70819 Implemented forced invariant locale on all SQL strings.
This fixes #6023
2025-03-13 23:06:32 +01:00
Marcelo C. b035c69e4d Integrating the IPv6 & IPv4 detection
It should be noted that I was unable to completely remove IPv4 on Windows 11 to a state where it would not provide the 127.0.0.1 loopback, even when disabling Ipv4 in various ways, including with registry flags.

On ubuntu/linux, after completely disabling ipv4 the ipv6 loopback was returned.
2025-03-11 16:24:15 -03:00
Marcelo C. 2118bd5917 Adding ParseIntOption 2025-03-04 09:23:53 -03:00
Kenneth Skovhede 1428d8cc6f Preserve order of input sources 2025-02-24 12:53:48 +01:00
Kenneth Skovhede 26bbe6a577 Added setup step for source providers.
This enables a fail-early approach, where the remote source loads the initial results.
By storing the `IAsyncEnumerable` it is possible to not perform any additional remote calls, even with the initial probing call.

This makes it possible to detect the absence of sources, so the backup can be aborted if sources are missing.
2025-02-24 12:50:58 +01:00
Kenneth Skovhede 9dfe977d3f Changed logic so the source providers are now logically mounted into the source directory structure.
This fixes the restore issues as all sources will now appear as if they were originally part of the source file system.

The backend implementation has now been simplified so the backends only return names of entries with no path information.  Most backends already do this, but the S3 backends did not, so this was fixed as well.

This also clears up the interfaces, so the backend does not know about the `ISourceProviderEntry`. All mapping is done by the `BackendSourceProvider`, making it simpler to support other backends as sources.
2025-02-21 16:06:55 +01:00
Kenneth Skovhede 6bbc93b8df Merge remote-tracking branch 'origin/master' into feature/alternate-source-provider 2025-02-16 16:37:12 +01:00
Kenneth Skovhede 8c935a7344 This creates a new ISourceProvider interface for describing a data source.
With this interface it is possible to wrap the current support for snapshots and USN and simplify the enumeration.

This makes a number of assumptions into fields such as `IsMetaEntry` and `IsRootEntry` that removes code that was checking for various properties.

This first commit has support for VSS and USN as well as "naked" files, keeping feature parity.

There is also an experimental support for loading a backend-as-a-source. The support for this is currently limited as the backends need to be extended to support a folder concept.
2025-02-09 16:14:22 +01:00
Kenneth Skovhede f22026cf59 Fixed a compile issue with older SDKs 2025-02-09 10:52:47 +01:00
Kenneth Skovhede bc8f6dd0c8 This adds the option to parse flags, where an enum can have multiple values.
It is only used by the FTP backend.
2025-01-30 10:52:17 +01:00
Kenneth SkovhedeandGitHub d99f74ed94 Rewrite the backend manager. (#5896)
* Rewrite the backend manager.

This creates a new more logic backend manager that handles all backend operations.

For each top-level operation, there is now a single backend manager instance that is passed to sub-commands.

The internals of the backend manager are now rewritten to use async logic instead of threading.

The design uses a single task runner that dispatches operations and honors concurrent settings and limits from one place.

The logic for each operation has been moved into a separate files/classes to make it easier to understand each operation.

This fixes #5804

* Fixed a few issues with not awaiting tasks

* Fixed not creating empty databases

* Fixed an issue with hashes not being recorded on download

* Reworked the download logic to avoid attempting to decrypt the file if it has been modified.

* Review fixes

* Renamed db collector to better reflect the purpose.

* Review fixes
2025-01-28 08:54:50 +01:00
Kenneth SkovhedeandGitHub 6bbd64a655 Fixed nullability warnings in Utility.cs (#5861)
* Fixed nullability warnings in `Utility.cs`

* Fixed a number of nullability issues and warnings

* More nullable fixes

* Fixed the overwrite issue

* Fixed additional nullability issues

* Removed additional nullability issues

* More nullability fixes and added some xmldoc

* Added more xmldocs and removed an unused argument

* Removed more warnings
2025-01-14 14:03:48 +01:00
Kenneth SkovhedeandGitHub 9464caf622 Feature/update license 2025 (#5851)
* Fixed some minor whitespace issues

* Updated all copyright to 2025
2025-01-07 09:40:39 +01:00
Kenneth SkovhedeandGitHub ff1b2b7990 Simplified task control (#5753)
* Simplified task control by having all logic in a single class and using async control mechanism
* Fixed the tests
* Made the marking of a backup partial explicitly communicated if the enumeration process is stopped.
* Added support for pausing active transfers
* Introduced transfer token to abort operations.
* Updated the way LiveControl is emitting events.
* Retains the paused state of the server across reboots, this fixes #5760.
* Reworked the way throttle speeds are propagated through LiveControls.
* Added option to pause transfers in the UI.
* Removed throttle settings from the LiveControls class so it is exclusively handled by the ApplicationSettings.
* Removed `thread-priority` as it does not work at all when tasks are used.
* Fixed the stop dialog and API to only support stop and abort.
* Removed unused variables
2024-12-18 08:27:59 +01:00
Kenneth SkovhedeandGitHub 58a5fc57f4 Implemented support for emitting intermediate certificates from pfx (#5739)
* Implemented support for emitting intermediate certificates from pfx files

* Added certificate check to crash earlier

* Fixed loading certificate on Windows
2024-12-05 10:34:10 +01:00
Marcelo Ceccon d4d9c47824 Further progress on removal of build warnings.
None of these changes have impact on code execution, they are mainly part of the effort to remove all build warnings.

The removal of Thread.ResetAbort leaves a TODO for us to integrate CancelationToken when it gets propagated down here on future changes.
2024-11-07 18:02:15 +01:00
Kenneth Skovhede aca02f0801 Fixed upgrade path with insecure passwords 2024-10-30 10:39:48 +01:00
Kenneth Skovhede d8a98049eb Added safeguard to avoid leaking the server key 2024-10-29 14:01:07 +01:00
Kenneth Skovhede 56816abed8 Reverted to not storing the certificate as a file, since the x509Certificate loader was the broken part, not Kestrel. 2024-10-29 13:55:12 +01:00
Kenneth Skovhede e914794b30 Simplified running TrayIcon with self-signed certificate.
Added workaround method to avoid loading certificate directly as that crashes .NET with EC-based keys.
2024-10-29 13:28:44 +01:00