LCOV - code coverage report
Current view: top level - source3/rpc_server - rpcd_rpcecho.c (source / functions) Hit Total Coverage
Test: coverage report for v4-17-test 1498b464 Lines: 12 23 52.2 %
Date: 2024-06-13 04:01:37 Functions: 2 3 66.7 %

          Line data    Source code
       1             : /*
       2             :  *  Unix SMB/CIFS implementation.
       3             :  *
       4             :  *  This program is free software; you can redistribute it and/or modify
       5             :  *  it under the terms of the GNU General Public License as published by
       6             :  *  the Free Software Foundation; either version 3 of the License, or
       7             :  *  (at your option) any later version.
       8             :  *
       9             :  *  This program is distributed in the hope that it will be useful,
      10             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             :  *  GNU General Public License for more details.
      13             :  *
      14             :  *  You should have received a copy of the GNU General Public License
      15             :  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
      16             :  */
      17             : 
      18             : #include "replace.h"
      19             : #include "rpc_worker.h"
      20             : #include "librpc/gen_ndr/ndr_echo.h"
      21             : #include "librpc/gen_ndr/ndr_echo_scompat.h"
      22             : #include "param/loadparm.h"
      23             : #include "libds/common/roles.h"
      24             : 
      25          35 : static size_t rpcecho_interfaces(
      26             :         const struct ndr_interface_table ***pifaces,
      27             :         void *private_data)
      28             : {
      29             :         static const struct ndr_interface_table *ifaces[] = {
      30             :                 &ndr_table_rpcecho,
      31             :         };
      32          35 :         size_t num_ifaces = ARRAY_SIZE(ifaces);
      33             : 
      34          35 :         switch(lp_server_role()) {
      35           4 :         case ROLE_ACTIVE_DIRECTORY_DC:
      36             :                 /*
      37             :                  * On the AD DC rpcecho is provided by the 'samba'
      38             :                  * binary from source4/
      39             :                  */
      40           4 :                 num_ifaces = 0;
      41           4 :                 break;
      42          31 :         default:
      43          31 :                 break;
      44             :         }
      45             : 
      46          35 :         *pifaces = ifaces;
      47          35 :         return num_ifaces;
      48             : }
      49             : 
      50           0 : static size_t rpcecho_servers(
      51             :         struct dcesrv_context *dce_ctx,
      52             :         const struct dcesrv_endpoint_server ***_ep_servers,
      53             :         void *private_data)
      54             : {
      55             :         static const struct dcesrv_endpoint_server *ep_servers[1] = { NULL };
      56           0 :         size_t num_servers = ARRAY_SIZE(ep_servers);
      57             : 
      58           0 :         ep_servers[0] = rpcecho_get_ep_server();
      59             : 
      60           0 :         switch(lp_server_role()) {
      61           0 :         case ROLE_ACTIVE_DIRECTORY_DC:
      62             :                 /*
      63             :                  * On the AD DC rpcecho is provided by the 'samba'
      64             :                  * binary from source4/
      65             :                  */
      66           0 :                 num_servers = 0;
      67           0 :                 break;
      68           0 :         default:
      69           0 :                 break;
      70             :         }
      71             : 
      72           0 :         *_ep_servers = ep_servers;
      73           0 :         return num_servers;
      74             : }
      75             : 
      76          35 : int main(int argc, const char *argv[])
      77             : {
      78          35 :         return rpc_worker_main(
      79             :                 argc,
      80             :                 argv,
      81             :                 "rpcd_rpcecho",
      82             :                 1,
      83             :                 1,
      84             :                 rpcecho_interfaces,
      85             :                 rpcecho_servers,
      86             :                 NULL);
      87             : }

Generated by: LCOV version 1.13