s4:net utility - add a notice for the "help" operation and format it's output of...
[ira/wip.git] / source4 / utils / net / net.c
index 6086a4ce32d98836d31aae821453dc7a378aab57..828e46889ea1f103733be569debb06d16f0e85f3 100644 (file)
@@ -104,9 +104,11 @@ static const struct net_functable net_functable[] = {
        {"time", "get remote server's time\n", net_time, net_time_usage},
        {"join", "join a domain\n", net_join, net_join_usage},
        {"samdump", "dump the sam of a domain\n", net_samdump, net_samdump_usage},
+       {"export", "dump the sam of this domain\n", net_export, net_export_usage},
        {"vampire", "join and syncronise an AD domain onto the local server\n", net_vampire, net_vampire_usage},
        {"samsync", "synchronise into the local ldb the sam of an NT4 domain\n", net_samsync_ldb, net_samsync_ldb_usage},
        {"user", "manage user accounts\n", net_user, net_user_usage},
+       {"machinepw", "Get a machine password out of our SAM\n", net_machinepw, net_machinepw_usage},
        {NULL, NULL, NULL, NULL}
 };
 
@@ -118,7 +120,11 @@ int net_help(struct net_context *ctx, const struct net_functable *ftable)
 
        d_printf("Available commands:\n");
        while (name && desc) {
-               d_printf("\t%s\t\t%s", name, desc);
+               if (strlen(name) > 7) {
+                       d_printf("\t%s\t%s", name, desc);
+               } else {
+                       d_printf("\t%s\t\t%s", name, desc);
+               }
                name = ftable[++i].name;
                desc = ftable[i].desc;
        }
@@ -130,6 +136,7 @@ static int net_usage(struct net_context *ctx, int argc, const char **argv)
 {
        d_printf("Usage:\n");
        d_printf("net <command> [options]\n");
+       d_printf("Type 'net help' for all available commands\n");
        return 0;
 }
 
@@ -142,7 +149,7 @@ static int binary_net(int argc, const char **argv)
        int rc;
        int argc_new;
        const char **argv_new;
-       struct event_context *ev;
+       struct tevent_context *ev;
        struct net_context *ctx = NULL;
        poptContext pc;
        struct poptOption long_options[] = {
@@ -183,9 +190,9 @@ static int binary_net(int argc, const char **argv)
                return net_usage(ctx, argc, argv);
        }
 
-       dcerpc_init();
+       dcerpc_init(cmdline_lp_ctx);
 
-       ev = event_context_init(NULL);
+       ev = s4_event_context_init(NULL);
        if (!ev) {
                d_printf("Failed to create an event context\n");
                exit(1);
@@ -199,7 +206,7 @@ static int binary_net(int argc, const char **argv)
        ZERO_STRUCTP(ctx);
        ctx->lp_ctx = cmdline_lp_ctx;
        ctx->credentials = cmdline_credentials;
-       cli_credentials_set_event_context(ctx->credentials, ev);
+       ctx->event_ctx = ev;
 
        rc = net_run_function(ctx, argc_new-1, argv_new+1, net_functable, net_usage);