MXS-2197: Make SERV_LISTENER a C++ class

The class is still mostly the same as the old C version but it now uses
std::string instead of char pointers. Changed configuration default values
so that the parameters passed to the listener allocation are always valid.
This commit is contained in:
Markus Mäkelä
2018-11-28 14:22:12 +02:00
parent 77585bdb8c
commit 01e9f71af1
15 changed files with 353 additions and 367 deletions

View File

@ -556,8 +556,6 @@ int cdc_replace_users(SERV_LISTENER* listener)
int i = cdc_read_users(newusers, path);
USERS* oldusers = NULL;
pthread_mutex_lock(&listener->lock);
if (i > 0)
{
/** Successfully loaded at least one user */
@ -578,8 +576,6 @@ int cdc_replace_users(SERV_LISTENER* listener)
cdc_set_service_user(listener);
pthread_mutex_unlock(&listener->lock);
if (oldusers)
{
users_free(oldusers);

View File

@ -635,8 +635,8 @@ static int mysql_auth_load_users(SERV_LISTENER* port)
{
MXS_ERROR("[%s] Unable to load users for listener %s listening at [%s]:%d.",
service->name,
port->name,
port->address ? port->address : "::",
port->name.c_str(),
!port->address.empty() ? port->address.c_str() : "::",
port->port);
}
@ -673,7 +673,7 @@ static int mysql_auth_load_users(SERV_LISTENER* port)
}
else if (loaded > 0 && first_load)
{
MXS_NOTICE("[%s] Loaded %d MySQL users for listener %s.", service->name, loaded, port->name);
MXS_NOTICE("[%s] Loaded %d MySQL users for listener %s.", service->name, loaded, port->name.c_str());
}
return rc;

View File

@ -206,7 +206,7 @@ static int httpd_read_event(DCB* dcb)
/** If listener->authenticator is the default authenticator, it means that
* we don't need to check the user credentials. All other authenticators
* cause a 401 Unauthorized to be returned on the first try. */
bool auth_ok = strcmp(httpd_default_auth(), dcb->listener->authenticator) == 0;
bool auth_ok = httpd_default_auth() == dcb->listener->authenticator;
/**
* Get the request headers