s3-netapi: add NetShutdownInit and NetShutdownAbort skeletons.
authorGünther Deschner <gd@samba.org>
Wed, 13 May 2009 14:27:58 +0000 (16:27 +0200)
committerGünther Deschner <gd@samba.org>
Thu, 14 May 2009 12:18:26 +0000 (14:18 +0200)
Guenther

source3/Makefile.in
source3/lib/netapi/libnetapi.c
source3/lib/netapi/libnetapi.h
source3/lib/netapi/shutdown.c [new file with mode: 0644]

index 190560a..1e6f681 100644 (file)
@@ -2035,7 +2035,8 @@ LIBNETAPI_OBJ0 = lib/netapi/netapi.o \
                 lib/netapi/samr.o \
                 lib/netapi/sid.o \
                 lib/netapi/share.o \
-                lib/netapi/file.o
+                lib/netapi/file.o \
+                lib/netapi/shutdown.o
 
 LIBNETAPI_OBJ  = $(LIBNETAPI_OBJ0) $(LIBNET_OBJ) \
                 $(LIBSMBCONF_OBJ) \
index 043190a..6e36667 100644 (file)
@@ -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;
+}
+
index 1b84b75..3eab6e6 100644 (file)
@@ -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 (file)
index 0000000..70c0980
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+
+#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);
+}