source: branches/samba-3.0/source/rpcclient/cmd_test.c

Last change on this file was 403, checked in by Silvan Scherrer, 16 years ago

server 3.0: fix testme

File size: 1.9 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 if (!cli) goto done; // if pointer to cli is NULL cli->cli crashes of course (vedor bug)
35
36 lsa_pipe = cli_rpc_pipe_open_noauth(cli->cli, PI_LSARPC, &status);
37 if (lsa_pipe == NULL) goto done;
38
39 samr_pipe = cli_rpc_pipe_open_noauth(cli->cli, PI_SAMR, &status);
40 if (samr_pipe == NULL) goto done;
41
42 status = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, False,
43 SEC_RIGHTS_QUERY_VALUE, &pol);
44
45 if (!NT_STATUS_IS_OK(status))
46 goto done;
47
48 status = rpccli_lsa_close(lsa_pipe, mem_ctx, &pol);
49
50 if (!NT_STATUS_IS_OK(status))
51 goto done;
52
53 done:
54 if (lsa_pipe != NULL) cli_rpc_pipe_close(lsa_pipe);
55 if (samr_pipe != NULL) cli_rpc_pipe_close(samr_pipe);
56
57 return status;
58}
59
60/* List of commands exported by this module */
61
62struct cmd_set test_commands[] = {
63
64 { "TESTING" },
65
66 { "testme", RPC_RTYPE_NTSTATUS, cmd_testme, NULL,
67 -1, NULL, "Sample test", "testme" },
68
69 { NULL }
70};
Note: See TracBrowser for help on using the repository browser.