MXS-662: Service protocol check no longer ignores bind

The address of a listener was ignored when service protocols were compared.
This commit is contained in:
Markus Makela
2016-04-14 19:04:54 +03:00
parent 25f4238231
commit 1fc27b39af
4 changed files with 10 additions and 7 deletions

View File

@ -708,8 +708,8 @@ serviceAddProtocol(SERVICE *service, char *protocol, char *address, unsigned sho
* @param port The port to listen on
* @return TRUE if the protocol/port is already part of the service
*/
int
serviceHasProtocol(SERVICE *service, char *protocol, unsigned short port)
int serviceHasProtocol(SERVICE *service, const char *protocol,
const char* address, unsigned short port)
{
SERV_LISTENER *proto;
@ -717,7 +717,9 @@ serviceHasProtocol(SERVICE *service, char *protocol, unsigned short port)
proto = service->ports;
while (proto)
{
if (strcmp(proto->protocol, protocol) == 0 && proto->port == port)
if (strcmp(proto->protocol, protocol) == 0 && proto->port == port &&
((address && proto->address && strcmp(proto->address, address) == 0) ||
(address == NULL && proto->address == NULL)))
{
break;
}