1 /* server functions auto-generated by pidl */
2 #include "bin/default/librpc/gen_ndr/ndr_unixinfo.h"
4 NTSTATUS dcerpc_server_unixinfo_init(void);
6 /* unixinfo - dcerpc server boilerplate generated by pidl */
9 static NTSTATUS unixinfo__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface, uint32_t if_version)
11 #ifdef DCESRV_INTERFACE_UNIXINFO_BIND
12 return DCESRV_INTERFACE_UNIXINFO_BIND(dce_call,iface);
18 static void unixinfo__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
20 #ifdef DCESRV_INTERFACE_UNIXINFO_UNBIND
21 DCESRV_INTERFACE_UNIXINFO_UNBIND(context, iface);
27 static NTSTATUS unixinfo__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
29 enum ndr_err_code ndr_err;
30 uint16_t opnum = dce_call->pkt.u.request.opnum;
32 dce_call->fault_code = 0;
34 if (opnum >= ndr_table_unixinfo.num_calls) {
35 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
36 return NT_STATUS_NET_WRITE_FAULT;
39 *r = talloc_named(mem_ctx,
40 ndr_table_unixinfo.calls[opnum].struct_size,
42 ndr_table_unixinfo.calls[opnum].name);
43 NT_STATUS_HAVE_NO_MEMORY(*r);
45 /* unravel the NDR for the packet */
46 ndr_err = ndr_table_unixinfo.calls[opnum].ndr_pull(pull, NDR_IN, *r);
47 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
48 dcerpc_log_packet(dce_call->conn->packet_log_dir,
49 &ndr_table_unixinfo, opnum, NDR_IN,
50 &dce_call->pkt.u.request.stub_and_verifier);
51 dce_call->fault_code = DCERPC_FAULT_NDR;
52 return NT_STATUS_NET_WRITE_FAULT;
58 static NTSTATUS unixinfo__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
60 uint16_t opnum = dce_call->pkt.u.request.opnum;
64 struct unixinfo_SidToUid *r2 = (struct unixinfo_SidToUid *)r;
65 if (DEBUGLEVEL >= 10) {
66 NDR_PRINT_FUNCTION_DEBUG(unixinfo_SidToUid, NDR_IN, r2);
68 r2->out.result = dcesrv_unixinfo_SidToUid(dce_call, mem_ctx, r2);
69 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
70 DEBUG(5,("function unixinfo_SidToUid will reply async\n"));
75 struct unixinfo_UidToSid *r2 = (struct unixinfo_UidToSid *)r;
76 if (DEBUGLEVEL >= 10) {
77 NDR_PRINT_FUNCTION_DEBUG(unixinfo_UidToSid, NDR_IN, r2);
79 r2->out.result = dcesrv_unixinfo_UidToSid(dce_call, mem_ctx, r2);
80 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
81 DEBUG(5,("function unixinfo_UidToSid will reply async\n"));
86 struct unixinfo_SidToGid *r2 = (struct unixinfo_SidToGid *)r;
87 if (DEBUGLEVEL >= 10) {
88 NDR_PRINT_FUNCTION_DEBUG(unixinfo_SidToGid, NDR_IN, r2);
90 r2->out.result = dcesrv_unixinfo_SidToGid(dce_call, mem_ctx, r2);
91 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
92 DEBUG(5,("function unixinfo_SidToGid will reply async\n"));
97 struct unixinfo_GidToSid *r2 = (struct unixinfo_GidToSid *)r;
98 if (DEBUGLEVEL >= 10) {
99 NDR_PRINT_FUNCTION_DEBUG(unixinfo_GidToSid, NDR_IN, r2);
101 r2->out.result = dcesrv_unixinfo_GidToSid(dce_call, mem_ctx, r2);
102 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
103 DEBUG(5,("function unixinfo_GidToSid will reply async\n"));
108 struct unixinfo_GetPWUid *r2 = (struct unixinfo_GetPWUid *)r;
109 if (DEBUGLEVEL >= 10) {
110 NDR_PRINT_FUNCTION_DEBUG(unixinfo_GetPWUid, NDR_IN, r2);
112 r2->out.result = dcesrv_unixinfo_GetPWUid(dce_call, mem_ctx, r2);
113 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
114 DEBUG(5,("function unixinfo_GetPWUid will reply async\n"));
120 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
124 if (dce_call->fault_code != 0) {
125 dcerpc_log_packet(dce_call->conn->packet_log_dir,
126 &ndr_table_unixinfo, opnum, NDR_IN,
127 &dce_call->pkt.u.request.stub_and_verifier);
128 return NT_STATUS_NET_WRITE_FAULT;
134 static NTSTATUS unixinfo__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
136 uint16_t opnum = dce_call->pkt.u.request.opnum;
140 struct unixinfo_SidToUid *r2 = (struct unixinfo_SidToUid *)r;
141 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
142 DEBUG(5,("function unixinfo_SidToUid replied async\n"));
144 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
145 NDR_PRINT_FUNCTION_DEBUG(unixinfo_SidToUid, NDR_OUT | NDR_SET_VALUES, r2);
147 if (dce_call->fault_code != 0) {
148 DEBUG(2,("dcerpc_fault %s in unixinfo_SidToUid\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
153 struct unixinfo_UidToSid *r2 = (struct unixinfo_UidToSid *)r;
154 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
155 DEBUG(5,("function unixinfo_UidToSid replied async\n"));
157 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
158 NDR_PRINT_FUNCTION_DEBUG(unixinfo_UidToSid, NDR_OUT | NDR_SET_VALUES, r2);
160 if (dce_call->fault_code != 0) {
161 DEBUG(2,("dcerpc_fault %s in unixinfo_UidToSid\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
166 struct unixinfo_SidToGid *r2 = (struct unixinfo_SidToGid *)r;
167 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
168 DEBUG(5,("function unixinfo_SidToGid replied async\n"));
170 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
171 NDR_PRINT_FUNCTION_DEBUG(unixinfo_SidToGid, NDR_OUT | NDR_SET_VALUES, r2);
173 if (dce_call->fault_code != 0) {
174 DEBUG(2,("dcerpc_fault %s in unixinfo_SidToGid\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
179 struct unixinfo_GidToSid *r2 = (struct unixinfo_GidToSid *)r;
180 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
181 DEBUG(5,("function unixinfo_GidToSid replied async\n"));
183 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
184 NDR_PRINT_FUNCTION_DEBUG(unixinfo_GidToSid, NDR_OUT | NDR_SET_VALUES, r2);
186 if (dce_call->fault_code != 0) {
187 DEBUG(2,("dcerpc_fault %s in unixinfo_GidToSid\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
192 struct unixinfo_GetPWUid *r2 = (struct unixinfo_GetPWUid *)r;
193 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
194 DEBUG(5,("function unixinfo_GetPWUid replied async\n"));
196 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
197 NDR_PRINT_FUNCTION_DEBUG(unixinfo_GetPWUid, NDR_OUT | NDR_SET_VALUES, r2);
199 if (dce_call->fault_code != 0) {
200 DEBUG(2,("dcerpc_fault %s in unixinfo_GetPWUid\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
206 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
210 if (dce_call->fault_code != 0) {
211 dcerpc_log_packet(dce_call->conn->packet_log_dir,
212 &ndr_table_unixinfo, opnum, NDR_IN,
213 &dce_call->pkt.u.request.stub_and_verifier);
214 return NT_STATUS_NET_WRITE_FAULT;
220 static NTSTATUS unixinfo__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
222 enum ndr_err_code ndr_err;
223 uint16_t opnum = dce_call->pkt.u.request.opnum;
225 ndr_err = ndr_table_unixinfo.calls[opnum].ndr_push(push, NDR_OUT, r);
226 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
227 dce_call->fault_code = DCERPC_FAULT_NDR;
228 return NT_STATUS_NET_WRITE_FAULT;
234 const struct dcesrv_interface dcesrv_unixinfo_interface = {
236 .syntax_id = {{0x9c54e310,0xa955,0x4885,{0xbd,0x31},{0x78,0x78,0x71,0x47,0xdf,0xa6}},0.0},
237 .bind = unixinfo__op_bind,
238 .unbind = unixinfo__op_unbind,
239 .ndr_pull = unixinfo__op_ndr_pull,
240 .dispatch = unixinfo__op_dispatch,
241 .reply = unixinfo__op_reply,
242 .ndr_push = unixinfo__op_ndr_push
246 static NTSTATUS unixinfo__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
250 for (i=0;i<ndr_table_unixinfo.endpoints->count;i++) {
252 const char *name = ndr_table_unixinfo.endpoints->names[i];
254 ret = dcesrv_interface_register(dce_ctx, name, &dcesrv_unixinfo_interface, NULL);
255 if (!NT_STATUS_IS_OK(ret)) {
256 DEBUG(1,("unixinfo_op_init_server: failed to register endpoint '%s'\n",name));
264 static bool unixinfo__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
266 if (dcesrv_unixinfo_interface.syntax_id.if_version == if_version &&
267 GUID_equal(&dcesrv_unixinfo_interface.syntax_id.uuid, uuid)) {
268 memcpy(iface,&dcesrv_unixinfo_interface, sizeof(*iface));
275 static bool unixinfo__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
277 if (strcmp(dcesrv_unixinfo_interface.name, name)==0) {
278 memcpy(iface, &dcesrv_unixinfo_interface, sizeof(*iface));
285 NTSTATUS dcerpc_server_unixinfo_init(void)
288 struct dcesrv_endpoint_server ep_server;
290 /* fill in our name */
291 ep_server.name = "unixinfo";
293 /* fill in all the operations */
294 ep_server.init_server = unixinfo__op_init_server;
296 ep_server.interface_by_uuid = unixinfo__op_interface_by_uuid;
297 ep_server.interface_by_name = unixinfo__op_interface_by_name;
299 /* register ourselves with the DCERPC subsystem. */
300 ret = dcerpc_register_ep_server(&ep_server);
302 if (!NT_STATUS_IS_OK(ret)) {
303 DEBUG(0,("Failed to register 'unixinfo' endpoint server!\n"));