LCOV - code coverage report
Current view: top level - librpc/rpc - dcesrv_mgmt.c (source / functions) Hit Total Coverage
Test: coverage report for v4-17-test 1498b464 Lines: 31 31 100.0 %
Date: 2024-06-13 04:01:37 Functions: 7 7 100.0 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             : 
       4             :    endpoint server for the mgmt pipe
       5             : 
       6             :    Copyright (C) Jelmer Vernooij 2006
       7             : 
       8             :    This program is free software; you can redistribute it and/or modify
       9             :    it under the terms of the GNU General Public License as published by
      10             :    the Free Software Foundation; either version 3 of the License, or
      11             :    (at your option) any later version.
      12             : 
      13             :    This program is distributed in the hope that it will be useful,
      14             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16             :    GNU General Public License for more details.
      17             : 
      18             :    You should have received a copy of the GNU General Public License
      19             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      20             : */
      21             : 
      22             : #include "includes.h"
      23             : #include "librpc/rpc/dcesrv_core.h"
      24             : #include "librpc/rpc/dcesrv_core_proto.h"
      25             : #include "librpc/gen_ndr/ndr_mgmt.h"
      26             : 
      27             : #define DCESRV_INTERFACE_MGMT_BIND(context, iface) \
      28             :        dcesrv_interface_mgmt_bind(context, iface)
      29             : /*
      30             :  * This #define allows the mgmt interface to accept invalid
      31             :  * association groups, because association groups are to coordinate
      32             :  * handles, and handles are not used in mgmt. This in turn avoids
      33             :  * the need to coordinate these across multiple possible NETLOGON
      34             :  * processes, as an mgmt interface is added to each
      35             :  */
      36             : 
      37             : #define DCESRV_INTERFACE_MGMT_FLAGS DCESRV_INTERFACE_FLAGS_HANDLES_NOT_USED
      38             : 
      39         542 : static NTSTATUS dcesrv_interface_mgmt_bind(struct dcesrv_connection_context *context,
      40             :                                              const struct dcesrv_interface *iface)
      41             : {
      42         542 :         return dcesrv_interface_bind_allow_connect(context, iface);
      43             : }
      44             : 
      45             : /*
      46             :   mgmt_inq_if_ids
      47             : */
      48         376 : static WERROR dcesrv_mgmt_inq_if_ids(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
      49             :                        struct mgmt_inq_if_ids *r)
      50             : {
      51         376 :         const struct dcesrv_endpoint *ep = dce_call->conn->endpoint;
      52             :         struct dcesrv_if_list *l;
      53             :         struct rpc_if_id_vector_t *vector;
      54             : 
      55         376 :         vector = *r->out.if_id_vector = talloc(mem_ctx, struct rpc_if_id_vector_t);
      56         376 :         vector->count = 0;
      57         376 :         vector->if_id = NULL;
      58        1150 :         for (l = ep->interface_list; l; l = l->next) {
      59         774 :                 vector->count++;
      60         774 :                 vector->if_id = talloc_realloc(mem_ctx, vector->if_id, struct ndr_syntax_id_p, vector->count);
      61         774 :                 vector->if_id[vector->count-1].id = &l->iface->syntax_id;
      62             :         }
      63         376 :         return WERR_OK;
      64             : }
      65             : 
      66             : 
      67             : /*
      68             :   mgmt_inq_stats
      69             : */
      70          96 : static WERROR dcesrv_mgmt_inq_stats(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
      71             :                        struct mgmt_inq_stats *r)
      72             : {
      73          96 :         if (r->in.max_count != MGMT_STATS_ARRAY_MAX_SIZE)
      74          36 :                 return WERR_NOT_SUPPORTED;
      75             : 
      76          60 :         r->out.statistics->count = r->in.max_count;
      77          60 :         r->out.statistics->statistics = talloc_array(mem_ctx, uint32_t, r->in.max_count);
      78             :         /* FIXME */
      79          60 :         r->out.statistics->statistics[MGMT_STATS_CALLS_IN] = 0;
      80          60 :         r->out.statistics->statistics[MGMT_STATS_CALLS_OUT] = 0;
      81          60 :         r->out.statistics->statistics[MGMT_STATS_PKTS_IN] = 0;
      82          60 :         r->out.statistics->statistics[MGMT_STATS_PKTS_OUT] = 0;
      83             : 
      84          60 :         return WERR_OK;
      85             : }
      86             : 
      87             : 
      88             : /*
      89             :   mgmt_is_server_listening
      90             : */
      91          78 : static uint32_t dcesrv_mgmt_is_server_listening(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
      92             :                        struct mgmt_is_server_listening *r)
      93             : {
      94          78 :         *r->out.status = 0;
      95          78 :         return 1;
      96             : }
      97             : 
      98             : 
      99             : /*
     100             :   mgmt_stop_server_listening
     101             : */
     102          90 : static WERROR dcesrv_mgmt_stop_server_listening(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     103             :                        struct mgmt_stop_server_listening *r)
     104             : {
     105          90 :         return WERR_ACCESS_DENIED;
     106             : }
     107             : 
     108             : 
     109             : /*
     110             :   mgmt_inq_princ_name
     111             : */
     112       13824 : static WERROR dcesrv_mgmt_inq_princ_name(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     113             :                        struct mgmt_inq_princ_name *r)
     114             : {
     115       13824 :         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
     116             : }
     117             : 
     118             : 
     119             : /* include the generated boilerplate */
     120             : #include "librpc/gen_ndr/ndr_mgmt_s.c"
     121             : 
     122        1754 : const struct dcesrv_interface *dcesrv_get_mgmt_interface(void)
     123             : {
     124        1754 :         return &dcesrv_mgmt_interface;
     125             : }

Generated by: LCOV version 1.13