Skip to content

Commit

Permalink
Change Assertion to Exit with error
Browse files Browse the repository at this point in the history
while initialization of ovsdb ssl protocol if,
we fail to find/open cert files exit with error
instead of assertion

Closes-Bug: 1448872
(cherry picked from commit bce5a24)

Change-Id: I37bb8787a0da1686321a1ce4f9f7e2c712403e2e
  • Loading branch information
Prabhjot Singh Sethi committed Apr 29, 2015
1 parent 04f21ad commit fb7545b
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/vnsw/agent/ovs_tor_agent/ovsdb_client/ovsdb_client_ssl.cc
Expand Up @@ -3,6 +3,7 @@
*/

#include <boost/bind.hpp>
#include <base/logging.h>

#include <oper/agent_sandesh.h>
#include <ovsdb_types.h>
Expand All @@ -29,13 +30,28 @@ OvsdbClientSsl::OvsdbClientSsl(Agent *agent, TorAgentParam *params,
ctx->set_verify_mode((boost::asio::ssl::verify_peer |
boost::asio::ssl::verify_fail_if_no_peer_cert), ec);
assert(ec.value() == 0);

ctx->use_certificate_chain_file(params->ssl_cert(), ec);
assert(ec.value() == 0);
if (ec.value() != 0) {
LOG(ERROR, "Error : " << ec.message() << ", while using cert file : "
<< params->ssl_cert());
exit(EINVAL);
}

ctx->use_private_key_file(params->ssl_privkey(),
boost::asio::ssl::context::pem, ec);
assert(ec.value() == 0);
if (ec.value() != 0) {
LOG(ERROR, "Error : " << ec.message() << ", while using privkey file : "
<< params->ssl_privkey());
exit(EINVAL);
}

ctx->load_verify_file(params->ssl_cacert(), ec);
assert(ec.value() == 0);
if (ec.value() != 0) {
LOG(ERROR, "Error : " << ec.message() << ", while using cacert file : "
<< params->ssl_cacert());
exit(EINVAL);
}
}

OvsdbClientSsl::~OvsdbClientSsl() {
Expand Down

0 comments on commit fb7545b

Please sign in to comment.