diff options
Diffstat (limited to 'source3/utils/net_rpc.c')
-rw-r--r-- | source3/utils/net_rpc.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 60adcfdf6e..2b2a69eb99 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -1442,8 +1442,11 @@ static NTSTATUS rpc_shutdown_internals(const DOM_SID *domain_sid, struct cli_sta int argc, const char **argv) { NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - const char *msg = "This machine will be shutdown shortly"; + char *msg = "This machine will be shutdown shortly"; uint32 timeout = 20; + uint16 flgs = 0; + BOOL reboot = opt_reboot; + BOOL force = opt_force; #if 0 poptContext pc; int rc; @@ -1469,6 +1472,12 @@ static NTSTATUS rpc_shutdown_internals(const DOM_SID *domain_sid, struct cli_sta return NT_STATUS_INVALID_PARAMETER; } #endif + if (reboot) { + flgs |= REG_REBOOT_ON_SHUTDOWN; + } + if (force) { + flgs |= REG_FORCE_SHUTDOWN; + } if (opt_comment) { msg = opt_comment; } @@ -1477,7 +1486,7 @@ static NTSTATUS rpc_shutdown_internals(const DOM_SID *domain_sid, struct cli_sta } /* create an entry */ - result = cli_reg_shutdown(cli, mem_ctx, msg, timeout, opt_reboot, opt_force); + result = cli_reg_shutdown(cli, mem_ctx, msg, timeout, flgs); if (NT_STATUS_IS_OK(result)) DEBUG(5,("Shutdown of remote machine succeeded\n")); @@ -1621,6 +1630,10 @@ static int rpc_trustdom_del(int argc, const char **argv) * @return Integer status (0 means success) **/ +extern char *opt_user_name; +extern char *opt_password; +extern char *opt_workgroup; + static int rpc_trustdom_establish(int argc, const char **argv) { struct cli_state *cli; @@ -1656,6 +1669,7 @@ static int rpc_trustdom_establish(int argc, const char **argv) * hence it should be set to remote domain name instead of ours */ if (opt_workgroup) { + SAFE_FREE(opt_workgroup); opt_workgroup = smb_xstrdup(domain_name); }; @@ -1856,13 +1870,18 @@ static NTSTATUS rpc_query_domain_sid(const DOM_SID *domain_sid, struct cli_state }; +extern char* opt_workgroup; +extern char* opt_target_worgroup; +extern char* opt_host; +extern char* opt_password; + static int rpc_trustdom_list(int argc, const char **argv) { /* common variables */ TALLOC_CTX* mem_ctx; struct cli_state *cli, *remote_cli; NTSTATUS nt_status; - const char *domain_name = NULL; + char *domain_name = NULL; DOM_SID queried_dom_sid; fstring ascii_sid, padding; int ascii_dom_name_len; @@ -1890,13 +1909,15 @@ static int rpc_trustdom_list(int argc, const char **argv) * set domain and pdc name to local samba server (default) * or to remote one given in command line */ - - if (StrCaseCmp(opt_workgroup, lp_workgroup())) { + strupper(opt_workgroup); + if (strcmp(opt_workgroup, lp_workgroup())) { domain_name = opt_workgroup; + if (opt_target_workgroup) SAFE_FREE(opt_target_workgroup); opt_target_workgroup = opt_workgroup; } else { - fstrcpy(pdc_name, global_myname()); + safe_strcpy(pdc_name, global_myname(), FSTRING_LEN); domain_name = talloc_strdup(mem_ctx, lp_workgroup()); + if (opt_target_workgroup) SAFE_FREE(opt_target_workgroup); opt_target_workgroup = domain_name; }; @@ -2048,6 +2069,7 @@ static int rpc_trustdom_list(int argc, const char **argv) /* set opt_* variables to remote domain */ strupper(trusting_dom_names[i]); opt_workgroup = talloc_strdup(mem_ctx, trusting_dom_names[i]); + if (opt_target_workgroup) SAFE_FREE(opt_target_workgroup); opt_target_workgroup = opt_workgroup; d_printf("%s%s", trusting_dom_names[i], padding); |