In server_update check if new user or pwd are NULL and decline to update used values if they are.

This commit is contained in:
vraatikka
2013-08-02 10:38:16 +03:00
parent ce8ce5b8fd
commit 9305cf0f9f

View File

@ -302,19 +302,27 @@ server_update(SERVER *server, char *protocol, char *user, char *passwd)
{ {
if (!strcmp(server->protocol, protocol)) if (!strcmp(server->protocol, protocol))
{ {
skygw_log_write(NULL, LOGFILE_MESSAGE, "Update server protocol for server %s to protocol %s", skygw_log_write(NULL,
server->name, protocol); LOGFILE_MESSAGE,
"Update server protocol for server %s to protocol %s",
server->name,
protocol);
free(server->protocol); free(server->protocol);
server->protocol = strdup(protocol); server->protocol = strdup(protocol);
} }
if (strcmp(server->monuser, user) == 0 || strcmp(server->monpw, passwd) == 0) if (user != NULL && passwd != NULL) {
{ if (strcmp(server->monuser, user) == 0 ||
skygw_log_write(NULL, LOGFILE_MESSAGE, "Update server monitor credentials for server %s", strcmp(server->monpw, passwd) == 0)
{
skygw_log_write(NULL,
LOGFILE_MESSAGE,
"Update server monitor credentials for server %s",
server->name); server->name);
free(server->monuser); free(server->monuser);
free(server->monpw); free(server->monpw);
serverAddMonUser(server, user, passwd); serverAddMonUser(server, user, passwd);
}
} }
} }