utils/net_help.c

説明を見る。
00001 /* 
00002    Samba Unix/Linux SMB client library 
00003    net help commands
00004    Copyright (C) 2002 Jim McDonough (jmcd@us.ibm.com)
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015    
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
00019 */
00020 
00021 #include "includes.h"
00022 #include "utils/net.h"
00023 
00024 int net_common_methods_usage(int argc, const char**argv)
00025 {
00026         d_printf("Valid methods: (auto-detected if not specified)\n");
00027         d_printf("\tads\t\t\t\tActive Directory (LDAP/Kerberos)\n");
00028         d_printf("\trpc\t\t\t\tDCE-RPC\n");
00029         d_printf("\trap\t\t\t\tRAP (older systems)\n");
00030         d_printf("\n");
00031         return 0;
00032 }
00033 
00034 int net_common_flags_usage(int argc, const char **argv)
00035 {
00036         d_printf("Valid targets: choose one (none defaults to localhost)\n");
00037         d_printf("\t-S or --server=<server>\t\tserver name\n");
00038         d_printf("\t-I or --ipaddress=<ipaddr>\taddress of target server\n");
00039         d_printf("\t-w or --workgroup=<wg>\t\ttarget workgroup or domain\n");
00040 
00041         d_printf("\n");
00042         d_printf("Valid miscellaneous options are:\n"); /* misc options */
00043         d_printf("\t-p or --port=<port>\t\tconnection port on target\n");
00044         d_printf("\t-W or --myworkgroup=<wg>\tclient workgroup\n");
00045         d_printf("\t-d or --debuglevel=<level>\tdebug level (0-10)\n");
00046         d_printf("\t-n or --myname=<name>\t\tclient name\n");
00047         d_printf("\t-U or --user=<name>\t\tuser name\n");
00048         d_printf("\t-s or --configfile=<path>\tpathname of smb.conf file\n");
00049         d_printf("\t-l or --long\t\t\tDisplay full information\n");
00050         d_printf("\t-V or --version\t\t\tPrint samba version information\n");
00051         d_printf("\t-P or --machine-pass\t\tAuthenticate as machine account\n");
00052         return -1;
00053 }
00054 
00055 static int help_usage(int argc, const char **argv)
00056 {
00057         d_printf(
00058 "\n"\
00059 "Usage: net help <function>\n"\
00060 "\n"\
00061 "Valid functions are:\n"\
00062 "  RPC RAP ADS FILE SHARE SESSION SERVER DOMAIN PRINTQ USER GROUP VALIDATE\n"\
00063 "  GROUPMEMBER ADMIN SERVICE PASSWORD TIME LOOKUP GETLOCALSID SETLOCALSID\n"\
00064 "  GETDOMAINSID SETDOMAINSID CHANGESCRETPW LOOKUP SAM\n");
00065         return -1;
00066 }
00067 
00068 int net_help_user(int argc, const char **argv)
00069 {
00070         d_printf("\nnet [<method>] user [misc. options] [targets]"\
00071                  "\n\tList users\n\n");
00072         d_printf("net [<method>] user DELETE <name> [misc. options] [targets]"\
00073                  "\n\tDelete specified user\n");
00074         d_printf("\nnet [<method>] user INFO <name> [misc. options] [targets]"\
00075                  "\n\tList the domain groups of the specified user\n");
00076         d_printf("\nnet [<method>] user ADD <name> [password] [-c container] "\
00077                  "[-F user flags] [misc. options]"\
00078                  " [targets]\n\tAdd specified user\n");
00079         d_printf("\nnet [<method>] user RENAME <oldusername> <newusername>"\
00080                  " [targets]\n\tRename specified user\n\n");
00081 
00082 
00083         net_common_methods_usage(argc, argv);
00084         net_common_flags_usage(argc, argv);
00085         d_printf("\t-C or --comment=<comment>\tdescriptive comment (for add only)\n");
00086         d_printf("\t-c or --container=<container>\tLDAP container, defaults to cn=Users (for add in ADS only)\n");
00087         return -1;
00088 }
00089 
00090 int net_help_group(int argc, const char **argv)
00091 {
00092         d_printf("net [<method>] group [misc. options] [targets]"\
00093                  "\n\tList user groups\n\n");
00094         d_printf("net rpc group LIST [global|local|builtin]* [misc. options]"\
00095                  "\n\tList specific user groups\n\n");
00096         d_printf("net [<method>] group DELETE <name> "\
00097                  "[misc. options] [targets]"\
00098                  "\n\tDelete specified group\n");
00099         d_printf("\nnet [<method>] group ADD <name> [-C comment] [-c container]"\
00100                  " [misc. options] [targets]\n\tCreate specified group\n");
00101         d_printf("\nnet rpc group MEMBERS <name>\n\tList Group Members\n\n");
00102         d_printf("\nnet rpc group ADDMEM <group> <member>\n\tAdd Group Members\n\n");
00103         d_printf("\nnet rpc group DELMEM <group> <member>\n\tDelete Group Members\n\n");
00104         net_common_methods_usage(argc, argv);
00105         net_common_flags_usage(argc, argv);
00106         d_printf("\t-C or --comment=<comment>\tdescriptive comment (for add only)\n");
00107         d_printf("\t-c or --container=<container>\tLDAP container, defaults to cn=Users (for add in ADS only)\n");
00108         d_printf("\t-L or --localgroup\t\tWhen adding groups, create a local group (alias)\n");
00109         return -1;
00110 }
00111 
00112 int net_help_join(int argc, const char **argv)
00113 {
00114         d_printf("\nnet [<method>] join [misc. options]\n"
00115                  "\tjoins this server to a domain\n");
00116         d_printf("Valid methods: (auto-detected if not specified)\n");
00117         d_printf("\tads\t\t\t\tActive Directory (LDAP/Kerberos)\n");
00118         d_printf("\trpc\t\t\t\tDCE-RPC\n");
00119         net_common_flags_usage(argc, argv);
00120         return -1;
00121 }
00122 
00123 int net_help_share(int argc, const char **argv)
00124 {
00125         d_printf(
00126          "\nnet [<method>] share [misc. options] [targets] \n"
00127          "\tenumerates all exported resources (network shares) "
00128          "on target server\n\n"
00129          "net [<method>] share ADD <name=serverpath> [misc. options] [targets]"
00130         "\n\tadds a share from a server (makes the export active)\n\n"
00131         "net [<method>] share DELETE <sharename> [misc. options] [targets]"
00132         "\n\tdeletes a share from a server (makes the export inactive)\n\n"
00133         "net [<method>] share ALLOWEDUSERS [<filename>] "
00134         "[misc. options] [targets]"
00135         "\n\tshows a list of all shares together with all users allowed to"
00136         "\n\taccess them. This needs the output of 'net usersidlist' on"
00137         "\n\tstdin or in <filename>.\n\n"
00138          "net [<method>] share MIGRATE FILES <sharename> [misc. options] [targets]"
00139          "\n\tMigrates files from remote to local server\n\n"
00140          "net [<method>] share MIGRATE SHARES <sharename> [misc. options] [targets]"
00141          "\n\tMigrates shares from remote to local server\n\n"
00142          "net [<method>] share MIGRATE SECURITY <sharename> [misc. options] [targets]"
00143          "\n\tMigrates share-ACLs from remote to local server\n\n" 
00144          "net [<method>] share MIGRATE ALL <sharename> [misc. options] [targets]"
00145          "\n\tMigrates shares (including directories, files) from remote\n"
00146          "\tto local server\n\n"
00147         );
00148         net_common_methods_usage(argc, argv);
00149         net_common_flags_usage(argc, argv);
00150         d_printf(
00151          "\t-C or --comment=<comment>\tdescriptive comment (for add only)\n"
00152          "\t-M or --maxusers=<num>\t\tmax users allowed for share\n"
00153          "\t      --acls\t\t\tcopies ACLs as well\n"
00154          "\t      --attrs\t\t\tcopies DOS Attributes as well\n"
00155          "\t      --timestamps\t\tpreserve timestamps while copying files\n"
00156          "\t      --destination\t\tmigration target server (default: localhost)\n"
00157          "\t-e or --exclude\t\t\tlist of shares to be excluded from mirroring\n"
00158          "\t-v or --verbose\t\t\tgive verbose output\n");
00159         return -1;
00160 }
00161 
00162 int net_help_file(int argc, const char **argv)
00163 {
00164         d_printf("net [<method>] file [misc. options] [targets]\n"\
00165                  "\tlists all open files on file server\n\n");
00166         d_printf("net [<method>] file USER <username> "\
00167                  "[misc. options] [targets]"\
00168                  "\n\tlists all files opened by username on file server\n\n");
00169         d_printf("net [<method>] file CLOSE <id> [misc. options] [targets]\n"\
00170                  "\tcloses specified file on target server\n\n");
00171         d_printf("net [rap] file INFO <id> [misc. options] [targets]\n"\
00172                  "\tdisplays information about the specified open file\n");
00173 
00174         net_common_methods_usage(argc, argv);
00175         net_common_flags_usage(argc, argv);
00176         return -1;
00177 }
00178 
00179 int net_help_printer(int argc, const char **argv)
00180 {
00181         d_printf("net rpc printer LIST [printer] [misc. options] [targets]\n"\
00182                  "\tlists all printers on print-server\n\n");
00183         d_printf("net rpc printer DRIVER [printer] [misc. options] [targets]\n"\
00184                  "\tlists all printer-drivers on print-server\n\n");
00185         d_printf("net rpc printer PUBLISH action [printer] [misc. options] [targets]\n"\
00186                  "\tpublishes printer settings in Active Directory\n"
00187                  "\taction can be one of PUBLISH, UPDATE, UNPUBLISH or LIST\n\n");
00188         d_printf("net rpc printer MIGRATE PRINTERS [printer] [misc. options] [targets]"\
00189                  "\n\tmigrates printers from remote to local server\n\n");
00190         d_printf("net rpc printer MIGRATE SETTINGS [printer] [misc. options] [targets]"\
00191                  "\n\tmigrates printer-settings from remote to local server\n\n");
00192         d_printf("net rpc printer MIGRATE DRIVERS [printer] [misc. options] [targets]"\
00193                  "\n\tmigrates printer-drivers from remote to local server\n\n");
00194         d_printf("net rpc printer MIGRATE FORMS [printer] [misc. options] [targets]"\
00195                  "\n\tmigrates printer-forms from remote to local server\n\n");
00196         d_printf("net rpc printer MIGRATE SECURITY [printer] [misc. options] [targets]"\
00197                  "\n\tmigrates printer-ACLs from remote to local server\n\n");
00198         d_printf("net rpc printer MIGRATE ALL [printer] [misc. options] [targets]"\
00199                  "\n\tmigrates drivers, forms, queues, settings and acls from\n"\
00200                  "\tremote to local print-server\n\n");
00201         net_common_methods_usage(argc, argv);
00202         net_common_flags_usage(argc, argv);
00203         d_printf(
00204          "\t-v or --verbose\t\t\tgive verbose output\n"
00205          "\t      --destination\t\tmigration target server (default: localhost)\n");
00206 
00207         return -1;
00208 }
00209 
00210 
00211 int net_help_status(int argc, const char **argv)
00212 {
00213         d_printf("  net status sessions [parseable] "
00214                  "Show list of open sessions\n");
00215         d_printf("  net status shares [parseable]   "
00216                  "Show list of open shares\n");
00217         return -1;
00218 }
00219 
00220 static int net_usage(int argc, const char **argv)
00221 {
00222         d_printf("  net time\t\tto view or set time information\n"\
00223                  "  net lookup\t\tto lookup host name or ip address\n"\
00224                  "  net user\t\tto manage users\n"\
00225                  "  net group\t\tto manage groups\n"\
00226                  "  net sam\t\tto edit the local user database directly\n"\
00227                  "  net lookup\t\tto look up various things\n"\
00228                  "  net groupmap\t\tto manage group mappings\n"\
00229                  "  net join\t\tto join a domain\n"\
00230                  "  net cache\t\tto operate on cache tdb file\n"\
00231                  "  net getlocalsid [NAME]\tto get the SID for local machine name\n"\
00232                  "  net setlocalsid SID\tto set the local domain SID\n"\
00233                  "  net getdomainsid the machine SID and the domain SID on the local server\n"\
00234                  "  net setdomainsid SID\tto set the domain SID on member servers\n"\
00235                  "  net changesecretpw\tto change the machine password in the local secrets database only\n"\
00236                  "                    \tthis requires the -f flag as a safety barrier\n"\
00237                  "  net status\t\tShow server status\n"\
00238                  "  net usersidlist\tto get a list of all users with their SIDs\n"
00239                  "  net usershare\t\tto add, delete and list locally user-modifiable shares\n"
00240                  "\n"\
00241                  "  net ads <command>\tto run ADS commands\n"\
00242                  "  net rap <command>\tto run RAP (pre-RPC) commands\n"\
00243                  "  net rpc <command>\tto run RPC commands\n"\
00244                  "\n"\
00245                  "Type \"net help <option>\" to get more information on that option\n");
00246         net_common_flags_usage(argc, argv);
00247         return -1;
00248 }
00249 
00250 /*
00251   handle "net help *" subcommands
00252 */
00253 int net_help(int argc, const char **argv)
00254 {
00255         struct functable func[] = {
00256                 {"ADS", net_ads_help},  
00257                 {"RAP", net_rap_help},
00258                 {"RPC", net_rpc_help},
00259 
00260                 {"FILE", net_help_file},
00261                 {"SHARE", net_help_share},
00262                 {"SESSION", net_rap_session_usage},
00263                 {"SERVER", net_rap_server_usage},
00264                 {"DOMAIN", net_rap_domain_usage},
00265                 {"PRINTQ", net_rap_printq_usage},
00266                 {"USER", net_help_user},
00267                 {"GROUP", net_help_group},
00268                 {"GROUPMAP", net_help_groupmap},
00269                 {"JOIN", net_help_join},
00270                 {"VALIDATE", net_rap_validate_usage},
00271                 {"GROUPMEMBER", net_rap_groupmember_usage},
00272                 {"ADMIN", net_rap_admin_usage},
00273                 {"SERVICE", net_rap_service_usage},
00274                 {"PASSWORD", net_rap_password_usage},
00275                 {"TIME", net_time_usage},
00276                 {"LOOKUP", net_lookup_usage},
00277                 {"USERSHARE", net_usershare_usage},
00278                 {"USERSIDLIST", net_usersidlist_usage},
00279 #ifdef WITH_FAKE_KASERVER
00280                 {"AFS", net_help_afs},
00281 #endif
00282 
00283                 {"HELP", help_usage},
00284                 {NULL, NULL}};
00285 
00286         return net_run_function(argc, argv, func, net_usage);
00287 }

Sambaに対してSat Aug 29 21:23:28 2009に生成されました。  doxygen 1.4.7