From 3c2ee8c5f5ad708252b34ab17adef68b83f14f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Sun, 22 Apr 2018 21:03:45 +0200 Subject: [PATCH] Disallow connect string to start with '/' One can easily use -c to specify the config file by mistake. -c is connect-string. -f is config file. Confusing these is bad enough, but ndb_mgmd often accepts a bogus value for the -c option (e.g -c /etc/ndb/config.ini) --- storage/ndb/src/mgmsrv/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/storage/ndb/src/mgmsrv/main.cpp b/storage/ndb/src/mgmsrv/main.cpp index 2722359b48b..2d0d6c4e182 100644 --- a/storage/ndb/src/mgmsrv/main.cpp +++ b/storage/ndb/src/mgmsrv/main.cpp @@ -227,6 +227,15 @@ static int mgmd_main(int argc, char** argv) mgmd_exit(1); } + if (opt_ndb_connectstring) + { + if (strncmp(opt_ndb_connectstring, "/", 1) == 0) + { + fprintf(stderr, "ERROR: ndb-connect-string starts with '/', use -f to specify config file instead of -c\n"); + mgmd_exit(1); + } + } + if (opt_nowait_nodes) { int res = parse_mask(opt_nowait_nodes, opts.nowait_nodes);