public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH proxmox 2/3] http: tls: implement `PartialEq` for `SslVerifyError`
Date: Thu, 25 Jun 2026 13:22:35 +0200	[thread overview]
Message-ID: <20260625112236.188257-2-s.sterz@proxmox.com> (raw)
In-Reply-To: <20260625112236.188257-1-s.sterz@proxmox.com>

this is useful for writting integration tests, but could also come in
handy if such errors ever get propagated to a yew front-end. as yew
requires `PartialEq` for `Properties` to implement its re-rendering
logic.

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 proxmox-http/src/tls.rs | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/proxmox-http/src/tls.rs b/proxmox-http/src/tls.rs
index d7a7aa98..aa77d4cf 100644
--- a/proxmox-http/src/tls.rs
+++ b/proxmox-http/src/tls.rs
@@ -27,6 +27,35 @@ pub enum SslVerifyError {
     UntrustedCertificate { fingerprint: String },
 }
 
+// Useful for testing. Can't hide it behind `#[cfg(test)]` for integration tests, though.
+impl PartialEq for SslVerifyError {
+    fn eq(&self, other: &Self) -> bool {
+        match (self, other) {
+            (SslVerifyError::NoCertificate, SslVerifyError::NoCertificate) => true,
+            (SslVerifyError::InvalidFingerprint(_), SslVerifyError::InvalidFingerprint(_)) => true,
+            (
+                SslVerifyError::FingerprintMismatch {
+                    fingerprint: a_fingerprint,
+                    expected: a_expected,
+                },
+                SslVerifyError::FingerprintMismatch {
+                    fingerprint: b_fingerprint,
+                    expected: b_expected,
+                },
+            ) => a_fingerprint == b_fingerprint && a_expected == b_expected,
+            (
+                SslVerifyError::UntrustedCertificate {
+                    fingerprint: a_fingerprint,
+                },
+                SslVerifyError::UntrustedCertificate {
+                    fingerprint: b_fingerprint,
+                },
+            ) => a_fingerprint == b_fingerprint,
+            _ => false,
+        }
+    }
+}
+
 /// Intended as an openssl verification callback.
 ///
 /// If the 'PROXMOX_NEW_TLS_CHECK' environment variable is set to "1",
-- 
2.47.3





  reply	other threads:[~2026-06-25 11:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17  8:59 [PATCH proxmox{,-backup,-websocket-tunnel} v3 0/6] unify openssl callback logic Dominik Csapak
2026-06-17  8:59 ` [PATCH proxmox v3 1/6] http: factor out openssl verification callback Dominik Csapak
2026-06-25 11:19   ` Shannon Sterz
2026-06-17  8:59 ` [PATCH proxmox v3 2/6] http: tls: use legacy behavior when PROXMOX_NEW_TLS_CHECK is not set Dominik Csapak
2026-06-25 11:19   ` Shannon Sterz
2026-06-17  8:59 ` [PATCH proxmox v3 3/6] client: use proxmox-http's openssl verification callback Dominik Csapak
2026-06-25 11:19   ` Shannon Sterz
2026-06-17  8:59 ` [PATCH proxmox-backup v3 4/6] pbs-client: use proxmox-https openssl callback Dominik Csapak
2026-06-25 11:19   ` Shannon Sterz
2026-06-17  8:59 ` [PATCH proxmox-backup v3 5/6] pbs-client: honor already verified fingerprint Dominik Csapak
2026-06-17  8:59 ` [PATCH proxmox-websocket-tunnel v3 6/6] use proxmox-http's openssl callback Dominik Csapak
2026-06-25 11:19   ` Shannon Sterz
2026-06-25 11:19 ` [PATCH proxmox{,-backup,-websocket-tunnel} v3 0/6] unify openssl callback logic Shannon Sterz
2026-06-25 11:22   ` [PATCH proxmox 1/3] http: tls: move PROXMOX_NEW_TLS_CHECK env var name into constant Shannon Sterz
2026-06-25 11:22     ` Shannon Sterz [this message]
2026-06-25 11:22     ` [PATCH proxmox 3/3] http: tls: add integration tests for openssl verify callbacks Shannon Sterz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260625112236.188257-2-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal