修改资源池化工具pagehack,pg_xlogdump,pg_controldata,pg_resetxlog针对socketpath合法值校验

This commit is contained in:
chendong76
2023-05-23 14:46:23 +08:00
parent a6e8f45825
commit 0155d94731
4 changed files with 13 additions and 8 deletions

View File

@ -5750,8 +5750,9 @@ int main(int argc, char** argv)
exit(1);
}
if (enable_dss && socketpath == NULL) {
fprintf(stderr, "Socketpath cannot be NULL when enable dss.\n");
if (enable_dss && (socketpath == NULL || strlen(socketpath) == 0 || strncmp("UDS:", socketpath, 4) != 0)) {
fprintf(stderr, "Socketpath must be specific correctly when enable dss, "
"format is: '-c UDS:xxx'.\n");
exit(1);
}

View File

@ -1012,8 +1012,10 @@ int main(int argc, char** argv)
}
if (dumpprivate.enable_dss) {
if (dumpprivate.socketpath == NULL) {
fprintf(stderr, "%s: socketpath cannot be NULL when enable dss\n", progname);
if (dumpprivate.socketpath == NULL || strlen(dumpprivate.socketpath) == 0 ||
strncmp("UDS:", dumpprivate.socketpath, 4) != 0) {
fprintf(stderr, "%s: socketpath must be specific correctly when enable dss, "
"format is: '--socketpath=\"UDS:xxx\"'.\n", progname);
goto bad_argument;
}

View File

@ -327,8 +327,9 @@ int main(int argc, char* argv[])
check_env_value_c(DataDir);
if (enable_dss) {
if (socketpath == NULL) {
fprintf(stderr, _("%s: socketpath cannot be NULL when enable dss\n"), progname);
if (socketpath == NULL || strlen(socketpath) == 0 || strncmp("UDS:", socketpath, 4) != 0) {
fprintf(stderr, _("%s: socketpath must be specific correctly when enable dss, "
"format is: '--socketpath=\"UDS:xxx\"'.\n"), progname);
exit_safely(1);
}

View File

@ -276,8 +276,9 @@ int main(int argc, char* argv[])
}
if (dss.enable_dss) {
if (dss.socketpath == NULL) {
fprintf(stderr, _("%s: socketpath cannot be NULL when enable dss\n"), progname);
if (dss.socketpath == NULL || strlen(dss.socketpath) == 0 || strncmp("UDS:", dss.socketpath, 4) != 0) {
fprintf(stderr, _("%s: socketpath must be specific correctly when enable dss, "
"format is: '--socketpath=\"UDS:xxx\"'.\n"), progname);
exit(1);
}
if (dss.vgname == NULL) {