LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - ndr_echo_scompat.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 149 279 53.4 %
Date: 2024-04-21 15:09:00 Functions: 10 13 76.9 %

          Line data    Source code
       1             : /* s3 compat server functions auto-generated by pidl */
       2             : #include "bin/default/librpc/gen_ndr/ndr_echo.h"
       3             : #include "bin/default/librpc/gen_ndr/ndr_echo_scompat.h"
       4             : #include <librpc/rpc/dcesrv_core.h>
       5             : #include <rpc_server/rpc_config.h>
       6             : #include <rpc_server/rpc_server.h>
       7             : #include <util/debug.h>
       8             : 
       9             : enum s3compat_rpc_dispatch {
      10             :         S3COMPAT_RPC_DISPATCH_EXTERNAL = 0x00000001,
      11             :         S3COMPAT_RPC_DISPATCH_INTERNAL = 0x00000002,
      12             : };
      13             : 
      14             : /* rpcecho - dcerpc server boilerplate generated by pidl */
      15           4 : static NTSTATUS rpcecho__op_bind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
      16             : {
      17             : #ifdef DCESRV_INTERFACE_RPCECHO_BIND
      18             :         return DCESRV_INTERFACE_RPCECHO_BIND(context,iface);
      19             : #else
      20           4 :         return NT_STATUS_OK;
      21             : #endif
      22             : }
      23             : 
      24           4 : static void rpcecho__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
      25             : {
      26             : #ifdef DCESRV_INTERFACE_RPCECHO_UNBIND
      27             :         DCESRV_INTERFACE_RPCECHO_UNBIND(context, iface);
      28             : #else
      29           4 :         return;
      30             : #endif
      31             : }
      32             : 
      33          88 : NTSTATUS rpcecho__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
      34             : {
      35           0 :         enum ndr_err_code ndr_err;
      36          88 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
      37             : 
      38          88 :         dce_call->fault_code = 0;
      39             : 
      40          88 :         if (opnum >= ndr_table_rpcecho.num_calls) {
      41           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
      42           0 :                 return NT_STATUS_NET_WRITE_FAULT;
      43             :         }
      44             : 
      45          88 :         *r = talloc_named(mem_ctx, ndr_table_rpcecho.calls[opnum].struct_size, "struct %s", ndr_table_rpcecho.calls[opnum].name);
      46          88 :         NT_STATUS_HAVE_NO_MEMORY(*r);
      47             : 
      48             :         /* unravel the NDR for the packet */
      49          88 :         ndr_err = ndr_table_rpcecho.calls[opnum].ndr_pull(pull, NDR_IN, *r);
      50          88 :         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
      51           0 :                 dce_call->fault_code = DCERPC_FAULT_NDR;
      52           0 :                 return NT_STATUS_NET_WRITE_FAULT;
      53             :         }
      54             : 
      55          88 :         return NT_STATUS_OK;
      56             : }
      57             : 
      58          88 : static NTSTATUS rpcecho__op_dispatch_internal(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r, enum s3compat_rpc_dispatch dispatch)
      59             : {
      60          88 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
      61          88 :         struct pipes_struct *p = NULL;
      62          88 :         NTSTATUS status = NT_STATUS_OK;
      63          88 :         bool impersonated = false;
      64             : 
      65             :         /* Retrieve pipes struct */
      66          88 :         p = dcesrv_get_pipes_struct(dce_call->conn);
      67          88 :         p->dce_call = dce_call;
      68          88 :         p->mem_ctx = mem_ctx;
      69             :         /* Reset pipes struct fault state */
      70          88 :         p->fault_state = 0;
      71             : 
      72             :         /* Impersonate */
      73          88 :         if (dispatch == S3COMPAT_RPC_DISPATCH_EXTERNAL) {
      74          88 :                 impersonated = become_authenticated_pipe_user(dce_call->auth_state->session_info);
      75          88 :                 if (!impersonated) {
      76           0 :                         dce_call->fault_code = DCERPC_FAULT_ACCESS_DENIED;
      77           0 :                         status = NT_STATUS_NET_WRITE_FAULT;
      78           0 :                         goto fail;
      79             :                 }
      80             :         }
      81             : 
      82          88 :         switch (opnum) {
      83          56 :         case 0: { /* echo_AddOne */
      84          56 :                 struct echo_AddOne *r2 = (struct echo_AddOne *)r;
      85          56 :                 if (DEBUGLEVEL >= 10) {
      86           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_AddOne, NDR_IN, r2);
      87             :                 }
      88          56 :                 NDR_ZERO_STRUCT(r2->out);
      89          56 :                 r2->out.out_data = talloc_zero(r2, uint32_t);
      90          56 :                 if (r2->out.out_data == NULL) {
      91           0 :                         status = NT_STATUS_NO_MEMORY;
      92           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
      93           0 :                         goto fail;
      94             :                 }
      95             : 
      96          56 :                 _echo_AddOne(p, r2);
      97          56 :                 break;
      98             :         }
      99           4 :         case 1: { /* echo_EchoData */
     100           4 :                 struct echo_EchoData *r2 = (struct echo_EchoData *)r;
     101           4 :                 if (DEBUGLEVEL >= 10) {
     102           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_EchoData, NDR_IN, r2);
     103             :                 }
     104           4 :                 NDR_ZERO_STRUCT(r2->out);
     105           4 :                 r2->out.out_data = talloc_zero_array(r2, uint8_t, r2->in.len);
     106           4 :                 if (r2->out.out_data == NULL) {
     107           0 :                         status = NT_STATUS_NO_MEMORY;
     108           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     109           0 :                         goto fail;
     110             :                 }
     111             : 
     112           4 :                 _echo_EchoData(p, r2);
     113           4 :                 break;
     114             :         }
     115           4 :         case 2: { /* echo_SinkData */
     116           4 :                 struct echo_SinkData *r2 = (struct echo_SinkData *)r;
     117           4 :                 if (DEBUGLEVEL >= 10) {
     118           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_SinkData, NDR_IN, r2);
     119             :                 }
     120           4 :                 _echo_SinkData(p, r2);
     121           4 :                 break;
     122             :         }
     123           4 :         case 3: { /* echo_SourceData */
     124           4 :                 struct echo_SourceData *r2 = (struct echo_SourceData *)r;
     125           4 :                 if (DEBUGLEVEL >= 10) {
     126           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_SourceData, NDR_IN, r2);
     127             :                 }
     128           4 :                 NDR_ZERO_STRUCT(r2->out);
     129           4 :                 r2->out.data = talloc_zero_array(r2, uint8_t, r2->in.len);
     130           4 :                 if (r2->out.data == NULL) {
     131           0 :                         status = NT_STATUS_NO_MEMORY;
     132           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     133           0 :                         goto fail;
     134             :                 }
     135             : 
     136           4 :                 _echo_SourceData(p, r2);
     137           4 :                 break;
     138             :         }
     139           4 :         case 4: { /* echo_TestCall */
     140           4 :                 struct echo_TestCall *r2 = (struct echo_TestCall *)r;
     141           4 :                 if (DEBUGLEVEL >= 10) {
     142           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_TestCall, NDR_IN, r2);
     143             :                 }
     144           4 :                 NDR_ZERO_STRUCT(r2->out);
     145           4 :                 r2->out.s2 = talloc_zero(r2, const char *);
     146           4 :                 if (r2->out.s2 == NULL) {
     147           0 :                         status = NT_STATUS_NO_MEMORY;
     148           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     149           0 :                         goto fail;
     150             :                 }
     151             : 
     152           4 :                 _echo_TestCall(p, r2);
     153           4 :                 break;
     154             :         }
     155           4 :         case 5: { /* echo_TestCall2 */
     156           4 :                 struct echo_TestCall2 *r2 = (struct echo_TestCall2 *)r;
     157           4 :                 if (DEBUGLEVEL >= 10) {
     158           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_TestCall2, NDR_IN, r2);
     159             :                 }
     160           4 :                 NDR_ZERO_STRUCT(r2->out);
     161           4 :                 r2->out.info = talloc_zero(r2, union echo_Info);
     162           4 :                 if (r2->out.info == NULL) {
     163           0 :                         status = NT_STATUS_NO_MEMORY;
     164           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     165           0 :                         goto fail;
     166             :                 }
     167             : 
     168           4 :                 r2->out.result = _echo_TestCall2(p, r2);
     169           4 :                 break;
     170             :         }
     171           0 :         case 6: { /* echo_TestSleep */
     172           0 :                 struct echo_TestSleep *r2 = (struct echo_TestSleep *)r;
     173           0 :                 if (DEBUGLEVEL >= 10) {
     174           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_TestSleep, NDR_IN, r2);
     175             :                 }
     176           0 :                 r2->out.result = _echo_TestSleep(p, r2);
     177           0 :                 break;
     178             :         }
     179           4 :         case 7: { /* echo_TestEnum */
     180           4 :                 struct echo_TestEnum *r2 = (struct echo_TestEnum *)r;
     181           4 :                 if (DEBUGLEVEL >= 10) {
     182           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_TestEnum, NDR_IN, r2);
     183             :                 }
     184           4 :                 NDR_ZERO_STRUCT(r2->out);
     185           4 :                 r2->out.foo1 = r2->in.foo1;
     186           4 :                 r2->out.foo2 = r2->in.foo2;
     187           4 :                 r2->out.foo3 = r2->in.foo3;
     188           4 :                 _echo_TestEnum(p, r2);
     189           4 :                 break;
     190             :         }
     191           4 :         case 8: { /* echo_TestSurrounding */
     192           4 :                 struct echo_TestSurrounding *r2 = (struct echo_TestSurrounding *)r;
     193           4 :                 if (DEBUGLEVEL >= 10) {
     194           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_TestSurrounding, NDR_IN, r2);
     195             :                 }
     196           4 :                 NDR_ZERO_STRUCT(r2->out);
     197           4 :                 r2->out.data = r2->in.data;
     198           4 :                 _echo_TestSurrounding(p, r2);
     199           4 :                 break;
     200             :         }
     201           4 :         case 9: { /* echo_TestDoublePointer */
     202           4 :                 struct echo_TestDoublePointer *r2 = (struct echo_TestDoublePointer *)r;
     203           4 :                 if (DEBUGLEVEL >= 10) {
     204           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_TestDoublePointer, NDR_IN, r2);
     205             :                 }
     206           4 :                 r2->out.result = _echo_TestDoublePointer(p, r2);
     207           4 :                 break;
     208             :         }
     209           0 :         default:
     210           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
     211           0 :                 break;
     212             :         }
     213             : 
     214          88 : fail:
     215             :         /* Unimpersonate */
     216          88 :         if (impersonated) {
     217          88 :                 unbecome_authenticated_pipe_user();
     218             :         }
     219             : 
     220          88 :         p->dce_call = NULL;
     221          88 :         p->mem_ctx = NULL;
     222             :         /* Check pipes struct fault state */
     223          88 :         if (p->fault_state != 0) {
     224          20 :                 dce_call->fault_code = p->fault_state;
     225             :         }
     226          88 :         if (dce_call->fault_code != 0) {
     227          20 :                 status = NT_STATUS_NET_WRITE_FAULT;
     228             :         }
     229             : 
     230          88 :         return status;
     231             : }
     232             : 
     233          88 : NTSTATUS rpcecho__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
     234             : {
     235          88 :         return rpcecho__op_dispatch_internal(dce_call, mem_ctx, r, S3COMPAT_RPC_DISPATCH_EXTERNAL);
     236             : }
     237             : 
     238          68 : NTSTATUS rpcecho__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
     239             : {
     240          68 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
     241             : 
     242          68 :         switch (opnum) {
     243          56 :         case 0: { /* echo_AddOne */
     244          56 :                 struct echo_AddOne *r2 = (struct echo_AddOne *)r;
     245          56 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     246           0 :                         DEBUG(5,("function echo_AddOne replied async\n"));
     247             :                 }
     248          56 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     249           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_AddOne, NDR_OUT | NDR_SET_VALUES, r2);
     250             :                 }
     251          56 :                 if (dce_call->fault_code != 0) {
     252           0 :                         DBG_WARNING("dcerpc_fault %s in echo_AddOne\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     253             :                 }
     254          56 :                 break;
     255             :         }
     256           4 :         case 1: { /* echo_EchoData */
     257           4 :                 struct echo_EchoData *r2 = (struct echo_EchoData *)r;
     258           4 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     259           0 :                         DEBUG(5,("function echo_EchoData replied async\n"));
     260             :                 }
     261           4 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     262           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_EchoData, NDR_OUT | NDR_SET_VALUES, r2);
     263             :                 }
     264           4 :                 if (dce_call->fault_code != 0) {
     265           0 :                         DBG_WARNING("dcerpc_fault %s in echo_EchoData\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     266             :                 }
     267           4 :                 break;
     268             :         }
     269           4 :         case 2: { /* echo_SinkData */
     270           4 :                 struct echo_SinkData *r2 = (struct echo_SinkData *)r;
     271           4 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     272           0 :                         DEBUG(5,("function echo_SinkData replied async\n"));
     273             :                 }
     274           4 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     275           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_SinkData, NDR_OUT | NDR_SET_VALUES, r2);
     276             :                 }
     277           4 :                 if (dce_call->fault_code != 0) {
     278           0 :                         DBG_WARNING("dcerpc_fault %s in echo_SinkData\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     279             :                 }
     280           4 :                 break;
     281             :         }
     282           4 :         case 3: { /* echo_SourceData */
     283           4 :                 struct echo_SourceData *r2 = (struct echo_SourceData *)r;
     284           4 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     285           0 :                         DEBUG(5,("function echo_SourceData replied async\n"));
     286             :                 }
     287           4 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     288           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_SourceData, NDR_OUT | NDR_SET_VALUES, r2);
     289             :                 }
     290           4 :                 if (dce_call->fault_code != 0) {
     291           0 :                         DBG_WARNING("dcerpc_fault %s in echo_SourceData\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     292             :                 }
     293           4 :                 break;
     294             :         }
     295           0 :         case 4: { /* echo_TestCall */
     296           0 :                 struct echo_TestCall *r2 = (struct echo_TestCall *)r;
     297           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     298           0 :                         DEBUG(5,("function echo_TestCall replied async\n"));
     299             :                 }
     300           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     301           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_TestCall, NDR_OUT | NDR_SET_VALUES, r2);
     302             :                 }
     303           0 :                 if (dce_call->fault_code != 0) {
     304           0 :                         DBG_WARNING("dcerpc_fault %s in echo_TestCall\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     305             :                 }
     306           0 :                 break;
     307             :         }
     308           0 :         case 5: { /* echo_TestCall2 */
     309           0 :                 struct echo_TestCall2 *r2 = (struct echo_TestCall2 *)r;
     310           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     311           0 :                         DEBUG(5,("function echo_TestCall2 replied async\n"));
     312             :                 }
     313           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     314           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_TestCall2, NDR_OUT | NDR_SET_VALUES, r2);
     315             :                 }
     316           0 :                 if (dce_call->fault_code != 0) {
     317           0 :                         DBG_WARNING("dcerpc_fault %s in echo_TestCall2\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     318             :                 }
     319           0 :                 break;
     320             :         }
     321           0 :         case 6: { /* echo_TestSleep */
     322           0 :                 struct echo_TestSleep *r2 = (struct echo_TestSleep *)r;
     323           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     324           0 :                         DEBUG(5,("function echo_TestSleep replied async\n"));
     325             :                 }
     326           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     327           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_TestSleep, NDR_OUT | NDR_SET_VALUES, r2);
     328             :                 }
     329           0 :                 if (dce_call->fault_code != 0) {
     330           0 :                         DBG_WARNING("dcerpc_fault %s in echo_TestSleep\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     331             :                 }
     332           0 :                 break;
     333             :         }
     334           0 :         case 7: { /* echo_TestEnum */
     335           0 :                 struct echo_TestEnum *r2 = (struct echo_TestEnum *)r;
     336           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     337           0 :                         DEBUG(5,("function echo_TestEnum replied async\n"));
     338             :                 }
     339           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     340           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_TestEnum, NDR_OUT | NDR_SET_VALUES, r2);
     341             :                 }
     342           0 :                 if (dce_call->fault_code != 0) {
     343           0 :                         DBG_WARNING("dcerpc_fault %s in echo_TestEnum\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     344             :                 }
     345           0 :                 break;
     346             :         }
     347           0 :         case 8: { /* echo_TestSurrounding */
     348           0 :                 struct echo_TestSurrounding *r2 = (struct echo_TestSurrounding *)r;
     349           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     350           0 :                         DEBUG(5,("function echo_TestSurrounding replied async\n"));
     351             :                 }
     352           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     353           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_TestSurrounding, NDR_OUT | NDR_SET_VALUES, r2);
     354             :                 }
     355           0 :                 if (dce_call->fault_code != 0) {
     356           0 :                         DBG_WARNING("dcerpc_fault %s in echo_TestSurrounding\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     357             :                 }
     358           0 :                 break;
     359             :         }
     360           0 :         case 9: { /* echo_TestDoublePointer */
     361           0 :                 struct echo_TestDoublePointer *r2 = (struct echo_TestDoublePointer *)r;
     362           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     363           0 :                         DEBUG(5,("function echo_TestDoublePointer replied async\n"));
     364             :                 }
     365           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     366           0 :                         NDR_PRINT_FUNCTION_DEBUG(echo_TestDoublePointer, NDR_OUT | NDR_SET_VALUES, r2);
     367             :                 }
     368           0 :                 if (dce_call->fault_code != 0) {
     369           0 :                         DBG_WARNING("dcerpc_fault %s in echo_TestDoublePointer\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     370             :                 }
     371           0 :                 break;
     372             :         }
     373           0 :         default:
     374           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
     375           0 :                 break;
     376             :         }
     377             : 
     378          68 :         if (dce_call->fault_code != 0) {
     379           0 :                 return NT_STATUS_NET_WRITE_FAULT;
     380             :         }
     381             : 
     382          68 :         return NT_STATUS_OK;
     383             : }
     384             : 
     385          68 : NTSTATUS rpcecho__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
     386             : {
     387           0 :         enum ndr_err_code ndr_err;
     388          68 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
     389             : 
     390          68 :         ndr_err = ndr_table_rpcecho.calls[opnum].ndr_push(push, NDR_OUT, r);
     391          68 :         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     392           0 :                 dce_call->fault_code = DCERPC_FAULT_NDR;
     393           0 :                 return NT_STATUS_NET_WRITE_FAULT;
     394             :         }
     395             : 
     396          68 :         return NT_STATUS_OK;
     397             : }
     398             : 
     399           0 : NTSTATUS rpcecho__op_local(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
     400             : {
     401           0 :         return rpcecho__op_dispatch_internal(dce_call, mem_ctx, r, S3COMPAT_RPC_DISPATCH_INTERNAL);
     402             : }
     403             : 
     404             : static const struct dcesrv_interface dcesrv_rpcecho_interface = {
     405             :         .name      = "rpcecho",
     406             :         .syntax_id = {{0x60a15ec5,0x4de8,0x11d7,{0xa6,0x37},{0x00,0x50,0x56,0xa2,0x01,0x82}},1.0},
     407             :         .bind      = rpcecho__op_bind,
     408             :         .unbind    = rpcecho__op_unbind,
     409             :         .ndr_pull  = rpcecho__op_ndr_pull,
     410             :         .dispatch  = rpcecho__op_dispatch,
     411             :         .reply     = rpcecho__op_reply,
     412             :         .ndr_push  = rpcecho__op_ndr_push,
     413             :         .local     = rpcecho__op_local,
     414             : #ifdef DCESRV_INTERFACE_RPCECHO_FLAGS
     415             :         .flags     = DCESRV_INTERFACE_RPCECHO_FLAGS
     416             : #else
     417             :         .flags     = 0
     418             : #endif
     419             : };
     420             : 
     421           4 : static NTSTATUS rpcecho__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
     422             : {
     423           0 :         uint32_t i;
     424           0 :         NTSTATUS ret;
     425             : 
     426             : #ifdef DCESRV_INTERFACE_RPCECHO_NCACN_NP_SECONDARY_ENDPOINT
     427             :         const char *ncacn_np_secondary_endpoint = DCESRV_INTERFACE_RPCECHO_NCACN_NP_SECONDARY_ENDPOINT;
     428             : #else
     429           4 :         const char *ncacn_np_secondary_endpoint = NULL;
     430             : #endif
     431             : 
     432          16 :         for (i=0;i<ndr_table_rpcecho.endpoints->count;i++) {
     433          12 :                 const char *name = ndr_table_rpcecho.endpoints->names[i];
     434             : 
     435          12 :                 ret = dcesrv_interface_register(dce_ctx, name, ncacn_np_secondary_endpoint, &dcesrv_rpcecho_interface, NULL);
     436          12 :                 if (!NT_STATUS_IS_OK(ret)) {
     437           0 :                         DBG_ERR("Failed to register endpoint '%s'\n",name);
     438           0 :                         return ret;
     439             :                 }
     440             :         }
     441             : 
     442           4 :         return NT_STATUS_OK;
     443             : }
     444             : 
     445           4 : static NTSTATUS rpcecho__op_shutdown_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
     446             : {
     447           4 :         return NT_STATUS_OK;
     448             : }
     449             : 
     450           0 : static bool rpcecho__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
     451             : {
     452           0 :         if (dcesrv_rpcecho_interface.syntax_id.if_version == if_version && GUID_equal(&dcesrv_rpcecho_interface.syntax_id.uuid, uuid)) {
     453           0 :                 memcpy(iface,&dcesrv_rpcecho_interface, sizeof(*iface));
     454           0 :                 return true;
     455             :         }
     456             : 
     457           0 :         return false;
     458             : }
     459             : 
     460           0 : static bool rpcecho__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
     461             : {
     462           0 :         if (strcmp(dcesrv_rpcecho_interface.name, name)==0) {
     463           0 :                 memcpy(iface, &dcesrv_rpcecho_interface, sizeof(*iface));
     464           0 :                 return true;
     465             :         }
     466             : 
     467           0 :         return false;
     468             : }
     469             : 
     470             : static const struct dcesrv_endpoint_server rpcecho_ep_server = {
     471             :         /* fill in our name */
     472             :         .name = "rpcecho",
     473             : 
     474             :         /* Initialization flag */
     475             :         .initialized = false,
     476             : 
     477             :         /* fill in all the operations */
     478             : #ifdef DCESRV_INTERFACE_RPCECHO_INIT_SERVER
     479             :         .init_server = DCESRV_INTERFACE_RPCECHO_INIT_SERVER,
     480             : #else
     481             :         .init_server = rpcecho__op_init_server,
     482             : #endif
     483             : #ifdef DCESRV_INTERFACE_RPCECHO_SHUTDOWN_SERVER
     484             :         .shutdown_server = DCESRV_INTERFACE_RPCECHO_SHUTDOWN_SERVER,
     485             : #else
     486             :         .shutdown_server = rpcecho__op_shutdown_server,
     487             : #endif
     488             :         .interface_by_uuid = rpcecho__op_interface_by_uuid,
     489             :         .interface_by_name = rpcecho__op_interface_by_name
     490             : };
     491             : 
     492           4 : const struct dcesrv_endpoint_server *rpcecho_get_ep_server(void)
     493             : {
     494           4 :         return &rpcecho_ep_server;
     495             : }

Generated by: LCOV version 1.14