From 8fd3c8902c5e953a0ddf184b08f9e37f954ee12e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 13 May 2009 16:27:58 +0200 Subject: s3-netapi: add NetShutdownInit and NetShutdownAbort skeletons. Guenther --- source3/lib/netapi/libnetapi.c | 88 ++++++++++++++++++++++++++++++++++++++++++ source3/lib/netapi/libnetapi.h | 14 +++++++ source3/lib/netapi/shutdown.c | 61 +++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 source3/lib/netapi/shutdown.c (limited to 'source3/lib/netapi') diff --git a/source3/lib/netapi/libnetapi.c b/source3/lib/netapi/libnetapi.c index 043190a1f9..6e366673f1 100644 --- a/source3/lib/netapi/libnetapi.c +++ b/source3/lib/netapi/libnetapi.c @@ -2353,3 +2353,91 @@ NET_API_STATUS NetFileEnum(const char * server_name /* [in] */, return r.out.result; } +/**************************************************************** + NetShutdownInit +****************************************************************/ + +NET_API_STATUS NetShutdownInit(const char * server_name /* [in] */, + const char * message /* [in] */, + uint32_t timeout /* [in] */, + uint8_t force_apps /* [in] */, + uint8_t do_reboot /* [in] */) +{ + struct NetShutdownInit r; + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status; + WERROR werr; + + status = libnetapi_getctx(&ctx); + if (status != 0) { + return status; + } + + /* In parameters */ + r.in.server_name = server_name; + r.in.message = message; + r.in.timeout = timeout; + r.in.force_apps = force_apps; + r.in.do_reboot = do_reboot; + + /* Out parameters */ + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(NetShutdownInit, &r); + } + + if (LIBNETAPI_LOCAL_SERVER(server_name)) { + werr = NetShutdownInit_l(ctx, &r); + } else { + werr = NetShutdownInit_r(ctx, &r); + } + + r.out.result = W_ERROR_V(werr); + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(NetShutdownInit, &r); + } + + return r.out.result; +} + +/**************************************************************** + NetShutdownAbort +****************************************************************/ + +NET_API_STATUS NetShutdownAbort(const char * server_name /* [in] */) +{ + struct NetShutdownAbort r; + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status; + WERROR werr; + + status = libnetapi_getctx(&ctx); + if (status != 0) { + return status; + } + + /* In parameters */ + r.in.server_name = server_name; + + /* Out parameters */ + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(NetShutdownAbort, &r); + } + + if (LIBNETAPI_LOCAL_SERVER(server_name)) { + werr = NetShutdownAbort_l(ctx, &r); + } else { + werr = NetShutdownAbort_r(ctx, &r); + } + + r.out.result = W_ERROR_V(werr); + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(NetShutdownAbort, &r); + } + + return r.out.result; +} + diff --git a/source3/lib/netapi/libnetapi.h b/source3/lib/netapi/libnetapi.h index 1b84b75f94..3eab6e61ab 100644 --- a/source3/lib/netapi/libnetapi.h +++ b/source3/lib/netapi/libnetapi.h @@ -426,4 +426,18 @@ WERROR NetFileEnum_r(struct libnetapi_ctx *ctx, struct NetFileEnum *r); WERROR NetFileEnum_l(struct libnetapi_ctx *ctx, struct NetFileEnum *r); +NET_API_STATUS NetShutdownInit(const char * server_name /* [in] */, + const char * message /* [in] */, + uint32_t timeout /* [in] */, + uint8_t force_apps /* [in] */, + uint8_t do_reboot /* [in] */); +WERROR NetShutdownInit_r(struct libnetapi_ctx *ctx, + struct NetShutdownInit *r); +WERROR NetShutdownInit_l(struct libnetapi_ctx *ctx, + struct NetShutdownInit *r); +NET_API_STATUS NetShutdownAbort(const char * server_name /* [in] */); +WERROR NetShutdownAbort_r(struct libnetapi_ctx *ctx, + struct NetShutdownAbort *r); +WERROR NetShutdownAbort_l(struct libnetapi_ctx *ctx, + struct NetShutdownAbort *r); #endif /* __LIBNETAPI_LIBNETAPI__ */ diff --git a/source3/lib/netapi/shutdown.c b/source3/lib/netapi/shutdown.c new file mode 100644 index 0000000000..70c0980a44 --- /dev/null +++ b/source3/lib/netapi/shutdown.c @@ -0,0 +1,61 @@ +/* + * Unix SMB/CIFS implementation. + * NetApi Shutdown Support + * Copyright (C) Guenther Deschner 2009 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "includes.h" + +#include "librpc/gen_ndr/libnetapi.h" +#include "lib/netapi/netapi.h" +#include "lib/netapi/netapi_private.h" +#include "lib/netapi/libnetapi.h" + +/**************************************************************** +****************************************************************/ + +WERROR NetShutdownInit_r(struct libnetapi_ctx *ctx, + struct NetShutdownInit *r) +{ + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR NetShutdownInit_l(struct libnetapi_ctx *ctx, + struct NetShutdownInit *r) +{ + LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetShutdownInit); +} + +/**************************************************************** +****************************************************************/ + +WERROR NetShutdownAbort_r(struct libnetapi_ctx *ctx, + struct NetShutdownAbort *r) +{ + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR NetShutdownAbort_l(struct libnetapi_ctx *ctx, + struct NetShutdownAbort *r) +{ + LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetShutdownAbort); +} -- cgit