From 1458b7c7959be7720162fef441025954f0082fe9 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 5 Apr 2002 01:36:28 +0000 Subject: Lots more net consistency work: - Added net_help.c for unified help when possible - Added net rpc user listing, delete, info commands - Unified net user command to autodetect ads/rpc/rap (try in that order) - Added generic routine for detecting rpc (protocol > PROTOCOL_NT1) - I'm sure I forgot something. (This used to be commit 9daa5788c822cf1ad20dc703e7f03b9ee82987bf) --- source3/utils/net.c | 92 ++----------- source3/utils/net_ads.c | 11 +- source3/utils/net_help.c | 125 +++++++++++++++++ source3/utils/net_rap.c | 15 +-- source3/utils/net_rpc.c | 344 +++++++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 470 insertions(+), 117 deletions(-) create mode 100644 source3/utils/net_help.c (limited to 'source3') diff --git a/source3/utils/net.c b/source3/utils/net.c index e33691ea5e..b81e37c0af 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -78,27 +78,6 @@ struct in_addr opt_dest_ip; extern pstring global_myname; -int net_common_flags_usage(int argc, const char **argv) -{ - - d_printf("Valid targets: choose one (none defaults to localhost)\n"); - d_printf("\t-S or --server=\t\tserver name\n"); - d_printf("\t-I or --ipaddress=\taddress of target server\n"); - d_printf("\t-w or --workgroup=\t\ttarget workgroup or domain\n"); - - d_printf("\n"); - d_printf("Valid miscellaneous options are:\n"); /* misc options */ - d_printf("\t-p or --port=\tconnection port on target server\n"); - d_printf("\t-W or --myworkgroup=\tclient workgroup\n"); - d_printf("\t-d or --debug=\t\tdebug level (0-10)\n"); - d_printf("\t-n or --myname=\t\tclient name\n"); - d_printf("\t-U or --user=\t\tuser name\n"); - d_printf("\t-s or --conf=\t\tpathname of smb.conf file\n"); - d_printf("\t-l or --long\t\t\tDisplay full information\n"); - return -1; -} - - /* run a function from a function table. If not found then call the specified usage function @@ -180,7 +159,7 @@ NTSTATUS connect_to_ipc_anonymous(struct cli_state **c, } } -static BOOL net_find_server(unsigned flags, struct in_addr *server_ip, char **server_name) +BOOL net_find_server(unsigned flags, struct in_addr *server_ip, char **server_name) { if (opt_host) { @@ -300,11 +279,17 @@ struct cli_state *net_make_ipc_connection(unsigned flags) return cli; } + + static int net_user(int argc, const char **argv) { if (net_ads_check() == 0) return net_ads_user(argc, argv); + /* if server is not specified, default to PDC? */ + if (net_rpc_check(NET_FLAGS_PDC)) + return net_rpc_user(argc, argv); + return net_rap_user(argc, argv); } @@ -320,63 +305,6 @@ static int net_join(int argc, const char **argv) return net_rpc_join(argc, argv); } -static int net_usage(int argc, const char **argv) -{ - d_printf(" net time\t\t to view or set time information\n"\ - " net lookup\t\t to lookup host name or ip address\n"\ - "\n"\ - " net ads [command]\tto run ADS commands\n"\ - " net rap [command]\tto run RAP (pre-RPC) commands\n"\ - " net rpc [command]\tto run RPC commands\n"\ - "\n"\ - "Type \"net help