LCOV - code coverage report
Current view: top level - source3/rpcclient - cmd_clusapi.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 0 218 0.0 %
Date: 2024-04-21 15:09:00 Functions: 0 13 0.0 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             :    RPC pipe client
       4             : 
       5             :    Copyright (C) Günther Deschner 2015
       6             : 
       7             :    This program is free software; you can redistribute it and/or modify
       8             :    it under the terms of the GNU General Public License as published by
       9             :    the Free Software Foundation; either version 3 of the License, or
      10             :    (at your option) any later version.
      11             : 
      12             :    This program is distributed in the hope that it will be useful,
      13             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :    GNU General Public License for more details.
      16             : 
      17             :    You should have received a copy of the GNU General Public License
      18             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      19             : */
      20             : 
      21             : #include "includes.h"
      22             : #include "rpcclient.h"
      23             : #include "../librpc/gen_ndr/ndr_clusapi_c.h"
      24             : 
      25           0 : static WERROR cmd_clusapi_open_cluster(struct rpc_pipe_client *cli,
      26             :                                        TALLOC_CTX *mem_ctx,
      27             :                                        int argc,
      28             :                                        const char **argv)
      29             : {
      30           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
      31             :         NTSTATUS status;
      32             :         WERROR error;
      33             :         struct policy_handle Cluster;
      34             : 
      35           0 :         status = dcerpc_clusapi_OpenCluster(b, mem_ctx,
      36             :                                             &error,
      37             :                                             &Cluster);
      38           0 :         if (!NT_STATUS_IS_OK(status)) {
      39           0 :                 return ntstatus_to_werror(status);
      40             :         }
      41             : 
      42           0 :         if (!W_ERROR_IS_OK(error)) {
      43           0 :                 printf("error: %s\n", win_errstr(error));
      44           0 :                 return error;
      45             :         }
      46             : 
      47           0 :         printf("successfully opened cluster\n");
      48             : 
      49           0 :         status = dcerpc_clusapi_CloseCluster(b, mem_ctx,
      50             :                                              &Cluster,
      51             :                                              &error);
      52           0 :         if (!NT_STATUS_IS_OK(status)) {
      53           0 :                 return ntstatus_to_werror(status);
      54             :         }
      55             : 
      56           0 :         if (!W_ERROR_IS_OK(error)) {
      57           0 :                 printf("error: %s\n", win_errstr(error));
      58           0 :                 return error;
      59             :         }
      60             : 
      61           0 :         printf("successfully closed cluster\n");
      62             : 
      63           0 :         return WERR_OK;
      64             : }
      65             : 
      66           0 : static WERROR cmd_clusapi_get_cluster_name(struct rpc_pipe_client *cli,
      67             :                                            TALLOC_CTX *mem_ctx,
      68             :                                            int argc,
      69             :                                            const char **argv)
      70             : {
      71           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
      72             :         NTSTATUS status;
      73             :         WERROR error;
      74             :         const char *ClusterName;
      75             :         const char *NodeName;
      76             : 
      77           0 :         status = dcerpc_clusapi_GetClusterName(b, mem_ctx,
      78             :                                                &ClusterName,
      79             :                                                &NodeName,
      80             :                                                &error);
      81           0 :         if (!NT_STATUS_IS_OK(status)) {
      82           0 :                 return ntstatus_to_werror(status);
      83             :         }
      84             : 
      85           0 :         if (!W_ERROR_IS_OK(error)) {
      86           0 :                 printf("error: %s\n", win_errstr(error));
      87           0 :                 return error;
      88             :         }
      89             : 
      90           0 :         printf("ClusterName: %s\n", ClusterName);
      91           0 :         printf("NodeName: %s\n", NodeName);
      92             : 
      93           0 :         return WERR_OK;
      94             : }
      95             : 
      96           0 : static WERROR cmd_clusapi_get_cluster_version(struct rpc_pipe_client *cli,
      97             :                                               TALLOC_CTX *mem_ctx,
      98             :                                               int argc,
      99             :                                               const char **argv)
     100             : {
     101           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     102             :         NTSTATUS status;
     103             :         WERROR error;
     104             :         uint16_t lpwMajorVersion;
     105             :         uint16_t lpwMinorVersion;
     106             :         uint16_t lpwBuildNumber;
     107             :         const char *lpszVendorId;
     108             :         const char *lpszCSDVersion;
     109             : 
     110           0 :         status = dcerpc_clusapi_GetClusterVersion(b, mem_ctx,
     111             :                                                   &lpwMajorVersion,
     112             :                                                   &lpwMinorVersion,
     113             :                                                   &lpwBuildNumber,
     114             :                                                   &lpszVendorId,
     115             :                                                   &lpszCSDVersion,
     116             :                                                   &error);
     117           0 :         if (!NT_STATUS_IS_OK(status)) {
     118           0 :                 return ntstatus_to_werror(status);
     119             :         }
     120             : 
     121           0 :         if (!W_ERROR_IS_OK(error)) {
     122           0 :                 printf("error: %s\n", win_errstr(error));
     123           0 :                 return error;
     124             :         }
     125             : 
     126           0 :         printf("lpwMajorVersion: %d\n", lpwMajorVersion);
     127           0 :         printf("lpwMinorVersion: %d\n", lpwMinorVersion);
     128           0 :         printf("lpwBuildNumber: %d\n", lpwBuildNumber);
     129           0 :         printf("lpszVendorId: %s\n", lpszVendorId);
     130           0 :         printf("lpszCSDVersion: %s\n", lpszCSDVersion);
     131             : 
     132           0 :         return WERR_OK;
     133             : }
     134             : 
     135           0 : static WERROR cmd_clusapi_get_quorum_resource(struct rpc_pipe_client *cli,
     136             :                                               TALLOC_CTX *mem_ctx,
     137             :                                               int argc,
     138             :                                               const char **argv)
     139             : {
     140           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     141             :         NTSTATUS status;
     142             :         WERROR error;
     143             :         const char *lpszResourceName;
     144             :         const char *lpszDeviceName;
     145             :         uint32_t pdwMaxQuorumLogSize;
     146             :         WERROR rpc_status;
     147             : 
     148           0 :         status = dcerpc_clusapi_GetQuorumResource(b, mem_ctx,
     149             :                                                   &lpszResourceName,
     150             :                                                   &lpszDeviceName,
     151             :                                                   &pdwMaxQuorumLogSize,
     152             :                                                   &rpc_status,
     153             :                                                   &error);
     154           0 :         if (!NT_STATUS_IS_OK(status)) {
     155           0 :                 return ntstatus_to_werror(status);
     156             :         }
     157             : 
     158           0 :         if (!W_ERROR_IS_OK(error)) {
     159           0 :                 printf("error: %s\n", win_errstr(error));
     160           0 :                 return error;
     161             :         }
     162             : 
     163           0 :         printf("lpszResourceName: %s\n", lpszResourceName);
     164           0 :         printf("lpszDeviceName: %s\n", lpszDeviceName);
     165           0 :         printf("pdwMaxQuorumLogSize: %d\n", pdwMaxQuorumLogSize);
     166           0 :         printf("rpc_status: %s\n", win_errstr(rpc_status));
     167             : 
     168           0 :         return WERR_OK;
     169             : }
     170             : 
     171           0 : static WERROR cmd_clusapi_create_enum(struct rpc_pipe_client *cli,
     172             :                                       TALLOC_CTX *mem_ctx,
     173             :                                       int argc,
     174             :                                       const char **argv)
     175             : {
     176           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     177             :         NTSTATUS status;
     178             :         WERROR error;
     179           0 :         uint32_t dwType = 1;
     180             :         struct ENUM_LIST *ReturnEnum;
     181             :         WERROR rpc_status;
     182             : 
     183           0 :         if (argc >= 2) {
     184           0 :                 sscanf(argv[1],"%x",&dwType);
     185             :         }
     186             : 
     187           0 :         status = dcerpc_clusapi_CreateEnum(b, mem_ctx,
     188             :                                            dwType,
     189             :                                            &ReturnEnum,
     190             :                                            &rpc_status,
     191             :                                            &error);
     192           0 :         if (!NT_STATUS_IS_OK(status)) {
     193           0 :                 return ntstatus_to_werror(status);
     194             :         }
     195             : 
     196           0 :         if (!W_ERROR_IS_OK(error)) {
     197           0 :                 printf("error: %s\n", win_errstr(error));
     198           0 :                 return error;
     199             :         }
     200             : 
     201           0 :         printf("rpc_status: %s\n", win_errstr(rpc_status));
     202             : 
     203           0 :         return WERR_OK;
     204             : }
     205             : 
     206           0 : static WERROR cmd_clusapi_create_enumex(struct rpc_pipe_client *cli,
     207             :                                         TALLOC_CTX *mem_ctx,
     208             :                                         int argc,
     209             :                                         const char **argv)
     210             : {
     211           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     212             :         NTSTATUS status;
     213             :         WERROR error;
     214           0 :         uint32_t dwType = 1;
     215             :         struct ENUM_LIST *ReturnIdEnum;
     216             :         struct ENUM_LIST *ReturnNameEnum;
     217             :         WERROR rpc_status, ignore;
     218             :         struct policy_handle Cluster;
     219             : 
     220           0 :         status = dcerpc_clusapi_OpenCluster(b, mem_ctx,
     221             :                                             &error,
     222             :                                             &Cluster);
     223           0 :         if (!NT_STATUS_IS_OK(status)) {
     224           0 :                 return ntstatus_to_werror(status);
     225             :         }
     226             : 
     227           0 :         if (!W_ERROR_IS_OK(error)) {
     228           0 :                 printf("error: %s\n", win_errstr(error));
     229           0 :                 return error;
     230             :         }
     231             : 
     232           0 :         if (argc >= 2) {
     233           0 :                 sscanf(argv[1],"%x",&dwType);
     234             :         }
     235             : 
     236           0 :         status = dcerpc_clusapi_CreateEnumEx(b, mem_ctx,
     237             :                                              Cluster,
     238             :                                              dwType,
     239             :                                              0,
     240             :                                              &ReturnIdEnum,
     241             :                                              &ReturnNameEnum,
     242             :                                              &rpc_status,
     243             :                                              &error);
     244           0 :         dcerpc_clusapi_CloseCluster(b, mem_ctx,
     245             :                                     &Cluster,
     246             :                                     &ignore);
     247             : 
     248           0 :         if (!NT_STATUS_IS_OK(status)) {
     249           0 :                 return ntstatus_to_werror(status);
     250             :         }
     251             : 
     252           0 :         if (!W_ERROR_IS_OK(error)) {
     253           0 :                 printf("error: %s\n", win_errstr(error));
     254           0 :                 return error;
     255             :         }
     256             : 
     257           0 :         printf("rpc_status: %s\n", win_errstr(rpc_status));
     258             : 
     259           0 :         return WERR_OK;
     260             : }
     261             : 
     262             : 
     263           0 : static WERROR cmd_clusapi_open_resource(struct rpc_pipe_client *cli,
     264             :                                         TALLOC_CTX *mem_ctx,
     265             :                                         int argc,
     266             :                                         const char **argv)
     267             : {
     268           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     269             :         NTSTATUS status;
     270           0 :         const char *lpszResourceName = "Cluster Name";
     271             :         WERROR Status;
     272             :         struct policy_handle hResource;
     273             :         WERROR rpc_status, ignore;
     274             : 
     275           0 :         if (argc >= 2) {
     276           0 :                 lpszResourceName = argv[1];
     277             :         }
     278             : 
     279           0 :         status = dcerpc_clusapi_OpenResource(b, mem_ctx,
     280             :                                              lpszResourceName,
     281             :                                              &Status,
     282             :                                              &rpc_status,
     283             :                                              &hResource);
     284           0 :         if (!NT_STATUS_IS_OK(status)) {
     285           0 :                 return ntstatus_to_werror(status);
     286             :         }
     287             : 
     288           0 :         if (!W_ERROR_IS_OK(Status)) {
     289           0 :                 printf("Status: %s\n", win_errstr(Status));
     290           0 :                 return Status;
     291             :         }
     292             : 
     293           0 :         printf("rpc_status: %s\n", win_errstr(rpc_status));
     294             : 
     295           0 :         dcerpc_clusapi_CloseResource(b, mem_ctx,
     296             :                                      &hResource,
     297             :                                      &ignore);
     298             : 
     299           0 :         return WERR_OK;
     300             : }
     301             : 
     302           0 : static WERROR cmd_clusapi_online_resource(struct rpc_pipe_client *cli,
     303             :                                           TALLOC_CTX *mem_ctx,
     304             :                                           int argc,
     305             :                                           const char **argv)
     306             : {
     307           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     308             :         NTSTATUS status;
     309           0 :         const char *lpszResourceName = "Cluster Name";
     310             :         WERROR Status;
     311             :         struct policy_handle hResource;
     312             :         WERROR rpc_status, ignore;
     313             : 
     314           0 :         if (argc >= 2) {
     315           0 :                 lpszResourceName = argv[1];
     316             :         }
     317             : 
     318           0 :         status = dcerpc_clusapi_OpenResource(b, mem_ctx,
     319             :                                              lpszResourceName,
     320             :                                              &Status,
     321             :                                              &rpc_status,
     322             :                                              &hResource);
     323           0 :         if (!NT_STATUS_IS_OK(status)) {
     324           0 :                 return ntstatus_to_werror(status);
     325             :         }
     326             : 
     327           0 :         if (!W_ERROR_IS_OK(Status)) {
     328           0 :                 printf("Status: %s\n", win_errstr(Status));
     329           0 :                 return Status;
     330             :         }
     331             : 
     332           0 :         status = dcerpc_clusapi_OnlineResource(b, mem_ctx,
     333             :                                                hResource,
     334             :                                                &Status,
     335             :                                                &rpc_status);
     336           0 :         dcerpc_clusapi_CloseResource(b, mem_ctx,
     337             :                                      &hResource,
     338             :                                      &ignore);
     339             : 
     340           0 :         if (!NT_STATUS_IS_OK(status)) {
     341           0 :                 return ntstatus_to_werror(status);
     342             :         }
     343             : 
     344           0 :         if (!W_ERROR_IS_OK(Status)) {
     345           0 :                 printf("Status: %s\n", win_errstr(Status));
     346           0 :                 return Status;
     347             :         }
     348             : 
     349           0 :         printf("rpc_status: %s\n", win_errstr(rpc_status));
     350             : 
     351           0 :         return WERR_OK;
     352             : }
     353             : 
     354           0 : static WERROR cmd_clusapi_offline_resource(struct rpc_pipe_client *cli,
     355             :                                            TALLOC_CTX *mem_ctx,
     356             :                                            int argc,
     357             :                                            const char **argv)
     358             : {
     359           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     360             :         NTSTATUS status;
     361           0 :         const char *lpszResourceName = "Cluster Name";
     362             :         WERROR Status;
     363             :         struct policy_handle hResource;
     364             :         WERROR rpc_status, ignore;
     365             : 
     366           0 :         if (argc >= 2) {
     367           0 :                 lpszResourceName = argv[1];
     368             :         }
     369             : 
     370           0 :         status = dcerpc_clusapi_OpenResource(b, mem_ctx,
     371             :                                              lpszResourceName,
     372             :                                              &Status,
     373             :                                              &rpc_status,
     374             :                                              &hResource);
     375           0 :         if (!NT_STATUS_IS_OK(status)) {
     376           0 :                 return ntstatus_to_werror(status);
     377             :         }
     378             : 
     379           0 :         if (!W_ERROR_IS_OK(Status)) {
     380           0 :                 printf("Status: %s\n", win_errstr(Status));
     381           0 :                 return Status;
     382             :         }
     383             : 
     384           0 :         status = dcerpc_clusapi_OfflineResource(b, mem_ctx,
     385             :                                                 hResource,
     386             :                                                 &Status,
     387             :                                                 &rpc_status);
     388           0 :         dcerpc_clusapi_CloseResource(b, mem_ctx,
     389             :                                      &hResource,
     390             :                                      &ignore);
     391             : 
     392           0 :         if (!NT_STATUS_IS_OK(status)) {
     393           0 :                 return ntstatus_to_werror(status);
     394             :         }
     395             : 
     396           0 :         if (!W_ERROR_IS_OK(Status)) {
     397           0 :                 printf("Status: %s\n", win_errstr(Status));
     398           0 :                 return Status;
     399             :         }
     400             : 
     401           0 :         printf("rpc_status: %s\n", win_errstr(rpc_status));
     402             : 
     403           0 :         return WERR_OK;
     404             : }
     405             : 
     406           0 : static WERROR cmd_clusapi_get_resource_state(struct rpc_pipe_client *cli,
     407             :                                              TALLOC_CTX *mem_ctx,
     408             :                                              int argc,
     409             :                                              const char **argv)
     410             : {
     411           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     412             :         NTSTATUS status;
     413           0 :         const char *lpszResourceName = "Cluster Name";
     414             :         WERROR Status;
     415             :         struct policy_handle hResource;
     416             :         WERROR rpc_status;
     417             :         enum clusapi_ClusterResourceState State;
     418             :         const char *NodeName;
     419             :         const char *GroupName;
     420             :         WERROR result, ignore;
     421             : 
     422           0 :         if (argc >= 2) {
     423           0 :                 lpszResourceName = argv[1];
     424             :         }
     425             : 
     426           0 :         status = dcerpc_clusapi_OpenResource(b, mem_ctx,
     427             :                                              lpszResourceName,
     428             :                                              &Status,
     429             :                                              &rpc_status,
     430             :                                              &hResource);
     431           0 :         if (!NT_STATUS_IS_OK(status)) {
     432           0 :                 return ntstatus_to_werror(status);
     433             :         }
     434             : 
     435           0 :         if (!W_ERROR_IS_OK(Status)) {
     436           0 :                 printf("Status: %s\n", win_errstr(Status));
     437           0 :                 return Status;
     438             :         }
     439             : 
     440           0 :         status = dcerpc_clusapi_GetResourceState(b, mem_ctx,
     441             :                                                  hResource,
     442             :                                                  &State,
     443             :                                                  &NodeName,
     444             :                                                  &GroupName,
     445             :                                                  &rpc_status,
     446             :                                                  &result);
     447           0 :         dcerpc_clusapi_CloseResource(b, mem_ctx,
     448             :                                      &hResource,
     449             :                                      &ignore);
     450             : 
     451           0 :         if (!NT_STATUS_IS_OK(status)) {
     452           0 :                 return ntstatus_to_werror(status);
     453             :         }
     454             : 
     455           0 :         if (!W_ERROR_IS_OK(Status)) {
     456           0 :                 printf("Status: %s\n", win_errstr(Status));
     457           0 :                 return Status;
     458             :         }
     459             : 
     460           0 :         printf("rpc_status: %s\n", win_errstr(rpc_status));
     461             : 
     462           0 :         return WERR_OK;
     463             : }
     464             : 
     465           0 : static WERROR cmd_clusapi_get_cluster_version2(struct rpc_pipe_client *cli,
     466             :                                                TALLOC_CTX *mem_ctx,
     467             :                                                int argc,
     468             :                                                const char **argv)
     469             : {
     470           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     471             :         NTSTATUS status;
     472             :         uint16_t lpwMajorVersion;
     473             :         uint16_t lpwMinorVersion;
     474             :         uint16_t lpwBuildNumber;
     475             :         const char *lpszVendorId;
     476             :         const char *lpszCSDVersion;
     477             :         struct CLUSTER_OPERATIONAL_VERSION_INFO *ppClusterOpVerInfo;
     478             :         WERROR rpc_status;
     479             :         WERROR result;
     480             : 
     481           0 :         status = dcerpc_clusapi_GetClusterVersion2(b, mem_ctx,
     482             :                                                    &lpwMajorVersion,
     483             :                                                    &lpwMinorVersion,
     484             :                                                    &lpwBuildNumber,
     485             :                                                    &lpszVendorId,
     486             :                                                    &lpszCSDVersion,
     487             :                                                    &ppClusterOpVerInfo,
     488             :                                                    &rpc_status,
     489             :                                                    &result);
     490           0 :         if (!NT_STATUS_IS_OK(status)) {
     491           0 :                 return ntstatus_to_werror(status);
     492             :         }
     493             : 
     494           0 :         if (!W_ERROR_IS_OK(result)) {
     495           0 :                 printf("result: %s\n", win_errstr(result));
     496           0 :                 return result;
     497             :         }
     498             : 
     499           0 :         printf("rpc_status: %s\n", win_errstr(rpc_status));
     500             : 
     501           0 :         return WERR_OK;
     502             : }
     503             : 
     504           0 : static WERROR cmd_clusapi_pause_node(struct rpc_pipe_client *cli,
     505             :                                      TALLOC_CTX *mem_ctx,
     506             :                                      int argc,
     507             :                                      const char **argv)
     508             : {
     509           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     510             :         NTSTATUS status;
     511           0 :         const char *lpszNodeName = "CTDB_NODE_0";
     512             :         WERROR Status;
     513             :         struct policy_handle hNode;
     514             :         WERROR rpc_status;
     515             :         WERROR result, ignore;
     516             : 
     517           0 :         if (argc >= 2) {
     518           0 :                 lpszNodeName = argv[1];
     519             :         }
     520             : 
     521           0 :         status = dcerpc_clusapi_OpenNode(b, mem_ctx,
     522             :                                          lpszNodeName,
     523             :                                          &Status,
     524             :                                          &rpc_status,
     525             :                                          &hNode);
     526           0 :         if (!NT_STATUS_IS_OK(status)) {
     527           0 :                 return ntstatus_to_werror(status);
     528             :         }
     529             : 
     530           0 :         if (!W_ERROR_IS_OK(Status)) {
     531           0 :                 printf("Failed to open node %s\n", lpszNodeName);
     532           0 :                 printf("Status: %s\n", win_errstr(Status));
     533           0 :                 return Status;
     534             :         }
     535             : 
     536           0 :         status = dcerpc_clusapi_PauseNode(b, mem_ctx,
     537             :                                           hNode,
     538             :                                           &rpc_status,
     539             :                                           &result);
     540           0 :         if (!NT_STATUS_IS_OK(status)) {
     541           0 :                 return ntstatus_to_werror(status);
     542             :         }
     543           0 :         if (!W_ERROR_IS_OK(result)) {
     544           0 :                 printf("Failed to pause node %s\n", lpszNodeName);
     545           0 :                 printf("Status: %s\n", win_errstr(result));
     546           0 :                 return result;
     547             :         }
     548             : 
     549           0 :         dcerpc_clusapi_CloseNode(b, mem_ctx,
     550             :                                  &hNode,
     551             :                                  &ignore);
     552             : 
     553           0 :         printf("Cluster node %s has been paused\n", lpszNodeName);
     554           0 :         printf("rpc_status: %s\n", win_errstr(rpc_status));
     555             : 
     556           0 :         return WERR_OK;
     557             : }
     558             : 
     559           0 : static WERROR cmd_clusapi_resume_node(struct rpc_pipe_client *cli,
     560             :                                       TALLOC_CTX *mem_ctx,
     561             :                                       int argc,
     562             :                                       const char **argv)
     563             : {
     564           0 :         struct dcerpc_binding_handle *b = cli->binding_handle;
     565             :         NTSTATUS status;
     566           0 :         const char *lpszNodeName = "CTDB_NODE_0";
     567             :         WERROR Status;
     568             :         struct policy_handle hNode;
     569             :         WERROR rpc_status;
     570             :         WERROR result, ignore;
     571             : 
     572           0 :         if (argc >= 2) {
     573           0 :                 lpszNodeName = argv[1];
     574             :         }
     575             : 
     576           0 :         status = dcerpc_clusapi_OpenNode(b, mem_ctx,
     577             :                                          lpszNodeName,
     578             :                                          &Status,
     579             :                                          &rpc_status,
     580             :                                          &hNode);
     581           0 :         if (!NT_STATUS_IS_OK(status)) {
     582           0 :                 return ntstatus_to_werror(status);
     583             :         }
     584             : 
     585           0 :         if (!W_ERROR_IS_OK(Status)) {
     586           0 :                 printf("Failed to open node %s\n", lpszNodeName);
     587           0 :                 printf("Status: %s\n", win_errstr(Status));
     588           0 :                 return Status;
     589             :         }
     590             : 
     591           0 :         status = dcerpc_clusapi_ResumeNode(b, mem_ctx,
     592             :                                            hNode,
     593             :                                            &rpc_status,
     594             :                                            &result);
     595           0 :         if (!NT_STATUS_IS_OK(status)) {
     596           0 :                 return ntstatus_to_werror(status);
     597             :         }
     598           0 :         if (!W_ERROR_IS_OK(result)) {
     599           0 :                 printf("Failed to resume node %s\n", lpszNodeName);
     600           0 :                 printf("Status: %s\n", win_errstr(result));
     601           0 :                 return result;
     602             :         }
     603             : 
     604           0 :         dcerpc_clusapi_CloseNode(b, mem_ctx,
     605             :                                  &hNode,
     606             :                                  &ignore);
     607             : 
     608           0 :         printf("Cluster node %s has been resumed\n", lpszNodeName);
     609           0 :         printf("rpc_status: %s\n", win_errstr(rpc_status));
     610             : 
     611           0 :         return WERR_OK;
     612             : }
     613             : 
     614             : 
     615             : struct cmd_set clusapi_commands[] = {
     616             : 
     617             :         {
     618             :                 .name = "CLUSAPI",
     619             :         },
     620             :         {
     621             :                 .name               = "clusapi_open_cluster",
     622             :                 .returntype         = RPC_RTYPE_WERROR,
     623             :                 .ntfn               = NULL,
     624             :                 .wfn                = cmd_clusapi_open_cluster,
     625             :                 .table              = &ndr_table_clusapi,
     626             :                 .rpc_pipe           = NULL,
     627             :                 .description        = "Open cluster",
     628             :                 .usage              = "",
     629             :         },
     630             :         {
     631             :                 .name               = "clusapi_get_cluster_name",
     632             :                 .returntype         = RPC_RTYPE_WERROR,
     633             :                 .ntfn               = NULL,
     634             :                 .wfn                = cmd_clusapi_get_cluster_name,
     635             :                 .table              = &ndr_table_clusapi,
     636             :                 .rpc_pipe           = NULL,
     637             :                 .description        = "Get cluster name",
     638             :                 .usage              = "",
     639             :         },
     640             :         {
     641             :                 .name               = "clusapi_get_cluster_version",
     642             :                 .returntype         = RPC_RTYPE_WERROR,
     643             :                 .ntfn               = NULL,
     644             :                 .wfn                = cmd_clusapi_get_cluster_version,
     645             :                 .table              = &ndr_table_clusapi,
     646             :                 .rpc_pipe           = NULL,
     647             :                 .description        = "Get cluster version",
     648             :                 .usage              = "",
     649             :         },
     650             :         {
     651             :                 .name               = "clusapi_get_quorum_resource",
     652             :                 .returntype         = RPC_RTYPE_WERROR,
     653             :                 .ntfn               = NULL,
     654             :                 .wfn                = cmd_clusapi_get_quorum_resource,
     655             :                 .table              = &ndr_table_clusapi,
     656             :                 .rpc_pipe           = NULL,
     657             :                 .description        = "Get quorum resource",
     658             :                 .usage              = "",
     659             :         },
     660             :         {
     661             :                 .name               = "clusapi_create_enum",
     662             :                 .returntype         = RPC_RTYPE_WERROR,
     663             :                 .ntfn               = NULL,
     664             :                 .wfn                = cmd_clusapi_create_enum,
     665             :                 .table              = &ndr_table_clusapi,
     666             :                 .rpc_pipe           = NULL,
     667             :                 .description        = "Create enum query",
     668             :                 .usage              = "",
     669             :         },
     670             :         {
     671             :                 .name               = "clusapi_create_enumex",
     672             :                 .returntype         = RPC_RTYPE_WERROR,
     673             :                 .ntfn               = NULL,
     674             :                 .wfn                = cmd_clusapi_create_enumex,
     675             :                 .table              = &ndr_table_clusapi,
     676             :                 .rpc_pipe           = NULL,
     677             :                 .description        = "Create enumex query",
     678             :                 .usage              = "",
     679             :         },
     680             :         {
     681             :                 .name               = "clusapi_open_resource",
     682             :                 .returntype         = RPC_RTYPE_WERROR,
     683             :                 .ntfn               = NULL,
     684             :                 .wfn                = cmd_clusapi_open_resource,
     685             :                 .table              = &ndr_table_clusapi,
     686             :                 .rpc_pipe           = NULL,
     687             :                 .description        = "Open cluster resource",
     688             :                 .usage              = "",
     689             :         },
     690             :         {
     691             :                 .name               = "clusapi_online_resource",
     692             :                 .returntype         = RPC_RTYPE_WERROR,
     693             :                 .ntfn               = NULL,
     694             :                 .wfn                = cmd_clusapi_online_resource,
     695             :                 .table              = &ndr_table_clusapi,
     696             :                 .rpc_pipe           = NULL,
     697             :                 .description        = "Set cluster resource online",
     698             :                 .usage              = "",
     699             :         },
     700             :         {
     701             :                 .name               = "clusapi_offline_resource",
     702             :                 .returntype         = RPC_RTYPE_WERROR,
     703             :                 .ntfn               = NULL,
     704             :                 .wfn                = cmd_clusapi_offline_resource,
     705             :                 .table              = &ndr_table_clusapi,
     706             :                 .rpc_pipe           = NULL,
     707             :                 .description        = "Set cluster resource offline",
     708             :                 .usage              = "",
     709             :         },
     710             :         {
     711             :                 .name               = "clusapi_get_resource_state",
     712             :                 .returntype         = RPC_RTYPE_WERROR,
     713             :                 .ntfn               = NULL,
     714             :                 .wfn                = cmd_clusapi_get_resource_state,
     715             :                 .table              = &ndr_table_clusapi,
     716             :                 .rpc_pipe           = NULL,
     717             :                 .description        = "Get cluster resource state",
     718             :                 .usage              = "",
     719             :         },
     720             :         {
     721             :                 .name               = "clusapi_get_cluster_version2",
     722             :                 .returntype         = RPC_RTYPE_WERROR,
     723             :                 .ntfn               = NULL,
     724             :                 .wfn                = cmd_clusapi_get_cluster_version2,
     725             :                 .table              = &ndr_table_clusapi,
     726             :                 .rpc_pipe           = NULL,
     727             :                 .description        = "Get cluster version2",
     728             :                 .usage              = "",
     729             :         },
     730             :         {
     731             :                 .name               = "clusapi_pause_node",
     732             :                 .returntype         = RPC_RTYPE_WERROR,
     733             :                 .ntfn               = NULL,
     734             :                 .wfn                = cmd_clusapi_pause_node,
     735             :                 .table              = &ndr_table_clusapi,
     736             :                 .rpc_pipe           = NULL,
     737             :                 .description        = "Pause cluster node",
     738             :                 .usage              = "",
     739             :         },
     740             :         {
     741             :                 .name               = "clusapi_resume_node",
     742             :                 .returntype         = RPC_RTYPE_WERROR,
     743             :                 .ntfn               = NULL,
     744             :                 .wfn                = cmd_clusapi_resume_node,
     745             :                 .table              = &ndr_table_clusapi,
     746             :                 .rpc_pipe           = NULL,
     747             :                 .description        = "Resume cluster node",
     748             :                 .usage              = "",
     749             :         },
     750             :         {
     751             :                 .name = NULL,
     752             :         },
     753             : };

Generated by: LCOV version 1.14