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

Generated by: LCOV version 1.14