summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2012-03-29 21:25:05 +0200
committerMarc-André Lureau <marcandre.lureau@gmail.com>2012-03-30 14:10:00 +0200
commite3f6941895085c7138abcb49a98572ea1479ac1a (patch)
tree74192ecc68bf1c01bff52d57d136a197414280b6
parenta0339261d4abe6ed67b22cf7c80405ae2b5ed571 (diff)
Bypass certicate verification failure if PUBKEY check only
During switch-host migration, only PUBKEY verification is required. Couldn't it just load the certificate again for the new session? perhaps, but that's they way the code used to work until I introduced a regression in spice commit d46f9d3f4e006d3bca9b99fac25169b17e7ac803.
-rw-r--r--common/ssl_verify.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/ssl_verify.c b/common/ssl_verify.c
index 9ec434d..e45d26e 100644
--- a/common/ssl_verify.c
+++ b/common/ssl_verify.c
@@ -421,6 +421,13 @@ static int openssl_verify(int preverify_ok, X509_STORE_CTX *ctx)
spice_warning("openssl verify:num=%d:%s:depth=%d:%s", err,
X509_verify_cert_error_string(err), depth, buf);
v->all_preverify_ok = 0;
+
+ /* if certificate verification failed, we can still authorize the server */
+ /* if its public key matches the one we hold in the peer_connect_options. */
+ if (err == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN &&
+ v->verifyop & SPICE_SSL_VERIFY_OP_PUBKEY)
+ return 1;
+
return 0;
} else
return 1;