Remove a pointless CONST_DISCARD
[Samba/gebeck_regimport.git] / source3 / rpcclient / cmd_dssetup.c
blobf2fd1249676650f89a300f24dd9eee873a17f91a
1 /*
2 Unix SMB/CIFS implementation.
3 RPC pipe client
5 Copyright (C) Gerald Carter 2002
6 Copyright (C) Guenther Deschner 2008
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "rpcclient.h"
25 /* Look up domain related information on a remote host */
27 static WERROR cmd_ds_dsrole_getprimarydominfo(struct rpc_pipe_client *cli,
28 TALLOC_CTX *mem_ctx, int argc,
29 const char **argv)
31 NTSTATUS status;
32 WERROR werr;
33 union dssetup_DsRoleInfo info;
35 status = rpccli_dssetup_DsRoleGetPrimaryDomainInformation(cli, mem_ctx,
36 DS_ROLE_BASIC_INFORMATION,
37 &info,
38 &werr);
39 if (!NT_STATUS_IS_OK(status)) {
40 return ntstatus_to_werror(status);
43 if (!W_ERROR_IS_OK(werr)) {
44 return werr;
47 printf ("Machine Role = [%d]\n", info.basic.role);
49 if (info.basic.flags & DS_ROLE_PRIMARY_DS_RUNNING) {
50 printf("Directory Service is running.\n");
51 printf("Domain is in %s mode.\n",
52 (info.basic.flags & DS_ROLE_PRIMARY_DS_MIXED_MODE) ? "mixed" : "native" );
53 } else {
54 printf("Directory Service not running on server\n");
57 return werr;
60 /* List of commands exported by this module */
62 struct cmd_set ds_commands[] = {
64 { "LSARPC-DS" },
66 { "dsroledominfo", RPC_RTYPE_WERROR, NULL, cmd_ds_dsrole_getprimarydominfo, &ndr_table_dssetup.syntax_id, NULL, "Get Primary Domain Information", "" },
68 { NULL }