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
Change-Id: Idf1a2d7043b9980367c2ab1d610049458169b306
  • Loading branch information
Prabhjot Singh Sethi committed Apr 29, 2015
1 parent a1bd6c7 commit bce5a24
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 bce5a24

Please sign in to comment.