diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-10-15 12:10:02 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-10-15 09:32:03 +0000 |
commit | 77a16bf5046e6026cc8ed8b96c15623c84a17ef7 (patch) | |
tree | b88b1614dec20e497548948554cd15db7a27d750 | |
parent | 10e1de3e06cf6b8a524f50685d6a675a2d49c9a9 (diff) | |
download | samba-77a16bf5046e6026cc8ed8b96c15623c84a17ef7.tar.gz samba-77a16bf5046e6026cc8ed8b96c15623c84a17ef7.tar.bz2 samba-77a16bf5046e6026cc8ed8b96c15623c84a17ef7.zip |
s4-net: fix the dependence on command line ordering
this fixes python net commands where you use a '-' option before the
command name
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source4/utils/net/net.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index acace9eeed..46cc07d702 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -156,7 +156,7 @@ int net_run_function(struct net_context *ctx, return functable[i].fn(ctx, argc-1, argv+1); } - d_printf("No command: %s\n", argv[0]); + d_printf("No command: '%s'\n", argv[0]); return usage_fn(ctx, argc, argv); } @@ -317,13 +317,15 @@ static int binary_net(int argc, const char **argv) return 1; } - if (argc > 1) { - py_cmd = PyDict_GetItemString(py_cmds, argv[1]); - if (py_cmd != NULL) { - rc = py_call_with_string_args(py_cmd, "_run", - argc-1, argv+1); - talloc_free(ev); - return rc; + for (i=1; i<argc; i++) { + if (argv[i][0] != '-') { + py_cmd = PyDict_GetItemString(py_cmds, argv[i]); + if (py_cmd != NULL) { + rc = py_call_with_string_args(py_cmd, "_run", + argc-1, argv+1); + talloc_free(ev); + return rc; + } } } |