summaryrefslogtreecommitdiff
path: root/source4/utils/net/net.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-12-28 20:37:48 +0100
committerJelmer Vernooij <jelmer@ganieda.vernstok.nl>2009-12-29 16:26:20 +0100
commit433f58f5a7490ba470dddc55e37325bb73cdba5c (patch)
tree3a0f667eaf519bed3a4f18fce6dfcf1d6c5b9fd8 /source4/utils/net/net.c
parente60a40e287a1febdab98cc6cf81a80a8cb6bcfb2 (diff)
downloadsamba-433f58f5a7490ba470dddc55e37325bb73cdba5c.tar.gz
samba-433f58f5a7490ba470dddc55e37325bb73cdba5c.tar.bz2
samba-433f58f5a7490ba470dddc55e37325bb73cdba5c.zip
s4/net: Pass all arguments through to the Python commands.
Diffstat (limited to 'source4/utils/net/net.c')
-rw-r--r--source4/utils/net/net.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c
index 9725402c7f..7b8f092f93 100644
--- a/source4/utils/net/net.c
+++ b/source4/utils/net/net.c
@@ -130,7 +130,6 @@ int net_run_function(struct net_context *ctx,
int (*usage_fn)(struct net_context *ctx, int argc, const char **argv))
{
int i;
- PyObject *py_cmds, *py_cmd;
if (argc == 0) {
return usage_fn(ctx, argc, argv);
@@ -144,17 +143,6 @@ int net_run_function(struct net_context *ctx,
return functable[i].fn(ctx, argc-1, argv+1);
}
- py_cmds = py_commands();
- if (py_cmds == NULL) {
- return 1;
- }
-
- py_cmd = PyDict_GetItemString(py_cmds, argv[0]);
- if (py_cmd != NULL) {
- return py_call_with_string_args(py_cmd, "_run",
- argc-1, argv+1);
- }
-
d_printf("No command: %s\n", argv[0]);
return usage_fn(ctx, argc, argv);
}
@@ -288,6 +276,7 @@ static int binary_net(int argc, const char **argv)
int opt,i;
int rc;
int argc_new;
+ PyObject *py_cmds, *py_cmd;
const char **argv_new;
struct tevent_context *ev;
struct net_context *ctx = NULL;
@@ -352,6 +341,19 @@ static int binary_net(int argc, const char **argv)
Py_Initialize();
py_update_path("bin"); /* FIXME: Can't assume this is always the case */
+ py_cmds = py_commands();
+ if (py_cmds == NULL) {
+ return 1;
+ }
+
+ py_cmd = PyDict_GetItemString(py_cmds, argv[1]);
+ if (py_cmd != NULL) {
+ rc = py_call_with_string_args(py_cmd, "_run",
+ argc-2, argv+2);
+ talloc_free(ev);
+ return rc;
+ }
+
rc = net_run_function(ctx, argc_new-1, argv_new+1, net_functable,
net_usage);