diff options
author | msvensson@neptunus.(none) <> | 2006-05-03 14:09:08 +0200 |
---|---|---|
committer | msvensson@neptunus.(none) <> | 2006-05-03 14:09:08 +0200 |
commit | e1b41812b71148159fb46592776071e1215e7b8f (patch) | |
tree | 8ce5ebcc0d24005b4fcede1a802b558df0679960 /vio/viosslfactories.c | |
parent | 99475e7f4c2e802f5c7453b7fa45eb7248fb0f6e (diff) | |
download | mariadb-git-e1b41812b71148159fb46592776071e1215e7b8f.tar.gz |
Load CA certs before setting local certs.
Make it possible to get the yaSSL error message printed in the DBUG log file.
Diffstat (limited to 'vio/viosslfactories.c')
-rw-r--r-- | vio/viosslfactories.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 2b3e80a98e4..f1d2b077367 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -103,7 +103,7 @@ vio_set_cert_stuff(SSL_CTX *ctx, const char *cert_file, const char *key_file) /* FIX stderr */ fprintf(stderr,"Error when connection to server using SSL:"); ERR_print_errors_fp(stderr); - fprintf(stderr,"Unable to get private key from '%s'\n", cert_file); + fprintf(stderr,"Unable to get private key from '%s'\n", key_file); fflush(stderr); DBUG_RETURN(1); } @@ -252,14 +252,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file, DBUG_RETURN(0); } - if (vio_set_cert_stuff(ssl_fd->ssl_context, cert_file, key_file)) - { - DBUG_PRINT("error", ("vio_set_cert_stuff failed")); - report_errors(); - my_free((void*)ssl_fd,MYF(0)); - DBUG_RETURN(0); - } - + /* Load certs from the trusted ca */ if (SSL_CTX_load_verify_locations(ssl_fd->ssl_context, ca_file, ca_path) == 0) { DBUG_PRINT("warning", ("SSL_CTX_load_verify_locations failed")); @@ -272,6 +265,14 @@ new_VioSSLFd(const char *key_file, const char *cert_file, } } + if (vio_set_cert_stuff(ssl_fd->ssl_context, cert_file, key_file)) + { + DBUG_PRINT("error", ("vio_set_cert_stuff failed")); + report_errors(); + my_free((void*)ssl_fd,MYF(0)); + DBUG_RETURN(0); + } + /* DH stuff */ dh=get_dh512(); SSL_CTX_set_tmp_dh(ssl_fd->ssl_context, dh); @@ -297,7 +298,7 @@ new_VioSSLConnectorFd(const char *key_file, const char *cert_file, return 0; } - /* Init the the VioSSLFd as a "connector" ie. the client side */ + /* Init the VioSSLFd as a "connector" ie. the client side */ /* The verify_callback function is used to control the behaviour |