LCOV - code coverage report
Current view: top level - source3/rpc_server - rpcd_spoolss.c (source / functions) Hit Total Coverage
Test: coverage report for master 98b443d9 Lines: 20 26 76.9 %
Date: 2024-05-31 13:13:24 Functions: 3 3 100.0 %

          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 "includes.h"
      19             : #include "rpc_worker.h"
      20             : #include "lib/global_contexts.h"
      21             : #include "librpc/gen_ndr/ndr_spoolss.h"
      22             : #include "librpc/gen_ndr/ndr_spoolss_scompat.h"
      23             : #include "source3/locking/share_mode_lock.h"
      24             : #include "source3/printing/queue_process.h"
      25             : #include "source3/include/messages.h"
      26             : #include "source3/include/secrets.h"
      27             : #include "source3/smbd/proto.h"
      28             : 
      29         103 : static size_t spoolss_interfaces(
      30             :         const struct ndr_interface_table ***pifaces,
      31             :         void *private_data)
      32             : {
      33             :         static const struct ndr_interface_table *ifaces[] = {
      34             :                 &ndr_table_spoolss,
      35             :         };
      36         103 :         *pifaces = ifaces;
      37         103 :         return ARRAY_SIZE(ifaces);
      38             : }
      39             : 
      40          28 : static NTSTATUS spoolss_servers(
      41             :         struct dcesrv_context *dce_ctx,
      42             :         const struct dcesrv_endpoint_server ***_ep_servers,
      43             :         size_t *_num_ep_servers,
      44             :         void *private_data)
      45             : {
      46             :         static const struct dcesrv_endpoint_server *ep_servers[1] = { NULL };
      47          28 :         struct messaging_context *msg_ctx = global_messaging_context();
      48          28 :         struct tevent_context *ev_ctx = messaging_tevent_context(msg_ctx);
      49             :         bool ok;
      50             : 
      51          28 :         ep_servers[0] = spoolss_get_ep_server();
      52             : 
      53          28 :         ok = secrets_init();
      54          28 :         if (!ok) {
      55           0 :                 DBG_ERR("secrets_init() failed\n");
      56           0 :                 return NT_STATUS_INTERNAL_ERROR;
      57             :         }
      58             : 
      59          28 :         ok = locking_init();
      60          28 :         if (!ok) {
      61           0 :                 DBG_ERR("locking_init() failed\n");
      62           0 :                 return NT_STATUS_INTERNAL_ERROR;
      63             :         }
      64             : 
      65          28 :         lp_load_with_shares(get_dyn_CONFIGFILE());
      66             : 
      67          28 :         ok = printing_subsystem_init(ev_ctx, msg_ctx, dce_ctx);
      68          28 :         if (!ok) {
      69           0 :                 DBG_ERR("printing_subsystem_init() failed\n");
      70           0 :                 return NT_STATUS_INTERNAL_ERROR;
      71             :         }
      72             : 
      73          28 :         mangle_reset_cache();
      74             : 
      75          28 :         *_ep_servers = ep_servers;
      76          28 :         *_num_ep_servers = ARRAY_SIZE(ep_servers);
      77          28 :         return NT_STATUS_OK;
      78             : }
      79             : 
      80         131 : int main(int argc, const char *argv[])
      81             : {
      82         131 :         return rpc_worker_main(
      83             :                 argc,
      84             :                 argv,
      85             :                 "rpcd_spoolss",
      86             :                 5,
      87             :                 60,
      88             :                 spoolss_interfaces,
      89             :                 spoolss_servers,
      90             :                 NULL);
      91             : }

Generated by: LCOV version 1.14