2 Unix SMB/CIFS implementation.
3 Test suite for libnet calls.
5 Copyright (C) Rafal Szczesniak 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 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.
23 #include "librpc/gen_ndr/ndr_samr.h"
26 static BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
27 struct policy_handle *handle, struct samr_String *domname)
30 struct policy_handle h, domain_handle;
31 struct samr_Connect r1;
32 struct samr_LookupDomain r2;
33 struct samr_OpenDomain r3;
35 printf("connecting\n");
37 r1.in.system_name = 0;
38 r1.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
39 r1.out.connect_handle = &h;
41 status = dcerpc_samr_Connect(p, mem_ctx, &r1);
42 if (!NT_STATUS_IS_OK(status)) {
43 printf("Connect failed - %s\n", nt_errstr(status));
47 r2.in.connect_handle = &h;
48 r2.in.domain_name = domname;
50 status = dcerpc_samr_LookupDomain(p, mem_ctx, &r2);
51 if (!NT_STATUS_IS_OK(status)) {
52 printf("LookupDomain failed - %s\n", nt_errstr(status));
56 r3.in.connect_handle = &h;
57 r3.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
58 r3.in.sid = r2.out.sid;
59 r3.out.domain_handle = &domain_handle;
61 status = dcerpc_samr_OpenDomain(p, mem_ctx, &r3);
62 if (!NT_STATUS_IS_OK(status)) {
63 printf("OpenDomain failed - %s\n", nt_errstr(status));
66 *handle = domain_handle;
71 BOOL torture_userinfo(void)
74 struct dcerpc_pipe *p;
77 struct policy_handle h;
78 struct samr_String name = { 4, 4, "TEST" };
80 mem_ctx = talloc_init("test_userinfo");
82 status = torture_rpc_connection(&p,
87 if (!NT_STATUS_IS_OK(status)) {
91 if (!test_opendomain(p, mem_ctx, &h, &name)) {