]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
testparm: don't ignore unknown options
authorRalph Boehme <slow@samba.org>
Fri, 10 Sep 2021 05:15:49 +0000 (07:15 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 10 Sep 2021 15:10:30 +0000 (15:10 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14828

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/utils/testparm.c

index 59ca8b700f3cbb60a0e237baafbb9a3eec5aeadb..98bcc219b1e8bfb24ed14f9f6c5b7596ff6fac59 100644 (file)
@@ -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...] <config-file> [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();