|
@@ -88,28 +88,28 @@ RadiusHostDataSource(const DatabaseConnection::ParameterMap& parameters) {
|
|
|
int res;
|
|
|
rh = rc_new();
|
|
|
if (rh == NULL) {
|
|
|
- isc_throw(isc::Exception, "Failed to initialize Radius client");
|
|
|
+ isc_throw(DbOpenError, "Failed to initialize Radius client");
|
|
|
}
|
|
|
rh = rc_config_init(rh);
|
|
|
if (rh == NULL) {
|
|
|
- isc_throw(isc::Exception, "Failed to initialize Radius client");
|
|
|
+ isc_throw(DbOpenError, "Failed to initialize Radius client");
|
|
|
}
|
|
|
res = rc_add_config(rh, "auth_order", "radius", NULL, 0);
|
|
|
if (res != 0) {
|
|
|
- isc_throw(isc::Exception, "Failed to configure Radius auth_order");
|
|
|
+ isc_throw(DbOpenError, "Failed to configure Radius auth_order");
|
|
|
}
|
|
|
/* TODO: just define manually the few attributes we need */
|
|
|
res = rc_add_config(rh, "dictionary", "/usr/share/radcli/dictionary", NULL, 0);
|
|
|
if (res != 0) {
|
|
|
- isc_throw(isc::Exception, "Failed to configure Radius dictionary");
|
|
|
+ isc_throw(DbOpenError, "Failed to configure Radius dictionary");
|
|
|
}
|
|
|
res = rc_add_config(rh, "radius_timeout", "1", NULL, 0);
|
|
|
if (res != 0) {
|
|
|
- isc_throw(isc::Exception, "Failed to configure Radius timeout");
|
|
|
+ isc_throw(DbOpenError, "Failed to configure Radius timeout");
|
|
|
}
|
|
|
res = rc_add_config(rh, "radius_retries", "1", NULL, 0);
|
|
|
if (res != 0) {
|
|
|
- isc_throw(isc::Exception, "Failed to configure Radius retries");
|
|
|
+ isc_throw(DbOpenError, "Failed to configure Radius retries");
|
|
|
}
|
|
|
|
|
|
const char* host = "localhost";
|
|
@@ -155,25 +155,25 @@ RadiusHostDataSource(const DatabaseConnection::ParameterMap& parameters) {
|
|
|
password = spassword.c_str();
|
|
|
} catch (...) {
|
|
|
// No secret. Throw an exception
|
|
|
- isc_throw(isc::Exception, "must specify a secret (password) for Radius connection");
|
|
|
+ isc_throw(NoPassword, "must specify a secret (password) for Radius connection");
|
|
|
}
|
|
|
|
|
|
char authserver[512];
|
|
|
snprintf(authserver, sizeof(authserver), "%s:%u:%s", host, port, password);
|
|
|
res = rc_add_config(rh, "authserver", authserver, NULL, 0);
|
|
|
if (res != 0) {
|
|
|
- isc_throw(isc::Exception, "Failed to configure Radius authserver");
|
|
|
+ isc_throw(DbOpenError, "Failed to configure Radius authserver");
|
|
|
}
|
|
|
// Test and apply config (this also setups the necessary structures to
|
|
|
// send requests to the radius server)
|
|
|
res = rc_test_config(rh, "kea");
|
|
|
if (res != 0) {
|
|
|
- isc_throw(isc::Exception, "Failed to apply radcli configuration");
|
|
|
+ isc_throw(DbOpenError, "Failed to apply radcli configuration");
|
|
|
}
|
|
|
// Load dictionary
|
|
|
res = rc_read_dictionary(rh, rc_conf_str(rh, "dictionary"));
|
|
|
if (res != 0) {
|
|
|
- isc_throw(isc::Exception, "Failed to read Radius dictionary");
|
|
|
+ isc_throw(DbOpenError, "Failed to read Radius dictionary");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -254,7 +254,7 @@ RadiusHostDataSource::getAll(const Host::IdentifierType& identifier_type,
|
|
|
const char* identifier_hex = tmp2.c_str();
|
|
|
// Build radius request
|
|
|
if (rc_avpair_add(rh, &send, PW_USER_NAME, identifier_hex, -1, 0) == NULL)
|
|
|
- isc_throw(isc::Exception, "Failed to set username");
|
|
|
+ isc_throw(DbOperationError, "Failed to set username");
|
|
|
|
|
|
res = rc_auth(rh, 0, send, &received, NULL);
|
|
|
if (res == OK_RC) {
|