From: Ralph Boehme Date: Fri, 10 Sep 2021 05:15:49 +0000 (+0200) Subject: testparm: don't ignore unknown options X-Git-Tag: ldb-2.5.0~700 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac292ec428ea8ef6702e028c15077818000dfa87;p=thirdparty%2Fsamba.git testparm: don't ignore unknown options BUG: https://bugzilla.samba.org/show_bug.cgi?id=14828 Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher --- diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index 59ca8b700f3..98bcc219b1e 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -672,6 +672,7 @@ static void do_per_share_checks(int s) const char *config_file = NULL; const struct loadparm_substitution *lp_sub = loadparm_s3_global_substitution(); + int opt; int s; static int silent_mode = False; static int show_all_parameters = False; @@ -776,7 +777,15 @@ static void do_per_share_checks(int s) poptSetOtherOptionHelp(pc, "[OPTION...] [host-name] [host-ip]"); - while(poptGetNextOpt(pc) != -1); + while ((opt = poptGetNextOpt(pc)) != -1) { + switch (opt) { + case POPT_ERROR_BADOPT: + fprintf(stderr, "\nInvalid option %s: %s\n\n", + poptBadOption(pc, 0), poptStrerror(opt)); + poptPrintUsage(pc, stderr, 0); + exit(1); + } + } if (show_all_parameters) { show_parameter_list();