diff options
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/config.mk | 3 | ||||
-rw-r--r-- | source4/torture/gentest.c | 173 | ||||
-rw-r--r-- | source4/torture/locktest.c | 181 | ||||
-rw-r--r-- | source4/torture/masktest.c | 157 |
4 files changed, 228 insertions, 286 deletions
diff --git a/source4/torture/config.mk b/source4/torture/config.mk index bcb3233ce4..5a3e3d0658 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -360,6 +360,9 @@ INSTALLDIR = BINDIR OBJ_FILES = \ locktest.o PRIVATE_DEPENDENCIES = \ + LIBPOPT \ + POPT_SAMBA \ + POPT_CREDENTIALS \ LIBSAMBA-UTIL \ LIBCLI_SMB \ LIBSAMBA-CONFIG diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index d50393baf0..d5fc855f17 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "lib/cmdline/popt_common.h" #include "system/time.h" #include "system/filesys.h" #include "libcli/raw/request.h" @@ -1755,6 +1756,7 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info) info->end_of_file_info.in.size = gen_offset(); break; case RAW_SFILEINFO_RENAME_INFORMATION: + case RAW_SFILEINFO_RENAME_INFORMATION_SMB2: info->rename_information.in.overwrite = gen_bool(); info->rename_information.in.root_fid = gen_root_fid(instance); info->rename_information.in.new_name = gen_fname_open(instance); @@ -2129,25 +2131,13 @@ static bool start_gentest(struct loadparm_context *lp_ctx) } -static void usage(void) +static void usage(poptContext pc) { printf( "Usage:\n\ - gentest2 //server1/share1 //server2/share2 [options..]\n\ - options:\n\ - -U user%%pass (can be specified twice)\n\ - -s seed\n\ - -o numops\n\ - -a (show all ops)\n\ - -A backtrack to find minimal ops\n\ - -i FILE add a list of wildcard exclusions\n\ - -O enable oplocks\n\ - -S FILE set preset seeds file\n\ - -L use preset seeds\n\ - -F fast reconnect (just close files)\n\ - -C continuous analysis mode\n\ - -X analyse even when test OK\n\ + gentest //server1/share1 //server2/share2 [options..]\n\ "); + poptPrintUsage(pc, stdout, 0); } /** @@ -2180,105 +2170,106 @@ static bool split_unc_name(const char *unc, char **server, char **share) int opt; int i, username_count=0; bool ret; + char *ignore_file=NULL; struct loadparm_context *lp_ctx; + poptContext pc; + int argc_new; + char **argv_new; + enum {OPT_UNCLIST=1000}; + struct poptOption long_options[] = { + POPT_AUTOHELP + {"seed", 0, POPT_ARG_INT, &options.seed, 0, "Seed to use for randomizer", NULL}, + {"num-ops", 0, POPT_ARG_INT, &options.numops, 0, "num ops", NULL}, + {"oplocks", 0, POPT_ARG_NONE, &options.use_oplocks,0, "use oplocks", NULL}, + {"showall", 0, POPT_ARG_NONE, &options.showall, 0, "display all operations", NULL}, + {"analyse", 0, POPT_ARG_NONE, &options.analyze, 0, "do backtrack analysis", NULL}, + {"analysealways", 0, POPT_ARG_NONE, &options.analyze_always, 0, "analysis always", NULL}, + {"analysecontinuous", 0, POPT_ARG_NONE, &options.analyze_continuous, 0, "analysis continuous", NULL}, + {"ignore", 0, POPT_ARG_STRING, &ignore_file, 0, "ignore from file", NULL}, + {"preset", 0, POPT_ARG_NONE, &options.use_preset_seeds, 0, "use preset seeds", NULL}, + {"fast", 0, POPT_ARG_NONE, &options.fast_reconnect, 0, "use fast reconnect", NULL}, + {"unclist", 0, POPT_ARG_STRING, NULL, OPT_UNCLIST, "unclist", NULL}, + {"seedsfile", 0, POPT_ARG_STRING, &options.seeds_file, 0, "seed file", NULL}, + { "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "[DOMAIN/]USERNAME[%PASSWORD]" }, + POPT_COMMON_SAMBA + POPT_COMMON_CONNECTION + POPT_COMMON_CREDENTIALS + POPT_COMMON_VERSION + { NULL } + }; setlinebuf(stdout); + options.seed = time(NULL); + options.numops = 1000; + options.max_open_handles = 20; + options.seeds_file = "gentest_seeds.dat"; - setup_logging("gentest", DEBUG_STDOUT); - - if (argc < 3 || argv[1][0] == '-') { - usage(); - exit(1); - } - - setup_logging(argv[0], DEBUG_STDOUT); - - for (i=0;i<NSERVERS;i++) { - const char *share = argv[1+i]; - servers[i].credentials = cli_credentials_init(NULL); - if (!split_unc_name(share, &servers[i].server_name, &servers[i].share_name)) { - printf("Invalid share name '%s'\n", share); - return -1; - } - } - - argc -= NSERVERS; - argv += NSERVERS; + pc = poptGetContext("gentest", argc, (const char **) argv, long_options, + POPT_CONTEXT_KEEP_FIRST); - lp_ctx = loadparm_init(talloc_autofree_context()); - lp_load(lp_ctx, dyn_CONFIGFILE); + poptSetOtherOptionHelp(pc, "<unc1> <unc2>"); + lp_ctx = cmdline_lp_ctx; servers[0].credentials = cli_credentials_init(talloc_autofree_context()); servers[1].credentials = cli_credentials_init(talloc_autofree_context()); cli_credentials_guess(servers[0].credentials, lp_ctx); cli_credentials_guess(servers[1].credentials, lp_ctx); - options.seed = time(NULL); - options.numops = 1000; - options.max_open_handles = 20; - options.seeds_file = "gentest_seeds.dat"; - - while ((opt = getopt(argc, argv, "U:s:o:ad:i:AOhS:LFXC")) != EOF) { + while((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { + case OPT_UNCLIST: + lp_set_cmdline(cmdline_lp_ctx, "torture:unclist", poptGetOptArg(pc)); + break; case 'U': if (username_count == 2) { - usage(); + usage(pc); exit(1); } - cli_credentials_parse_string(servers[username_count].credentials, - optarg, CRED_SPECIFIED); + cli_credentials_parse_string(servers[username_count].credentials, poptGetOptArg(pc), CRED_SPECIFIED); username_count++; break; - case 'd': - DEBUGLEVEL = atoi(optarg); - setup_logging(NULL, DEBUG_STDOUT); - break; - case 's': - options.seed = atoi(optarg); - break; - case 'S': - options.seeds_file = optarg; - break; - case 'L': - options.use_preset_seeds = true; - break; - case 'F': - options.fast_reconnect = true; - break; - case 'o': - options.numops = atoi(optarg); - break; - case 'O': - options.use_oplocks = true; - break; - case 'a': - options.showall = true; - break; - case 'A': - options.analyze = true; - break; - case 'X': - options.analyze_always = true; - break; - case 'C': - options.analyze_continuous = true; - break; - case 'i': - options.ignore_patterns = file_lines_load(optarg, NULL, NULL); + } + } + + if (ignore_file) { + options.ignore_patterns = file_lines_load(ignore_file, NULL, NULL); + } + + argv_new = discard_const_p(char *, poptGetArgs(pc)); + argc_new = argc; + for (i=0; i<argc; i++) { + if (argv_new[i] == NULL) { + argc_new = i; break; - case 'h': - usage(); - exit(1); - default: - printf("Unknown option %c (%d)\n", (char)opt, opt); - exit(1); } } - gensec_init(lp_ctx); + if (!(argc_new >= 3)) { + usage(pc); + exit(1); + } + + setlinebuf(stdout); + + setup_logging("gentest", DEBUG_STDOUT); + + if (argc < 3 || argv[1][0] == '-') { + usage(pc); + exit(1); + } + + setup_logging(argv[0], DEBUG_STDOUT); + + for (i=0;i<NSERVERS;i++) { + const char *share = argv[1+i]; + if (!split_unc_name(share, &servers[i].server_name, &servers[i].share_name)) { + printf("Invalid share name '%s'\n", share); + return -1; + } + } if (username_count == 0) { - usage(); + usage(pc); return -1; } if (username_count == 1) { @@ -2287,6 +2278,8 @@ static bool split_unc_name(const char *unc, char **server, char **share) printf("seed=%u\n", options.seed); + gensec_init(lp_ctx); + ret = start_gentest(lp_ctx); if (ret) { diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 90e2eec2be..618568acf9 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "lib/cmdline/popt_common.h" #include "system/filesys.h" #include "system/time.h" #include "pstring.h" @@ -29,15 +30,15 @@ #include "libcli/resolve/resolve.h" static int numops = 1000; -static bool showall; -static bool analyze; -static bool hide_unlock_fails; -static bool use_oplocks; +static int showall; +static int analyze; +static int hide_unlock_fails; +static int use_oplocks; static uint_t lock_range = 100; static uint_t lock_base = 0; static uint_t min_length = 0; -static bool exact_error_codes; -static bool zero_zero; +static int exact_error_codes; +static int zero_zero; #define FILENAME "\\locktest.dat" @@ -395,7 +396,7 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], we then do random locking ops in tamdem on the 4 fnums from each server and ensure that the results match */ -static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) +static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) { struct smbcli_state *cli[NSERVERS][NCONNECTIONS]; int fnum[NSERVERS][NCONNECTIONS][NFILES]; @@ -450,7 +451,12 @@ static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) open_files(cli, fnum); n = retest(cli, fnum, numops); - if (n == numops || !analyze) return; + if (n == numops || !analyze) { + if (n != numops) { + return 1; + } + return 0; + } n++; skip = n/2; @@ -516,30 +522,16 @@ static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) (double)recorded[i].len, recorded[i].needed); } + + return 1; } -static void usage(void) +static void usage(poptContext pc) { - printf( -"Usage:\n\ - locktest //server1/share1 //server2/share2 [options..]\n\ - options:\n\ - -U user%%pass (may be specified twice)\n\ - -s seed\n\ - -o numops\n\ - -u hide unlock fails\n\ - -a (show all ops)\n\ - -A analyse for minimal ops\n\ - -O use oplocks\n\ - -E enable exact error code checking\n\ - -Z enable the zero/zero lock\n\ - -R range set lock range\n\ - -B base set lock base\n\ - -M min set min lock length\n\ - -l filename unclist file\n\ -"); + printf("Usage:\n\tlocktest //server1/share1 //server2/share2 [options..]\n"); + poptPrintUsage(pc, stdout, 0); } /**************************************************************************** @@ -552,97 +544,87 @@ static void usage(void) int seed, server; int username_count=0; struct loadparm_context *lp_ctx; + poptContext pc; + int argc_new, i; + char **argv_new; + enum {OPT_UNCLIST=1000}; + struct poptOption long_options[] = { + POPT_AUTOHELP + {"seed", 0, POPT_ARG_INT, &seed, 0, "Seed to use for randomizer", NULL}, + {"num-ops", 0, POPT_ARG_INT, &numops, 0, "num ops", NULL}, + {"lockrange", 0, POPT_ARG_INT, &lock_range,0, "locking range", NULL}, + {"lockbase", 0, POPT_ARG_INT, &lock_base, 0, "locking base", NULL}, + {"minlength", 0, POPT_ARG_INT, &min_length,0, "min lock length", NULL}, + {"hidefails", 0, POPT_ARG_NONE, &hide_unlock_fails,0,"hide unlock fails", NULL}, + {"oplocks", 0, POPT_ARG_NONE, &use_oplocks,0, "use oplocks", NULL}, + {"showall", 0, POPT_ARG_NONE, &showall, 0, "display all operations", NULL}, + {"analyse", 0, POPT_ARG_NONE, &analyze, 0, "do backtrack analysis", NULL}, + {"zerozero", 0, POPT_ARG_NONE, &zero_zero, 0, "do zero/zero lock", NULL}, + {"exacterrors", 0, POPT_ARG_NONE, &exact_error_codes,0,"use exact error codes", NULL}, + {"unclist", 0, POPT_ARG_STRING, NULL, OPT_UNCLIST, "unclist", NULL}, + { "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "[DOMAIN/]USERNAME[%PASSWORD]" }, + POPT_COMMON_SAMBA + POPT_COMMON_CONNECTION + POPT_COMMON_CREDENTIALS + POPT_COMMON_VERSION + { NULL } + }; setlinebuf(stdout); + seed = time(NULL); - setup_logging("locktest", DEBUG_STDOUT); - - if (argc < 3 || argv[1][0] == '-') { - usage(); - exit(1); - } - - setup_logging(argv[0], DEBUG_STDOUT); - - for (server=0;server<NSERVERS;server++) { - share[server] = argv[1+server]; - all_string_sub(share[server],"/","\\",0); - } - - argc -= NSERVERS; - argv += NSERVERS; + pc = poptGetContext("locktest", argc, (const char **) argv, long_options, + POPT_CONTEXT_KEEP_FIRST); - lp_ctx = loadparm_init(talloc_autofree_context()); - lp_load(lp_ctx, dyn_CONFIGFILE); + poptSetOtherOptionHelp(pc, "<unc1> <unc2>"); + lp_ctx = cmdline_lp_ctx; servers[0] = cli_credentials_init(talloc_autofree_context()); servers[1] = cli_credentials_init(talloc_autofree_context()); cli_credentials_guess(servers[0], lp_ctx); cli_credentials_guess(servers[1], lp_ctx); - seed = time(NULL); - - while ((opt = getopt(argc, argv, "U:s:ho:aAW:OR:B:M:EZW:l:")) != EOF) { + while((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { + case OPT_UNCLIST: + lp_set_cmdline(cmdline_lp_ctx, "torture:unclist", poptGetOptArg(pc)); + break; case 'U': if (username_count == 2) { - usage(); + usage(pc); exit(1); } - cli_credentials_parse_string(servers[username_count], - optarg, CRED_SPECIFIED); + cli_credentials_parse_string(servers[username_count], poptGetOptArg(pc), CRED_SPECIFIED); username_count++; break; - case 'R': - lock_range = strtol(optarg, NULL, 0); - break; - case 'B': - lock_base = strtol(optarg, NULL, 0); - break; - case 'M': - min_length = strtol(optarg, NULL, 0); - break; - case 's': - seed = atoi(optarg); - break; - case 'u': - hide_unlock_fails = true; - break; - case 'o': - numops = atoi(optarg); - break; - case 'O': - use_oplocks = true; - break; - case 'a': - showall = true; - break; - case 'A': - analyze = true; - break; - case 'Z': - zero_zero = true; - break; - case 'E': - exact_error_codes = true; - break; - case 'l': - lp_set_cmdline(lp_ctx, "torture:unclist", optarg); - break; - case 'W': - lp_set_cmdline(lp_ctx, "workgroup", optarg); + } + } + + argv_new = discard_const_p(char *, poptGetArgs(pc)); + argc_new = argc; + for (i=0; i<argc; i++) { + if (argv_new[i] == NULL) { + argc_new = i; break; - case 'h': - usage(); - exit(1); - default: - printf("Unknown option %c (%d)\n", (char)opt, opt); - exit(1); } } + if (!(argc_new >= 3)) { + usage(pc); + exit(1); + } + + setup_logging("locktest", DEBUG_STDOUT); + + for (server=0;server<NSERVERS;server++) { + share[server] = argv_new[1+server]; + all_string_sub(share[server],"/","\\",0); + } + + lp_ctx = cmdline_lp_ctx; + if (username_count == 0) { - usage(); + usage(pc); return -1; } if (username_count == 1) { @@ -651,15 +633,10 @@ static void usage(void) gensec_init(lp_ctx); - argc -= optind; - argv += optind; - DEBUG(0,("seed=%u base=%d range=%d min_length=%d\n", seed, lock_base, lock_range, min_length)); srandom(seed); - test_locks(lp_ctx, share); - - return(0); + return test_locks(lp_ctx, share); } diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index d1b853de72..ac7029aa50 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "lib/cmdline/popt_common.h" #include "system/filesys.h" #include "system/dir.h" #include "libcli/libcli.h" @@ -30,12 +31,10 @@ #include "dynconfig.h" #include "libcli/resolve/resolve.h" -static struct cli_credentials *credentials; static bool showall = false; static bool old_list = false; static const char *maskchars = "<>\"?*abc."; static const char *filechars = "abcdefghijklm."; -static int verbose; static int die_on_error; static int NumLoops = 0; static int max_length = 20; @@ -87,13 +86,13 @@ static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx, *share = 0; share++; - cli_credentials_set_workstation(credentials, "masktest", CRED_SPECIFIED); + cli_credentials_set_workstation(cmdline_credentials, "masktest", CRED_SPECIFIED); status = smbcli_full_connection(NULL, &c, server, ports, share, NULL, - credentials, resolve_ctx, NULL, + cmdline_credentials, resolve_ctx, NULL, options); if (!NT_STATUS_IS_OK(status)) { @@ -112,7 +111,7 @@ static bool f_info_hit; static void listfn(struct clilist_file_info *f, const char *s, void *state) { - struct masktest_state *m = talloc_get_type(state,struct masktest_state); + struct masktest_state *m = (struct masktest_state *)state; if (ISDOT(f->name)) { resultp[0] = '+'; @@ -128,7 +127,7 @@ static void listfn(struct clilist_file_info *f, const char *s, void *state) } static void get_real_name(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, - char *long_name, fstring short_name) + char **long_name, fstring short_name) { const char *mask; struct masktest_state state; @@ -151,12 +150,12 @@ static void get_real_name(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, if (f_info_hit) { fstrcpy(short_name, last_hit.short_name); strlower(short_name); - long_name = talloc_strdup(mem_ctx, last_hit.long_name); - strlower(long_name); + *long_name = talloc_strdup(mem_ctx, last_hit.long_name); + strlower(*long_name); } if (*short_name == '\0') { - fstrcpy(short_name, long_name); + fstrcpy(short_name, *long_name); } } @@ -168,7 +167,7 @@ static void testpair(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, char *mask, char *res2; static int count; fstring short_name; - char *long_name; + char *long_name = NULL; struct masktest_state state; count++; @@ -186,7 +185,7 @@ static void testpair(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, char *mask, resultp = res1; fstrcpy(short_name, ""); - get_real_name(mem_ctx, cli, long_name, short_name); + get_real_name(mem_ctx, cli, &long_name, short_name); fstrcpy(res1, "---"); smbcli_list_new(cli->tree, mask, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY, @@ -241,6 +240,8 @@ static void test_mask(int argc, char *argv[], l2 = 1 + random() % max_length; mask = talloc_strdup(mem_ctx, "\\masktest\\"); file = talloc_strdup(mem_ctx, "\\masktest\\"); + mask = talloc_realloc_size(mem_ctx, mask, strlen(mask)+l1+1); + file = talloc_realloc_size(mem_ctx, file, strlen(file)+l2+1); l = strlen(mask); for (i=0;i<l1;i++) { mask[i+l] = maskchars[random() % mc_len]; @@ -269,30 +270,16 @@ static void test_mask(int argc, char *argv[], } -static void usage(void) +static void usage(poptContext pc) { printf( "Usage:\n\ masktest //server/share [options..]\n\ - options:\n\ - -d debuglevel\n\ - -n numloops\n\ - -W workgroup\n\ - -U user%%pass\n\ - -s seed\n\ - -l max test length\n\ - -M max protocol\n\ - -f filechars (default %s)\n\ - -m maskchars (default %s)\n\ - -v verbose mode\n\ - -E die on error\n\ - -a show all tests\n\ \n\ This program tests wildcard matching between two servers. It generates\n\ random pairs of filenames/masks and tests that they match in the same\n\ - way on the servers and internally\n\ -", - filechars, maskchars); + way on the servers and internally\n"); + poptPrintUsage(pc, stdout, 0); } /**************************************************************************** @@ -306,85 +293,67 @@ static void usage(void) int seed; struct loadparm_context *lp_ctx; struct smbcli_options options; + poptContext pc; + int argc_new, i; + char **argv_new; + enum {OPT_UNCLIST=1000}; + struct poptOption long_options[] = { + POPT_AUTOHELP + {"seed", 0, POPT_ARG_INT, &seed, 0, "Seed to use for randomizer", NULL}, + {"num-ops", 0, POPT_ARG_INT, &NumLoops, 0, "num ops", NULL}, + {"maxlength", 0, POPT_ARG_INT, &max_length,0, "maximum length", NULL}, + {"dieonerror", 0, POPT_ARG_NONE, &die_on_error, 0, "die on errors", NULL}, + {"showall", 0, POPT_ARG_NONE, &showall, 0, "display all operations", NULL}, + {"oldlist", 0, POPT_ARG_NONE, &old_list, 0, "use old list call", NULL}, + {"maskchars", 0, POPT_ARG_STRING, &maskchars, 0,"mask characters", NULL}, + {"filechars", 0, POPT_ARG_STRING, &filechars, 0,"file characters", NULL}, + POPT_COMMON_SAMBA + POPT_COMMON_CONNECTION + POPT_COMMON_CREDENTIALS + POPT_COMMON_VERSION + { NULL } + }; setlinebuf(stdout); + seed = time(NULL); - setup_logging("masktest", DEBUG_STDOUT); + pc = poptGetContext("locktest", argc, (const char **) argv, long_options, + POPT_CONTEXT_KEEP_FIRST); - if (argc < 2 || argv[1][0] == '-') { - usage(); - exit(1); - } + poptSetOtherOptionHelp(pc, "<unc>"); - share = argv[1]; - - all_string_sub(share,"/","\\",0); + while((opt = poptGetNextOpt(pc)) != -1) { + switch (opt) { + case OPT_UNCLIST: + lp_set_cmdline(cmdline_lp_ctx, "torture:unclist", poptGetOptArg(pc)); + break; + } + } - setup_logging(argv[0], DEBUG_STDOUT); + argv_new = discard_const_p(char *, poptGetArgs(pc)); + argc_new = argc; + for (i=0; i<argc; i++) { + if (argv_new[i] == NULL) { + argc_new = i; + break; + } + } - argc -= 1; - argv += 1; + if (!(argc_new >= 2)) { + usage(pc); + exit(1); + } - lp_ctx = loadparm_init(talloc_autofree_context()); - lp_load(lp_ctx, dyn_CONFIGFILE); + setup_logging("masktest", DEBUG_STDOUT); - credentials = cli_credentials_init(talloc_autofree_context()); - cli_credentials_guess(credentials, lp_ctx); + share = argv_new[1]; - seed = time(NULL); + all_string_sub(share,"/","\\",0); - while ((opt = getopt(argc, argv, "n:d:U:s:hm:f:aoW:M:vEl:")) != EOF) { - switch (opt) { - case 'n': - NumLoops = atoi(optarg); - break; - case 'd': - DEBUGLEVEL = atoi(optarg); - break; - case 'E': - die_on_error = 1; - break; - case 'v': - verbose++; - break; - case 'M': - lp_set_cmdline(lp_ctx, "max protocol", optarg); - break; - case 'U': - cli_credentials_parse_string(credentials, optarg, CRED_SPECIFIED); - break; - case 's': - seed = atoi(optarg); - break; - case 'h': - usage(); - exit(1); - case 'm': - maskchars = optarg; - break; - case 'l': - max_length = atoi(optarg); - break; - case 'f': - filechars = optarg; - break; - case 'a': - showall = 1; - break; - case 'o': - old_list = true; - break; - default: - printf("Unknown option %c (%d)\n", (char)opt, opt); - exit(1); - } - } + lp_ctx = cmdline_lp_ctx; gensec_init(lp_ctx); - argc -= optind; - argv += optind; - lp_smbcli_options(lp_ctx, &options); cli = connect_one(lp_resolve_context(lp_ctx), share, @@ -398,7 +367,7 @@ static void usage(void) DEBUG(0,("seed=%d format --- --- (server, correct)\n", seed)); srandom(seed); - test_mask(argc, argv, cli); + test_mask(argc_new-1, argv_new+1, cli); return(0); } |