Improve confparse logging and add missing brackets

This commit is contained in:
2019-01-08 20:56:38 +02:00
parent 3f1a49704f
commit 1c7b7335e6

View File

@@ -289,6 +289,7 @@ static int test_conf_syntax(char *config)
sizeof(conf.db.port) - 1);
} else {
ok = 0;
log(ERROR, "Invalid db.type: %s", tmp + 1);
failed = 1;
}
} else if (!strcmp(buf, "db.hostname"))
@@ -308,6 +309,7 @@ static int test_conf_syntax(char *config)
}
}
}
log(ERROR, "Invalid db.port value: %s", tmp + 1);
ok = 0;
failed = 1;
} else if (!strcmp(buf, "db.pass"))
@@ -329,6 +331,7 @@ static int test_conf_syntax(char *config)
}
}
}
log(ERROR, "Invalid rmps.agent_port value: %s", tmp + 1);
ok = 0;
failed = 1;
} else if (!strcmp(buf, "rmps.client_ip")) {
@@ -347,6 +350,7 @@ static int test_conf_syntax(char *config)
}
}
}
log(ERROR, "Invalid rmps.client_port value: %s", tmp + 1);
ok = 0;
failed = 1;
} else if (!strcmp(buf, "rmps.logfile")) {
@@ -368,8 +372,10 @@ static int test_conf_syntax(char *config)
if (strlen(tmp + 1) == 1 &&
(tmp[1] > '0' && tmp[1] < '5'))
conf.rmps.loglevel = tmp[1] - '0';
else
else {
log(ERROR, "Invalid loglevel: %s", tmp + 1);
failed = 1;
}
} else if (!strcmp(buf, "rmps.agent_tls_crt")) {
if (access(tmp + 1, F_OK) == -1) {
log(ERROR, "%s is missing", tmp + 1);
@@ -427,10 +433,11 @@ static int test_conf_syntax(char *config)
strncpy(conf.rmps.client_tls_key,
tmp + 1,
sizeof(conf.rmps.client_tls_key) - 1);
} else
} else {
log(ERROR, "Unknown config entry on line %d: %s",
j, buf);
failed = 1;
failed = 1;
}
if (!ok) {
log(ERROR,
"Invalid value for \"%s\", line %d: \"%s\"",