summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2010-06-21 11:09:45 -0700
committerJames Peach <jpeach@samba.org>2010-06-21 11:09:45 -0700
commit6227eac607131ed1042af1de83af7f70d0b05375 (patch)
tree93d844743d7af52ab614735b03c3f5dedc35b159
parent0fc18ead76a79286365646eeb7607b39b01a1c9f (diff)
downloadsamba-6227eac607131ed1042af1de83af7f70d0b05375.tar.gz
samba-6227eac607131ed1042af1de83af7f70d0b05375.tar.bz2
samba-6227eac607131ed1042af1de83af7f70d0b05375.zip
smbtorture: Fixx off-by-one command line parsing.
If we are not in shell mode we require both the target and test name arguments. Make sure we process these from the correct index.
-rw-r--r--source4/torture/smbtorture.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index f0da3f0e9e..14eeff93ab 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -639,29 +639,29 @@ int main(int argc,char *argv[])
gensec_init(cmdline_lp_ctx);
- // At this point, we should just have a target string,
- // followed by a series of test names. Unless we are in
- // shell mode, in which case we don't need anythig more.
+ if (shell) {
+ /* In shell mode, just ignore any remaining test names. */
+ torture_shell(torture);
+ } else {
- if (argc_new > 1) {
- // Take the target name or binding.
- if (!torture_parse_target(cmdline_lp_ctx, argv_new[1])) {
+ /* At this point, we should just have a target string,
+ * followed by a series of test names. Unless we are in
+ * shell mode, in which case we don't need anythig more.
+ */
+
+ if (argc_new < 3) {
+ printf("You must specify a test to run, or 'ALL'\n");
usage(pc);
exit(1);
}
- argc_new--;
- }
+ /* Take the target name or binding. */
+ if (!torture_parse_target(cmdline_lp_ctx, argv_new[1])) {
+ usage(pc);
+ exit(1);
+ }
- if (shell) {
- // In shell mode, just ignore any remaining test names.
- torture_shell(torture);
- } else if (argc_new == 1) {
- printf("You must specify a test to run, or 'ALL'\n");
- usage(pc);
- exit(1);
- } else {
- for (i=1;i<argc_new;i++) {
+ for (i=2;i<argc_new;i++) {
if (!torture_run_named_tests(torture, argv_new[i],
(const char **)restricted)) {
correct = false;