2 Unix SMB/CIFS implementation.
3 test suite for samr rpc operations
5 Copyright (C) Andrew Tridgell 2003
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.
25 static BOOL test_EnumDomains(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
26 struct policy_handle *handle)
29 struct samr_EnumDomains r;
30 uint32 resume_handle = 0;
34 r.in.resume_handle = &resume_handle;
35 r.in.buf_size = (uint32)-1;
36 r.out.resume_handle = &resume_handle;
37 r.out.num_entries = &num_entries;
39 status = dcerpc_samr_EnumDomains(p, mem_ctx, &r);
40 if (!NT_STATUS_IS_OK(status)) {
41 printf("EnumDomains failed - %s\n", nt_errstr(status));
45 NDR_PRINT_DEBUG(samr_SamArray, r.out.sam);
51 static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
52 struct policy_handle *handle)
55 struct samr_Connect r;
58 r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
59 r.out.handle = handle;
61 status = dcerpc_samr_Connect(p, mem_ctx, &r);
62 if (!NT_STATUS_IS_OK(status)) {
63 printf("Connect failed - %s\n", nt_errstr(status));
71 BOOL torture_rpc_samr(int dummy)
74 struct dcerpc_pipe *p;
77 struct policy_handle handle;
79 mem_ctx = talloc_init("torture_rpc_samr");
81 status = torture_rpc_connection(&p, "samr");
82 if (!NT_STATUS_IS_OK(status)) {
86 if (!test_Connect(p, mem_ctx, &handle)) {
90 if (!test_EnumDomains(p, mem_ctx, &handle)) {