s3-passdb: Fix typo in comment.
[Samba.git] / source3 / rpcclient / cmd_test.c
blobe854df9a780eb196a1b72dcec4eb300f1543dbfb
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 3 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, see <http://www.gnu.org/licenses/>.
21 #include "includes.h"
22 #include "rpcclient.h"
23 #include "../librpc/gen_ndr/cli_lsa.h"
24 #include "rpc_client/cli_lsarpc.h"
25 #include "../librpc/gen_ndr/ndr_samr.h"
27 static NTSTATUS cmd_testme(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
28 int argc, const char **argv)
30 struct rpc_pipe_client *lsa_pipe = NULL, *samr_pipe = NULL;
31 NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
32 struct policy_handle pol;
34 d_printf("testme\n");
36 status = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(cli),
37 &ndr_table_lsarpc.syntax_id,
38 &lsa_pipe);
39 if (!NT_STATUS_IS_OK(status)) {
40 goto done;
43 status = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(cli),
44 &ndr_table_samr.syntax_id,
45 &samr_pipe);
46 if (!NT_STATUS_IS_OK(status)) {
47 goto done;
50 status = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, False,
51 KEY_QUERY_VALUE, &pol);
53 if (!NT_STATUS_IS_OK(status))
54 goto done;
56 status = rpccli_lsa_Close(lsa_pipe, mem_ctx, &pol);
58 if (!NT_STATUS_IS_OK(status))
59 goto done;
61 done:
62 TALLOC_FREE(lsa_pipe);
63 TALLOC_FREE(samr_pipe);
65 return status;
68 /* List of commands exported by this module */
70 struct cmd_set test_commands[] = {
72 { "TESTING" },
74 { "testme", RPC_RTYPE_NTSTATUS, cmd_testme, NULL,
75 NULL, NULL, "Sample test", "testme" },
77 { NULL }