2 Samba Unix/Linux SMB client library
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 2 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, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 int net_common_methods_usage(int argc
, const char**argv
)
25 d_printf("Valid methods: (auto-detected if not specified)\n");
26 d_printf("\tads\t\t\t\tActive Directory (LDAP/Kerberos)\n");
27 d_printf("\trpc\t\t\t\tDCE-RPC\n");
28 d_printf("\trap\t\t\t\tRAP (older systems)\n");
33 int net_common_flags_usage(int argc
, const char **argv
)
35 d_printf("Valid targets: choose one (none defaults to localhost)\n");
36 d_printf("\t-S or --server=<server>\t\tserver name\n");
37 d_printf("\t-I or --ipaddress=<ipaddr>\taddress of target server\n");
38 d_printf("\t-w or --workgroup=<wg>\t\ttarget workgroup or domain\n");
41 d_printf("Valid miscellaneous options are:\n"); /* misc options */
42 d_printf("\t-p or --port=<port>\t\tconnection port on target\n");
43 d_printf("\t-W or --myworkgroup=<wg>\tclient workgroup\n");
44 d_printf("\t-d or --debug=<level>\t\tdebug level (0-10)\n");
45 d_printf("\t-n or --myname=<name>\t\tclient name\n");
46 d_printf("\t-U or --user=<name>\t\tuser name\n");
47 d_printf("\t-s or --conf=<path>\t\tpathname of smb.conf file\n");
48 d_printf("\t-l or --long\t\t\tDisplay full information\n");
52 static int help_usage(int argc
, const char **argv
)
56 "Usage: net help <function>\n"\
58 "Valid functions are:\n"\
59 " RPC RAP ADS FILE SHARE SESSION SERVER DOMAIN PRINTQ USER GROUP VALIDATE\n"\
60 " GROUPMEMBER ADMIN SERVICE PASSWORD TIME LOOKUP\n");
64 int net_help_user(int argc
, const char **argv
)
66 d_printf("\nnet <method> user [misc. options] [targets]\n\tList users\n");
67 d_printf("\nnet <method> user DELETE <name> [misc. options] [targets]"\
68 "\n\tDelete specified user\n");
69 d_printf("\nnet <method> user INFO <name> [misc. options] [targets]"\
70 "\n\tList the domain groups of the specified user\n");
71 d_printf("\nnet <method> user ADD <name> [password] [-F user flags] [misc. options]"\
72 " [targets]\n\tAdd specified user\n");
74 net_common_methods_usage(argc
, argv
);
75 net_common_flags_usage(argc
, argv
);
77 "\t-C or --comment=<comment>\tdescriptive comment (for add only)\n");
81 int net_help_group(int argc
, const char **argv
)
83 d_printf("net <method> group [misc. options] [targets]"\
84 "\n\tList user groups\n\n");
85 d_printf("net <method> group DELETE <name> [misc. options] [targets]"\
86 "\n\tDelete specified group\n");
87 d_printf("\nnet <method> group ADD <name> [-C comment]"\
88 " [misc. options] [targets]\n\tCreate specified group\n");
89 net_common_methods_usage(argc
, argv
);
90 net_common_flags_usage(argc
, argv
);
92 "\t-C or --comment=<comment>\tdescriptive comment (for add only)\n");
96 int net_help_share(int argc
, const char **argv
)
99 "\nnet <method> share [misc. options] [targets] \n"
100 "\tenumerates all exported resources (network shares) "
102 "\nnet <method> share ADD <name=serverpath> [misc. options] [targets]"
103 "\n\tAdds a share from a server (makes the export active)\n"
104 "\nnet <method> share DELETE <sharename> [misc. options] [targets]\n"
105 "\n\tDeletes a share from a server (makes the export inactive)\n");
106 net_common_methods_usage(argc
, argv
);
107 net_common_flags_usage(argc
, argv
);
109 "\t-C or --comment=<comment>\tdescriptive comment (for add only)\n"
110 "\t-M or --maxusers=<num>\t\tmax users allowed for share\n");
114 int net_help_file(int argc
, const char **argv
)
116 d_printf("net <method> file [misc. options] [targets]\n"\
117 "\tlists all open files on file server\n\n");
118 d_printf("net <method> file USER <username> [misc. options] [targets]"\
119 "\n\tlists all files opened by username on file server\n\n");
120 d_printf("net <method> file CLOSE <id> [misc. options] [targets]\n"\
121 "\tcloses specified file on target server\n\n");
122 d_printf("net [rap] file INFO <id> [misc. options] [targets]\n"\
123 "\tdisplays information about the specified open file\n");
125 net_common_methods_usage(argc
, argv
);
126 net_common_flags_usage(argc
, argv
);
130 static int net_usage(int argc
, const char **argv
)
132 d_printf(" net time\t\tto view or set time information\n"\
133 " net lookup\t\tto lookup host name or ip address\n"\
134 " net user\t\tto manage users\n"\
135 " net group\t\tto manage groups\n"\
136 " net join\t\tto join a domain\n"\
138 " net ads <command>\tto run ADS commands\n"\
139 " net rap <command>\tto run RAP (pre-RPC) commands\n"\
140 " net rpc <command>\tto run RPC commands\n"\
142 "Type \"net help <option>\" to get more information on that option\n");
147 handle "net help *" subcommands
149 int net_help(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_help_file
},
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_help_user
},
163 {"GROUP", net_help_group
},
164 {"VALIDATE", net_rap_validate_usage
},
165 {"GROUPMEMBER", net_rap_groupmember_usage
},
166 {"ADMIN", net_rap_admin_usage
},
167 {"SERVICE", net_rap_service_usage
},
168 {"PASSWORD", net_rap_password_usage
},
169 {"TIME", net_time_usage
},
170 {"LOOKUP", net_lookup_usage
},
172 {"HELP", help_usage
},
175 return net_run_function(argc
, argv
, func
, net_usage
);