LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - ndr_dssetup_s.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 59 265 22.3 %
Date: 2024-04-21 15:09:00 Functions: 8 11 72.7 %

          Line data    Source code
       1             : /* server functions auto-generated by pidl */
       2             : #include "bin/default/librpc/gen_ndr/ndr_dssetup.h"
       3             : #include <util/debug.h>
       4             : 
       5             : NTSTATUS dcerpc_server_dssetup_init(TALLOC_CTX *);
       6             : 
       7             : /* dssetup - dcerpc server boilerplate generated by pidl */
       8             : 
       9             : 
      10          63 : static NTSTATUS dssetup__op_bind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
      11             : {
      12             : #ifdef DCESRV_INTERFACE_DSSETUP_BIND
      13             :         return DCESRV_INTERFACE_DSSETUP_BIND(context,iface);
      14             : #else
      15          63 :         return NT_STATUS_OK;
      16             : #endif
      17             : }
      18             : 
      19          63 : static void dssetup__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
      20             : {
      21             : #ifdef DCESRV_INTERFACE_DSSETUP_UNBIND
      22             :         DCESRV_INTERFACE_DSSETUP_UNBIND(context, iface);
      23             : #else
      24          63 :         return;
      25             : #endif
      26             : }
      27             : 
      28         123 : static NTSTATUS dssetup__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
      29             : {
      30           9 :         enum ndr_err_code ndr_err;
      31         123 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
      32             : 
      33         123 :         dce_call->fault_code = 0;
      34             : 
      35         123 :         if (opnum >= ndr_table_dssetup.num_calls) {
      36           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
      37           0 :                 return NT_STATUS_NET_WRITE_FAULT;
      38             :         }
      39             : 
      40         246 :         *r = talloc_named(mem_ctx,
      41         123 :                           ndr_table_dssetup.calls[opnum].struct_size,
      42             :                           "struct %s",
      43         123 :                           ndr_table_dssetup.calls[opnum].name);
      44         123 :         NT_STATUS_HAVE_NO_MEMORY(*r);
      45             : 
      46             :         /* unravel the NDR for the packet */
      47         123 :         ndr_err = ndr_table_dssetup.calls[opnum].ndr_pull(pull, NDR_IN, *r);
      48         123 :         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
      49           0 :                 dce_call->fault_code = DCERPC_FAULT_NDR;
      50           0 :                 return NT_STATUS_NET_WRITE_FAULT;
      51             :         }
      52             : 
      53         123 :         return NT_STATUS_OK;
      54             : }
      55             : 
      56         123 : static NTSTATUS dssetup__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
      57             : {
      58         123 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
      59             : 
      60         123 :         switch (opnum) {
      61         123 :         case 0: {
      62         123 :                 struct dssetup_DsRoleGetPrimaryDomainInformation *r2 = (struct dssetup_DsRoleGetPrimaryDomainInformation *)r;
      63         123 :                 if (DEBUGLEVEL >= 10) {
      64           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleGetPrimaryDomainInformation, NDR_IN, r2);
      65             :                 }
      66         123 :                 r2->out.result = dcesrv_dssetup_DsRoleGetPrimaryDomainInformation(dce_call, mem_ctx, r2);
      67         123 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
      68           0 :                         DEBUG(5,("function dssetup_DsRoleGetPrimaryDomainInformation will reply async\n"));
      69             :                 }
      70         114 :                 break;
      71             :         }
      72           0 :         case 1: {
      73           0 :                 struct dssetup_DsRoleDnsNameToFlatName *r2 = (struct dssetup_DsRoleDnsNameToFlatName *)r;
      74           0 :                 if (DEBUGLEVEL >= 10) {
      75           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleDnsNameToFlatName, NDR_IN, r2);
      76             :                 }
      77           0 :                 r2->out.result = dcesrv_dssetup_DsRoleDnsNameToFlatName(dce_call, mem_ctx, r2);
      78           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
      79           0 :                         DEBUG(5,("function dssetup_DsRoleDnsNameToFlatName will reply async\n"));
      80             :                 }
      81           0 :                 break;
      82             :         }
      83           0 :         case 2: {
      84           0 :                 struct dssetup_DsRoleDcAsDc *r2 = (struct dssetup_DsRoleDcAsDc *)r;
      85           0 :                 if (DEBUGLEVEL >= 10) {
      86           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleDcAsDc, NDR_IN, r2);
      87             :                 }
      88           0 :                 r2->out.result = dcesrv_dssetup_DsRoleDcAsDc(dce_call, mem_ctx, r2);
      89           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
      90           0 :                         DEBUG(5,("function dssetup_DsRoleDcAsDc will reply async\n"));
      91             :                 }
      92           0 :                 break;
      93             :         }
      94           0 :         case 3: {
      95           0 :                 struct dssetup_DsRoleDcAsReplica *r2 = (struct dssetup_DsRoleDcAsReplica *)r;
      96           0 :                 if (DEBUGLEVEL >= 10) {
      97           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleDcAsReplica, NDR_IN, r2);
      98             :                 }
      99           0 :                 r2->out.result = dcesrv_dssetup_DsRoleDcAsReplica(dce_call, mem_ctx, r2);
     100           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     101           0 :                         DEBUG(5,("function dssetup_DsRoleDcAsReplica will reply async\n"));
     102             :                 }
     103           0 :                 break;
     104             :         }
     105           0 :         case 4: {
     106           0 :                 struct dssetup_DsRoleDemoteDc *r2 = (struct dssetup_DsRoleDemoteDc *)r;
     107           0 :                 if (DEBUGLEVEL >= 10) {
     108           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleDemoteDc, NDR_IN, r2);
     109             :                 }
     110           0 :                 r2->out.result = dcesrv_dssetup_DsRoleDemoteDc(dce_call, mem_ctx, r2);
     111           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     112           0 :                         DEBUG(5,("function dssetup_DsRoleDemoteDc will reply async\n"));
     113             :                 }
     114           0 :                 break;
     115             :         }
     116           0 :         case 5: {
     117           0 :                 struct dssetup_DsRoleGetDcOperationProgress *r2 = (struct dssetup_DsRoleGetDcOperationProgress *)r;
     118           0 :                 if (DEBUGLEVEL >= 10) {
     119           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleGetDcOperationProgress, NDR_IN, r2);
     120             :                 }
     121           0 :                 r2->out.result = dcesrv_dssetup_DsRoleGetDcOperationProgress(dce_call, mem_ctx, r2);
     122           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     123           0 :                         DEBUG(5,("function dssetup_DsRoleGetDcOperationProgress will reply async\n"));
     124             :                 }
     125           0 :                 break;
     126             :         }
     127           0 :         case 6: {
     128           0 :                 struct dssetup_DsRoleGetDcOperationResults *r2 = (struct dssetup_DsRoleGetDcOperationResults *)r;
     129           0 :                 if (DEBUGLEVEL >= 10) {
     130           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleGetDcOperationResults, NDR_IN, r2);
     131             :                 }
     132           0 :                 r2->out.result = dcesrv_dssetup_DsRoleGetDcOperationResults(dce_call, mem_ctx, r2);
     133           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     134           0 :                         DEBUG(5,("function dssetup_DsRoleGetDcOperationResults will reply async\n"));
     135             :                 }
     136           0 :                 break;
     137             :         }
     138           0 :         case 7: {
     139           0 :                 struct dssetup_DsRoleCancel *r2 = (struct dssetup_DsRoleCancel *)r;
     140           0 :                 if (DEBUGLEVEL >= 10) {
     141           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleCancel, NDR_IN, r2);
     142             :                 }
     143           0 :                 r2->out.result = dcesrv_dssetup_DsRoleCancel(dce_call, mem_ctx, r2);
     144           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     145           0 :                         DEBUG(5,("function dssetup_DsRoleCancel will reply async\n"));
     146             :                 }
     147           0 :                 break;
     148             :         }
     149           0 :         case 8: {
     150           0 :                 struct dssetup_DsRoleServerSaveStateForUpgrade *r2 = (struct dssetup_DsRoleServerSaveStateForUpgrade *)r;
     151           0 :                 if (DEBUGLEVEL >= 10) {
     152           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleServerSaveStateForUpgrade, NDR_IN, r2);
     153             :                 }
     154           0 :                 r2->out.result = dcesrv_dssetup_DsRoleServerSaveStateForUpgrade(dce_call, mem_ctx, r2);
     155           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     156           0 :                         DEBUG(5,("function dssetup_DsRoleServerSaveStateForUpgrade will reply async\n"));
     157             :                 }
     158           0 :                 break;
     159             :         }
     160           0 :         case 9: {
     161           0 :                 struct dssetup_DsRoleUpgradeDownlevelServer *r2 = (struct dssetup_DsRoleUpgradeDownlevelServer *)r;
     162           0 :                 if (DEBUGLEVEL >= 10) {
     163           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleUpgradeDownlevelServer, NDR_IN, r2);
     164             :                 }
     165           0 :                 r2->out.result = dcesrv_dssetup_DsRoleUpgradeDownlevelServer(dce_call, mem_ctx, r2);
     166           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     167           0 :                         DEBUG(5,("function dssetup_DsRoleUpgradeDownlevelServer will reply async\n"));
     168             :                 }
     169           0 :                 break;
     170             :         }
     171           0 :         case 10: {
     172           0 :                 struct dssetup_DsRoleAbortDownlevelServerUpgrade *r2 = (struct dssetup_DsRoleAbortDownlevelServerUpgrade *)r;
     173           0 :                 if (DEBUGLEVEL >= 10) {
     174           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleAbortDownlevelServerUpgrade, NDR_IN, r2);
     175             :                 }
     176           0 :                 r2->out.result = dcesrv_dssetup_DsRoleAbortDownlevelServerUpgrade(dce_call, mem_ctx, r2);
     177           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     178           0 :                         DEBUG(5,("function dssetup_DsRoleAbortDownlevelServerUpgrade will reply async\n"));
     179             :                 }
     180           0 :                 break;
     181             :         }
     182             : 
     183           0 :         default:
     184           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
     185           0 :                 break;
     186             :         }
     187             : 
     188         123 :         if (dce_call->fault_code != 0) {
     189           0 :                 return NT_STATUS_NET_WRITE_FAULT;
     190             :         }
     191             : 
     192         123 :         return NT_STATUS_OK;
     193             : }
     194             : 
     195         123 : static NTSTATUS dssetup__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
     196             : {
     197         123 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
     198             : 
     199         123 :         switch (opnum) {
     200         123 :         case 0: {
     201         123 :                 struct dssetup_DsRoleGetPrimaryDomainInformation *r2 = (struct dssetup_DsRoleGetPrimaryDomainInformation *)r;
     202         123 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     203           0 :                         DEBUG(5,("function dssetup_DsRoleGetPrimaryDomainInformation replied async\n"));
     204             :                 }
     205         123 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     206           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleGetPrimaryDomainInformation, NDR_OUT | NDR_SET_VALUES, r2);
     207             :                 }
     208         123 :                 if (dce_call->fault_code != 0) {
     209           0 :                         DEBUG(2,("dcerpc_fault %s in dssetup_DsRoleGetPrimaryDomainInformation\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     210             :                 }
     211         114 :                 break;
     212             :         }
     213           0 :         case 1: {
     214           0 :                 struct dssetup_DsRoleDnsNameToFlatName *r2 = (struct dssetup_DsRoleDnsNameToFlatName *)r;
     215           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     216           0 :                         DEBUG(5,("function dssetup_DsRoleDnsNameToFlatName replied async\n"));
     217             :                 }
     218           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     219           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleDnsNameToFlatName, NDR_OUT | NDR_SET_VALUES, r2);
     220             :                 }
     221           0 :                 if (dce_call->fault_code != 0) {
     222           0 :                         DEBUG(2,("dcerpc_fault %s in dssetup_DsRoleDnsNameToFlatName\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     223             :                 }
     224           0 :                 break;
     225             :         }
     226           0 :         case 2: {
     227           0 :                 struct dssetup_DsRoleDcAsDc *r2 = (struct dssetup_DsRoleDcAsDc *)r;
     228           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     229           0 :                         DEBUG(5,("function dssetup_DsRoleDcAsDc replied async\n"));
     230             :                 }
     231           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     232           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleDcAsDc, NDR_OUT | NDR_SET_VALUES, r2);
     233             :                 }
     234           0 :                 if (dce_call->fault_code != 0) {
     235           0 :                         DEBUG(2,("dcerpc_fault %s in dssetup_DsRoleDcAsDc\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     236             :                 }
     237           0 :                 break;
     238             :         }
     239           0 :         case 3: {
     240           0 :                 struct dssetup_DsRoleDcAsReplica *r2 = (struct dssetup_DsRoleDcAsReplica *)r;
     241           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     242           0 :                         DEBUG(5,("function dssetup_DsRoleDcAsReplica replied async\n"));
     243             :                 }
     244           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     245           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleDcAsReplica, NDR_OUT | NDR_SET_VALUES, r2);
     246             :                 }
     247           0 :                 if (dce_call->fault_code != 0) {
     248           0 :                         DEBUG(2,("dcerpc_fault %s in dssetup_DsRoleDcAsReplica\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     249             :                 }
     250           0 :                 break;
     251             :         }
     252           0 :         case 4: {
     253           0 :                 struct dssetup_DsRoleDemoteDc *r2 = (struct dssetup_DsRoleDemoteDc *)r;
     254           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     255           0 :                         DEBUG(5,("function dssetup_DsRoleDemoteDc replied async\n"));
     256             :                 }
     257           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     258           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleDemoteDc, NDR_OUT | NDR_SET_VALUES, r2);
     259             :                 }
     260           0 :                 if (dce_call->fault_code != 0) {
     261           0 :                         DEBUG(2,("dcerpc_fault %s in dssetup_DsRoleDemoteDc\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     262             :                 }
     263           0 :                 break;
     264             :         }
     265           0 :         case 5: {
     266           0 :                 struct dssetup_DsRoleGetDcOperationProgress *r2 = (struct dssetup_DsRoleGetDcOperationProgress *)r;
     267           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     268           0 :                         DEBUG(5,("function dssetup_DsRoleGetDcOperationProgress replied async\n"));
     269             :                 }
     270           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     271           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleGetDcOperationProgress, NDR_OUT | NDR_SET_VALUES, r2);
     272             :                 }
     273           0 :                 if (dce_call->fault_code != 0) {
     274           0 :                         DEBUG(2,("dcerpc_fault %s in dssetup_DsRoleGetDcOperationProgress\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     275             :                 }
     276           0 :                 break;
     277             :         }
     278           0 :         case 6: {
     279           0 :                 struct dssetup_DsRoleGetDcOperationResults *r2 = (struct dssetup_DsRoleGetDcOperationResults *)r;
     280           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     281           0 :                         DEBUG(5,("function dssetup_DsRoleGetDcOperationResults replied async\n"));
     282             :                 }
     283           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     284           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleGetDcOperationResults, NDR_OUT | NDR_SET_VALUES, r2);
     285             :                 }
     286           0 :                 if (dce_call->fault_code != 0) {
     287           0 :                         DEBUG(2,("dcerpc_fault %s in dssetup_DsRoleGetDcOperationResults\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     288             :                 }
     289           0 :                 break;
     290             :         }
     291           0 :         case 7: {
     292           0 :                 struct dssetup_DsRoleCancel *r2 = (struct dssetup_DsRoleCancel *)r;
     293           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     294           0 :                         DEBUG(5,("function dssetup_DsRoleCancel replied async\n"));
     295             :                 }
     296           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     297           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleCancel, NDR_OUT | NDR_SET_VALUES, r2);
     298             :                 }
     299           0 :                 if (dce_call->fault_code != 0) {
     300           0 :                         DEBUG(2,("dcerpc_fault %s in dssetup_DsRoleCancel\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     301             :                 }
     302           0 :                 break;
     303             :         }
     304           0 :         case 8: {
     305           0 :                 struct dssetup_DsRoleServerSaveStateForUpgrade *r2 = (struct dssetup_DsRoleServerSaveStateForUpgrade *)r;
     306           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     307           0 :                         DEBUG(5,("function dssetup_DsRoleServerSaveStateForUpgrade replied async\n"));
     308             :                 }
     309           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     310           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleServerSaveStateForUpgrade, NDR_OUT | NDR_SET_VALUES, r2);
     311             :                 }
     312           0 :                 if (dce_call->fault_code != 0) {
     313           0 :                         DEBUG(2,("dcerpc_fault %s in dssetup_DsRoleServerSaveStateForUpgrade\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     314             :                 }
     315           0 :                 break;
     316             :         }
     317           0 :         case 9: {
     318           0 :                 struct dssetup_DsRoleUpgradeDownlevelServer *r2 = (struct dssetup_DsRoleUpgradeDownlevelServer *)r;
     319           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     320           0 :                         DEBUG(5,("function dssetup_DsRoleUpgradeDownlevelServer replied async\n"));
     321             :                 }
     322           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     323           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleUpgradeDownlevelServer, NDR_OUT | NDR_SET_VALUES, r2);
     324             :                 }
     325           0 :                 if (dce_call->fault_code != 0) {
     326           0 :                         DEBUG(2,("dcerpc_fault %s in dssetup_DsRoleUpgradeDownlevelServer\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     327             :                 }
     328           0 :                 break;
     329             :         }
     330           0 :         case 10: {
     331           0 :                 struct dssetup_DsRoleAbortDownlevelServerUpgrade *r2 = (struct dssetup_DsRoleAbortDownlevelServerUpgrade *)r;
     332           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     333           0 :                         DEBUG(5,("function dssetup_DsRoleAbortDownlevelServerUpgrade replied async\n"));
     334             :                 }
     335           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     336           0 :                         NDR_PRINT_FUNCTION_DEBUG(dssetup_DsRoleAbortDownlevelServerUpgrade, NDR_OUT | NDR_SET_VALUES, r2);
     337             :                 }
     338           0 :                 if (dce_call->fault_code != 0) {
     339           0 :                         DEBUG(2,("dcerpc_fault %s in dssetup_DsRoleAbortDownlevelServerUpgrade\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     340             :                 }
     341           0 :                 break;
     342             :         }
     343             : 
     344           0 :         default:
     345           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
     346           0 :                 break;
     347             :         }
     348             : 
     349         123 :         if (dce_call->fault_code != 0) {
     350           0 :                 return NT_STATUS_NET_WRITE_FAULT;
     351             :         }
     352             : 
     353         123 :         return NT_STATUS_OK;
     354             : }
     355             : 
     356         123 : static NTSTATUS dssetup__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
     357             : {
     358           9 :         enum ndr_err_code ndr_err;
     359         123 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
     360             : 
     361         123 :         ndr_err = ndr_table_dssetup.calls[opnum].ndr_push(push, NDR_OUT, r);
     362         123 :         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     363           0 :                 dce_call->fault_code = DCERPC_FAULT_NDR;
     364           0 :                 return NT_STATUS_NET_WRITE_FAULT;
     365             :         }
     366             : 
     367         123 :         return NT_STATUS_OK;
     368             : }
     369             : 
     370             : static const struct dcesrv_interface dcesrv_dssetup_interface = {
     371             :         .name               = "dssetup",
     372             :         .syntax_id          = {{0x3919286a,0xb10c,0x11d0,{0x9b,0xa8},{0x00,0xc0,0x4f,0xd9,0x2e,0xf5}},0.0},
     373             :         .bind               = dssetup__op_bind,
     374             :         .unbind             = dssetup__op_unbind,
     375             :         .ndr_pull           = dssetup__op_ndr_pull,
     376             :         .dispatch           = dssetup__op_dispatch,
     377             :         .reply              = dssetup__op_reply,
     378             :         .ndr_push           = dssetup__op_ndr_push,
     379             :         .local              = NULL,
     380             : #ifdef DCESRV_INTERFACE_DSSETUP_FLAGS
     381             :         .flags              = DCESRV_INTERFACE_DSSETUP_FLAGS
     382             : #else
     383             :         .flags              = 0
     384             : #endif
     385             : };
     386             : 
     387             : 
     388          64 : static NTSTATUS dssetup__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
     389             : {
     390           2 :         int i;
     391             : #ifdef DCESRV_INTERFACE_DSSETUP_NCACN_NP_SECONDARY_ENDPOINT
     392             :         const char *ncacn_np_secondary_endpoint =
     393             :                 DCESRV_INTERFACE_DSSETUP_NCACN_NP_SECONDARY_ENDPOINT;
     394             : #else
     395          64 :         const char *ncacn_np_secondary_endpoint = NULL;
     396             : #endif
     397             : 
     398         320 :         for (i=0;i<ndr_table_dssetup.endpoints->count;i++) {
     399           8 :                 NTSTATUS ret;
     400         256 :                 const char *name = ndr_table_dssetup.endpoints->names[i];
     401             : 
     402         256 :                 ret = dcesrv_interface_register(dce_ctx,
     403             :                                                 name,
     404             :                                                 ncacn_np_secondary_endpoint,
     405             :                                                 &dcesrv_dssetup_interface,
     406             :                                                 NULL);
     407         256 :                 if (!NT_STATUS_IS_OK(ret)) {
     408           0 :                         DEBUG(1,("dssetup_op_init_server: failed to register endpoint '%s'\n",name));
     409           0 :                         return ret;
     410             :                 }
     411             :         }
     412             : 
     413          64 :         return NT_STATUS_OK;
     414             : }
     415             : 
     416           0 : static NTSTATUS dssetup__op_shutdown_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
     417             : {
     418           0 :         return NT_STATUS_OK;
     419             : }
     420             : 
     421           0 : static bool dssetup__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
     422             : {
     423           0 :         if (dcesrv_dssetup_interface.syntax_id.if_version == if_version &&
     424           0 :                 GUID_equal(&dcesrv_dssetup_interface.syntax_id.uuid, uuid)) {
     425           0 :                 memcpy(iface,&dcesrv_dssetup_interface, sizeof(*iface));
     426           0 :                 return true;
     427             :         }
     428             : 
     429           0 :         return false;
     430             : }
     431             : 
     432           0 : static bool dssetup__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
     433             : {
     434           0 :         if (strcmp(dcesrv_dssetup_interface.name, name)==0) {
     435           0 :                 memcpy(iface, &dcesrv_dssetup_interface, sizeof(*iface));
     436           0 :                 return true;
     437             :         }
     438             : 
     439           0 :         return false;
     440             : }
     441             : 
     442          66 : NTSTATUS dcerpc_server_dssetup_init(TALLOC_CTX *ctx)
     443             : {
     444           2 :         NTSTATUS ret;
     445           2 :         static const struct dcesrv_endpoint_server ep_server = {
     446             :             /* fill in our name */
     447             :             .name = "dssetup",
     448             : 
     449             :             /* Initialization flag */
     450             :             .initialized = false,
     451             : 
     452             :             /* fill in all the operations */
     453             : #ifdef DCESRV_INTERFACE_DSSETUP_INIT_SERVER
     454             :             .init_server = DCESRV_INTERFACE_DSSETUP_INIT_SERVER,
     455             : #else
     456             :             .init_server = dssetup__op_init_server,
     457             : #endif
     458             : #ifdef DCESRV_INTERFACE_DSSETUP_SHUTDOWN_SERVER
     459             :             .shutdown_server = DCESRV_INTERFACE_DSSETUP_SHUTDOWN_SERVER,
     460             : #else
     461             :             .shutdown_server = dssetup__op_shutdown_server,
     462             : #endif
     463             :             .interface_by_uuid = dssetup__op_interface_by_uuid,
     464             :             .interface_by_name = dssetup__op_interface_by_name
     465             :         };
     466             :         /* register ourselves with the DCERPC subsystem. */
     467          66 :         ret = dcerpc_register_ep_server(&ep_server);
     468             : 
     469          66 :         if (!NT_STATUS_IS_OK(ret)) {
     470           0 :                 DEBUG(0,("Failed to register 'dssetup' endpoint server!\n"));
     471           0 :                 return ret;
     472             :         }
     473             : 
     474          66 :         return ret;
     475             : }
     476             : 

Generated by: LCOV version 1.14