net: Split out "net afs"
[Samba.git] / source / utils / net_help.c
blobffd533eedd63785f0748732714e96524a8936413
1 /*
2 Samba Unix/Linux SMB client library
3 net help commands
4 Copyright (C) 2002 Jim McDonough (jmcd@us.ibm.com)
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "includes.h"
21 #include "utils/net.h"
23 static int help_usage(struct net_context *c, int argc, const char **argv)
25 d_printf(
26 "\n"\
27 "Usage: net help <function>\n"\
28 "\n"\
29 "Valid functions are:\n"\
30 " RPC RAP ADS FILE SHARE SESSION SERVER DOMAIN PRINTQ USER GROUP VALIDATE\n"\
31 " GROUPMEMBER ADMIN SERVICE PASSWORD TIME LOOKUP GETLOCALSID SETLOCALSID\n"\
32 " SETDOMAINSID CHANGESCRETPW LOOKUP SAM\n");
33 return -1;
36 int net_help_share(struct net_context *c, int argc, const char **argv)
38 d_printf(
39 "\nnet [<method>] share [misc. options] [targets] \n"
40 "\tenumerates all exported resources (network shares) "
41 "on target server\n\n"
42 "net [<method>] share ADD <name=serverpath> [misc. options] [targets]"
43 "\n\tadds a share from a server (makes the export active)\n\n"
44 "net [<method>] share DELETE <sharename> [misc. options] [targets]"
45 "\n\tdeletes a share from a server (makes the export inactive)\n\n"
46 "net [<method>] share ALLOWEDUSERS [<filename>] "
47 "[misc. options] [targets]"
48 "\n\tshows a list of all shares together with all users allowed to"
49 "\n\taccess them. This needs the output of 'net usersidlist' on"
50 "\n\tstdin or in <filename>.\n\n"
51 "net [<method>] share MIGRATE FILES <sharename> [misc. options] [targets]"
52 "\n\tMigrates files from remote to local server\n\n"
53 "net [<method>] share MIGRATE SHARES <sharename> [misc. options] [targets]"
54 "\n\tMigrates shares from remote to local server\n\n"
55 "net [<method>] share MIGRATE SECURITY <sharename> [misc. options] [targets]"
56 "\n\tMigrates share-ACLs from remote to local server\n\n"
57 "net [<method>] share MIGRATE ALL <sharename> [misc. options] [targets]"
58 "\n\tMigrates shares (including directories, files) from remote\n"
59 "\tto local server\n\n"
61 net_common_methods_usage(c, argc, argv);
62 net_common_flags_usage(c, argc, argv);
63 d_printf(
64 "\t-C or --comment=<comment>\tdescriptive comment (for add only)\n"
65 "\t-M or --maxusers=<num>\t\tmax users allowed for share\n"
66 "\t --acls\t\t\tcopies ACLs as well\n"
67 "\t --attrs\t\t\tcopies DOS Attributes as well\n"
68 "\t --timestamps\t\tpreserve timestamps while copying files\n"
69 "\t --destination\t\tmigration target server (default: localhost)\n"
70 "\t-e or --exclude\t\t\tlist of shares to be excluded from mirroring\n"
71 "\t-v or --verbose\t\t\tgive verbose output\n");
72 return -1;
75 int net_help_printer(struct net_context *c, int argc, const char **argv)
77 d_printf("net rpc printer LIST [printer] [misc. options] [targets]\n"\
78 "\tlists all printers on print-server\n\n");
79 d_printf("net rpc printer DRIVER [printer] [misc. options] [targets]\n"\
80 "\tlists all printer-drivers on print-server\n\n");
81 d_printf("net rpc printer PUBLISH action [printer] [misc. options] [targets]\n"\
82 "\tpublishes printer settings in Active Directory\n"
83 "\taction can be one of PUBLISH, UPDATE, UNPUBLISH or LIST\n\n");
84 d_printf("net rpc printer MIGRATE PRINTERS [printer] [misc. options] [targets]"\
85 "\n\tmigrates printers from remote to local server\n\n");
86 d_printf("net rpc printer MIGRATE SETTINGS [printer] [misc. options] [targets]"\
87 "\n\tmigrates printer-settings from remote to local server\n\n");
88 d_printf("net rpc printer MIGRATE DRIVERS [printer] [misc. options] [targets]"\
89 "\n\tmigrates printer-drivers from remote to local server\n\n");
90 d_printf("net rpc printer MIGRATE FORMS [printer] [misc. options] [targets]"\
91 "\n\tmigrates printer-forms from remote to local server\n\n");
92 d_printf("net rpc printer MIGRATE SECURITY [printer] [misc. options] [targets]"\
93 "\n\tmigrates printer-ACLs from remote to local server\n\n");
94 d_printf("net rpc printer MIGRATE ALL [printer] [misc. options] [targets]"\
95 "\n\tmigrates drivers, forms, queues, settings and acls from\n"\
96 "\tremote to local print-server\n\n");
97 net_common_methods_usage(c, argc, argv);
98 net_common_flags_usage(c, argc, argv);
99 d_printf(
100 "\t-v or --verbose\t\t\tgive verbose output\n"
101 "\t --destination\t\tmigration target server (default: localhost)\n");
103 return -1;
107 int net_help_status(struct net_context *c, int argc, const char **argv)
109 d_printf(" net status sessions [parseable] "
110 "Show list of open sessions\n");
111 d_printf(" net status shares [parseable] "
112 "Show list of open shares\n");
113 return -1;
116 static int net_usage(struct net_context *c, int argc, const char **argv)
118 d_printf(" net time\t\tto view or set time information\n"\
119 " net lookup\t\tto lookup host name or ip address\n"\
120 " net user\t\tto manage users\n"\
121 " net group\t\tto manage groups\n"\
122 " net sam\t\tto edit the local user database directly\n"\
123 " net lookup\t\tto look up various things\n"\
124 " net groupmap\t\tto manage group mappings\n"\
125 " net join\t\tto join a domain\n"\
126 " net cache\t\tto operate on cache tdb file\n"\
127 " net getlocalsid [NAME]\tto get the SID for local name\n"\
128 " net setlocalsid SID\tto set the local domain SID\n"\
129 " net setdomainsid SID\tto set the domain SID on member servers\n"\
130 " net changesecretpw\tto change the machine password in the local secrets database only\n"\
131 " \tthis requires the -f flag as a safety barrier\n"\
132 " net status\t\tShow server status\n"\
133 " net usersidlist\tto get a list of all users with their SIDs\n"
134 " net usershare\t\tto add, delete and list locally user-modifiable shares\n"
135 " net conf\t\tto view and edit samba's registry based configuration\n"
136 "\n"\
137 " net ads <command>\tto run ADS commands\n"\
138 " net rap <command>\tto run RAP (pre-RPC) commands\n"\
139 " net rpc <command>\tto run RPC commands\n"\
140 "\n"\
141 "Type \"net help <option>\" to get more information on that option\n");
142 net_common_flags_usage(c, argc, argv);
143 return -1;
147 handle "net help *" subcommands
149 int net_help(struct net_context *c, int argc, const char **argv)
151 struct functable func[] = {
152 {"ADS", net_ads_help},
153 {"RAP", net_rap_help},
154 {"RPC", net_rpc_help},
156 {"FILE", net_file_usage},
157 {"SHARE", net_help_share},
158 {"SESSION", net_rap_session_usage},
159 {"SERVER", net_rap_server_usage},
160 {"DOMAIN", net_rap_domain_usage},
161 {"PRINTQ", net_rap_printq_usage},
162 {"USER", net_user_usage},
163 {"GROUP", net_group_usage},
164 {"GROUPMAP", net_help_groupmap},
165 {"JOIN", net_join_usage},
166 {"DOM", net_help_dom},
167 {"VALIDATE", net_rap_validate_usage},
168 {"GROUPMEMBER", net_rap_groupmember_usage},
169 {"ADMIN", net_rap_admin_usage},
170 {"SERVICE", net_rap_service_usage},
171 {"PASSWORD", net_rap_password_usage},
172 {"TIME", net_time_usage},
173 {"LOOKUP", net_lookup_usage},
174 {"USERSHARE", net_usershare_usage},
175 {"USERSIDLIST", net_usersidlist_usage},
176 #ifdef WITH_FAKE_KASERVER
177 {"AFS", net_afs_usage},
178 #endif
180 {"HELP", help_usage},
181 {NULL, NULL}};
183 return net_run_function(c, argc, argv, func, net_usage);