summaryrefslogtreecommitdiff
path: root/source3/librpc/gen_ndr/srv_dfsblobs.c
blob: 06b5726e0b88970e4047a802090d0defbbeffd10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
 * Unix SMB/CIFS implementation.
 * server auto-generated by pidl. DO NOT MODIFY!
 */

#include "includes.h"
#include "ntdomain.h"
#include "librpc/gen_ndr/srv_dfsblobs.h"

static bool api_dfs_GetDFSReferral(struct pipes_struct *p)
{
	const struct ndr_interface_call *call;
	struct ndr_pull *pull;
	struct ndr_push *push;
	enum ndr_err_code ndr_err;
	struct dfs_GetDFSReferral *r;

	call = &ndr_table_dfsblobs.calls[NDR_DFS_GETDFSREFERRAL];

	r = talloc(talloc_tos(), struct dfs_GetDFSReferral);
	if (r == NULL) {
		return false;
	}

	pull = ndr_pull_init_blob(&p->in_data.data, r);
	if (pull == NULL) {
		talloc_free(r);
		return false;
	}

	pull->flags |= LIBNDR_FLAG_REF_ALLOC;
	if (p->endian) {
		pull->flags |= LIBNDR_FLAG_BIGENDIAN;
	}
	ndr_err = call->ndr_pull(pull, NDR_IN, r);
	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
		talloc_free(r);
		return false;
	}

	if (DEBUGLEVEL >= 10) {
		NDR_PRINT_FUNCTION_DEBUG(dfs_GetDFSReferral, NDR_IN, r);
	}

	ZERO_STRUCT(r->out);
	r->out.resp = talloc_zero(r, struct dfs_referral_resp);
	if (r->out.resp == NULL) {
		talloc_free(r);
		return false;
	}

	_dfs_GetDFSReferral(p, r);

	if (p->rng_fault_state) {
		talloc_free(r);
		/* Return true here, srv_pipe_hnd.c will take care */
		return true;
	}

	if (DEBUGLEVEL >= 10) {
		NDR_PRINT_FUNCTION_DEBUG(dfs_GetDFSReferral, NDR_OUT | NDR_SET_VALUES, r);
	}

	push = ndr_push_init_ctx(r);
	if (push == NULL) {
		talloc_free(r);
		return false;
	}

	/*
	 * carry over the pointer count to the reply in case we are
	 * using full pointer. See NDR specification for full pointers
	 */
	push->ptr_count = pull->ptr_count;

	ndr_err = call->ndr_push(push, NDR_OUT, r);
	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
		talloc_free(r);
		return false;
	}

	p->out_data.rdata = ndr_push_blob(push);
	talloc_steal(p->mem_ctx, p->out_data.rdata.data);

	talloc_free(r);

	return true;
}


/* Tables */
static struct api_struct api_dfsblobs_cmds[] = 
{
	{"DFS_GETDFSREFERRAL", NDR_DFS_GETDFSREFERRAL, api_dfs_GetDFSReferral},
};

void dfsblobs_get_pipe_fns(struct api_struct **fns, int *n_fns)
{
	*fns = api_dfsblobs_cmds;
	*n_fns = sizeof(api_dfsblobs_cmds) / sizeof(struct api_struct);
}

NTSTATUS rpc_dfsblobs_init(const struct rpc_srv_callbacks *rpc_srv_cb)
{
	return rpc_srv_register(SMB_RPC_INTERFACE_VERSION, "dfsblobs", "dfsblobs", &ndr_table_dfsblobs, api_dfsblobs_cmds, sizeof(api_dfsblobs_cmds) / sizeof(struct api_struct), rpc_srv_cb);
}

NTSTATUS rpc_dfsblobs_shutdown(void)
{
	return rpc_srv_unregister(&ndr_table_dfsblobs);
}