From d2ea6d5ae759bd2c842b5836d778b5a52b8af477 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 4 Oct 2002 19:11:36 +0000 Subject: merge of working dsrolegetprimdominfo() client code from APP_HEAD (This used to be commit f70caa25e4ee198151b915cf2bc0a26b2d0e243d) --- source3/rpcclient/cmd_ds.c | 59 ++++++++++++++++++++++++++++++++++++++++++ source3/rpcclient/cmd_lsarpc.c | 8 ------ source3/rpcclient/rpcclient.c | 2 ++ 3 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 source3/rpcclient/cmd_ds.c (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/cmd_ds.c b/source3/rpcclient/cmd_ds.c new file mode 100644 index 0000000000..9a2114e07e --- /dev/null +++ b/source3/rpcclient/cmd_ds.c @@ -0,0 +1,59 @@ +/* + Unix SMB/CIFS implementation. + RPC pipe client + + Copyright (C) Gerald Carter 2002 + + 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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "rpcclient.h" + +/* Look up domain related information on a remote host */ + +static NTSTATUS cmd_ds_dsrole_getprimarydominfo(struct cli_state *cli, + TALLOC_CTX *mem_ctx, int argc, + char **argv) +{ + NTSTATUS result; + DS_DOMINFO_CTR ctr; + + result = cli_ds_getprimarydominfo( cli, mem_ctx, DsRolePrimaryDomainInfoBasic, &ctr ); + if ( NT_STATUS_IS_OK(result) ) + { + printf ("Machine Role = [%d]\n", ctr.basic->machine_role); + + if ( ctr.basic->flags & DSROLE_PRIMARY_DS_RUNNING ) { + printf( "Directory Service is running.\n"); + printf( "Domain is in %s mode.\n", (ctr.basic->flags & DSROLE_PRIMARY_DS_MIXED_MODE) ? "mized" : "native" ); + } + else + printf( "Directory Service not running on server\n"); + } + + return result; +} + +/* List of commands exported by this module */ + +struct cmd_set ds_commands[] = { + + { "LSARPC-DS" }, + + { "dsroledominfo", cmd_ds_dsrole_getprimarydominfo, PI_LSARPC_DS, "Get Primary Domain Information", "" }, + + { NULL } +}; diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index af5bb2066b..8eb8ce8754 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -525,13 +525,6 @@ static NTSTATUS cmd_lsa_query_secobj(struct cli_state *cli, } -static NTSTATUS cmd_lsa_dsrole_getprimarydominfo(struct cli_state *cli, - TALLOC_CTX *mem_ctx, int argc, - char **argv) -{ - return NT_STATUS_OK; -} - /* List of commands exported by this module */ struct cmd_set lsarpc_commands[] = { @@ -548,7 +541,6 @@ struct cmd_set lsarpc_commands[] = { { "lsaenumprivsaccount", cmd_lsa_enum_privsaccounts, PI_LSARPC, "Enumerate the privileges of an SID", "" }, { "lsalookupprivvalue", cmd_lsa_lookupprivvalue, PI_LSARPC, "Get a privilege value given its name", "" }, { "lsaquerysecobj", cmd_lsa_query_secobj, PI_LSARPC, "Query LSA security object", "" }, - { "lsarpcbind", cmd_lsa_dsrole_getprimarydominfo, PI_LSARPC_V2, "Test 2k UUID in rpc bind", "" }, { NULL } }; diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 9c6cd3794b..c34f3b08ad 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -402,10 +402,12 @@ extern struct cmd_set netlogon_commands[]; extern struct cmd_set srvsvc_commands[]; extern struct cmd_set dfs_commands[]; extern struct cmd_set reg_commands[]; +extern struct cmd_set ds_commands[]; static struct cmd_set *rpcclient_command_list[] = { rpcclient_commands, lsarpc_commands, + ds_commands, samr_commands, spoolss_commands, netlogon_commands, -- cgit