diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-06-07 16:36:08 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-07 16:36:08 -0500 |
| commit | ec0dd1430f8987fc7cc2550975ff4ec3d80a3147 (patch) | |
| tree | d08eb919616c50060d98c060136a31e296c1b670 /src | |
| parent | 7d934eaf0a352eeb8d3a1dbe20af944813ca2580 (diff) | |
| parent | fd54ff88342d9ee8c124199a90312ebf254d12f5 (diff) | |
| download | slskd-ec0dd1430f8987fc7cc2550975ff4ec3d80a3147.tar.gz | |
Merge pull request #1760 from slskd/cert
Update x509 generation/validation to resolve warnings, deprecate old permissions objects
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Common/Cryptography/X509.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Core/Options.cs | 51 |
2 files changed, 2 insertions, 53 deletions
diff --git a/src/slskd/Common/Cryptography/X509.cs b/src/slskd/Common/Cryptography/X509.cs index bed224cf..b003decf 100644 --- a/src/slskd/Common/Cryptography/X509.cs +++ b/src/slskd/Common/Cryptography/X509.cs @@ -64,7 +64,7 @@ namespace slskd.Cryptography new DateTimeOffset(DateTime.UtcNow.AddDays(-1)), new DateTimeOffset(DateTime.UtcNow.AddDays(36500))); - return new X509Certificate2(certificate.Export(X509ContentType.Pkcs12, password), password, x509KeyStorageFlags); + return X509CertificateLoader.LoadPkcs12(certificate.Export(X509ContentType.Pkcs12, password), password, x509KeyStorageFlags); } /// <summary> @@ -80,7 +80,7 @@ namespace slskd.Cryptography try { - _ = new X509Certificate2(fileName, password); + _ = X509CertificateLoader.LoadPkcs12FromFile(fileName, password); return true; } catch (Exception ex) diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index f35a56df..d1062a2c 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -706,57 +706,6 @@ namespace slskd } /// <summary> - /// Permission options. - /// </summary> - public class PermissionsOptions - { - /// <summary> - /// Gets file permission options. - /// </summary> - [Validate] - public FileOptions File { get; init; } = new FileOptions(); - - /// <summary> - /// File permission options. - /// </summary> - public class FileOptions : IValidatableObject - { - /// <summary> - /// Gets the permissions to apply to newly created files. - /// </summary> - /// <remarks> - /// Applicable to non-Windows operating systems, only. - /// </remarks> - [Argument(default, "file-permission-mode")] - [EnvironmentVariable("FILE_PERMISSION_MODE")] - [Description("the permissions to apply to newly created files (chmod syntax, non-Windows only)")] - public string Mode { get; init; } - - /// <summary> - /// Extended validation. - /// </summary> - /// <param name="validationContext"></param> - /// <returns></returns> - public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) - { - var results = new List<ValidationResult>(); - - if (!string.IsNullOrEmpty(Mode)) - { - var regEx = new Regex("^[0-7]{3,4}$", RegexOptions.Compiled); - - if (!regEx.IsMatch(Mode)) - { - results.Add(new ValidationResult($"Field {nameof(Mode)} is invalid. Specify a three- or four-character string consisting of only 0-7 (chmod syntax, [0]000-[7]777, inclusive)")); - } - } - - return results; - } - } - } - - /// <summary> /// Directory options. /// </summary> public class DirectoriesOptions |
