[GLUE] Rsync SAMBA_3_0 SVN r25598 in order to create the v3-0-test branch.
[Samba.git] / source / rpcclient / cmd_test.c
blob94545dc74e6e654b84097f473c9f27537a75c996
1 /*
2 Unix SMB/CIFS implementation.
3 RPC pipe client
5 Copyright (C) Volker Lendecke 2005
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 2 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "includes.h"
23 #include "rpcclient.h"
25 static NTSTATUS cmd_testme(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
26 int argc, const char **argv)
28 struct rpc_pipe_client *lsa_pipe = NULL, *samr_pipe = NULL;
29 NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
30 POLICY_HND pol;
32 d_printf("testme\n");
34 lsa_pipe = cli_rpc_pipe_open_noauth(cli->cli, PI_LSARPC, &status);
35 if (lsa_pipe == NULL) goto done;
37 samr_pipe = cli_rpc_pipe_open_noauth(cli->cli, PI_SAMR, &status);
38 if (samr_pipe == NULL) goto done;
40 status = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, False,
41 SEC_RIGHTS_QUERY_VALUE, &pol);
43 if (!NT_STATUS_IS_OK(status))
44 goto done;
46 status = rpccli_lsa_close(lsa_pipe, mem_ctx, &pol);
48 if (!NT_STATUS_IS_OK(status))
49 goto done;
51 done:
52 if (lsa_pipe != NULL) cli_rpc_pipe_close(lsa_pipe);
53 if (samr_pipe != NULL) cli_rpc_pipe_close(samr_pipe);
55 return status;
58 /* List of commands exported by this module */
60 struct cmd_set test_commands[] = {
62 { "TESTING" },
64 { "testme", RPC_RTYPE_NTSTATUS, cmd_testme, NULL,
65 -1, NULL, "Sample test", "testme" },
67 { NULL }