From 0f1b3ed5c0326cdca931adc43806ec4df0d3abf3 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Mon, 19 May 2008 00:19:18 +0200 Subject: [PATCH] net: Autogenerate "net help" output from net's functable. (This used to be commit 0feb40bc8408412336c667df4f8bf57c77446ca7) --- source3/utils/net.c | 1 + source3/utils/net.h | 1 + source3/utils/net_help.c | 173 +++++++++++++++++++---------------------------- 3 files changed, 71 insertions(+), 104 deletions(-) rewrite source3/utils/net_help.c (69%) diff --git a/source3/utils/net.c b/source3/utils/net.c index b56ca7e26c5..b1401e97bac 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -758,6 +758,7 @@ static struct functable3 net_func[] = { c->opt_password = getenv("PASSWD"); } + c->private_data = net_func; rc = net_run_function3(c, argc_new-1, argv_new+1, "net", net_func); DEBUG(2,("return code = %d\n", rc)); diff --git a/source3/utils/net.h b/source3/utils/net.h index b89caca856d..d1e759c5a95 100644 --- a/source3/utils/net.h +++ b/source3/utils/net.h @@ -62,6 +62,7 @@ struct net_context { struct libnetapi_ctx *netapi_ctx; bool display_usage; + void *private_data; const char *share_type[]; }; diff --git a/source3/utils/net_help.c b/source3/utils/net_help.c dissimilarity index 69% index ddb8d763365..035914431e6 100644 --- a/source3/utils/net_help.c +++ b/source3/utils/net_help.c @@ -1,104 +1,69 @@ -/* - Samba Unix/Linux SMB client library - net help commands - Copyright (C) 2002 Jim McDonough (jmcd@us.ibm.com) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include "includes.h" -#include "utils/net.h" - -static int net_help_usage(struct net_context *c, int argc, const char **argv) -{ - d_printf( -"\n"\ -"Usage: net help \n"\ -"\n"\ -"Valid functions are:\n"\ -" RPC RAP ADS FILE SHARE SESSION SERVER DOMAIN PRINTQ USER GROUP VALIDATE\n"\ -" GROUPMEMBER ADMIN SERVICE PASSWORD TIME LOOKUP GETLOCALSID SETLOCALSID\n"\ -" SETDOMAINSID CHANGESCRETPW LOOKUP SAM\n"); - return -1; -} - -static int net_usage(struct net_context *c, int argc, const char **argv) -{ - d_printf(" net time\t\tto view or set time information\n"\ - " net lookup\t\tto lookup host name or ip address\n"\ - " net user\t\tto manage users\n"\ - " net group\t\tto manage groups\n"\ - " net sam\t\tto edit the local user database directly\n"\ - " net lookup\t\tto look up various things\n"\ - " net groupmap\t\tto manage group mappings\n"\ - " net join\t\tto join a domain\n"\ - " net cache\t\tto operate on cache tdb file\n"\ - " net getlocalsid [NAME]\tto get the SID for local name\n"\ - " net setlocalsid SID\tto set the local domain SID\n"\ - " net setdomainsid SID\tto set the domain SID on member servers\n"\ - " net changesecretpw\tto change the machine password in the local secrets database only\n"\ - " \tthis requires the -f flag as a safety barrier\n"\ - " net status\t\tShow server status\n"\ - " net usersidlist\tto get a list of all users with their SIDs\n" - " net usershare\t\tto add, delete and list locally user-modifiable shares\n" - " net conf\t\tto view and edit samba's registry based configuration\n" - "\n"\ - " net ads \tto run ADS commands\n"\ - " net rap \tto run RAP (pre-RPC) commands\n"\ - " net rpc \tto run RPC commands\n"\ - "\n"\ - "Type \"net help