s3:include: add START/END_PROFILE_STAMP()
[Samba/vl.git] / source4 / torture / dfs / common.c
blob5772c0d1a6c72f04aa23c203c669a013dee92e26
1 /*
2 Unix SMB/CIFS implementation.
3 test suite for various Domain DFS
4 Copyright (C) Matthieu Patou 2010
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "includes.h"
21 #include "libcli/libcli.h"
22 #include "torture/smbtorture.h"
23 #include "torture/util.h"
24 #include "../librpc/gen_ndr/ndr_dfsblobs.h"
25 #include "librpc/ndr/libndr.h"
26 #include "param/param.h"
27 #include "torture/torture.h"
28 #include "torture/dfs/proto.h"
29 #include "libcli/raw/raw_proto.h"
31 NTSTATUS dfs_cli_do_call(struct smbcli_tree *tree,
32 struct dfs_GetDFSReferral *ref)
34 NTSTATUS result;
35 enum ndr_err_code ndr_err;
36 uint16_t setup = TRANSACT2_GET_DFS_REFERRAL;
37 struct smb_trans2 trans;
39 ZERO_STRUCT(trans);
40 trans.in.max_param = 0;
41 trans.in.max_data = 4096;
42 trans.in.max_setup = 0;
43 trans.in.flags = 0;
44 trans.in.timeout = 0;
45 trans.in.setup_count = 1;
46 trans.in.setup = &setup;
47 trans.in.trans_name = NULL;
49 ndr_err = ndr_push_struct_blob(&trans.in.params, tree,
50 &ref->in.req,
51 (ndr_push_flags_fn_t)ndr_push_dfs_GetDFSReferral_in);
52 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
53 return NT_STATUS_INTERNAL_ERROR;
55 trans.in.data = data_blob(NULL, 0);
57 result = smb_raw_trans2(tree, tree, &trans);
59 if (!NT_STATUS_IS_OK(result))
60 return result;
62 ndr_err = ndr_pull_struct_blob(&trans.out.data, tree,
63 ref->out.resp,
64 (ndr_pull_flags_fn_t)ndr_pull_dfs_referral_resp);
65 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
66 return NT_STATUS_INVALID_NETWORK_RESPONSE;
69 return NT_STATUS_OK;