1
/* server functions auto-generated by pidl */
2
#include "librpc/gen_ndr/ndr_rot.h"
4
/* rot - dcerpc server boilerplate generated by pidl */
7
static NTSTATUS rot__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface, uint32_t if_version)
9
#ifdef DCESRV_INTERFACE_ROT_BIND
10
return DCESRV_INTERFACE_ROT_BIND(dce_call,iface);
16
static void rot__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
18
#ifdef DCESRV_INTERFACE_ROT_UNBIND
19
DCESRV_INTERFACE_ROT_UNBIND(context, iface);
25
static NTSTATUS rot__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
27
enum ndr_err_code ndr_err;
28
uint16_t opnum = dce_call->pkt.u.request.opnum;
30
dce_call->fault_code = 0;
32
if (opnum >= ndr_table_rot.num_calls) {
33
dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
34
return NT_STATUS_NET_WRITE_FAULT;
37
*r = talloc_named(mem_ctx,
38
ndr_table_rot.calls[opnum].struct_size,
40
ndr_table_rot.calls[opnum].name);
41
NT_STATUS_HAVE_NO_MEMORY(*r);
43
/* unravel the NDR for the packet */
44
ndr_err = ndr_table_rot.calls[opnum].ndr_pull(pull, NDR_IN, *r);
45
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
46
dcerpc_log_packet(dce_call->conn->packet_log_dir,
47
&ndr_table_rot, opnum, NDR_IN,
48
&dce_call->pkt.u.request.stub_and_verifier);
49
dce_call->fault_code = DCERPC_FAULT_NDR;
50
return NT_STATUS_NET_WRITE_FAULT;
56
static NTSTATUS rot__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
58
uint16_t opnum = dce_call->pkt.u.request.opnum;
62
struct rot_add *r2 = (struct rot_add *)r;
63
if (DEBUGLEVEL >= 10) {
64
NDR_PRINT_FUNCTION_DEBUG(rot_add, NDR_IN, r2);
66
r2->out.result = dcesrv_rot_add(dce_call, mem_ctx, r2);
67
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
68
DEBUG(5,("function rot_add will reply async\n"));
73
struct rot_remove *r2 = (struct rot_remove *)r;
74
if (DEBUGLEVEL >= 10) {
75
NDR_PRINT_FUNCTION_DEBUG(rot_remove, NDR_IN, r2);
77
r2->out.result = dcesrv_rot_remove(dce_call, mem_ctx, r2);
78
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
79
DEBUG(5,("function rot_remove will reply async\n"));
84
struct rot_is_listed *r2 = (struct rot_is_listed *)r;
85
if (DEBUGLEVEL >= 10) {
86
NDR_PRINT_FUNCTION_DEBUG(rot_is_listed, NDR_IN, r2);
88
r2->out.result = dcesrv_rot_is_listed(dce_call, mem_ctx, r2);
89
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
90
DEBUG(5,("function rot_is_listed will reply async\n"));
95
struct rot_get_interface_pointer *r2 = (struct rot_get_interface_pointer *)r;
96
if (DEBUGLEVEL >= 10) {
97
NDR_PRINT_FUNCTION_DEBUG(rot_get_interface_pointer, NDR_IN, r2);
99
r2->out.result = dcesrv_rot_get_interface_pointer(dce_call, mem_ctx, r2);
100
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
101
DEBUG(5,("function rot_get_interface_pointer will reply async\n"));
106
struct rot_set_modification_time *r2 = (struct rot_set_modification_time *)r;
107
if (DEBUGLEVEL >= 10) {
108
NDR_PRINT_FUNCTION_DEBUG(rot_set_modification_time, NDR_IN, r2);
110
r2->out.result = dcesrv_rot_set_modification_time(dce_call, mem_ctx, r2);
111
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
112
DEBUG(5,("function rot_set_modification_time will reply async\n"));
117
struct rot_get_modification_time *r2 = (struct rot_get_modification_time *)r;
118
if (DEBUGLEVEL >= 10) {
119
NDR_PRINT_FUNCTION_DEBUG(rot_get_modification_time, NDR_IN, r2);
121
r2->out.result = dcesrv_rot_get_modification_time(dce_call, mem_ctx, r2);
122
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
123
DEBUG(5,("function rot_get_modification_time will reply async\n"));
128
struct rot_enum *r2 = (struct rot_enum *)r;
129
if (DEBUGLEVEL >= 10) {
130
NDR_PRINT_FUNCTION_DEBUG(rot_enum, NDR_IN, r2);
132
r2->out.result = dcesrv_rot_enum(dce_call, mem_ctx, r2);
133
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
134
DEBUG(5,("function rot_enum will reply async\n"));
140
dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
144
if (dce_call->fault_code != 0) {
145
dcerpc_log_packet(dce_call->conn->packet_log_dir,
146
&ndr_table_rot, opnum, NDR_IN,
147
&dce_call->pkt.u.request.stub_and_verifier);
148
return NT_STATUS_NET_WRITE_FAULT;
154
static NTSTATUS rot__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
156
uint16_t opnum = dce_call->pkt.u.request.opnum;
160
struct rot_add *r2 = (struct rot_add *)r;
161
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
162
DEBUG(5,("function rot_add replied async\n"));
164
if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
165
NDR_PRINT_FUNCTION_DEBUG(rot_add, NDR_OUT | NDR_SET_VALUES, r2);
167
if (dce_call->fault_code != 0) {
168
DEBUG(2,("dcerpc_fault %s in rot_add\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
173
struct rot_remove *r2 = (struct rot_remove *)r;
174
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
175
DEBUG(5,("function rot_remove replied async\n"));
177
if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
178
NDR_PRINT_FUNCTION_DEBUG(rot_remove, NDR_OUT | NDR_SET_VALUES, r2);
180
if (dce_call->fault_code != 0) {
181
DEBUG(2,("dcerpc_fault %s in rot_remove\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
186
struct rot_is_listed *r2 = (struct rot_is_listed *)r;
187
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
188
DEBUG(5,("function rot_is_listed replied async\n"));
190
if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
191
NDR_PRINT_FUNCTION_DEBUG(rot_is_listed, NDR_OUT | NDR_SET_VALUES, r2);
193
if (dce_call->fault_code != 0) {
194
DEBUG(2,("dcerpc_fault %s in rot_is_listed\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
199
struct rot_get_interface_pointer *r2 = (struct rot_get_interface_pointer *)r;
200
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
201
DEBUG(5,("function rot_get_interface_pointer replied async\n"));
203
if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
204
NDR_PRINT_FUNCTION_DEBUG(rot_get_interface_pointer, NDR_OUT | NDR_SET_VALUES, r2);
206
if (dce_call->fault_code != 0) {
207
DEBUG(2,("dcerpc_fault %s in rot_get_interface_pointer\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
212
struct rot_set_modification_time *r2 = (struct rot_set_modification_time *)r;
213
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
214
DEBUG(5,("function rot_set_modification_time replied async\n"));
216
if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
217
NDR_PRINT_FUNCTION_DEBUG(rot_set_modification_time, NDR_OUT | NDR_SET_VALUES, r2);
219
if (dce_call->fault_code != 0) {
220
DEBUG(2,("dcerpc_fault %s in rot_set_modification_time\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
225
struct rot_get_modification_time *r2 = (struct rot_get_modification_time *)r;
226
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
227
DEBUG(5,("function rot_get_modification_time replied async\n"));
229
if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
230
NDR_PRINT_FUNCTION_DEBUG(rot_get_modification_time, NDR_OUT | NDR_SET_VALUES, r2);
232
if (dce_call->fault_code != 0) {
233
DEBUG(2,("dcerpc_fault %s in rot_get_modification_time\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
238
struct rot_enum *r2 = (struct rot_enum *)r;
239
if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
240
DEBUG(5,("function rot_enum replied async\n"));
242
if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
243
NDR_PRINT_FUNCTION_DEBUG(rot_enum, NDR_OUT | NDR_SET_VALUES, r2);
245
if (dce_call->fault_code != 0) {
246
DEBUG(2,("dcerpc_fault %s in rot_enum\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
252
dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
256
if (dce_call->fault_code != 0) {
257
dcerpc_log_packet(dce_call->conn->packet_log_dir,
258
&ndr_table_rot, opnum, NDR_IN,
259
&dce_call->pkt.u.request.stub_and_verifier);
260
return NT_STATUS_NET_WRITE_FAULT;
266
static NTSTATUS rot__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
268
enum ndr_err_code ndr_err;
269
uint16_t opnum = dce_call->pkt.u.request.opnum;
271
ndr_err = ndr_table_rot.calls[opnum].ndr_push(push, NDR_OUT, r);
272
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
273
dce_call->fault_code = DCERPC_FAULT_NDR;
274
return NT_STATUS_NET_WRITE_FAULT;
280
const struct dcesrv_interface dcesrv_rot_interface = {
282
.syntax_id = {{0xb9e79e60,0x3d52,0x11ce,{0xaa,0xa1},{0x00,0x00,0x69,0x01,0x29,0x3f}},0.2},
283
.bind = rot__op_bind,
284
.unbind = rot__op_unbind,
285
.ndr_pull = rot__op_ndr_pull,
286
.dispatch = rot__op_dispatch,
287
.reply = rot__op_reply,
288
.ndr_push = rot__op_ndr_push
292
static NTSTATUS rot__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
296
for (i=0;i<ndr_table_rot.endpoints->count;i++) {
298
const char *name = ndr_table_rot.endpoints->names[i];
300
ret = dcesrv_interface_register(dce_ctx, name, &dcesrv_rot_interface, NULL);
301
if (!NT_STATUS_IS_OK(ret)) {
302
DEBUG(1,("rot_op_init_server: failed to register endpoint '%s'\n",name));
310
static bool rot__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
312
if (dcesrv_rot_interface.syntax_id.if_version == if_version &&
313
GUID_equal(&dcesrv_rot_interface.syntax_id.uuid, uuid)) {
314
memcpy(iface,&dcesrv_rot_interface, sizeof(*iface));
321
static bool rot__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
323
if (strcmp(dcesrv_rot_interface.name, name)==0) {
324
memcpy(iface, &dcesrv_rot_interface, sizeof(*iface));
331
NTSTATUS dcerpc_server_rot_init(void)
334
struct dcesrv_endpoint_server ep_server;
336
/* fill in our name */
337
ep_server.name = "rot";
339
/* fill in all the operations */
340
ep_server.init_server = rot__op_init_server;
342
ep_server.interface_by_uuid = rot__op_interface_by_uuid;
343
ep_server.interface_by_name = rot__op_interface_by_name;
345
/* register ourselves with the DCERPC subsystem. */
346
ret = dcerpc_register_ep_server(&ep_server);
348
if (!NT_STATUS_IS_OK(ret)) {
349
DEBUG(0,("Failed to register 'rot' endpoint server!\n"));