mirror of
https://github.com/samba-team/samba.git
synced 2025-09-17 05:44:20 +03:00
s3-initshutdown: prefer dcerpc_initshutdown_X functions.
Guenther
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
#include "lib/netapi/netapi.h"
|
#include "lib/netapi/netapi.h"
|
||||||
#include "lib/netapi/netapi_private.h"
|
#include "lib/netapi/netapi_private.h"
|
||||||
#include "lib/netapi/libnetapi.h"
|
#include "lib/netapi/libnetapi.h"
|
||||||
#include "../librpc/gen_ndr/cli_initshutdown.h"
|
#include "../librpc/gen_ndr/ndr_initshutdown_c.h"
|
||||||
#include "rpc_client/init_lsa.h"
|
#include "rpc_client/init_lsa.h"
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
@@ -36,6 +36,7 @@ WERROR NetShutdownInit_r(struct libnetapi_ctx *ctx,
|
|||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
struct rpc_pipe_client *pipe_cli = NULL;
|
struct rpc_pipe_client *pipe_cli = NULL;
|
||||||
struct lsa_StringLarge message;
|
struct lsa_StringLarge message;
|
||||||
|
struct dcerpc_binding_handle *b;
|
||||||
|
|
||||||
werr = libnetapi_open_pipe(ctx, r->in.server_name,
|
werr = libnetapi_open_pipe(ctx, r->in.server_name,
|
||||||
&ndr_table_initshutdown.syntax_id,
|
&ndr_table_initshutdown.syntax_id,
|
||||||
@@ -44,9 +45,11 @@ WERROR NetShutdownInit_r(struct libnetapi_ctx *ctx,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b = pipe_cli->binding_handle;
|
||||||
|
|
||||||
init_lsa_StringLarge(&message, r->in.message);
|
init_lsa_StringLarge(&message, r->in.message);
|
||||||
|
|
||||||
status = rpccli_initshutdown_Init(pipe_cli, talloc_tos(),
|
status = dcerpc_initshutdown_Init(b, talloc_tos(),
|
||||||
NULL,
|
NULL,
|
||||||
&message,
|
&message,
|
||||||
r->in.timeout,
|
r->in.timeout,
|
||||||
@@ -80,6 +83,7 @@ WERROR NetShutdownAbort_r(struct libnetapi_ctx *ctx,
|
|||||||
WERROR werr;
|
WERROR werr;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
struct rpc_pipe_client *pipe_cli = NULL;
|
struct rpc_pipe_client *pipe_cli = NULL;
|
||||||
|
struct dcerpc_binding_handle *b;
|
||||||
|
|
||||||
werr = libnetapi_open_pipe(ctx, r->in.server_name,
|
werr = libnetapi_open_pipe(ctx, r->in.server_name,
|
||||||
&ndr_table_initshutdown.syntax_id,
|
&ndr_table_initshutdown.syntax_id,
|
||||||
@@ -88,7 +92,9 @@ WERROR NetShutdownAbort_r(struct libnetapi_ctx *ctx,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = rpccli_initshutdown_Abort(pipe_cli, talloc_tos(),
|
b = pipe_cli->binding_handle;
|
||||||
|
|
||||||
|
status = dcerpc_initshutdown_Abort(b, talloc_tos(),
|
||||||
NULL,
|
NULL,
|
||||||
&werr);
|
&werr);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#include "../librpc/gen_ndr/cli_netlogon.h"
|
#include "../librpc/gen_ndr/cli_netlogon.h"
|
||||||
#include "../librpc/gen_ndr/cli_srvsvc.h"
|
#include "../librpc/gen_ndr/cli_srvsvc.h"
|
||||||
#include "../librpc/gen_ndr/cli_spoolss.h"
|
#include "../librpc/gen_ndr/cli_spoolss.h"
|
||||||
#include "../librpc/gen_ndr/cli_initshutdown.h"
|
#include "../librpc/gen_ndr/ndr_initshutdown_c.h"
|
||||||
#include "../librpc/gen_ndr/cli_winreg.h"
|
#include "../librpc/gen_ndr/cli_winreg.h"
|
||||||
#include "secrets.h"
|
#include "secrets.h"
|
||||||
#include "lib/netapi/netapi.h"
|
#include "lib/netapi/netapi.h"
|
||||||
@@ -5073,17 +5073,21 @@ static NTSTATUS rpc_shutdown_abort_internals(struct net_context *c,
|
|||||||
int argc,
|
int argc,
|
||||||
const char **argv)
|
const char **argv)
|
||||||
{
|
{
|
||||||
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
|
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
|
||||||
|
WERROR result;
|
||||||
|
struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
|
||||||
|
|
||||||
result = rpccli_initshutdown_Abort(pipe_hnd, mem_ctx, NULL, NULL);
|
status = dcerpc_initshutdown_Abort(b, mem_ctx, NULL, &result);
|
||||||
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
if (NT_STATUS_IS_OK(result)) {
|
return status;
|
||||||
|
}
|
||||||
|
if (W_ERROR_IS_OK(result)) {
|
||||||
d_printf(_("\nShutdown successfully aborted\n"));
|
d_printf(_("\nShutdown successfully aborted\n"));
|
||||||
DEBUG(5,("cmd_shutdown_abort: query succeeded\n"));
|
DEBUG(5,("cmd_shutdown_abort: query succeeded\n"));
|
||||||
} else
|
} else
|
||||||
DEBUG(5,("cmd_shutdown_abort: query failed\n"));
|
DEBUG(5,("cmd_shutdown_abort: query failed\n"));
|
||||||
|
|
||||||
return result;
|
return werror_to_ntstatus(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5188,10 +5192,12 @@ NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
|
|||||||
int argc,
|
int argc,
|
||||||
const char **argv)
|
const char **argv)
|
||||||
{
|
{
|
||||||
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
|
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
|
||||||
|
WERROR result;
|
||||||
const char *msg = N_("This machine will be shutdown shortly");
|
const char *msg = N_("This machine will be shutdown shortly");
|
||||||
uint32 timeout = 20;
|
uint32 timeout = 20;
|
||||||
struct lsa_StringLarge msg_string;
|
struct lsa_StringLarge msg_string;
|
||||||
|
struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
|
||||||
|
|
||||||
if (c->opt_comment) {
|
if (c->opt_comment) {
|
||||||
msg = c->opt_comment;
|
msg = c->opt_comment;
|
||||||
@@ -5203,17 +5209,19 @@ NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
|
|||||||
msg_string.string = msg;
|
msg_string.string = msg;
|
||||||
|
|
||||||
/* create an entry */
|
/* create an entry */
|
||||||
result = rpccli_initshutdown_Init(pipe_hnd, mem_ctx, NULL,
|
status = dcerpc_initshutdown_Init(b, mem_ctx, NULL,
|
||||||
&msg_string, timeout, c->opt_force, c->opt_reboot,
|
&msg_string, timeout, c->opt_force, c->opt_reboot,
|
||||||
NULL);
|
&result);
|
||||||
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
if (NT_STATUS_IS_OK(result)) {
|
return status;
|
||||||
|
}
|
||||||
|
if (W_ERROR_IS_OK(result)) {
|
||||||
d_printf(_("\nShutdown of remote machine succeeded\n"));
|
d_printf(_("\nShutdown of remote machine succeeded\n"));
|
||||||
DEBUG(5,("Shutdown of remote machine succeeded\n"));
|
DEBUG(5,("Shutdown of remote machine succeeded\n"));
|
||||||
} else {
|
} else {
|
||||||
DEBUG(1,("Shutdown of remote machine failed!\n"));
|
DEBUG(1,("Shutdown of remote machine failed!\n"));
|
||||||
}
|
}
|
||||||
return result;
|
return werror_to_ntstatus(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user