python/samba/tests: add test cases for s3/registry init funcs
[Samba.git] / source3 / rpc_server / rpcd_spoolss.c
blob733e70764a572ff03073828cc4156f67141e09d3
1 /*
2 * Unix SMB/CIFS implementation.
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.
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.
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/>.
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"
28 static size_t spoolss_interfaces(
29 const struct ndr_interface_table ***pifaces,
30 void *private_data)
32 static const struct ndr_interface_table *ifaces[] = {
33 &ndr_table_spoolss,
35 *pifaces = ifaces;
36 return ARRAY_SIZE(ifaces);
39 static size_t spoolss_servers(
40 struct dcesrv_context *dce_ctx,
41 const struct dcesrv_endpoint_server ***_ep_servers,
42 void *private_data)
44 static const struct dcesrv_endpoint_server *ep_servers[1] = { NULL };
45 struct messaging_context *msg_ctx = global_messaging_context();
46 struct tevent_context *ev_ctx = messaging_tevent_context(msg_ctx);
47 bool ok;
49 ep_servers[0] = spoolss_get_ep_server();
51 ok = secrets_init();
52 if (!ok) {
53 DBG_ERR("secrets_init() failed\n");
54 exit(1);
57 ok = locking_init();
58 if (!ok) {
59 DBG_ERR("locking_init() failed\n");
60 exit(1);
63 lp_load_with_shares(get_dyn_CONFIGFILE());
65 ok = printing_subsystem_init(ev_ctx, msg_ctx, dce_ctx);
66 if (!ok) {
67 DBG_WARNING("printing_subsystem_init() failed\n");
68 exit(1);
71 *_ep_servers = ep_servers;
72 return ARRAY_SIZE(ep_servers);
75 int main(int argc, const char *argv[])
77 return rpc_worker_main(
78 argc,
79 argv,
80 "rpcd_spoolss",
82 60,
83 spoolss_interfaces,
84 spoolss_servers,
85 NULL);