Improve confparse logging and add missing brackets
This commit is contained in:
@@ -289,6 +289,7 @@ static int test_conf_syntax(char *config)
|
|||||||
sizeof(conf.db.port) - 1);
|
sizeof(conf.db.port) - 1);
|
||||||
} else {
|
} else {
|
||||||
ok = 0;
|
ok = 0;
|
||||||
|
log(ERROR, "Invalid db.type: %s", tmp + 1);
|
||||||
failed = 1;
|
failed = 1;
|
||||||
}
|
}
|
||||||
} else if (!strcmp(buf, "db.hostname"))
|
} 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;
|
ok = 0;
|
||||||
failed = 1;
|
failed = 1;
|
||||||
} else if (!strcmp(buf, "db.pass"))
|
} 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;
|
ok = 0;
|
||||||
failed = 1;
|
failed = 1;
|
||||||
} else if (!strcmp(buf, "rmps.client_ip")) {
|
} 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;
|
ok = 0;
|
||||||
failed = 1;
|
failed = 1;
|
||||||
} else if (!strcmp(buf, "rmps.logfile")) {
|
} else if (!strcmp(buf, "rmps.logfile")) {
|
||||||
@@ -368,8 +372,10 @@ static int test_conf_syntax(char *config)
|
|||||||
if (strlen(tmp + 1) == 1 &&
|
if (strlen(tmp + 1) == 1 &&
|
||||||
(tmp[1] > '0' && tmp[1] < '5'))
|
(tmp[1] > '0' && tmp[1] < '5'))
|
||||||
conf.rmps.loglevel = tmp[1] - '0';
|
conf.rmps.loglevel = tmp[1] - '0';
|
||||||
else
|
else {
|
||||||
|
log(ERROR, "Invalid loglevel: %s", tmp + 1);
|
||||||
failed = 1;
|
failed = 1;
|
||||||
|
}
|
||||||
} else if (!strcmp(buf, "rmps.agent_tls_crt")) {
|
} else if (!strcmp(buf, "rmps.agent_tls_crt")) {
|
||||||
if (access(tmp + 1, F_OK) == -1) {
|
if (access(tmp + 1, F_OK) == -1) {
|
||||||
log(ERROR, "%s is missing", tmp + 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,
|
strncpy(conf.rmps.client_tls_key,
|
||||||
tmp + 1,
|
tmp + 1,
|
||||||
sizeof(conf.rmps.client_tls_key) - 1);
|
sizeof(conf.rmps.client_tls_key) - 1);
|
||||||
} else
|
} else {
|
||||||
log(ERROR, "Unknown config entry on line %d: %s",
|
log(ERROR, "Unknown config entry on line %d: %s",
|
||||||
j, buf);
|
j, buf);
|
||||||
failed = 1;
|
failed = 1;
|
||||||
|
}
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
log(ERROR,
|
log(ERROR,
|
||||||
"Invalid value for \"%s\", line %d: \"%s\"",
|
"Invalid value for \"%s\", line %d: \"%s\"",
|
||||||
|
|||||||
Reference in New Issue
Block a user