]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pdbtest: don't ignore unknown options
authorRalph Boehme <slow@samba.org>
Fri, 10 Sep 2021 05:03:21 +0000 (07:03 +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/torture/pdbtest.c

index 1a95a3c8646f0875f46db7f95ee2d0e667fe5649..146320ff45350544e4728e085c1cceedadedaa47 100644 (file)
@@ -554,6 +554,7 @@ int main(int argc, const char **argv)
        struct samu *in = NULL;
        NTSTATUS rv;
        int i;
+       int opt;
        struct timeval tv;
        bool error = False;
        struct passwd *pwd;
@@ -593,7 +594,15 @@ int main(int argc, const char **argv)
 
        poptSetOtherOptionHelp(pc, "backend[:settings] username");
 
-       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);
+               }
+       }
 
        poptFreeContext(pc);