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 3 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, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #include "includes.h"
|
---|
22 | #include "rpcclient.h"
|
---|
23 | #include "../librpc/gen_ndr/ndr_lsa_c.h"
|
---|
24 | #include "rpc_client/cli_lsarpc.h"
|
---|
25 | #include "../librpc/gen_ndr/ndr_samr.h"
|
---|
26 | #include "../librpc/gen_ndr/winreg.h"
|
---|
27 |
|
---|
28 | static NTSTATUS cmd_testme(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
---|
29 | int argc, const char **argv)
|
---|
30 | {
|
---|
31 | struct rpc_pipe_client *lsa_pipe = NULL, *samr_pipe = NULL;
|
---|
32 | NTSTATUS status = NT_STATUS_UNSUCCESSFUL, result;
|
---|
33 | struct policy_handle pol;
|
---|
34 | struct dcerpc_binding_handle *b;
|
---|
35 |
|
---|
36 | d_printf("testme\n");
|
---|
37 |
|
---|
38 | status = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(cli),
|
---|
39 | &ndr_table_lsarpc.syntax_id,
|
---|
40 | &lsa_pipe);
|
---|
41 | if (!NT_STATUS_IS_OK(status)) {
|
---|
42 | goto done;
|
---|
43 | }
|
---|
44 |
|
---|
45 | status = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(cli),
|
---|
46 | &ndr_table_samr.syntax_id,
|
---|
47 | &samr_pipe);
|
---|
48 | if (!NT_STATUS_IS_OK(status)) {
|
---|
49 | goto done;
|
---|
50 | }
|
---|
51 |
|
---|
52 | b = lsa_pipe->binding_handle;
|
---|
53 |
|
---|
54 | status = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, False,
|
---|
55 | KEY_QUERY_VALUE, &pol);
|
---|
56 |
|
---|
57 | if (!NT_STATUS_IS_OK(status))
|
---|
58 | goto done;
|
---|
59 |
|
---|
60 | status = dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
|
---|
61 |
|
---|
62 | if (!NT_STATUS_IS_OK(status))
|
---|
63 | goto done;
|
---|
64 | if (!NT_STATUS_IS_OK(result)) {
|
---|
65 | status = result;
|
---|
66 | goto done;
|
---|
67 | }
|
---|
68 |
|
---|
69 | done:
|
---|
70 | TALLOC_FREE(lsa_pipe);
|
---|
71 | TALLOC_FREE(samr_pipe);
|
---|
72 |
|
---|
73 | return status;
|
---|
74 | }
|
---|
75 |
|
---|
76 | /* List of commands exported by this module */
|
---|
77 |
|
---|
78 | struct cmd_set test_commands[] = {
|
---|
79 |
|
---|
80 | { "TESTING" },
|
---|
81 |
|
---|
82 | { "testme", RPC_RTYPE_NTSTATUS, cmd_testme, NULL,
|
---|
83 | NULL, NULL, "Sample test", "testme" },
|
---|
84 |
|
---|
85 | { NULL }
|
---|
86 | };
|
---|