LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - ndr_dfs_scompat.c (source / functions) Hit Total Coverage
Test: coverage report for abartlet/fix-coverage dd10fb34 Lines: 29 503 5.8 %
Date: 2021-09-23 10:06:22 Functions: 4 14 28.6 %

          Line data    Source code
       1             : /* s3 compat server functions auto-generated by pidl */
       2             : #include "bin/default/librpc/gen_ndr/ndr_dfs.h"
       3             : #include "bin/default/librpc/gen_ndr/ndr_dfs_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             : /* netdfs - dcerpc server boilerplate generated by pidl */
      15           0 : static NTSTATUS netdfs__op_bind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
      16             : {
      17           0 :         struct pipes_struct *p = NULL;
      18             : 
      19             :         /* Retrieve pipes struct */
      20           0 :         p = dcesrv_get_pipes_struct(context->conn);
      21           0 :         p->pipe_bound = true;
      22             : #ifdef DCESRV_INTERFACE_NETDFS_BIND
      23             :         return DCESRV_INTERFACE_NETDFS_BIND(context,iface);
      24             : #else
      25           0 :         return NT_STATUS_OK;
      26             : #endif
      27             : }
      28             : 
      29           0 : static void netdfs__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
      30             : {
      31             : #ifdef DCESRV_INTERFACE_NETDFS_UNBIND
      32             :         DCESRV_INTERFACE_NETDFS_UNBIND(context, iface);
      33             : #else
      34           0 :         return;
      35             : #endif
      36             : }
      37             : 
      38           0 : NTSTATUS netdfs__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
      39             : {
      40             :         enum ndr_err_code ndr_err;
      41           0 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
      42             : 
      43           0 :         dce_call->fault_code = 0;
      44             : 
      45           0 :         if (opnum >= ndr_table_netdfs.num_calls) {
      46           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
      47           0 :                 return NT_STATUS_NET_WRITE_FAULT;
      48             :         }
      49             : 
      50           0 :         *r = talloc_named(mem_ctx, ndr_table_netdfs.calls[opnum].struct_size, "struct %s", ndr_table_netdfs.calls[opnum].name);
      51           0 :         NT_STATUS_HAVE_NO_MEMORY(*r);
      52             : 
      53             :         /* unravel the NDR for the packet */
      54           0 :         ndr_err = ndr_table_netdfs.calls[opnum].ndr_pull(pull, NDR_IN, *r);
      55           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
      56           0 :                 dce_call->fault_code = DCERPC_FAULT_NDR;
      57           0 :                 return NT_STATUS_NET_WRITE_FAULT;
      58             :         }
      59             : 
      60           0 :         return NT_STATUS_OK;
      61             : }
      62             : 
      63           0 : static NTSTATUS netdfs__op_dispatch_internal(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r, enum s3compat_rpc_dispatch dispatch)
      64             : {
      65           0 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
      66           0 :         struct pipes_struct *p = NULL;
      67           0 :         struct auth_session_info *pipe_session_info = NULL;
      68           0 :         NTSTATUS status = NT_STATUS_OK;
      69           0 :         bool impersonated = false;
      70             : 
      71             :         /* Retrieve pipes struct */
      72           0 :         p = dcesrv_get_pipes_struct(dce_call->conn);
      73             :         /* Update pipes struct opnum */
      74           0 :         p->opnum = opnum;
      75           0 :         p->dce_call = dce_call;
      76           0 :         p->mem_ctx = mem_ctx;
      77             :         /* Update pipes struct session info */
      78           0 :         pipe_session_info = p->session_info;
      79           0 :         p->session_info = dce_call->auth_state->session_info;
      80           0 :         p->auth.auth_type = dce_call->auth_state->auth_type;
      81           0 :         p->auth.auth_level = dce_call->auth_state->auth_level;
      82           0 :         p->auth.auth_context_id = dce_call->auth_state->auth_context_id;
      83             :         /* Reset pipes struct fault state */
      84           0 :         p->fault_state = 0;
      85             : 
      86             :         /* Impersonate */
      87           0 :         if (dispatch == S3COMPAT_RPC_DISPATCH_EXTERNAL) {
      88           0 :                 impersonated = become_authenticated_pipe_user(p->session_info);
      89           0 :                 if (!impersonated) {
      90           0 :                         dce_call->fault_code = DCERPC_FAULT_ACCESS_DENIED;
      91           0 :                         status = NT_STATUS_NET_WRITE_FAULT;
      92           0 :                         goto fail;
      93             :                 }
      94             :         }
      95             : 
      96           0 :         switch (opnum) {
      97           0 :         case 0: { /* dfs_GetManagerVersion */
      98           0 :                 struct dfs_GetManagerVersion *r2 = (struct dfs_GetManagerVersion *)r;
      99           0 :                 if (DEBUGLEVEL >= 10) {
     100           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_GetManagerVersion, NDR_IN, r2);
     101             :                 }
     102           0 :                 NDR_ZERO_STRUCT(r2->out);
     103           0 :                 r2->out.version = talloc_zero(r2, enum dfs_ManagerVersion);
     104           0 :                 if (r2->out.version == NULL) {
     105           0 :                         status = NT_STATUS_NO_MEMORY;
     106           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     107           0 :                         goto fail;
     108             :                 }
     109             : 
     110           0 :                 _dfs_GetManagerVersion(p, r2);
     111           0 :                 break;
     112             :         }
     113           0 :         case 1: { /* dfs_Add */
     114           0 :                 struct dfs_Add *r2 = (struct dfs_Add *)r;
     115           0 :                 if (DEBUGLEVEL >= 10) {
     116           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Add, NDR_IN, r2);
     117             :                 }
     118           0 :                 r2->out.result = _dfs_Add(p, r2);
     119           0 :                 break;
     120             :         }
     121           0 :         case 2: { /* dfs_Remove */
     122           0 :                 struct dfs_Remove *r2 = (struct dfs_Remove *)r;
     123           0 :                 if (DEBUGLEVEL >= 10) {
     124           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Remove, NDR_IN, r2);
     125             :                 }
     126           0 :                 r2->out.result = _dfs_Remove(p, r2);
     127           0 :                 break;
     128             :         }
     129           0 :         case 3: { /* dfs_SetInfo */
     130           0 :                 struct dfs_SetInfo *r2 = (struct dfs_SetInfo *)r;
     131           0 :                 if (DEBUGLEVEL >= 10) {
     132           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_SetInfo, NDR_IN, r2);
     133             :                 }
     134           0 :                 r2->out.result = _dfs_SetInfo(p, r2);
     135           0 :                 break;
     136             :         }
     137           0 :         case 4: { /* dfs_GetInfo */
     138           0 :                 struct dfs_GetInfo *r2 = (struct dfs_GetInfo *)r;
     139           0 :                 if (DEBUGLEVEL >= 10) {
     140           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_GetInfo, NDR_IN, r2);
     141             :                 }
     142           0 :                 NDR_ZERO_STRUCT(r2->out);
     143           0 :                 r2->out.info = talloc_zero(r2, union dfs_Info);
     144           0 :                 if (r2->out.info == NULL) {
     145           0 :                         status = NT_STATUS_NO_MEMORY;
     146           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     147           0 :                         goto fail;
     148             :                 }
     149             : 
     150           0 :                 r2->out.result = _dfs_GetInfo(p, r2);
     151           0 :                 break;
     152             :         }
     153           0 :         case 5: { /* dfs_Enum */
     154           0 :                 struct dfs_Enum *r2 = (struct dfs_Enum *)r;
     155           0 :                 if (DEBUGLEVEL >= 10) {
     156           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Enum, NDR_IN, r2);
     157             :                 }
     158           0 :                 NDR_ZERO_STRUCT(r2->out);
     159           0 :                 r2->out.info = r2->in.info;
     160           0 :                 r2->out.total = r2->in.total;
     161           0 :                 r2->out.result = _dfs_Enum(p, r2);
     162           0 :                 break;
     163             :         }
     164           0 :         case 6: { /* dfs_Rename */
     165           0 :                 struct dfs_Rename *r2 = (struct dfs_Rename *)r;
     166           0 :                 if (DEBUGLEVEL >= 10) {
     167           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Rename, NDR_IN, r2);
     168             :                 }
     169           0 :                 r2->out.result = _dfs_Rename(p, r2);
     170           0 :                 break;
     171             :         }
     172           0 :         case 7: { /* dfs_Move */
     173           0 :                 struct dfs_Move *r2 = (struct dfs_Move *)r;
     174           0 :                 if (DEBUGLEVEL >= 10) {
     175           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Move, NDR_IN, r2);
     176             :                 }
     177           0 :                 r2->out.result = _dfs_Move(p, r2);
     178           0 :                 break;
     179             :         }
     180           0 :         case 8: { /* dfs_ManagerGetConfigInfo */
     181           0 :                 struct dfs_ManagerGetConfigInfo *r2 = (struct dfs_ManagerGetConfigInfo *)r;
     182           0 :                 if (DEBUGLEVEL >= 10) {
     183           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_ManagerGetConfigInfo, NDR_IN, r2);
     184             :                 }
     185           0 :                 r2->out.result = _dfs_ManagerGetConfigInfo(p, r2);
     186           0 :                 break;
     187             :         }
     188           0 :         case 9: { /* dfs_ManagerSendSiteInfo */
     189           0 :                 struct dfs_ManagerSendSiteInfo *r2 = (struct dfs_ManagerSendSiteInfo *)r;
     190           0 :                 if (DEBUGLEVEL >= 10) {
     191           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_ManagerSendSiteInfo, NDR_IN, r2);
     192             :                 }
     193           0 :                 r2->out.result = _dfs_ManagerSendSiteInfo(p, r2);
     194           0 :                 break;
     195             :         }
     196           0 :         case 10: { /* dfs_AddFtRoot */
     197           0 :                 struct dfs_AddFtRoot *r2 = (struct dfs_AddFtRoot *)r;
     198           0 :                 if (DEBUGLEVEL >= 10) {
     199           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_AddFtRoot, NDR_IN, r2);
     200             :                 }
     201           0 :                 NDR_ZERO_STRUCT(r2->out);
     202           0 :                 r2->out.unknown2 = r2->in.unknown2;
     203           0 :                 r2->out.result = _dfs_AddFtRoot(p, r2);
     204           0 :                 break;
     205             :         }
     206           0 :         case 11: { /* dfs_RemoveFtRoot */
     207           0 :                 struct dfs_RemoveFtRoot *r2 = (struct dfs_RemoveFtRoot *)r;
     208           0 :                 if (DEBUGLEVEL >= 10) {
     209           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_RemoveFtRoot, NDR_IN, r2);
     210             :                 }
     211           0 :                 NDR_ZERO_STRUCT(r2->out);
     212           0 :                 r2->out.unknown = r2->in.unknown;
     213           0 :                 r2->out.result = _dfs_RemoveFtRoot(p, r2);
     214           0 :                 break;
     215             :         }
     216           0 :         case 12: { /* dfs_AddStdRoot */
     217           0 :                 struct dfs_AddStdRoot *r2 = (struct dfs_AddStdRoot *)r;
     218           0 :                 if (DEBUGLEVEL >= 10) {
     219           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_AddStdRoot, NDR_IN, r2);
     220             :                 }
     221           0 :                 r2->out.result = _dfs_AddStdRoot(p, r2);
     222           0 :                 break;
     223             :         }
     224           0 :         case 13: { /* dfs_RemoveStdRoot */
     225           0 :                 struct dfs_RemoveStdRoot *r2 = (struct dfs_RemoveStdRoot *)r;
     226           0 :                 if (DEBUGLEVEL >= 10) {
     227           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_RemoveStdRoot, NDR_IN, r2);
     228             :                 }
     229           0 :                 r2->out.result = _dfs_RemoveStdRoot(p, r2);
     230           0 :                 break;
     231             :         }
     232           0 :         case 14: { /* dfs_ManagerInitialize */
     233           0 :                 struct dfs_ManagerInitialize *r2 = (struct dfs_ManagerInitialize *)r;
     234           0 :                 if (DEBUGLEVEL >= 10) {
     235           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_ManagerInitialize, NDR_IN, r2);
     236             :                 }
     237           0 :                 r2->out.result = _dfs_ManagerInitialize(p, r2);
     238           0 :                 break;
     239             :         }
     240           0 :         case 15: { /* dfs_AddStdRootForced */
     241           0 :                 struct dfs_AddStdRootForced *r2 = (struct dfs_AddStdRootForced *)r;
     242           0 :                 if (DEBUGLEVEL >= 10) {
     243           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_AddStdRootForced, NDR_IN, r2);
     244             :                 }
     245           0 :                 r2->out.result = _dfs_AddStdRootForced(p, r2);
     246           0 :                 break;
     247             :         }
     248           0 :         case 16: { /* dfs_GetDcAddress */
     249           0 :                 struct dfs_GetDcAddress *r2 = (struct dfs_GetDcAddress *)r;
     250           0 :                 if (DEBUGLEVEL >= 10) {
     251           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_GetDcAddress, NDR_IN, r2);
     252             :                 }
     253           0 :                 NDR_ZERO_STRUCT(r2->out);
     254           0 :                 r2->out.server_fullname = r2->in.server_fullname;
     255           0 :                 r2->out.is_root = r2->in.is_root;
     256           0 :                 r2->out.ttl = r2->in.ttl;
     257           0 :                 r2->out.result = _dfs_GetDcAddress(p, r2);
     258           0 :                 break;
     259             :         }
     260           0 :         case 17: { /* dfs_SetDcAddress */
     261           0 :                 struct dfs_SetDcAddress *r2 = (struct dfs_SetDcAddress *)r;
     262           0 :                 if (DEBUGLEVEL >= 10) {
     263           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_SetDcAddress, NDR_IN, r2);
     264             :                 }
     265           0 :                 r2->out.result = _dfs_SetDcAddress(p, r2);
     266           0 :                 break;
     267             :         }
     268           0 :         case 18: { /* dfs_FlushFtTable */
     269           0 :                 struct dfs_FlushFtTable *r2 = (struct dfs_FlushFtTable *)r;
     270           0 :                 if (DEBUGLEVEL >= 10) {
     271           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_FlushFtTable, NDR_IN, r2);
     272             :                 }
     273           0 :                 r2->out.result = _dfs_FlushFtTable(p, r2);
     274           0 :                 break;
     275             :         }
     276           0 :         case 19: { /* dfs_Add2 */
     277           0 :                 struct dfs_Add2 *r2 = (struct dfs_Add2 *)r;
     278           0 :                 if (DEBUGLEVEL >= 10) {
     279           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Add2, NDR_IN, r2);
     280             :                 }
     281           0 :                 r2->out.result = _dfs_Add2(p, r2);
     282           0 :                 break;
     283             :         }
     284           0 :         case 20: { /* dfs_Remove2 */
     285           0 :                 struct dfs_Remove2 *r2 = (struct dfs_Remove2 *)r;
     286           0 :                 if (DEBUGLEVEL >= 10) {
     287           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Remove2, NDR_IN, r2);
     288             :                 }
     289           0 :                 r2->out.result = _dfs_Remove2(p, r2);
     290           0 :                 break;
     291             :         }
     292           0 :         case 21: { /* dfs_EnumEx */
     293           0 :                 struct dfs_EnumEx *r2 = (struct dfs_EnumEx *)r;
     294           0 :                 if (DEBUGLEVEL >= 10) {
     295           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_EnumEx, NDR_IN, r2);
     296             :                 }
     297           0 :                 NDR_ZERO_STRUCT(r2->out);
     298           0 :                 r2->out.info = r2->in.info;
     299           0 :                 r2->out.total = r2->in.total;
     300           0 :                 r2->out.result = _dfs_EnumEx(p, r2);
     301           0 :                 break;
     302             :         }
     303           0 :         case 22: { /* dfs_SetInfo2 */
     304           0 :                 struct dfs_SetInfo2 *r2 = (struct dfs_SetInfo2 *)r;
     305           0 :                 if (DEBUGLEVEL >= 10) {
     306           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_SetInfo2, NDR_IN, r2);
     307             :                 }
     308           0 :                 r2->out.result = _dfs_SetInfo2(p, r2);
     309           0 :                 break;
     310             :         }
     311           0 :         default:
     312           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
     313           0 :                 break;
     314             :         }
     315             : 
     316           0 : fail:
     317             :         /* Unimpersonate */
     318           0 :         if (impersonated) {
     319           0 :                 unbecome_authenticated_pipe_user();
     320             :         }
     321             : 
     322           0 :         p->dce_call = NULL;
     323           0 :         p->mem_ctx = NULL;
     324             :         /* Restore session info */
     325           0 :         p->session_info = pipe_session_info;
     326           0 :         p->auth.auth_type = 0;
     327           0 :         p->auth.auth_level = 0;
     328           0 :         p->auth.auth_context_id = 0;
     329             :         /* Check pipes struct fault state */
     330           0 :         if (p->fault_state != 0) {
     331           0 :                 dce_call->fault_code = p->fault_state;
     332             :         }
     333           0 :         if (dce_call->fault_code != 0) {
     334           0 :                 status = NT_STATUS_NET_WRITE_FAULT;
     335             :         }
     336             : 
     337           0 :         return status;
     338             : }
     339             : 
     340           0 : NTSTATUS netdfs__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
     341             : {
     342           0 :         return netdfs__op_dispatch_internal(dce_call, mem_ctx, r, S3COMPAT_RPC_DISPATCH_EXTERNAL);
     343             : }
     344             : 
     345           0 : NTSTATUS netdfs__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
     346             : {
     347           0 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
     348             : 
     349           0 :         switch (opnum) {
     350           0 :         case 0: { /* dfs_GetManagerVersion */
     351           0 :                 struct dfs_GetManagerVersion *r2 = (struct dfs_GetManagerVersion *)r;
     352           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     353           0 :                         DEBUG(5,("function dfs_GetManagerVersion replied async\n"));
     354             :                 }
     355           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     356           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_GetManagerVersion, NDR_OUT | NDR_SET_VALUES, r2);
     357             :                 }
     358           0 :                 if (dce_call->fault_code != 0) {
     359           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_GetManagerVersion\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     360             :                 }
     361           0 :                 break;
     362             :         }
     363           0 :         case 1: { /* dfs_Add */
     364           0 :                 struct dfs_Add *r2 = (struct dfs_Add *)r;
     365           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     366           0 :                         DEBUG(5,("function dfs_Add replied async\n"));
     367             :                 }
     368           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     369           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Add, NDR_OUT | NDR_SET_VALUES, r2);
     370             :                 }
     371           0 :                 if (dce_call->fault_code != 0) {
     372           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_Add\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     373             :                 }
     374           0 :                 break;
     375             :         }
     376           0 :         case 2: { /* dfs_Remove */
     377           0 :                 struct dfs_Remove *r2 = (struct dfs_Remove *)r;
     378           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     379           0 :                         DEBUG(5,("function dfs_Remove replied async\n"));
     380             :                 }
     381           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     382           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Remove, NDR_OUT | NDR_SET_VALUES, r2);
     383             :                 }
     384           0 :                 if (dce_call->fault_code != 0) {
     385           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_Remove\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     386             :                 }
     387           0 :                 break;
     388             :         }
     389           0 :         case 3: { /* dfs_SetInfo */
     390           0 :                 struct dfs_SetInfo *r2 = (struct dfs_SetInfo *)r;
     391           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     392           0 :                         DEBUG(5,("function dfs_SetInfo replied async\n"));
     393             :                 }
     394           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     395           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_SetInfo, NDR_OUT | NDR_SET_VALUES, r2);
     396             :                 }
     397           0 :                 if (dce_call->fault_code != 0) {
     398           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_SetInfo\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     399             :                 }
     400           0 :                 break;
     401             :         }
     402           0 :         case 4: { /* dfs_GetInfo */
     403           0 :                 struct dfs_GetInfo *r2 = (struct dfs_GetInfo *)r;
     404           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     405           0 :                         DEBUG(5,("function dfs_GetInfo replied async\n"));
     406             :                 }
     407           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     408           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_GetInfo, NDR_OUT | NDR_SET_VALUES, r2);
     409             :                 }
     410           0 :                 if (dce_call->fault_code != 0) {
     411           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_GetInfo\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     412             :                 }
     413           0 :                 break;
     414             :         }
     415           0 :         case 5: { /* dfs_Enum */
     416           0 :                 struct dfs_Enum *r2 = (struct dfs_Enum *)r;
     417           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     418           0 :                         DEBUG(5,("function dfs_Enum replied async\n"));
     419             :                 }
     420           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     421           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Enum, NDR_OUT | NDR_SET_VALUES, r2);
     422             :                 }
     423           0 :                 if (dce_call->fault_code != 0) {
     424           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_Enum\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     425             :                 }
     426           0 :                 break;
     427             :         }
     428           0 :         case 6: { /* dfs_Rename */
     429           0 :                 struct dfs_Rename *r2 = (struct dfs_Rename *)r;
     430           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     431           0 :                         DEBUG(5,("function dfs_Rename replied async\n"));
     432             :                 }
     433           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     434           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Rename, NDR_OUT | NDR_SET_VALUES, r2);
     435             :                 }
     436           0 :                 if (dce_call->fault_code != 0) {
     437           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_Rename\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     438             :                 }
     439           0 :                 break;
     440             :         }
     441           0 :         case 7: { /* dfs_Move */
     442           0 :                 struct dfs_Move *r2 = (struct dfs_Move *)r;
     443           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     444           0 :                         DEBUG(5,("function dfs_Move replied async\n"));
     445             :                 }
     446           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     447           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Move, NDR_OUT | NDR_SET_VALUES, r2);
     448             :                 }
     449           0 :                 if (dce_call->fault_code != 0) {
     450           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_Move\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     451             :                 }
     452           0 :                 break;
     453             :         }
     454           0 :         case 8: { /* dfs_ManagerGetConfigInfo */
     455           0 :                 struct dfs_ManagerGetConfigInfo *r2 = (struct dfs_ManagerGetConfigInfo *)r;
     456           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     457           0 :                         DEBUG(5,("function dfs_ManagerGetConfigInfo replied async\n"));
     458             :                 }
     459           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     460           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_ManagerGetConfigInfo, NDR_OUT | NDR_SET_VALUES, r2);
     461             :                 }
     462           0 :                 if (dce_call->fault_code != 0) {
     463           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_ManagerGetConfigInfo\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     464             :                 }
     465           0 :                 break;
     466             :         }
     467           0 :         case 9: { /* dfs_ManagerSendSiteInfo */
     468           0 :                 struct dfs_ManagerSendSiteInfo *r2 = (struct dfs_ManagerSendSiteInfo *)r;
     469           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     470           0 :                         DEBUG(5,("function dfs_ManagerSendSiteInfo replied async\n"));
     471             :                 }
     472           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     473           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_ManagerSendSiteInfo, NDR_OUT | NDR_SET_VALUES, r2);
     474             :                 }
     475           0 :                 if (dce_call->fault_code != 0) {
     476           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_ManagerSendSiteInfo\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     477             :                 }
     478           0 :                 break;
     479             :         }
     480           0 :         case 10: { /* dfs_AddFtRoot */
     481           0 :                 struct dfs_AddFtRoot *r2 = (struct dfs_AddFtRoot *)r;
     482           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     483           0 :                         DEBUG(5,("function dfs_AddFtRoot replied async\n"));
     484             :                 }
     485           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     486           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_AddFtRoot, NDR_OUT | NDR_SET_VALUES, r2);
     487             :                 }
     488           0 :                 if (dce_call->fault_code != 0) {
     489           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_AddFtRoot\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     490             :                 }
     491           0 :                 break;
     492             :         }
     493           0 :         case 11: { /* dfs_RemoveFtRoot */
     494           0 :                 struct dfs_RemoveFtRoot *r2 = (struct dfs_RemoveFtRoot *)r;
     495           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     496           0 :                         DEBUG(5,("function dfs_RemoveFtRoot replied async\n"));
     497             :                 }
     498           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     499           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_RemoveFtRoot, NDR_OUT | NDR_SET_VALUES, r2);
     500             :                 }
     501           0 :                 if (dce_call->fault_code != 0) {
     502           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_RemoveFtRoot\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     503             :                 }
     504           0 :                 break;
     505             :         }
     506           0 :         case 12: { /* dfs_AddStdRoot */
     507           0 :                 struct dfs_AddStdRoot *r2 = (struct dfs_AddStdRoot *)r;
     508           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     509           0 :                         DEBUG(5,("function dfs_AddStdRoot replied async\n"));
     510             :                 }
     511           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     512           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_AddStdRoot, NDR_OUT | NDR_SET_VALUES, r2);
     513             :                 }
     514           0 :                 if (dce_call->fault_code != 0) {
     515           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_AddStdRoot\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     516             :                 }
     517           0 :                 break;
     518             :         }
     519           0 :         case 13: { /* dfs_RemoveStdRoot */
     520           0 :                 struct dfs_RemoveStdRoot *r2 = (struct dfs_RemoveStdRoot *)r;
     521           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     522           0 :                         DEBUG(5,("function dfs_RemoveStdRoot replied async\n"));
     523             :                 }
     524           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     525           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_RemoveStdRoot, NDR_OUT | NDR_SET_VALUES, r2);
     526             :                 }
     527           0 :                 if (dce_call->fault_code != 0) {
     528           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_RemoveStdRoot\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     529             :                 }
     530           0 :                 break;
     531             :         }
     532           0 :         case 14: { /* dfs_ManagerInitialize */
     533           0 :                 struct dfs_ManagerInitialize *r2 = (struct dfs_ManagerInitialize *)r;
     534           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     535           0 :                         DEBUG(5,("function dfs_ManagerInitialize replied async\n"));
     536             :                 }
     537           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     538           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_ManagerInitialize, NDR_OUT | NDR_SET_VALUES, r2);
     539             :                 }
     540           0 :                 if (dce_call->fault_code != 0) {
     541           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_ManagerInitialize\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     542             :                 }
     543           0 :                 break;
     544             :         }
     545           0 :         case 15: { /* dfs_AddStdRootForced */
     546           0 :                 struct dfs_AddStdRootForced *r2 = (struct dfs_AddStdRootForced *)r;
     547           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     548           0 :                         DEBUG(5,("function dfs_AddStdRootForced replied async\n"));
     549             :                 }
     550           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     551           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_AddStdRootForced, NDR_OUT | NDR_SET_VALUES, r2);
     552             :                 }
     553           0 :                 if (dce_call->fault_code != 0) {
     554           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_AddStdRootForced\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     555             :                 }
     556           0 :                 break;
     557             :         }
     558           0 :         case 16: { /* dfs_GetDcAddress */
     559           0 :                 struct dfs_GetDcAddress *r2 = (struct dfs_GetDcAddress *)r;
     560           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     561           0 :                         DEBUG(5,("function dfs_GetDcAddress replied async\n"));
     562             :                 }
     563           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     564           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_GetDcAddress, NDR_OUT | NDR_SET_VALUES, r2);
     565             :                 }
     566           0 :                 if (dce_call->fault_code != 0) {
     567           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_GetDcAddress\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     568             :                 }
     569           0 :                 break;
     570             :         }
     571           0 :         case 17: { /* dfs_SetDcAddress */
     572           0 :                 struct dfs_SetDcAddress *r2 = (struct dfs_SetDcAddress *)r;
     573           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     574           0 :                         DEBUG(5,("function dfs_SetDcAddress replied async\n"));
     575             :                 }
     576           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     577           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_SetDcAddress, NDR_OUT | NDR_SET_VALUES, r2);
     578             :                 }
     579           0 :                 if (dce_call->fault_code != 0) {
     580           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_SetDcAddress\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     581             :                 }
     582           0 :                 break;
     583             :         }
     584           0 :         case 18: { /* dfs_FlushFtTable */
     585           0 :                 struct dfs_FlushFtTable *r2 = (struct dfs_FlushFtTable *)r;
     586           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     587           0 :                         DEBUG(5,("function dfs_FlushFtTable replied async\n"));
     588             :                 }
     589           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     590           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_FlushFtTable, NDR_OUT | NDR_SET_VALUES, r2);
     591             :                 }
     592           0 :                 if (dce_call->fault_code != 0) {
     593           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_FlushFtTable\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     594             :                 }
     595           0 :                 break;
     596             :         }
     597           0 :         case 19: { /* dfs_Add2 */
     598           0 :                 struct dfs_Add2 *r2 = (struct dfs_Add2 *)r;
     599           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     600           0 :                         DEBUG(5,("function dfs_Add2 replied async\n"));
     601             :                 }
     602           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     603           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Add2, NDR_OUT | NDR_SET_VALUES, r2);
     604             :                 }
     605           0 :                 if (dce_call->fault_code != 0) {
     606           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_Add2\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     607             :                 }
     608           0 :                 break;
     609             :         }
     610           0 :         case 20: { /* dfs_Remove2 */
     611           0 :                 struct dfs_Remove2 *r2 = (struct dfs_Remove2 *)r;
     612           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     613           0 :                         DEBUG(5,("function dfs_Remove2 replied async\n"));
     614             :                 }
     615           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     616           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_Remove2, NDR_OUT | NDR_SET_VALUES, r2);
     617             :                 }
     618           0 :                 if (dce_call->fault_code != 0) {
     619           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_Remove2\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     620             :                 }
     621           0 :                 break;
     622             :         }
     623           0 :         case 21: { /* dfs_EnumEx */
     624           0 :                 struct dfs_EnumEx *r2 = (struct dfs_EnumEx *)r;
     625           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     626           0 :                         DEBUG(5,("function dfs_EnumEx replied async\n"));
     627             :                 }
     628           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     629           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_EnumEx, NDR_OUT | NDR_SET_VALUES, r2);
     630             :                 }
     631           0 :                 if (dce_call->fault_code != 0) {
     632           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_EnumEx\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     633             :                 }
     634           0 :                 break;
     635             :         }
     636           0 :         case 22: { /* dfs_SetInfo2 */
     637           0 :                 struct dfs_SetInfo2 *r2 = (struct dfs_SetInfo2 *)r;
     638           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     639           0 :                         DEBUG(5,("function dfs_SetInfo2 replied async\n"));
     640             :                 }
     641           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     642           0 :                         NDR_PRINT_FUNCTION_DEBUG(dfs_SetInfo2, NDR_OUT | NDR_SET_VALUES, r2);
     643             :                 }
     644           0 :                 if (dce_call->fault_code != 0) {
     645           0 :                         DBG_WARNING("dcerpc_fault %s in dfs_SetInfo2\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     646             :                 }
     647           0 :                 break;
     648             :         }
     649           0 :         default:
     650           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
     651           0 :                 break;
     652             :         }
     653             : 
     654           0 :         if (dce_call->fault_code != 0) {
     655           0 :                 return NT_STATUS_NET_WRITE_FAULT;
     656             :         }
     657             : 
     658           0 :         return NT_STATUS_OK;
     659             : }
     660             : 
     661           0 : NTSTATUS netdfs__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
     662             : {
     663             :         enum ndr_err_code ndr_err;
     664           0 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
     665             : 
     666           0 :         ndr_err = ndr_table_netdfs.calls[opnum].ndr_push(push, NDR_OUT, r);
     667           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     668           0 :                 dce_call->fault_code = DCERPC_FAULT_NDR;
     669           0 :                 return NT_STATUS_NET_WRITE_FAULT;
     670             :         }
     671             : 
     672           0 :         return NT_STATUS_OK;
     673             : }
     674             : 
     675           0 : NTSTATUS netdfs__op_local(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
     676             : {
     677           0 :         return netdfs__op_dispatch_internal(dce_call, mem_ctx, r, S3COMPAT_RPC_DISPATCH_INTERNAL);
     678             : }
     679             : 
     680             : static const struct dcesrv_interface dcesrv_netdfs_interface = {
     681             :         .name      = "netdfs",
     682             :         .syntax_id = {{0x4fc742e0,0x4a10,0x11cf,{0x82,0x73},{0x00,0xaa,0x00,0x4a,0xe6,0x73}},3.0},
     683             :         .bind      = netdfs__op_bind,
     684             :         .unbind    = netdfs__op_unbind,
     685             :         .ndr_pull  = netdfs__op_ndr_pull,
     686             :         .dispatch  = netdfs__op_dispatch,
     687             :         .reply     = netdfs__op_reply,
     688             :         .ndr_push  = netdfs__op_ndr_push,
     689             :         .local     = netdfs__op_local,
     690             : #ifdef DCESRV_INTERFACE_NETDFS_FLAGS
     691             :         .flags     = DCESRV_INTERFACE_NETDFS_FLAGS
     692             : #else
     693             :         .flags     = 0
     694             : #endif
     695             : };
     696             : 
     697          84 : static NTSTATUS netdfs__check_register_in_endpoint(const char *name, struct dcerpc_binding *binding) {
     698          84 :         enum dcerpc_transport_t transport = dcerpc_binding_get_transport(binding);
     699             :         NTSTATUS status;
     700             : 
     701             :         /* If service is disabled, do not register */
     702          84 :         if (rpc_service_mode(name) == RPC_SERVICE_MODE_DISABLED) {
     703           0 :                 return NT_STATUS_NOT_IMPLEMENTED;
     704             :         }
     705             : 
     706             :         /* If service is embedded, register only for ncacn_np
     707             :          * see 8466b3c85e4b835e57e41776853093f4a0edc8b8
     708             :          */
     709          84 :         if (rpc_service_mode(name) == RPC_SERVICE_MODE_EMBEDDED && (transport != NCACN_NP && transport != NCALRPC)) {
     710          28 :                 DBG_INFO("Interface 'netdfs' not registered in endpoint '%s' as service is embedded\n", name);
     711          28 :                 return NT_STATUS_NOT_SUPPORTED;
     712             :         }
     713             : 
     714             :         /*
     715             :          * If rpc service is external then change the default ncalrpc endpoint,
     716             :          * otherwise if the rpc daemon running this service is configured in
     717             :          * fork mode the forked process will race with main smbd to accept the
     718             :          * connections in the default ncalrpc socket, and the forked process
     719             :          * may not have the requested interface registered.
     720             :          * For example, in the ad_member test environment:
     721             :          *
     722             :          *   rpc_server:lsarpc = external
     723             :          *   rpc_server:samr = external
     724             :          *   rpc_server:netlogon = disabled
     725             :          *   rpc_daemon:lsasd = fork
     726             :          *
     727             :          * With these settings both, the main smbd and all the preforked lsasd
     728             :          * processes would be listening in the default ncalrpc socket if it is
     729             :          * not changed. If a client connection is accepted by one of the lsasd
     730             :          * worker processes and the client asks for an interface not registered
     731             :          * in these processes (winreg for example) it will get an error.
     732             :          */
     733          56 :         if (rpc_service_mode(name) == RPC_SERVICE_MODE_EXTERNAL && transport == NCALRPC) {
     734           0 :                 status = dcerpc_binding_set_string_option(binding, "endpoint", "NETDFS");
     735           0 :                 if (!NT_STATUS_IS_OK(status)) {
     736           0 :                         return status;
     737             :                 }
     738             :         }
     739             : 
     740          56 :         return NT_STATUS_OK;
     741             : }
     742             : 
     743          28 : static NTSTATUS netdfs__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
     744             : {
     745             :         uint32_t i;
     746             :         NTSTATUS ret;
     747             :         struct dcerpc_binding *binding;
     748          28 :         struct dcerpc_binding *binding2 = NULL;
     749             : 
     750             : #ifdef DCESRV_INTERFACE_NETDFS_NCACN_NP_SECONDARY_ENDPOINT
     751             :         const char *ncacn_np_secondary_endpoint = DCESRV_INTERFACE_NETDFS_NCACN_NP_SECONDARY_ENDPOINT;
     752             : #else
     753          28 :         const char *ncacn_np_secondary_endpoint = NULL;
     754             : #endif
     755             : 
     756         112 :         for (i=0;i<ndr_table_netdfs.endpoints->count;i++) {
     757          84 :                 const char *name = ndr_table_netdfs.endpoints->names[i];
     758             : 
     759          84 :                 ret = dcerpc_parse_binding(dce_ctx, name, &binding);
     760          84 :                 if (NT_STATUS_IS_ERR(ret)) {
     761           0 :                         DBG_ERR("Failed to parse binding string '%s'\n", name);
     762           0 :                         return ret;
     763             :                 }
     764             : 
     765          84 :                 ret = netdfs__check_register_in_endpoint("netdfs", binding);
     766          84 :                 if (NT_STATUS_IS_ERR(ret)) {
     767          28 :                         talloc_free(binding);
     768          28 :                         continue;
     769             :                 }
     770             : 
     771          56 :                 if (ncacn_np_secondary_endpoint != NULL) {
     772           0 :                         ret = dcerpc_parse_binding(dce_ctx, ncacn_np_secondary_endpoint, &binding2);
     773           0 :                         if (NT_STATUS_IS_ERR(ret)) {
     774           0 :                                 DBG_ERR("Failed to parse 2nd binding string '%s'\n", ncacn_np_secondary_endpoint);
     775           0 :                                 TALLOC_FREE(binding);
     776           0 :                                 return ret;
     777             :                         }
     778             :                 }
     779             : 
     780          56 :                 ret = dcesrv_interface_register_b(dce_ctx, binding, binding2, &dcesrv_netdfs_interface, NULL);
     781          56 :                 TALLOC_FREE(binding);
     782          56 :                 TALLOC_FREE(binding2);
     783          56 :                 if (!NT_STATUS_IS_OK(ret)) {
     784           0 :                         DBG_ERR("Failed to register endpoint '%s'\n",name);
     785           0 :                         return ret;
     786             :                 }
     787             :         }
     788             : 
     789          28 :         return NT_STATUS_OK;
     790             : }
     791             : 
     792          19 : static NTSTATUS netdfs__op_shutdown_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
     793             : {
     794          19 :         return NT_STATUS_OK;
     795             : }
     796             : 
     797           0 : static bool netdfs__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
     798             : {
     799           0 :         if (dcesrv_netdfs_interface.syntax_id.if_version == if_version && GUID_equal(&dcesrv_netdfs_interface.syntax_id.uuid, uuid)) {
     800           0 :                 memcpy(iface,&dcesrv_netdfs_interface, sizeof(*iface));
     801           0 :                 return true;
     802             :         }
     803             : 
     804           0 :         return false;
     805             : }
     806             : 
     807           0 : static bool netdfs__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
     808             : {
     809           0 :         if (strcmp(dcesrv_netdfs_interface.name, name)==0) {
     810           0 :                 memcpy(iface, &dcesrv_netdfs_interface, sizeof(*iface));
     811           0 :                 return true;
     812             :         }
     813             : 
     814           0 :         return false;
     815             : }
     816             : 
     817             : static const struct dcesrv_endpoint_server netdfs_ep_server = {
     818             :         /* fill in our name */
     819             :         .name = "netdfs",
     820             : 
     821             :         /* Initialization flag */
     822             :         .initialized = false,
     823             : 
     824             :         /* fill in all the operations */
     825             : #ifdef DCESRV_INTERFACE_NETDFS_INIT_SERVER
     826             :         .init_server = DCESRV_INTERFACE_NETDFS_INIT_SERVER,
     827             : #else
     828             :         .init_server = netdfs__op_init_server,
     829             : #endif
     830             : #ifdef DCESRV_INTERFACE_NETDFS_SHUTDOWN_SERVER
     831             :         .shutdown_server = DCESRV_INTERFACE_NETDFS_SHUTDOWN_SERVER,
     832             : #else
     833             :         .shutdown_server = netdfs__op_shutdown_server,
     834             : #endif
     835             :         .interface_by_uuid = netdfs__op_interface_by_uuid,
     836             :         .interface_by_name = netdfs__op_interface_by_name
     837             : };
     838             : 
     839          60 : const struct dcesrv_endpoint_server *netdfs_get_ep_server(void)
     840             : {
     841          60 :         return &netdfs_ep_server;
     842             : }

Generated by: LCOV version 1.13