if (selectNextServer()) {
// We have a server to try.
transition(ADDING_FWD_ADDRS_ST, SERVER_SELECTED_EVT);
- }
- else {
+ } else {
// Server list is exhausted, so fail the transaction.
transition(PROCESS_TRANS_FAILED_ST, NO_MORE_SERVERS_EVT);
}
if (selectNextServer()) {
// We have a server to try.
transition(REPLACING_REV_PTRS_ST, SERVER_SELECTED_EVT);
- }
- else {
+ } else {
// Server list is exhausted, so fail the transaction.
transition(PROCESS_TRANS_FAILED_ST, NO_MORE_SERVERS_EVT);
}
if (selectNextServer()) {
// We have a server to try.
transition(REMOVING_FWD_ADDRS_ST, SERVER_SELECTED_EVT);
- }
- else {
+ } else {
// Server list is exhausted, so fail the transaction.
transition(PROCESS_TRANS_FAILED_ST, NO_MORE_SERVERS_EVT);
}
if (selectNextServer()) {
// We have a server to try.
transition(REMOVING_REV_PTRS_ST, SERVER_SELECTED_EVT);
- }
- else {
+ } else {
// Server list is exhausted, so fail the transaction.
transition(PROCESS_TRANS_FAILED_ST, NO_MORE_SERVERS_EVT);
}
if (selectNextServer()) {
// We have a server to try.
transition(REPLACING_FWD_ADDRS_ST, SERVER_SELECTED_EVT);
- }
- else {
+ } else {
// Server list is exhausted, so fail the transaction.
transition(PROCESS_TRANS_FAILED_ST, NO_MORE_SERVERS_EVT);
}
if (selectNextServer()) {
// We have a server to try.
transition(REPLACING_REV_PTRS_ST, SERVER_SELECTED_EVT);
- }
- else {
+ } else {
// Server list is exhausted, so fail the transaction.
transition(PROCESS_TRANS_FAILED_ST, NO_MORE_SERVERS_EVT);
}
if (selectNextServer()) {
// We have a server to try.
transition(REMOVING_FWD_RRS_ST, SERVER_SELECTED_EVT);
- }
- else {
+ } else {
// Server list is exhausted, so fail the transaction.
transition(PROCESS_TRANS_FAILED_ST, NO_MORE_SERVERS_EVT);
}
if (selectNextServer()) {
// We have a server to try.
transition(REMOVING_REV_PTRS_ST, SERVER_SELECTED_EVT);
- }
- else {
+ } else {
// Server list is exhausted, so fail the transaction.
transition(PROCESS_TRANS_FAILED_ST, NO_MORE_SERVERS_EVT);
}
try {
pid_file.deleteFile();
} catch (const PIDFileError& pid_ex) {
- LOG_FATAL(lfc_logger, LFC_FAIL_PID_DEL).arg(pid_ex.what());
+ LOG_FATAL(lfc_logger, LFC_FAIL_PID_DEL).arg(pid_ex.what());
}
LOG_INFO(lfc_logger, LFC_TERMINATE);
// else use our defaults
if (test_mode) {
initLogger();
- }
- else {
+ } else {
OutputOption option;
LoggerManager manager;
std::stringstream os;
if (feed_.getProcessedText().empty()) {
os << "no input data to discard";
- }
- else {
+ } else {
os << "discarding partial command of "
<< feed_.getProcessedText().size() << " bytes";
}
if (attribs_table[IFLA_ADDRESS]) {
iface->setMac(static_cast<const uint8_t*>(RTA_DATA(attribs_table[IFLA_ADDRESS])),
RTA_PAYLOAD(attribs_table[IFLA_ADDRESS]));
- }
- else {
+ } else {
// Tunnels can have no LL_ADDR. RTA_PAYLOAD doesn't check it and
// try to dereference it in this manner
}
Result result;
if (successful) {
result = SUCCESS;
- }
- else {
+ } else {
// On a failure, log the error and set the result to ERROR.
boost::system::error_code error_code = send_callback->getErrorCode();
if (error_code.value() == boost::asio::error::operation_aborted) {
// If the supplied name is partial, qualify it by adding the suffix.
if (fqdn.getDomainNameType() == T::PARTIAL) {
fqdn_resp.setDomainName(qualifyName(client_name, ddns_params, true), T::FULL);
- }
- else {
+ } else {
fqdn_resp.setDomainName(client_name, T::FULL);
}
}
bind_array->add(host->getIPv4SubnetID()); // subnet_id
}
-
} catch (const std::exception& ex) {
host_.reset();
isc_throw(DbOperationError,
return (collection);
}
-
// Miscellaneous database methods.
std::string
return (val ? string(val) : "");
}
-string getMySQLTlsServer() {
- DatabaseConnection::ParameterMap parameters =
- DatabaseConnection::parse(validMySQLConnectionString());
- MySqlConnection conn(parameters);
+string getMySQLTlsServerVariable(string variable) {
MYSQL_RES* result(0);
try {
+ DatabaseConnection::ParameterMap parameters =
+ DatabaseConnection::parse(validMySQLConnectionString());
+ MySqlConnection conn(parameters);
conn.openDatabase();
- string sql("SHOW GLOBAL VARIABLES LIKE 'have_ssl'");
+ string sql("SHOW GLOBAL VARIABLES LIKE '");
+ sql += variable;
+ sql += "'";
if (mysql_query(conn.mysql_, sql.c_str())) {
isc_throw(DbOperationError,
sql << ": " << mysql_error(conn.mysql_));
}
// first column is 'have_ssl', second is the status.
string name(row[0]);
- if (name != "have_ssl") {
+ if (name != variable) {
isc_throw(DbOperationError,
sql << " returned a wrong name '" << name
- << "', expected 'have_ssl'");
+ << "', expected " << variable);
}
string value(row[1]);
- const string env("KEA_MYSQL_HAVE_SSL");
- static_cast<void>(setenv(env.c_str(), value.c_str(), 1));
mysql_free_result(result);
return (value);
} catch (...) {
}
}
+bool isMySQLTlsConfigured() {
+ if (getMySQLTlsServerVariable("ssl_ca").find("kea-ca.crt") == string::npos) {
+ return (false);
+ }
+ if (getMySQLTlsServerVariable("ssl_cert").find("kea-server.crt") == string::npos) {
+ return (false);
+ }
+ if (getMySQLTlsServerVariable("ssl_key").find("kea-server.key") == string::npos) {
+ return (false);
+ }
+ return (true);
+}
+
+string getMySQLTlsServer() {
+ string value = getMySQLTlsServerVariable("have_ssl");
+ if (value == "YES" && !isMySQLTlsConfigured()) {
+ value = "UNCONFIGURED";
+ }
+ const string env("KEA_MYSQL_HAVE_SSL");
+ static_cast<void>(setenv(env.c_str(), value.c_str(), 1));
+ return (value);
+}
+
} // namespace test
} // namespace db
} // namespace isc
/// @note the returned value is set in the environment
std::string getMySQLTlsServer();
+/// @brief Return true if the server has been configured with proper SSL/TLS
+/// credentials, false otherwise
+bool isMySQLTlsConfigured();
+
+/// @brief Get the server global variable value
+///
+/// @param variable The server global variable name
+std::string getMySQLTlsServerVariable(std::string variable);
+
}
}
}