The branch, v3-3-test has been updated via bb7c5fc4ec77db4073d3beccf12af12910b6bd07 (commit) via b161fb7cfe3d0f5c2e853d5759420817c6ed7c0f (commit) via 08dd5f5311d97544d5cb3067f019260a9161ef81 (commit) via 47f7308e4ee7422a6d9c578c1073b0207969fbb2 (commit) via b8382bc3af318226a1160c6c39627e7a32e050ab (commit) via d0d1346f209ab66754fe2141d22115934ed6f728 (commit) via aa06cd5cb2c72cc6c883bbfafe43546accce00a1 (commit) via b0e373e595d66bd92b685dd98fc8967d45532e41 (commit) via c47ff2bff6d97a5e7654849965253928a825fe6a (commit) via 428b56863c3963ecd041b8398d5683c92fa64307 (commit) via 7a2364518c4200befb419f2bcbf3afd425fd7a6f (commit) via 4418b4da61646172981fd54e4bfb6a038feb640b (commit) via 64e3dc63966ecf216b354263e4bd5dfd1491abcc (commit) via b45ada159e1eec757eaf5210517139aae4159119 (commit) via aea3466d12e31f8f506c21b856235e2e2aa40090 (commit) via 28991ad74a387ebfe931860b380d25d5b0b67c7d (commit) via 9c88b16bebd0917a6a4e8d0e5fcc64c3581ceff5 (commit) via c328b3e30b17866f4a0fd344d01efca826215cbc (commit) via 11d692de7330b0d6b995fae62746df2ef7830e38 (commit) via 60ac59fb8a391989f2c2e25b288674e6cc63ae60 (commit) via aa60f3c0d59e2ebb870ae4e79c7c4c51c3e22d68 (commit) via e4b4fb4c39f251b0675b1c1dcec14f20135f876b (commit) via 37ef7c28163a5c538f325729855ec47ef6fac6bd (commit) via de0e15b35ea46cfcdd82f45eb3329c44d7aacb90 (commit) via 0feb40bc8408412336c667df4f8bf57c77446ca7 (commit) via 122dfe876d954ee3b3796951df16e1be9e9b0eb8 (commit) via e9be24a2cbbd9bc7075c0fe75d44d51184f84dba (commit) via ba1108f06ae5860c8f418dc383b027068780abf9 (commit) via 73fb5f392dbc1966ec34217e39d565200e071aaf (commit) via 1943e2752d4dcb5bbbd4e40cf854efba4aed8f45 (commit) from 0f292d70f698b8ae885005b5704a96476e876571 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test - Log ----------------------------------------------------------------- commit bb7c5fc4ec77db4073d3beccf12af12910b6bd07 Author: Kai Blin <[EMAIL PROTECTED]> Date: Sat Jun 7 02:25:08 2008 +0200 net: Rename functable3 to functable, get rid of old functables commit b161fb7cfe3d0f5c2e853d5759420817c6ed7c0f Author: Kai Blin <[EMAIL PROTECTED]> Date: Sat Jun 7 02:13:52 2008 +0200 net: Make "net sam" use functable3 commit 08dd5f5311d97544d5cb3067f019260a9161ef81 Author: Kai Blin <[EMAIL PROTECTED]> Date: Sat Jun 7 01:27:41 2008 +0200 net: Make "net rpc registry" use functable3 commit 47f7308e4ee7422a6d9c578c1073b0207969fbb2 Author: Kai Blin <[EMAIL PROTECTED]> Date: Sat Jun 7 01:10:59 2008 +0200 net: Make "net registry" use functable3 commit b8382bc3af318226a1160c6c39627e7a32e050ab Author: Kai Blin <[EMAIL PROTECTED]> Date: Sat Jun 7 01:02:13 2008 +0200 net: Make "net conf" use a functable similar to functable3 commit d0d1346f209ab66754fe2141d22115934ed6f728 Author: Kai Blin <[EMAIL PROTECTED]> Date: Fri Jun 6 11:07:04 2008 +0200 net: Use d_printf() instead of printf() in net_ads_gpo.c commit aa06cd5cb2c72cc6c883bbfafe43546accce00a1 Author: Kai Blin <[EMAIL PROTECTED]> Date: Wed May 21 10:37:10 2008 +0200 net: Make "net rpc service" use functable3 commit b0e373e595d66bd92b685dd98fc8967d45532e41 Author: Kai Blin <[EMAIL PROTECTED]> Date: Wed May 21 10:34:34 2008 +0200 net: Make "net rpc rights" use functable3 commit c47ff2bff6d97a5e7654849965253928a825fe6a Author: Kai Blin <[EMAIL PROTECTED]> Date: Wed May 21 10:31:14 2008 +0200 net: Make "net rpc audit" use functable3 commit 428b56863c3963ecd041b8398d5683c92fa64307 Author: Kai Blin <[EMAIL PROTECTED]> Date: Wed May 21 10:27:59 2008 +0200 net: Make "net rpc" use functable3 commit 7a2364518c4200befb419f2bcbf3afd425fd7a6f Author: Kai Blin <[EMAIL PROTECTED]> Date: Wed May 21 09:05:35 2008 +0200 net: Make "net rap" use functable3 commit 4418b4da61646172981fd54e4bfb6a038feb640b Author: Kai Blin <[EMAIL PROTECTED]> Date: Wed May 21 08:28:15 2008 +0200 net: Make "net ads gpo" use functable3 commit 64e3dc63966ecf216b354263e4bd5dfd1491abcc Author: Kai Blin <[EMAIL PROTECTED]> Date: Tue May 20 13:35:04 2008 +0200 net: Make "net ads" use functable3 commit b45ada159e1eec757eaf5210517139aae4159119 Author: Kai Blin <[EMAIL PROTECTED]> Date: Mon May 19 16:36:18 2008 +0200 net: Make "net usershare" use functable3 commit aea3466d12e31f8f506c21b856235e2e2aa40090 Author: Kai Blin <[EMAIL PROTECTED]> Date: Thu Jun 5 22:14:38 2008 +0200 net: Fix comment for net_time_zone() commit 28991ad74a387ebfe931860b380d25d5b0b67c7d Author: Kai Blin <[EMAIL PROTECTED]> Date: Mon May 19 16:19:37 2008 +0200 net: Make "net time" use functable3 commit 9c88b16bebd0917a6a4e8d0e5fcc64c3581ceff5 Author: Kai Blin <[EMAIL PROTECTED]> Date: Mon May 19 16:10:07 2008 +0200 net: Make "net idmap" use functable3 commit c328b3e30b17866f4a0fd344d01efca826215cbc Author: Kai Blin <[EMAIL PROTECTED]> Date: Mon May 19 15:55:34 2008 +0200 net: Make "net groupmap" use functable3 commit 11d692de7330b0d6b995fae62746df2ef7830e38 Author: Kai Blin <[EMAIL PROTECTED]> Date: Mon May 19 15:46:57 2008 +0200 net: Make "net dom" use functable3 commit 60ac59fb8a391989f2c2e25b288674e6cc63ae60 Author: Kai Blin <[EMAIL PROTECTED]> Date: Mon May 19 15:40:50 2008 +0200 net: Make "net cache" use functable3 commit aa60f3c0d59e2ebb870ae4e79c7c4c51c3e22d68 Author: Kai Blin <[EMAIL PROTECTED]> Date: Mon May 19 15:35:36 2008 +0200 net: Make "net afs" use functable3 commit e4b4fb4c39f251b0675b1c1dcec14f20135f876b Author: Kai Blin <[EMAIL PROTECTED]> Date: Mon May 19 15:30:30 2008 +0200 net: Make "net status" use functable3 commit 37ef7c28163a5c538f325729855ec47ef6fac6bd Author: Kai Blin <[EMAIL PROTECTED]> Date: Mon May 19 00:33:02 2008 +0200 net: Don't try to look up a server if net time is called with a command. commit de0e15b35ea46cfcdd82f45eb3329c44d7aacb90 Author: Kai Blin <[EMAIL PROTECTED]> Date: Thu Jun 5 23:22:19 2008 +0200 net: Add net_display_usage_from_functable() commit 0feb40bc8408412336c667df4f8bf57c77446ca7 Author: Kai Blin <[EMAIL PROTECTED]> Date: Mon May 19 00:19:18 2008 +0200 net: Autogenerate "net help" output from net's functable. commit 122dfe876d954ee3b3796951df16e1be9e9b0eb8 Author: Kai Blin <[EMAIL PROTECTED]> Date: Sun May 25 22:41:58 2008 +0200 net: Use functable3 commit e9be24a2cbbd9bc7075c0fe75d44d51184f84dba Author: Kai Blin <[EMAIL PROTECTED]> Date: Sun May 18 19:12:24 2008 +0200 net: Use functable2 to give a short help text for top-level functions. commit ba1108f06ae5860c8f418dc383b027068780abf9 Author: Kai Blin <[EMAIL PROTECTED]> Date: Thu May 22 09:41:21 2008 +0200 net: Add net_run_function3 commit 73fb5f392dbc1966ec34217e39d565200e071aaf Author: Kai Blin <[EMAIL PROTECTED]> Date: Sun May 18 10:56:32 2008 +0200 net: Move net_run_function/net_run_function2 to net_util.c commit 1943e2752d4dcb5bbbd4e40cf854efba4aed8f45 Author: Kai Blin <[EMAIL PROTECTED]> Date: Wed May 21 10:47:59 2008 +0200 net: Move includes to net.h ----------------------------------------------------------------------- Summary of changes: source/include/includes.h | 14 - source/utils/net.c | 372 +++++++++--- source/utils/net.h | 95 ++-- source/utils/net_ads.c | 712 +++++++++++++++++------- source/utils/net_ads_gpo.c | 245 ++++++--- source/utils/net_afs.c | 23 +- source/utils/net_cache.c | 106 +++- source/utils/net_conf.c | 182 +++++-- source/utils/net_dom.c | 33 +- source/utils/net_groupmap.c | 187 +++++-- source/utils/net_help.c | 91 +-- source/utils/net_idmap.c | 96 +++- source/utils/net_proto.h | 15 +- source/utils/net_rap.c | 660 +++++++++++++++------- source/utils/net_registry.c | 56 ++- source/utils/net_rpc.c | 1198 +++++++++++++++++++++++++++++---------- source/utils/net_rpc_audit.c | 87 +++- source/utils/net_rpc_join.c | 7 + source/utils/net_rpc_registry.c | 138 ++++-- source/utils/net_rpc_rights.c | 83 ++- source/utils/net_rpc_service.c | 118 +++- source/utils/net_rpc_shell.c | 5 +- source/utils/net_sam.c | 461 ++++++++++++---- source/utils/net_status.c | 43 ++- source/utils/net_time.c | 76 ++- source/utils/net_usershare.c | 76 ++- source/utils/net_util.c | 34 ++ 27 files changed, 3775 insertions(+), 1438 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/includes.h b/source/include/includes.h index d9c699a..adbf8f7 100644 --- a/source/include/includes.h +++ b/source/include/includes.h @@ -726,20 +726,6 @@ typedef char fstring[FSTRING_LEN]; #include "lib/smbconf/smbconf.h" -/* used in net.c */ -struct net_context; - -struct functable { - const char *funcname; - int (*fn)(struct net_context *c, int argc, const char **argv); -}; - -struct functable2 { - const char *funcname; - int (*fn)(struct net_context *c, int argc, const char **argv); - const char *helptext; -}; - /* Defines for wisXXX functions. */ #define UNI_UPPER 0x1 #define UNI_LOWER 0x2 diff --git a/source/utils/net.c b/source/utils/net.c index 91070a5..c298fdb 100644 --- a/source/utils/net.c +++ b/source/utils/net.c @@ -85,52 +85,6 @@ uint32 get_sec_channel_type(const char *param) } } -/* - run a function from a function table. If not found then - call the specified usage function -*/ -int net_run_function(struct net_context *c, int argc, const char **argv, - struct functable *table, - int (*usage_fn)(struct net_context *c, - int argc, const char **argv)) -{ - int i; - - if (argc < 1) { - d_printf("\nUsage: \n"); - return usage_fn(c, argc, argv); - } - for (i=0; table[i].funcname; i++) { - if (StrCaseCmp(argv[0], table[i].funcname) == 0) - return table[i].fn(c, argc-1, argv+1); - } - d_fprintf(stderr, "No command: %s\n", argv[0]); - return usage_fn(c, argc, argv); -} - -/* - * run a function from a function table. - */ -int net_run_function2(struct net_context *c, int argc, const char **argv, - const char *whoami, struct functable2 *table) -{ - int i; - - if (argc != 0) { - for (i=0; table[i].funcname; i++) { - if (StrCaseCmp(argv[0], table[i].funcname) == 0) - return table[i].fn(c, argc-1, argv+1); - } - } - - for (i=0; table[i].funcname != NULL; i++) { - d_printf("%s %-15s %s\n", whoami, table[i].funcname, - table[i].helptext); - } - - return -1; -} - static int net_changetrustpw(struct net_context *c, int argc, const char **argv) { if (net_ads_check_our_domain(c) == 0) @@ -360,50 +314,292 @@ static int net_maxrid(struct net_context *c, int argc, const char **argv) /* main function table */ static struct functable net_func[] = { - {"RPC", net_rpc}, - {"RAP", net_rap}, - {"ADS", net_ads}, + { + "rpc", + net_rpc, + NET_TRANSPORT_RPC, + "Run functions using RPC transport", + " Use 'net help rpc' to get more extensive information about " + "'net rpc' commands." + }, + { + "rap", + net_rap, + NET_TRANSPORT_RAP, + "Run functions using RAP transport", + " Use 'net help rap' to get more extensive information about " + "'net rap' commands." + }, + { + "ads", + net_ads, + NET_TRANSPORT_ADS, + "Run functions using ADS transport", + " Use 'net help ads' to get more extensive information about " + "'net ads' commands." + }, /* eventually these should auto-choose the transport ... */ - {"FILE", net_file}, - {"SHARE", net_share}, - {"SESSION", net_rap_session}, - {"SERVER", net_rap_server}, - {"DOMAIN", net_rap_domain}, - {"PRINTQ", net_rap_printq}, - {"USER", net_user}, - {"GROUP", net_group}, - {"GROUPMAP", net_groupmap}, - {"SAM", net_sam}, - {"VALIDATE", net_rap_validate}, - {"GROUPMEMBER", net_rap_groupmember}, - {"ADMIN", net_rap_admin}, - {"SERVICE", net_rap_service}, - {"PASSWORD", net_rap_password}, - {"CHANGETRUSTPW", net_changetrustpw}, - {"CHANGESECRETPW", net_changesecretpw}, - {"TIME", net_time}, - {"LOOKUP", net_lookup}, - {"JOIN", net_join}, - {"DOM", net_dom}, - {"CACHE", net_cache}, - {"GETLOCALSID", net_getlocalsid}, - {"SETLOCALSID", net_setlocalsid}, - {"SETDOMAINSID", net_setdomainsid}, - {"GETDOMAINSID", net_getdomainsid}, - {"MAXRID", net_maxrid}, - {"IDMAP", net_idmap}, - {"STATUS", net_status}, - {"USERSHARE", net_usershare}, - {"USERSIDLIST", net_usersidlist}, - {"CONF", net_conf}, - {"REGISTRY", net_registry}, + { + "file", + net_file, + NET_TRANSPORT_RPC | NET_TRANSPORT_RAP, + "Functions on remote opened files", + " Use 'net help file' to get more information about 'net " + "file' commands." + }, + { + "share", + net_share, + NET_TRANSPORT_RPC | NET_TRANSPORT_RAP, + "Functions on shares", + " Use 'net help share' to get more information about 'net " + "share' commands." + }, + { + "session", + net_rap_session, + NET_TRANSPORT_RAP, + "Manage sessions", + " Use 'net help session' to get more information about 'net " + "session' commands." + }, + { + "server", + net_rap_server, + NET_TRANSPORT_RAP, + "List servers in workgroup", + " Use 'net help server' to get more information about 'net " + "server' commands." + }, + { + "domain", + net_rap_domain, + NET_TRANSPORT_RAP, + "List domains/workgroups on network", + " Use 'net help domain' to get more information about 'net " + "domain' commands." + }, + { + "printq", + net_rap_printq, + NET_TRANSPORT_RAP, + "Modify printer queue", + " Use 'net help printq' to get more information about 'net " + "printq' commands." + }, + { + "user", + net_user, + NET_TRANSPORT_ADS | NET_TRANSPORT_RPC | NET_TRANSPORT_RAP, + "Manage users", + " Use 'net help user' to get more information about 'net " + "user' commands." + }, + { + "group", + net_group, + NET_TRANSPORT_ADS | NET_TRANSPORT_RPC | NET_TRANSPORT_RAP, + "Manage groups", + " Use 'net help group' to get more information about 'net " + "group' commands." + }, + { + "groupmap", + net_groupmap, + NET_TRANSPORT_LOCAL, + "Manage group mappings", + " Use 'net help groupmap' to get more information about 'net " + "groupmap' commands." + }, + { + "sam", + net_sam, + NET_TRANSPORT_LOCAL, + "Functions on the SAM database", + " Use 'net help sam' to get more information about 'net sam' " + "commands." + }, + { + "validate", + net_rap_validate, + NET_TRANSPORT_RAP, + "Validate username and password", + " Use 'net help validate' to get more information about 'net " + "validate' commands." + }, + { + "groupmember", + net_rap_groupmember, + NET_TRANSPORT_RAP, + "Modify group memberships", + " Use 'net help groupmember' to get more information about " + "'net groupmember' commands." + }, + { "admin", + net_rap_admin, + NET_TRANSPORT_RAP, + "Execute remote command on a remote OS/2 server", + " Use 'net help admin' to get more information about 'net " + "admin' commands." + }, + { "service", + net_rap_service, + NET_TRANSPORT_RAP, + "List/modify running services", + " Use 'net help service' to get more information about 'net " + "service' commands." + }, + { + "password", + net_rap_password, + NET_TRANSPORT_RAP, + "Change user password on target server", + " Use 'net help password' to get more information about 'net " + "password' commands." + }, + { "changetrustpw", + net_changetrustpw, + NET_TRANSPORT_ADS | NET_TRANSPORT_RPC, + "Change the trust password", + " Use 'net help changetrustpw' to get more information about " + "'net changetrustpw'." + }, + { "changesecretpw", + net_changesecretpw, + NET_TRANSPORT_LOCAL, + "Change the secret password", + " net [options] changesecretpw\n" + " Change the ADS domain member machine account password in " + "secrets.tdb.\n" + " Do NOT use this function unless you know what it does.\n" + " Requires the -f flag to work." + }, + { "time", + net_time, + NET_TRANSPORT_LOCAL, + "Show/set time", + " Use 'net help time' to get more information about 'net " + "time' commands." + }, + { "lookup", + net_lookup, + NET_TRANSPORT_LOCAL, + "Look up host names/IP addresses", + " Use 'net help lookup' to get more information about 'net " + "lookup' commands." + }, + { "join", + net_join, + NET_TRANSPORT_ADS | NET_TRANSPORT_RPC, + "Join a domain/AD", + " Use 'net help join' to get more information about 'net " + "join'." + }, + { "dom", + net_dom, + NET_TRANSPORT_LOCAL, + "Join/unjoin (remote) machines to/from a domain/AD", + " Use 'net help dom' to get more information about 'net dom' " + "commands." + }, + { "cache", + net_cache, + NET_TRANSPORT_LOCAL, + "Operate on the cache tdb file", + " Use 'net help cache' to get more information about 'net " + "cache' commands." + }, + { "getlocalsid", + net_getlocalsid, + NET_TRANSPORT_LOCAL, + "Get the SID for the local domain", + " net getlocalsid" + }, + { "setlocalsid", + net_setlocalsid, + NET_TRANSPORT_LOCAL, + "Set the SID for the local domain", + " net setlocalsid S-1-5-21-x-y-z" + }, + { "setdomainsid", + net_setdomainsid, + NET_TRANSPORT_LOCAL, + "Set domain SID on member servers", + " net setdomainsid S-1-5-21-x-y-z" + }, + { "getdomainsid", + net_getdomainsid, + NET_TRANSPORT_LOCAL, + "Get domain SID on member servers", + " net getdomainsid" + }, + { "maxrid", + net_maxrid, + NET_TRANSPORT_LOCAL, + "Display the maximul RID currently used", + " net maxrid" + }, + { "idmap", + net_idmap, + NET_TRANSPORT_LOCAL, + "IDmap functions", + " Use 'net help idmap to get more information about 'net " + "idmap' commands." + }, + { "status", + net_status, + NET_TRANSPORT_LOCAL, + "Display server status", + " Use 'net help status' to get more information about 'net " + "status' commands." + }, + { "usershare", + net_usershare, + NET_TRANSPORT_LOCAL, + "Manage user-modifiable shares", + " Use 'net help usershare to get more information about 'net " + "usershare' commands." + }, + { "usersidlist", + net_usersidlist, + NET_TRANSPORT_RPC, + "Display list of all users with SID", + " Use 'net help usersidlist' to get more information about " + "'net usersidlist'." + }, + { "conf", + net_conf, + NET_TRANSPORT_LOCAL, + "Manage Samba registry based configuration", + " Use 'net help conf' to get more information about 'net " + "conf' commands." + }, + { "registry", + net_registry, + NET_TRANSPORT_LOCAL, + "Manage the Samba registry", + " Use 'net help registry' to get more information about 'net " + "registry' commands." + }, #ifdef WITH_FAKE_KASERVER - {"AFS", net_afs}, + { "afs", + net_afs, + NET_TRANSPORT_LOCAL, + "Manage AFS tokens", + " Use 'net help afs' to get more information about 'net afs' " + "commands." + }, #endif - {"HELP", net_help}, - {NULL, NULL} + { "help", + net_help, + NET_TRANSPORT_LOCAL, + "Print usage information", + " Use 'net help help' to list usage information for 'net' " + "commands." + }, + {NULL, NULL, 0, NULL, NULL} }; @@ -475,8 +671,7 @@ static struct functable net_func[] = { while((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { case 'h': - net_help(c, argc, argv); - exit(0); + c->display_usage = true; break; case 'e': c->smb_encrypt = true; @@ -563,7 +758,8 @@ static struct functable net_func[] = { c->opt_password = getenv("PASSWD"); } - rc = net_run_function(c, argc_new-1, argv_new+1, net_func, net_help); + c->private_data = net_func; + rc = net_run_function(c, argc_new-1, argv_new+1, "net", net_func); DEBUG(2,("return code = %d\n", rc)); diff --git a/source/utils/net.h b/source/utils/net.h index 80024bd..ef5cfa7 100644 --- a/source/utils/net.h +++ b/source/utils/net.h @@ -24,6 +24,61 @@ #include "lib/netapi/netapi.h" +struct net_context { + const char *opt_requester_name; + const char *opt_host; + const char *opt_password; + const char *opt_user_name; + bool opt_user_specified; + const char *opt_workgroup; + int opt_long_list_entries; + int opt_reboot; + int opt_force; + int opt_stdin; + int opt_port; + int opt_verbose; + int opt_maxusers; + const char *opt_comment; + const char *opt_container; + int opt_flags; + int opt_timeout; + const char *opt_target_workgroup; + int opt_machine_pass; + int opt_localgroup; + int opt_domaingroup; + int do_talloc_report; + const char *opt_newntname; + int opt_rid; + int opt_acls; + int opt_attrs; + int opt_timestamps; + const char *opt_exclude; + const char *opt_destination; + int opt_testmode; + + int opt_have_ip; + struct sockaddr_storage opt_dest_ip; + bool smb_encrypt; + struct libnetapi_ctx *netapi_ctx; + + bool display_usage; + void *private_data; + const char *share_type[]; +}; + +#define NET_TRANSPORT_LOCAL 0x01 +#define NET_TRANSPORT_RAP 0x02 +#define NET_TRANSPORT_RPC 0x04 +#define NET_TRANSPORT_ADS 0x08 + +struct functable { + const char *funcname; + int (*fn)(struct net_context *c, int argc, const char **argv); + int valid_transports; + const char *description; + const char *usage; +}; + typedef NTSTATUS (*rpc_command_fn)(struct net_context *c, const DOM_SID *, const char *, -- Samba Shared Repository