diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2012-09-11 18:24:13 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2012-09-20 16:40:54 +0200 |
commit | 3494eaf938695fc75ed6718699d59a34fab0e17a (patch) | |
tree | 38e21e702d23aa6dbe50537de93e2f2fa1ff40d2 | |
parent | 1e5bf67c2bc417d16308fc3d51f028c25b8544f6 (diff) | |
download | spice-3494eaf938695fc75ed6718699d59a34fab0e17a.tar.gz spice-3494eaf938695fc75ed6718699d59a34fab0e17a.tar.xz spice-3494eaf938695fc75ed6718699d59a34fab0e17a.zip |
reds: Report errors from load_dh_params
-rw-r--r-- | server/reds.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/server/reds.c b/server/reds.c index 1ff25f81..b1fd437e 100644 --- a/server/reds.c +++ b/server/reds.c @@ -3208,25 +3208,30 @@ static int reds_init_net(void) return 0; } -static void load_dh_params(SSL_CTX *ctx, char *file) +static int load_dh_params(SSL_CTX *ctx, char *file) { DH *ret = 0; BIO *bio; if ((bio = BIO_new_file(file, "r")) == NULL) { spice_warning("Could not open DH file"); + return -1; } ret = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); + BIO_free(bio); if (ret == 0) { spice_warning("Could not read DH params"); + return -1; } - BIO_free(bio); if (SSL_CTX_set_tmp_dh(ctx, ret) < 0) { spice_warning("Could not set DH params"); + return -1; } + + return 0; } /*The password code is not thread safe*/ @@ -3337,7 +3342,9 @@ static int reds_init_ssl(void) #endif if (strlen(ssl_parameters.dh_key_file) > 0) { - load_dh_params(reds->ctx, ssl_parameters.dh_key_file); + if (load_dh_params(reds->ctx, ssl_parameters.dh_key_file) < 0) { + return -1; + } } SSL_CTX_set_session_id_context(reds->ctx, (const unsigned char *)"SPICE", 5); |