2 * Unix SMB/CIFS implementation.
3 * NetApi Shutdown Support
4 * Copyright (C) Guenther Deschner 2009
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 #include "librpc/gen_ndr/libnetapi.h"
23 #include "lib/netapi/netapi.h"
24 #include "lib/netapi/netapi_private.h"
25 #include "lib/netapi/libnetapi.h"
27 /****************************************************************
28 ****************************************************************/
30 WERROR NetShutdownInit_r(struct libnetapi_ctx *ctx,
31 struct NetShutdownInit *r)
35 struct rpc_pipe_client *pipe_cli = NULL;
36 struct lsa_StringLarge message;
38 werr = libnetapi_open_pipe(ctx, r->in.server_name,
39 &ndr_table_initshutdown.syntax_id,
41 if (!W_ERROR_IS_OK(werr)) {
45 init_lsa_StringLarge(&message, r->in.message);
47 status = rpccli_initshutdown_Init(pipe_cli, ctx,
54 if (!NT_STATUS_IS_OK(status)) {
55 werr = ntstatus_to_werror(status);
63 /****************************************************************
64 ****************************************************************/
66 WERROR NetShutdownInit_l(struct libnetapi_ctx *ctx,
67 struct NetShutdownInit *r)
69 LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetShutdownInit);
72 /****************************************************************
73 ****************************************************************/
75 WERROR NetShutdownAbort_r(struct libnetapi_ctx *ctx,
76 struct NetShutdownAbort *r)
80 struct rpc_pipe_client *pipe_cli = NULL;
82 werr = libnetapi_open_pipe(ctx, r->in.server_name,
83 &ndr_table_initshutdown.syntax_id,
85 if (!W_ERROR_IS_OK(werr)) {
89 status = rpccli_initshutdown_Abort(pipe_cli, ctx,
92 if (!NT_STATUS_IS_OK(status)) {
93 werr = ntstatus_to_werror(status);
101 /****************************************************************
102 ****************************************************************/
104 WERROR NetShutdownAbort_l(struct libnetapi_ctx *ctx,
105 struct NetShutdownAbort *r)
107 LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetShutdownAbort);