2 Unix SMB/CIFS implementation.
5 Copyright (C) Andrew Tridgell 1992-1998,
6 Copyright (C) Luke Kenneth Casson Leighton 1996-1998,
7 Copyright (C) Paul Ashton 1997-1998.
8 Copyright (C) Jeremy Allison 1999,
9 Copyright (C) Simo Sorce 2001,
10 Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003.
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 /* Shutdown a server */
31 NTSTATUS
cli_shutdown_init(struct cli_state
* cli
, TALLOC_CTX
*mem_ctx
,
32 const char *msg
, uint32 timeout
, BOOL do_reboot
,
39 NTSTATUS result
= NT_STATUS_UNSUCCESSFUL
;
41 if (msg
== NULL
) return NT_STATUS_INVALID_PARAMETER
;
46 prs_init(&qbuf
, MAX_PDU_FRAG_LEN
, mem_ctx
, MARSHALL
);
47 prs_init(&rbuf
, 0, mem_ctx
, UNMARSHALL
);
49 /* Marshall data and send request */
51 init_shutdown_q_init(&q_s
, msg
, timeout
, do_reboot
, force
);
53 if (!shutdown_io_q_init("", &q_s
, &qbuf
, 0) ||
54 !rpc_api_pipe_req(cli
, SHUTDOWN_INIT
, &qbuf
, &rbuf
))
57 /* Unmarshall response */
59 if(shutdown_io_r_init("", &r_s
, &rbuf
, 0))
70 /* Abort a server shutdown */
72 NTSTATUS
cli_shutdown_abort(struct cli_state
* cli
, TALLOC_CTX
*mem_ctx
)
78 NTSTATUS result
= NT_STATUS_UNSUCCESSFUL
;
83 prs_init(&qbuf
, MAX_PDU_FRAG_LEN
, mem_ctx
, MARSHALL
);
84 prs_init(&rbuf
, 0, mem_ctx
, UNMARSHALL
);
86 /* Marshall data and send request */
88 init_shutdown_q_abort(&q_s
);
90 if (!shutdown_io_q_abort("", &q_s
, &qbuf
, 0) ||
91 !rpc_api_pipe_req(cli
, SHUTDOWN_ABORT
, &qbuf
, &rbuf
))
94 /* Unmarshall response */
96 if (shutdown_io_r_abort("", &r_s
, &rbuf
, 0))
101 prs_mem_free(&qbuf
);