LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - ndr_browser_s.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 57 282 20.2 %
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_browser.h"
       3             : #include <util/debug.h>
       4             : 
       5             : NTSTATUS dcerpc_server_browser_init(TALLOC_CTX *);
       6             : 
       7             : /* browser - dcerpc server boilerplate generated by pidl */
       8             : 
       9             : 
      10           3 : static NTSTATUS browser__op_bind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
      11             : {
      12             : #ifdef DCESRV_INTERFACE_BROWSER_BIND
      13             :         return DCESRV_INTERFACE_BROWSER_BIND(context,iface);
      14             : #else
      15           3 :         return NT_STATUS_OK;
      16             : #endif
      17             : }
      18             : 
      19           3 : static void browser__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
      20             : {
      21             : #ifdef DCESRV_INTERFACE_BROWSER_UNBIND
      22             :         DCESRV_INTERFACE_BROWSER_UNBIND(context, iface);
      23             : #else
      24           3 :         return;
      25             : #endif
      26             : }
      27             : 
      28          24 : static NTSTATUS browser__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
      29             : {
      30           0 :         enum ndr_err_code ndr_err;
      31          24 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
      32             : 
      33          24 :         dce_call->fault_code = 0;
      34             : 
      35          24 :         if (opnum >= ndr_table_browser.num_calls) {
      36           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
      37           0 :                 return NT_STATUS_NET_WRITE_FAULT;
      38             :         }
      39             : 
      40          48 :         *r = talloc_named(mem_ctx,
      41          24 :                           ndr_table_browser.calls[opnum].struct_size,
      42             :                           "struct %s",
      43          24 :                           ndr_table_browser.calls[opnum].name);
      44          24 :         NT_STATUS_HAVE_NO_MEMORY(*r);
      45             : 
      46             :         /* unravel the NDR for the packet */
      47          24 :         ndr_err = ndr_table_browser.calls[opnum].ndr_pull(pull, NDR_IN, *r);
      48          24 :         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          24 :         return NT_STATUS_OK;
      54             : }
      55             : 
      56          24 : static NTSTATUS browser__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
      57             : {
      58          24 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
      59             : 
      60          24 :         switch (opnum) {
      61           0 :         case 0: {
      62           0 :                 struct BrowserrServerEnum *r2 = (struct BrowserrServerEnum *)r;
      63           0 :                 if (DEBUGLEVEL >= 10) {
      64           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrServerEnum, NDR_IN, r2);
      65             :                 }
      66           0 :                 dcesrv_BrowserrServerEnum(dce_call, mem_ctx, r2);
      67           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
      68           0 :                         DEBUG(5,("function BrowserrServerEnum will reply async\n"));
      69             :                 }
      70           0 :                 break;
      71             :         }
      72           0 :         case 1: {
      73           0 :                 struct BrowserrDebugCall *r2 = (struct BrowserrDebugCall *)r;
      74           0 :                 if (DEBUGLEVEL >= 10) {
      75           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrDebugCall, NDR_IN, r2);
      76             :                 }
      77           0 :                 dcesrv_BrowserrDebugCall(dce_call, mem_ctx, r2);
      78           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
      79           0 :                         DEBUG(5,("function BrowserrDebugCall will reply async\n"));
      80             :                 }
      81           0 :                 break;
      82             :         }
      83          24 :         case 2: {
      84          24 :                 struct BrowserrQueryOtherDomains *r2 = (struct BrowserrQueryOtherDomains *)r;
      85          24 :                 if (DEBUGLEVEL >= 10) {
      86           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrQueryOtherDomains, NDR_IN, r2);
      87             :                 }
      88          24 :                 r2->out.result = dcesrv_BrowserrQueryOtherDomains(dce_call, mem_ctx, r2);
      89          24 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
      90           0 :                         DEBUG(5,("function BrowserrQueryOtherDomains will reply async\n"));
      91             :                 }
      92          24 :                 break;
      93             :         }
      94           0 :         case 3: {
      95           0 :                 struct BrowserrResetNetlogonState *r2 = (struct BrowserrResetNetlogonState *)r;
      96           0 :                 if (DEBUGLEVEL >= 10) {
      97           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrResetNetlogonState, NDR_IN, r2);
      98             :                 }
      99           0 :                 dcesrv_BrowserrResetNetlogonState(dce_call, mem_ctx, r2);
     100           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     101           0 :                         DEBUG(5,("function BrowserrResetNetlogonState will reply async\n"));
     102             :                 }
     103           0 :                 break;
     104             :         }
     105           0 :         case 4: {
     106           0 :                 struct BrowserrDebugTrace *r2 = (struct BrowserrDebugTrace *)r;
     107           0 :                 if (DEBUGLEVEL >= 10) {
     108           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrDebugTrace, NDR_IN, r2);
     109             :                 }
     110           0 :                 dcesrv_BrowserrDebugTrace(dce_call, mem_ctx, r2);
     111           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     112           0 :                         DEBUG(5,("function BrowserrDebugTrace will reply async\n"));
     113             :                 }
     114           0 :                 break;
     115             :         }
     116           0 :         case 5: {
     117           0 :                 struct BrowserrQueryStatistics *r2 = (struct BrowserrQueryStatistics *)r;
     118           0 :                 if (DEBUGLEVEL >= 10) {
     119           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrQueryStatistics, NDR_IN, r2);
     120             :                 }
     121           0 :                 dcesrv_BrowserrQueryStatistics(dce_call, mem_ctx, r2);
     122           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     123           0 :                         DEBUG(5,("function BrowserrQueryStatistics will reply async\n"));
     124             :                 }
     125           0 :                 break;
     126             :         }
     127           0 :         case 6: {
     128           0 :                 struct BrowserResetStatistics *r2 = (struct BrowserResetStatistics *)r;
     129           0 :                 if (DEBUGLEVEL >= 10) {
     130           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserResetStatistics, NDR_IN, r2);
     131             :                 }
     132           0 :                 dcesrv_BrowserResetStatistics(dce_call, mem_ctx, r2);
     133           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     134           0 :                         DEBUG(5,("function BrowserResetStatistics will reply async\n"));
     135             :                 }
     136           0 :                 break;
     137             :         }
     138           0 :         case 7: {
     139           0 :                 struct NetrBrowserStatisticsClear *r2 = (struct NetrBrowserStatisticsClear *)r;
     140           0 :                 if (DEBUGLEVEL >= 10) {
     141           0 :                         NDR_PRINT_FUNCTION_DEBUG(NetrBrowserStatisticsClear, NDR_IN, r2);
     142             :                 }
     143           0 :                 dcesrv_NetrBrowserStatisticsClear(dce_call, mem_ctx, r2);
     144           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     145           0 :                         DEBUG(5,("function NetrBrowserStatisticsClear will reply async\n"));
     146             :                 }
     147           0 :                 break;
     148             :         }
     149           0 :         case 8: {
     150           0 :                 struct NetrBrowserStatisticsGet *r2 = (struct NetrBrowserStatisticsGet *)r;
     151           0 :                 if (DEBUGLEVEL >= 10) {
     152           0 :                         NDR_PRINT_FUNCTION_DEBUG(NetrBrowserStatisticsGet, NDR_IN, r2);
     153             :                 }
     154           0 :                 dcesrv_NetrBrowserStatisticsGet(dce_call, mem_ctx, r2);
     155           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     156           0 :                         DEBUG(5,("function NetrBrowserStatisticsGet will reply async\n"));
     157             :                 }
     158           0 :                 break;
     159             :         }
     160           0 :         case 9: {
     161           0 :                 struct BrowserrSetNetlogonState *r2 = (struct BrowserrSetNetlogonState *)r;
     162           0 :                 if (DEBUGLEVEL >= 10) {
     163           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrSetNetlogonState, NDR_IN, r2);
     164             :                 }
     165           0 :                 dcesrv_BrowserrSetNetlogonState(dce_call, mem_ctx, r2);
     166           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     167           0 :                         DEBUG(5,("function BrowserrSetNetlogonState will reply async\n"));
     168             :                 }
     169           0 :                 break;
     170             :         }
     171           0 :         case 10: {
     172           0 :                 struct BrowserrQueryEmulatedDomains *r2 = (struct BrowserrQueryEmulatedDomains *)r;
     173           0 :                 if (DEBUGLEVEL >= 10) {
     174           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrQueryEmulatedDomains, NDR_IN, r2);
     175             :                 }
     176           0 :                 dcesrv_BrowserrQueryEmulatedDomains(dce_call, mem_ctx, r2);
     177           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     178           0 :                         DEBUG(5,("function BrowserrQueryEmulatedDomains will reply async\n"));
     179             :                 }
     180           0 :                 break;
     181             :         }
     182           0 :         case 11: {
     183           0 :                 struct BrowserrServerEnumEx *r2 = (struct BrowserrServerEnumEx *)r;
     184           0 :                 if (DEBUGLEVEL >= 10) {
     185           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrServerEnumEx, NDR_IN, r2);
     186             :                 }
     187           0 :                 dcesrv_BrowserrServerEnumEx(dce_call, mem_ctx, r2);
     188           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     189           0 :                         DEBUG(5,("function BrowserrServerEnumEx will reply async\n"));
     190             :                 }
     191           0 :                 break;
     192             :         }
     193             : 
     194           0 :         default:
     195           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
     196           0 :                 break;
     197             :         }
     198             : 
     199          24 :         if (dce_call->fault_code != 0) {
     200           0 :                 return NT_STATUS_NET_WRITE_FAULT;
     201             :         }
     202             : 
     203          24 :         return NT_STATUS_OK;
     204             : }
     205             : 
     206          24 : static NTSTATUS browser__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
     207             : {
     208          24 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
     209             : 
     210          24 :         switch (opnum) {
     211           0 :         case 0: {
     212           0 :                 struct BrowserrServerEnum *r2 = (struct BrowserrServerEnum *)r;
     213           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     214           0 :                         DEBUG(5,("function BrowserrServerEnum replied async\n"));
     215             :                 }
     216           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     217           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrServerEnum, NDR_OUT | NDR_SET_VALUES, r2);
     218             :                 }
     219           0 :                 if (dce_call->fault_code != 0) {
     220           0 :                         DEBUG(2,("dcerpc_fault %s in BrowserrServerEnum\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     221             :                 }
     222           0 :                 break;
     223             :         }
     224           0 :         case 1: {
     225           0 :                 struct BrowserrDebugCall *r2 = (struct BrowserrDebugCall *)r;
     226           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     227           0 :                         DEBUG(5,("function BrowserrDebugCall replied async\n"));
     228             :                 }
     229           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     230           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrDebugCall, NDR_OUT | NDR_SET_VALUES, r2);
     231             :                 }
     232           0 :                 if (dce_call->fault_code != 0) {
     233           0 :                         DEBUG(2,("dcerpc_fault %s in BrowserrDebugCall\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     234             :                 }
     235           0 :                 break;
     236             :         }
     237          24 :         case 2: {
     238          24 :                 struct BrowserrQueryOtherDomains *r2 = (struct BrowserrQueryOtherDomains *)r;
     239          24 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     240           0 :                         DEBUG(5,("function BrowserrQueryOtherDomains replied async\n"));
     241             :                 }
     242          24 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     243           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrQueryOtherDomains, NDR_OUT | NDR_SET_VALUES, r2);
     244             :                 }
     245          24 :                 if (dce_call->fault_code != 0) {
     246           0 :                         DEBUG(2,("dcerpc_fault %s in BrowserrQueryOtherDomains\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     247             :                 }
     248          24 :                 break;
     249             :         }
     250           0 :         case 3: {
     251           0 :                 struct BrowserrResetNetlogonState *r2 = (struct BrowserrResetNetlogonState *)r;
     252           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     253           0 :                         DEBUG(5,("function BrowserrResetNetlogonState replied async\n"));
     254             :                 }
     255           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     256           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrResetNetlogonState, NDR_OUT | NDR_SET_VALUES, r2);
     257             :                 }
     258           0 :                 if (dce_call->fault_code != 0) {
     259           0 :                         DEBUG(2,("dcerpc_fault %s in BrowserrResetNetlogonState\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     260             :                 }
     261           0 :                 break;
     262             :         }
     263           0 :         case 4: {
     264           0 :                 struct BrowserrDebugTrace *r2 = (struct BrowserrDebugTrace *)r;
     265           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     266           0 :                         DEBUG(5,("function BrowserrDebugTrace replied async\n"));
     267             :                 }
     268           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     269           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrDebugTrace, NDR_OUT | NDR_SET_VALUES, r2);
     270             :                 }
     271           0 :                 if (dce_call->fault_code != 0) {
     272           0 :                         DEBUG(2,("dcerpc_fault %s in BrowserrDebugTrace\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     273             :                 }
     274           0 :                 break;
     275             :         }
     276           0 :         case 5: {
     277           0 :                 struct BrowserrQueryStatistics *r2 = (struct BrowserrQueryStatistics *)r;
     278           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     279           0 :                         DEBUG(5,("function BrowserrQueryStatistics replied async\n"));
     280             :                 }
     281           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     282           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrQueryStatistics, NDR_OUT | NDR_SET_VALUES, r2);
     283             :                 }
     284           0 :                 if (dce_call->fault_code != 0) {
     285           0 :                         DEBUG(2,("dcerpc_fault %s in BrowserrQueryStatistics\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     286             :                 }
     287           0 :                 break;
     288             :         }
     289           0 :         case 6: {
     290           0 :                 struct BrowserResetStatistics *r2 = (struct BrowserResetStatistics *)r;
     291           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     292           0 :                         DEBUG(5,("function BrowserResetStatistics replied async\n"));
     293             :                 }
     294           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     295           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserResetStatistics, NDR_OUT | NDR_SET_VALUES, r2);
     296             :                 }
     297           0 :                 if (dce_call->fault_code != 0) {
     298           0 :                         DEBUG(2,("dcerpc_fault %s in BrowserResetStatistics\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     299             :                 }
     300           0 :                 break;
     301             :         }
     302           0 :         case 7: {
     303           0 :                 struct NetrBrowserStatisticsClear *r2 = (struct NetrBrowserStatisticsClear *)r;
     304           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     305           0 :                         DEBUG(5,("function NetrBrowserStatisticsClear replied async\n"));
     306             :                 }
     307           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     308           0 :                         NDR_PRINT_FUNCTION_DEBUG(NetrBrowserStatisticsClear, NDR_OUT | NDR_SET_VALUES, r2);
     309             :                 }
     310           0 :                 if (dce_call->fault_code != 0) {
     311           0 :                         DEBUG(2,("dcerpc_fault %s in NetrBrowserStatisticsClear\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     312             :                 }
     313           0 :                 break;
     314             :         }
     315           0 :         case 8: {
     316           0 :                 struct NetrBrowserStatisticsGet *r2 = (struct NetrBrowserStatisticsGet *)r;
     317           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     318           0 :                         DEBUG(5,("function NetrBrowserStatisticsGet replied async\n"));
     319             :                 }
     320           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     321           0 :                         NDR_PRINT_FUNCTION_DEBUG(NetrBrowserStatisticsGet, NDR_OUT | NDR_SET_VALUES, r2);
     322             :                 }
     323           0 :                 if (dce_call->fault_code != 0) {
     324           0 :                         DEBUG(2,("dcerpc_fault %s in NetrBrowserStatisticsGet\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     325             :                 }
     326           0 :                 break;
     327             :         }
     328           0 :         case 9: {
     329           0 :                 struct BrowserrSetNetlogonState *r2 = (struct BrowserrSetNetlogonState *)r;
     330           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     331           0 :                         DEBUG(5,("function BrowserrSetNetlogonState replied async\n"));
     332             :                 }
     333           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     334           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrSetNetlogonState, NDR_OUT | NDR_SET_VALUES, r2);
     335             :                 }
     336           0 :                 if (dce_call->fault_code != 0) {
     337           0 :                         DEBUG(2,("dcerpc_fault %s in BrowserrSetNetlogonState\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     338             :                 }
     339           0 :                 break;
     340             :         }
     341           0 :         case 10: {
     342           0 :                 struct BrowserrQueryEmulatedDomains *r2 = (struct BrowserrQueryEmulatedDomains *)r;
     343           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     344           0 :                         DEBUG(5,("function BrowserrQueryEmulatedDomains replied async\n"));
     345             :                 }
     346           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     347           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrQueryEmulatedDomains, NDR_OUT | NDR_SET_VALUES, r2);
     348             :                 }
     349           0 :                 if (dce_call->fault_code != 0) {
     350           0 :                         DEBUG(2,("dcerpc_fault %s in BrowserrQueryEmulatedDomains\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     351             :                 }
     352           0 :                 break;
     353             :         }
     354           0 :         case 11: {
     355           0 :                 struct BrowserrServerEnumEx *r2 = (struct BrowserrServerEnumEx *)r;
     356           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     357           0 :                         DEBUG(5,("function BrowserrServerEnumEx replied async\n"));
     358             :                 }
     359           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     360           0 :                         NDR_PRINT_FUNCTION_DEBUG(BrowserrServerEnumEx, NDR_OUT | NDR_SET_VALUES, r2);
     361             :                 }
     362           0 :                 if (dce_call->fault_code != 0) {
     363           0 :                         DEBUG(2,("dcerpc_fault %s in BrowserrServerEnumEx\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
     364             :                 }
     365           0 :                 break;
     366             :         }
     367             : 
     368           0 :         default:
     369           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
     370           0 :                 break;
     371             :         }
     372             : 
     373          24 :         if (dce_call->fault_code != 0) {
     374           0 :                 return NT_STATUS_NET_WRITE_FAULT;
     375             :         }
     376             : 
     377          24 :         return NT_STATUS_OK;
     378             : }
     379             : 
     380          24 : static NTSTATUS browser__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
     381             : {
     382           0 :         enum ndr_err_code ndr_err;
     383          24 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
     384             : 
     385          24 :         ndr_err = ndr_table_browser.calls[opnum].ndr_push(push, NDR_OUT, r);
     386          24 :         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     387           0 :                 dce_call->fault_code = DCERPC_FAULT_NDR;
     388           0 :                 return NT_STATUS_NET_WRITE_FAULT;
     389             :         }
     390             : 
     391          24 :         return NT_STATUS_OK;
     392             : }
     393             : 
     394             : static const struct dcesrv_interface dcesrv_browser_interface = {
     395             :         .name               = "browser",
     396             :         .syntax_id          = {{0x6bffd098,0xa112,0x3610,{0x98,0x33},{0x01,0x28,0x92,0x02,0x01,0x62}},0.0},
     397             :         .bind               = browser__op_bind,
     398             :         .unbind             = browser__op_unbind,
     399             :         .ndr_pull           = browser__op_ndr_pull,
     400             :         .dispatch           = browser__op_dispatch,
     401             :         .reply              = browser__op_reply,
     402             :         .ndr_push           = browser__op_ndr_push,
     403             :         .local              = NULL,
     404             : #ifdef DCESRV_INTERFACE_BROWSER_FLAGS
     405             :         .flags              = DCESRV_INTERFACE_BROWSER_FLAGS
     406             : #else
     407             :         .flags              = 0
     408             : #endif
     409             : };
     410             : 
     411             : 
     412          64 : static NTSTATUS browser__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
     413             : {
     414           2 :         int i;
     415             : #ifdef DCESRV_INTERFACE_BROWSER_NCACN_NP_SECONDARY_ENDPOINT
     416             :         const char *ncacn_np_secondary_endpoint =
     417             :                 DCESRV_INTERFACE_BROWSER_NCACN_NP_SECONDARY_ENDPOINT;
     418             : #else
     419          64 :         const char *ncacn_np_secondary_endpoint = NULL;
     420             : #endif
     421             : 
     422         256 :         for (i=0;i<ndr_table_browser.endpoints->count;i++) {
     423           6 :                 NTSTATUS ret;
     424         192 :                 const char *name = ndr_table_browser.endpoints->names[i];
     425             : 
     426         192 :                 ret = dcesrv_interface_register(dce_ctx,
     427             :                                                 name,
     428             :                                                 ncacn_np_secondary_endpoint,
     429             :                                                 &dcesrv_browser_interface,
     430             :                                                 NULL);
     431         192 :                 if (!NT_STATUS_IS_OK(ret)) {
     432           0 :                         DEBUG(1,("browser_op_init_server: failed to register endpoint '%s'\n",name));
     433           0 :                         return ret;
     434             :                 }
     435             :         }
     436             : 
     437          64 :         return NT_STATUS_OK;
     438             : }
     439             : 
     440           0 : static NTSTATUS browser__op_shutdown_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
     441             : {
     442           0 :         return NT_STATUS_OK;
     443             : }
     444             : 
     445           0 : static bool browser__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
     446             : {
     447           0 :         if (dcesrv_browser_interface.syntax_id.if_version == if_version &&
     448           0 :                 GUID_equal(&dcesrv_browser_interface.syntax_id.uuid, uuid)) {
     449           0 :                 memcpy(iface,&dcesrv_browser_interface, sizeof(*iface));
     450           0 :                 return true;
     451             :         }
     452             : 
     453           0 :         return false;
     454             : }
     455             : 
     456           0 : static bool browser__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
     457             : {
     458           0 :         if (strcmp(dcesrv_browser_interface.name, name)==0) {
     459           0 :                 memcpy(iface, &dcesrv_browser_interface, sizeof(*iface));
     460           0 :                 return true;
     461             :         }
     462             : 
     463           0 :         return false;
     464             : }
     465             : 
     466          66 : NTSTATUS dcerpc_server_browser_init(TALLOC_CTX *ctx)
     467             : {
     468           2 :         NTSTATUS ret;
     469           2 :         static const struct dcesrv_endpoint_server ep_server = {
     470             :             /* fill in our name */
     471             :             .name = "browser",
     472             : 
     473             :             /* Initialization flag */
     474             :             .initialized = false,
     475             : 
     476             :             /* fill in all the operations */
     477             : #ifdef DCESRV_INTERFACE_BROWSER_INIT_SERVER
     478             :             .init_server = DCESRV_INTERFACE_BROWSER_INIT_SERVER,
     479             : #else
     480             :             .init_server = browser__op_init_server,
     481             : #endif
     482             : #ifdef DCESRV_INTERFACE_BROWSER_SHUTDOWN_SERVER
     483             :             .shutdown_server = DCESRV_INTERFACE_BROWSER_SHUTDOWN_SERVER,
     484             : #else
     485             :             .shutdown_server = browser__op_shutdown_server,
     486             : #endif
     487             :             .interface_by_uuid = browser__op_interface_by_uuid,
     488             :             .interface_by_name = browser__op_interface_by_name
     489             :         };
     490             :         /* register ourselves with the DCERPC subsystem. */
     491          66 :         ret = dcerpc_register_ep_server(&ep_server);
     492             : 
     493          66 :         if (!NT_STATUS_IS_OK(ret)) {
     494           0 :                 DEBUG(0,("Failed to register 'browser' endpoint server!\n"));
     495           0 :                 return ret;
     496             :         }
     497             : 
     498          66 :         return ret;
     499             : }
     500             : 

Generated by: LCOV version 1.14