diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-05-21 18:04:47 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-05-21 18:04:47 +0200 |
commit | 20796bcf57a7f5e1921dc12e0568221f985fe4f2 (patch) | |
tree | 8f0540a602a9ea0031d656bc31c0b8bc1e91eb70 /source3/utils/net_rpc.c | |
parent | 323be4a6907e4915bb76aa103bf5b868f0b459b1 (diff) | |
parent | 1a416ff13ca7786f2e8d24c66addf00883e9cb12 (diff) | |
download | samba-20796bcf57a7f5e1921dc12e0568221f985fe4f2.tar.gz samba-20796bcf57a7f5e1921dc12e0568221f985fe4f2.tar.bz2 samba-20796bcf57a7f5e1921dc12e0568221f985fe4f2.zip |
Merge branch 'v3-3-test' of ssh://git.samba.org/data/git/samba into docbook
Conflicts:
source/Makefile.in
(This used to be commit 01987778a123f853fccdcb7fe9566143e2d7c490)
Diffstat (limited to 'source3/utils/net_rpc.c')
-rw-r--r-- | source3/utils/net_rpc.c | 139 |
1 files changed, 83 insertions, 56 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 642a4baa45..3779611d01 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -65,7 +65,7 @@ NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx, return result; } - result = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, False, + result = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, false, SEC_RIGHTS_MAXIMUM_ALLOWED, &pol); if (!NT_STATUS_IS_OK(result)) { @@ -571,7 +571,7 @@ int net_rpc_getsid(struct net_context *c, int argc, const char **argv) static int rpc_user_usage(struct net_context *c, int argc, const char **argv) { - return net_help_user(c, argc, argv); + return net_user_usage(c, argc, argv); } /** @@ -1586,7 +1586,7 @@ struct rpc_sh_cmd *net_rpc_user_cmds(struct net_context *c, static int rpc_group_usage(struct net_context *c, int argc, const char **argv) { - return net_help_group(c, argc, argv); + return net_group_usage(c, argc, argv); } /** @@ -1615,7 +1615,7 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c, const char **argv) { POLICY_HND connect_pol, domain_pol, group_pol, user_pol; - bool group_is_primary = False; + bool group_is_primary = false; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; uint32_t group_rid; struct samr_RidTypeArray *rids = NULL; @@ -1727,7 +1727,7 @@ static NTSTATUS rpc_group_delete_internals(struct net_context *c, d_printf("Group is primary group of %s\n", info->info21.account_name.string); } - group_is_primary = True; + group_is_primary = true; } rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); @@ -1978,7 +1978,7 @@ static NTSTATUS get_sid_from_name(struct cli_state *cli, goto done; } - result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, False, + result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, false, SEC_RIGHTS_MAXIMUM_ALLOWED, &lsa_pol); if (!NT_STATUS_IS_OK(result)) { @@ -2443,25 +2443,25 @@ static NTSTATUS rpc_group_list_internals(struct net_context *c, NTSTATUS result = NT_STATUS_UNSUCCESSFUL; uint32 start_idx=0, max_entries=250, num_entries, i, loop_count = 0; struct samr_SamArray *groups = NULL; - bool global = False; - bool local = False; - bool builtin = False; + bool global = false; + bool local = false; + bool builtin = false; if (argc == 0) { - global = True; - local = True; - builtin = True; + global = true; + local = true; + builtin = true; } for (i=0; i<argc; i++) { if (strequal(argv[i], "global")) - global = True; + global = true; if (strequal(argv[i], "local")) - local = True; + local = true; if (strequal(argv[i], "builtin")) - builtin = True; + builtin = true; } /* Get sam policy handle */ @@ -2774,7 +2774,7 @@ static NTSTATUS rpc_list_alias_members(struct net_context *c, return result; } - result = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, True, + result = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, true, SEC_RIGHTS_MAXIMUM_ALLOWED, &lsa_pol); if (!NT_STATUS_IS_OK(result)) { @@ -3059,7 +3059,7 @@ int net_rpc_group(struct net_context *c, int argc, const char **argv) static int rpc_share_usage(struct net_context *c, int argc, const char **argv) { - return net_help_share(c, argc, argv); + return net_share_usage(c, argc, argv); } /** @@ -3371,13 +3371,13 @@ static bool check_share_availability(struct cli_state *cli, const char *netname) { if (!cli_send_tconX(cli, netname, "A:", "", 0)) { d_printf("skipping [%s]: not a file share.\n", netname); - return False; + return false; } if (!cli_tdis(cli)) - return False; + return false; - return True; + return true; } static bool check_share_sanity(struct net_context *c, struct cli_state *cli, @@ -3386,18 +3386,18 @@ static bool check_share_sanity(struct net_context *c, struct cli_state *cli, /* only support disk shares */ if (! ( type == STYPE_DISKTREE || type == (STYPE_DISKTREE | STYPE_HIDDEN)) ) { printf("share [%s] is not a diskshare (type: %x)\n", netname, type); - return False; + return false; } /* skip builtin shares */ /* FIXME: should print$ be added too ? */ if (strequal(netname,"IPC$") || strequal(netname,"ADMIN$") || strequal(netname,"global")) - return False; + return false; - if (c->opt_exclude && in_list(netname, c->opt_exclude, False)) { + if (c->opt_exclude && in_list(netname, c->opt_exclude, false)) { printf("excluding [%s]\n", netname); - return False; + return false; } return check_share_availability(cli, netname); @@ -3644,16 +3644,16 @@ static bool sync_files(struct copy_clistate *cp_clistate, const char *mask) mask, &targetcli, &targetpath ) ) { d_fprintf(stderr, "cli_resolve_path %s failed with error: %s\n", mask, cli_errstr(cp_clistate->cli_share_src)); - return False; + return false; } if (cli_list(targetcli, targetpath, cp_clistate->attribute, copy_fn, cp_clistate) == -1) { d_fprintf(stderr, "listing %s failed with error: %s\n", mask, cli_errstr(targetcli)); - return False; + return false; } - return True; + return true; } @@ -3689,10 +3689,10 @@ bool copy_top_level_perms(struct net_context *c, if (!NT_STATUS_IS_OK(nt_status)) { printf("Could handle directory attributes for top level directory of share %s. Error %s\n", sharename, nt_errstr(nt_status)); - return False; + return false; } - return True; + return true; } /** @@ -3726,8 +3726,8 @@ static NTSTATUS rpc_share_migrate_files_internals(struct net_context *c, uint32 i; uint32 level = 502; struct copy_clistate cp_clistate; - bool got_src_share = False; - bool got_dst_share = False; + bool got_src_share = false; + bool got_dst_share = false; const char *mask = "\\*"; char *dst = NULL; @@ -3782,7 +3782,7 @@ static NTSTATUS rpc_share_migrate_files_internals(struct net_context *c, if (!NT_STATUS_IS_OK(nt_status)) goto done; - got_src_share = True; + got_src_share = true; if (net_mode_share == NET_MODE_SHARE_MIGRATE) { /* open share destination */ @@ -3791,7 +3791,7 @@ static NTSTATUS rpc_share_migrate_files_internals(struct net_context *c, if (!NT_STATUS_IS_OK(nt_status)) goto done; - got_dst_share = True; + got_dst_share = true; } if (!copy_top_level_perms(c, &cp_clistate, info502.name)) { @@ -4138,7 +4138,7 @@ static NTSTATUS rpc_aliaslist_dump(struct net_context *c, NTSTATUS result; POLICY_HND lsa_pol; - result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, True, + result = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true, SEC_RIGHTS_MAXIMUM_ALLOWED, &lsa_pol); if (!NT_STATUS_IS_OK(result)) @@ -4252,9 +4252,9 @@ static bool is_sid_in_token(NT_USER_TOKEN *token, DOM_SID *sid) for (i=0; i<token->num_sids; i++) { if (sid_compare(sid, &token->user_sids[i]) == 0) - return True; + return true; } - return False; + return false; } static void add_sid_to_token(NT_USER_TOKEN *token, DOM_SID *sid) @@ -4294,10 +4294,10 @@ static bool is_alias_member(DOM_SID *sid, struct full_alias *alias) for (i=0; i<alias->num_members; i++) { if (sid_compare(sid, &alias->members[i]) == 0) - return True; + return true; } - return False; + return false; } static void collect_sid_memberships(NT_USER_TOKEN *token, DOM_SID sid) @@ -4489,7 +4489,7 @@ static bool get_user_tokens_from_file(FILE *f, fstring line; if (fgets(line, sizeof(line)-1, f) == NULL) { - return True; + return true; } if (line[strlen(line)-1] == '\n') @@ -4503,7 +4503,7 @@ static bool get_user_tokens_from_file(FILE *f, if (token == NULL) { DEBUG(0, ("File does not begin with username")); - return False; + return false; } add_sid_to_token(&token->token, &sid); @@ -4516,7 +4516,7 @@ static bool get_user_tokens_from_file(FILE *f, *tokens = SMB_REALLOC_ARRAY(*tokens, struct user_token, *num_tokens); if (*tokens == NULL) { DEBUG(0, ("Could not realloc tokens\n")); - return False; + return false; } token = &((*tokens)[*num_tokens-1]); @@ -4527,7 +4527,7 @@ static bool get_user_tokens_from_file(FILE *f, continue; } - return False; + return false; } @@ -4968,7 +4968,7 @@ struct rpc_sh_cmd *net_rpc_share_cmds(struct net_context *c, TALLOC_CTX *mem_ctx static int rpc_file_usage(struct net_context *c, int argc, const char **argv) { - return net_help_file(c, argc, argv); + return net_file_usage(c, argc, argv); } /** @@ -5867,7 +5867,7 @@ static int rpc_trustdom_establish(struct net_context *c, int argc, return -1; } - nt_status = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, True, SEC_RIGHTS_QUERY_VALUE, + nt_status = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, true, SEC_RIGHTS_QUERY_VALUE, &connect_hnd); if (NT_STATUS_IS_ERR(nt_status)) { DEBUG(0, ("Couldn't open policy handle. Error was %s\n", @@ -6131,7 +6131,7 @@ static int rpc_trustdom_vampire(struct net_context *c, int argc, return -1; }; - nt_status = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, False, SEC_RIGHTS_QUERY_VALUE, + nt_status = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, false, SEC_RIGHTS_QUERY_VALUE, &connect_hnd); if (NT_STATUS_IS_ERR(nt_status)) { DEBUG(0, ("Couldn't open policy handle. Error was %s\n", @@ -6280,7 +6280,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv) return -1; }; - nt_status = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, False, SEC_RIGHTS_QUERY_VALUE, + nt_status = rpccli_lsa_open_policy2(pipe_hnd, mem_ctx, false, SEC_RIGHTS_QUERY_VALUE, &connect_hnd); if (NT_STATUS_IS_ERR(nt_status)) { DEBUG(0, ("Couldn't open policy handle. Error was %s\n", @@ -6527,17 +6527,17 @@ static int rpc_trustdom(struct net_context *c, int argc, const char **argv) bool net_rpc_check(struct net_context *c, unsigned flags) { struct cli_state *cli; - bool ret = False; + bool ret = false; struct sockaddr_storage server_ss; char *server_name = NULL; NTSTATUS status; /* flags (i.e. server type) may depend on command */ if (!net_find_server(c, NULL, flags, &server_ss, &server_name)) - return False; + return false; if ((cli = cli_initialise()) == NULL) { - return False; + return false; } status = cli_connect(cli, server_name, &server_ss); @@ -6551,7 +6551,7 @@ bool net_rpc_check(struct net_context *c, unsigned flags) if (cli->protocol < PROTOCOL_NT1) goto done; - ret = True; + ret = true; done: cli_shutdown(cli); return ret; @@ -6925,7 +6925,33 @@ static int rpc_printer_publish(struct net_context *c, int argc, **/ int rpc_printer_usage(struct net_context *c, int argc, const char **argv) { - return net_help_printer(c, argc, argv); + d_printf("net rpc printer LIST [printer] [misc. options] [targets]\n"\ + "\tlists all printers on print-server\n\n"); + d_printf("net rpc printer DRIVER [printer] [misc. options] [targets]\n"\ + "\tlists all printer-drivers on print-server\n\n"); + d_printf("net rpc printer PUBLISH action [printer] [misc. options] [targets]\n"\ + "\tpublishes printer settings in Active Directory\n" + "\taction can be one of PUBLISH, UPDATE, UNPUBLISH or LIST\n\n"); + d_printf("net rpc printer MIGRATE PRINTERS [printer] [misc. options] [targets]"\ + "\n\tmigrates printers from remote to local server\n\n"); + d_printf("net rpc printer MIGRATE SETTINGS [printer] [misc. options] [targets]"\ + "\n\tmigrates printer-settings from remote to local server\n\n"); + d_printf("net rpc printer MIGRATE DRIVERS [printer] [misc. options] [targets]"\ + "\n\tmigrates printer-drivers from remote to local server\n\n"); + d_printf("net rpc printer MIGRATE FORMS [printer] [misc. options] [targets]"\ + "\n\tmigrates printer-forms from remote to local server\n\n"); + d_printf("net rpc printer MIGRATE SECURITY [printer] [misc. options] [targets]"\ + "\n\tmigrates printer-ACLs from remote to local server\n\n"); + d_printf("net rpc printer MIGRATE ALL [printer] [misc. options] [targets]"\ + "\n\tmigrates drivers, forms, queues, settings and acls from\n"\ + "\tremote to local print-server\n\n"); + net_common_methods_usage(c, argc, argv); + net_common_flags_usage(c, argc, argv); + d_printf( + "\t-v or --verbose\t\t\tgive verbose output\n" + "\t --destination\t\tmigration target server (default: localhost)\n"); + + return -1; } /** @@ -6958,7 +6984,7 @@ int net_rpc_printer(struct net_context *c, int argc, const char **argv) /** - * Basic usage function for 'net rpc' + * Basic help function for 'net rpc' * * @param c A net_context structure * @param argc Standard main() style argc @@ -6966,7 +6992,7 @@ int net_rpc_printer(struct net_context *c, int argc, const char **argv) * stripped **/ -int net_rpc_usage(struct net_context *c, int argc, const char **argv) +int net_rpc_help(struct net_context *c, int argc, const char **argv) { d_printf(" net rpc info \t\t\tshow basic info about a domain \n"); d_printf(" net rpc join \t\t\tto join a domain \n"); @@ -7010,7 +7036,7 @@ int net_rpc_usage(struct net_context *c, int argc, const char **argv) * stripped **/ -int net_rpc_help(struct net_context *c, int argc, const char **argv) +int net_rpc_usage(struct net_context *c, int argc, const char **argv) { struct functable func[] = { {"join", rpc_join_usage}, @@ -7022,15 +7048,16 @@ int net_rpc_help(struct net_context *c, int argc, const char **argv) /*{"abortshutdown", rpc_shutdown_abort_usage},*/ /*{"shutdown", rpc_shutdown_usage}, */ {"vampire", rpc_vampire_usage}, + {"help", net_rpc_help}, {NULL, NULL} }; if (argc == 0) { - net_rpc_usage(c, argc, argv); + net_rpc_help(c, argc, argv); return -1; } - return net_run_function(c, argc, argv, func, rpc_user_usage); + return net_run_function(c, argc, argv, func, net_rpc_help); } /** |