source: trunk-3.0/source/rpcclient/cmd_test.c@ 101

Last change on this file since 101 was 1, checked in by Paul Smedley, 18 years ago

Initial code import

File size: 1.8 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 RPC pipe client
4
5 Copyright (C) Volker Lendecke 2005
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 2 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, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#include "includes.h"
23#include "rpcclient.h"
24
25static NTSTATUS cmd_testme(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
26 int argc, const char **argv)
27{
28 struct rpc_pipe_client *lsa_pipe = NULL, *samr_pipe = NULL;
29 NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
30 POLICY_HND pol;
31
32 d_printf("testme\n");
33
34 lsa_pipe = cli_rpc_pipe_open_noauth(cli->cli, PI_LSARPC, &status);
35 if (lsa_pipe == NULL) goto done;
36
37 samr_pipe = cli_rpc_pipe_open_noauth(cli->cli, PI_SAMR, &status);
38 if (samr_pipe == NULL) goto done;
39
40 status = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, False,
41 SEC_RIGHTS_QUERY_VALUE, &pol);
42
43 if (!NT_STATUS_IS_OK(status))
44 goto done;
45
46 status = rpccli_lsa_close(lsa_pipe, mem_ctx, &pol);
47
48 if (!NT_STATUS_IS_OK(status))
49 goto done;
50
51 done:
52 if (lsa_pipe != NULL) cli_rpc_pipe_close(lsa_pipe);
53 if (samr_pipe != NULL) cli_rpc_pipe_close(samr_pipe);
54
55 return status;
56}
57
58/* List of commands exported by this module */
59
60struct cmd_set test_commands[] = {
61
62 { "TESTING" },
63
64 { "testme", RPC_RTYPE_NTSTATUS, cmd_testme, NULL,
65 -1, NULL, "Sample test", "testme" },
66
67 { NULL }
68};
Note: See TracBrowser for help on using the repository browser.