s3-prefork: do not use a lock_fd, just race on accept()
[Samba/bjacke.git] / source3 / printing / spoolssd.c
blobe1052ad1f5768cbe45da3eceae543a1de8b82044
1 /*
2 Unix SMB/Netbios implementation.
3 SPOOLSS Daemon
4 Copyright (C) Simo Sorce <idra@samba.org> 2010-2011
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "includes.h"
20 #include "serverid.h"
21 #include "smbd/smbd.h"
23 #include "messages.h"
24 #include "include/printing.h"
25 #include "printing/nt_printing_migrate_internal.h"
26 #include "printing/queue_process.h"
27 #include "printing/pcap.h"
28 #include "printing/load.h"
29 #include "ntdomain.h"
30 #include "librpc/gen_ndr/srv_winreg.h"
31 #include "librpc/gen_ndr/srv_spoolss.h"
32 #include "rpc_server/rpc_server.h"
33 #include "rpc_server/rpc_ep_register.h"
34 #include "rpc_server/spoolss/srv_spoolss_nt.h"
35 #include "librpc/rpc/dcerpc_ep.h"
36 #include "lib/server_prefork.h"
37 #include "lib/server_prefork_util.h"
39 #define SPOOLSS_PIPE_NAME "spoolss"
40 #define DAEMON_NAME "spoolssd"
42 static struct prefork_pool *spoolss_pool = NULL;
43 static int spoolss_child_id = 0;
45 static struct pf_daemon_config default_pf_spoolss_cfg = {
46 .prefork_status = PFH_INIT,
47 .min_children = 5,
48 .max_children = 25,
49 .spawn_rate = 5,
50 .max_allowed_clients = 100,
51 .child_min_life = 60 /* 1 minute minimum life time */
53 static struct pf_daemon_config pf_spoolss_cfg = { 0 };
55 pid_t start_spoolssd(struct tevent_context *ev_ctx,
56 struct messaging_context *msg_ctx);
58 static void spoolss_reopen_logs(int child_id)
60 char *lfile = lp_logfile();
61 char *ext;
62 int rc;
64 if (child_id) {
65 rc = asprintf(&ext, "%s.%d", DAEMON_NAME, child_id);
66 } else {
67 rc = asprintf(&ext, "%s", DAEMON_NAME);
70 if (rc == -1) {
71 return;
74 rc = 0;
75 if (lfile == NULL || lfile[0] == '\0') {
76 rc = asprintf(&lfile, "%s/log.%s",
77 get_dyn_LOGFILEBASE(), ext);
78 } else {
79 if (strstr(lfile, ext) == NULL) {
80 if (child_id) {
81 rc = asprintf(&lfile, "%s.%d",
82 lp_logfile(), child_id);
83 } else {
84 rc = asprintf(&lfile, "%s.%s",
85 lp_logfile(), ext);
90 if (rc > 0) {
91 lp_set_logfile(lfile);
92 SAFE_FREE(lfile);
95 SAFE_FREE(ext);
97 reopen_logs();
100 static void update_conf(struct tevent_context *ev,
101 struct messaging_context *msg)
103 change_to_root_user();
104 lp_load(get_dyn_CONFIGFILE(), true, false, false, true);
105 reload_printers(ev, msg);
107 spoolss_reopen_logs(spoolss_child_id);
108 if (spoolss_child_id == 0) {
109 pfh_daemon_config(DAEMON_NAME,
110 &pf_spoolss_cfg,
111 &default_pf_spoolss_cfg);
112 pfh_manage_pool(ev, msg, &pf_spoolss_cfg, spoolss_pool);
116 static void smb_conf_updated(struct messaging_context *msg,
117 void *private_data,
118 uint32_t msg_type,
119 struct server_id server_id,
120 DATA_BLOB *data)
122 struct tevent_context *ev_ctx = talloc_get_type_abort(private_data,
123 struct tevent_context);
125 DEBUG(10, ("Got message saying smb.conf was updated. Reloading.\n"));
126 update_conf(ev_ctx, msg);
129 static void update_pcap(struct tevent_context *ev_ctx,
130 struct messaging_context *msg_ctx)
132 change_to_root_user();
133 reload_printers(ev_ctx, msg_ctx);
136 static void pcap_updated(struct messaging_context *msg,
137 void *private_data,
138 uint32_t msg_type,
139 struct server_id server_id,
140 DATA_BLOB *data)
142 struct tevent_context *ev_ctx;
144 ev_ctx = talloc_get_type_abort(private_data, struct tevent_context);
146 DEBUG(10, ("Got message that pcap updated. Reloading.\n"));
147 update_pcap(ev_ctx, msg);
150 static void spoolss_sig_term_handler(struct tevent_context *ev,
151 struct tevent_signal *se,
152 int signum,
153 int count,
154 void *siginfo,
155 void *private_data)
157 exit_server_cleanly("termination signal");
160 static void spoolss_setup_sig_term_handler(struct tevent_context *ev_ctx)
162 struct tevent_signal *se;
164 se = tevent_add_signal(ev_ctx,
165 ev_ctx,
166 SIGTERM, 0,
167 spoolss_sig_term_handler,
168 NULL);
169 if (!se) {
170 exit_server("failed to setup SIGTERM handler");
174 static void spoolss_sig_hup_handler(struct tevent_context *ev,
175 struct tevent_signal *se,
176 int signum,
177 int count,
178 void *siginfo,
179 void *pvt)
181 struct messaging_context *msg_ctx;
183 msg_ctx = talloc_get_type_abort(pvt, struct messaging_context);
185 DEBUG(1,("Reloading printers after SIGHUP\n"));
186 update_conf(ev, msg_ctx);
188 /* relay to all children */
189 if (spoolss_pool) {
190 prefork_send_signal_to_all(spoolss_pool, SIGHUP);
194 static void spoolss_setup_sig_hup_handler(struct tevent_context *ev_ctx,
195 struct messaging_context *msg_ctx)
197 struct tevent_signal *se;
199 se = tevent_add_signal(ev_ctx,
200 ev_ctx,
201 SIGHUP, 0,
202 spoolss_sig_hup_handler,
203 msg_ctx);
204 if (!se) {
205 exit_server("failed to setup SIGHUP handler");
209 static bool spoolss_init_cb(void *ptr)
211 struct messaging_context *msg_ctx = talloc_get_type_abort(
212 ptr, struct messaging_context);
214 return nt_printing_tdb_migrate(msg_ctx);
217 static bool spoolss_shutdown_cb(void *ptr)
219 srv_spoolss_cleanup();
221 return true;
224 /* Children */
226 struct spoolss_chld_sig_hup_ctx {
227 struct messaging_context *msg_ctx;
228 struct pf_worker_data *pf;
231 static void spoolss_chld_sig_hup_handler(struct tevent_context *ev,
232 struct tevent_signal *se,
233 int signum,
234 int count,
235 void *siginfo,
236 void *pvt)
238 struct spoolss_chld_sig_hup_ctx *shc;
240 shc = talloc_get_type_abort(pvt, struct spoolss_chld_sig_hup_ctx);
242 /* avoid wasting CPU cycles if we are going to exit soon anyways */
243 if (shc->pf != NULL &&
244 shc->pf->cmds == PF_SRV_MSG_EXIT) {
245 return;
248 change_to_root_user();
249 DEBUG(1,("Reloading printers after SIGHUP\n"));
250 reload_printers(ev, shc->msg_ctx);
251 spoolss_reopen_logs(spoolss_child_id);
254 static bool spoolss_setup_chld_hup_handler(struct tevent_context *ev_ctx,
255 struct messaging_context *msg_ctx,
256 struct pf_worker_data *pf)
258 struct spoolss_chld_sig_hup_ctx *shc;
259 struct tevent_signal *se;
261 shc = talloc(ev_ctx, struct spoolss_chld_sig_hup_ctx);
262 if (!shc) {
263 DEBUG(1, ("failed to setup SIGHUP handler"));
264 return false;
266 shc->pf = pf;
267 shc->msg_ctx = msg_ctx;
269 se = tevent_add_signal(ev_ctx,
270 ev_ctx,
271 SIGHUP, 0,
272 spoolss_chld_sig_hup_handler,
273 shc);
274 if (!se) {
275 DEBUG(1, ("failed to setup SIGHUP handler"));
276 return false;
279 return true;
282 static bool spoolss_child_init(struct tevent_context *ev_ctx,
283 int child_id, struct pf_worker_data *pf)
285 NTSTATUS status;
286 struct rpc_srv_callbacks spoolss_cb;
287 struct messaging_context *msg_ctx = server_messaging_context();
288 bool ok;
290 status = reinit_after_fork(msg_ctx, ev_ctx,
291 procid_self(), true);
292 if (!NT_STATUS_IS_OK(status)) {
293 DEBUG(0,("reinit_after_fork() failed\n"));
294 smb_panic("reinit_after_fork() failed");
297 spoolss_child_id = child_id;
298 spoolss_reopen_logs(child_id);
300 ok = spoolss_setup_chld_hup_handler(ev_ctx, msg_ctx, pf);
301 if (!ok) {
302 return false;
305 if (!serverid_register(procid_self(),
306 FLAG_MSG_GENERAL |
307 FLAG_MSG_PRINT_GENERAL)) {
308 return false;
311 if (!locking_init()) {
312 return false;
315 messaging_register(msg_ctx, ev_ctx,
316 MSG_SMB_CONF_UPDATED, smb_conf_updated);
317 messaging_register(msg_ctx, ev_ctx, MSG_PRINTER_PCAP,
318 pcap_updated);
320 /* As soon as messaging is up check if pcap has been loaded already.
321 * If so then we probably missed a message and should load_printers()
322 * ourselves. If pcap has not been loaded yet, then ignore, we will get
323 * a message as soon as the bq process completes the reload. */
324 if (pcap_cache_loaded()) {
325 load_printers(ev_ctx, msg_ctx);
328 /* try to reinit rpc queues */
329 spoolss_cb.init = spoolss_init_cb;
330 spoolss_cb.shutdown = spoolss_shutdown_cb;
331 spoolss_cb.private_data = msg_ctx;
333 status = rpc_winreg_init(NULL);
334 if (!NT_STATUS_IS_OK(status)) {
335 DEBUG(0, ("Failed to register winreg rpc inteface! (%s)\n",
336 nt_errstr(status)));
337 return false;
340 status = rpc_spoolss_init(&spoolss_cb);
341 if (!NT_STATUS_IS_OK(status)) {
342 DEBUG(0, ("Failed to register spoolss rpc inteface! (%s)\n",
343 nt_errstr(status)));
344 return false;
347 return true;
350 struct spoolss_children_data {
351 struct tevent_context *ev_ctx;
352 struct messaging_context *msg_ctx;
353 struct pf_worker_data *pf;
354 int listen_fd_size;
355 int *listen_fds;
357 bool listening;
360 static void spoolss_next_client(void *pvt);
362 static int spoolss_children_main(struct tevent_context *ev_ctx,
363 struct messaging_context *msg_ctx,
364 struct pf_worker_data *pf,
365 int child_id,
366 int listen_fd_size,
367 int *listen_fds,
368 void *private_data)
370 struct spoolss_children_data *data;
371 bool ok;
372 int ret;
374 ok = spoolss_child_init(ev_ctx, child_id, pf);
375 if (!ok) {
376 return 1;
379 data = talloc(ev_ctx, struct spoolss_children_data);
380 if (!data) {
381 return 1;
383 data->pf = pf;
384 data->ev_ctx = ev_ctx;
385 data->msg_ctx = msg_ctx;
386 data->listen_fd_size = listen_fd_size;
387 data->listen_fds = listen_fds;
388 data->listening = false;
390 /* loop until it is time to exit */
391 while (pf->status != PF_WORKER_EXITING) {
392 /* try to see if it is time to schedule the next client */
393 spoolss_next_client(data);
395 ret = tevent_loop_once(ev_ctx);
396 if (ret != 0) {
397 DEBUG(0, ("tevent_loop_once() exited with %d: %s\n",
398 ret, strerror(errno)));
399 pf->status = PF_WORKER_EXITING;
403 return ret;
406 static void spoolss_client_terminated(void *pvt)
408 struct spoolss_children_data *data;
410 data = talloc_get_type_abort(pvt, struct spoolss_children_data);
412 if (data->pf->num_clients) {
413 data->pf->num_clients--;
414 } else {
415 DEBUG(2, ("Invalid num clients, aborting!\n"));
416 data->pf->status = PF_WORKER_EXITING;
417 return;
420 spoolss_next_client(pvt);
423 struct spoolss_new_client {
424 struct spoolss_children_data *data;
425 struct tsocket_address *srv_addr;
426 struct tsocket_address *cli_addr;
429 static void spoolss_handle_client(struct tevent_req *req);
431 static void spoolss_next_client(void *pvt)
433 struct tevent_req *req;
434 struct spoolss_children_data *data;
435 struct spoolss_new_client *next;
437 data = talloc_get_type_abort(pvt, struct spoolss_children_data);
439 if (data->pf->num_clients == 0) {
440 data->pf->status = PF_WORKER_IDLE;
443 if (data->pf->cmds == PF_SRV_MSG_EXIT) {
444 DEBUG(2, ("Parent process commands we terminate!\n"));
445 return;
448 if (data->listening ||
449 data->pf->num_clients >= data->pf->allowed_clients) {
450 /* nothing to do for now we are already listening
451 * or reached the number of clients we are allowed
452 * to handle in parallel */
453 return;
456 next = talloc_zero(data, struct spoolss_new_client);
457 if (!next) {
458 DEBUG(1, ("Out of memory!?\n"));
459 return;
461 next->data = data;
463 req = prefork_listen_send(next, data->ev_ctx, data->pf,
464 data->listen_fd_size,
465 data->listen_fds);
466 if (!req) {
467 DEBUG(1, ("Failed to make listening request!?\n"));
468 talloc_free(next);
469 return;
471 tevent_req_set_callback(req, spoolss_handle_client, next);
473 data->listening = true;
476 static void spoolss_handle_client(struct tevent_req *req)
478 struct spoolss_children_data *data;
479 struct spoolss_new_client *client;
480 int ret;
481 int sd;
483 client = tevent_req_callback_data(req, struct spoolss_new_client);
484 data = client->data;
486 ret = prefork_listen_recv(req, client, &sd,
487 &client->srv_addr, &client->cli_addr);
489 /* this will free the request too */
490 talloc_free(client);
491 /* we are done listening */
492 data->listening = false;
494 if (ret != 0) {
495 DEBUG(6, ("No client connection was available after all!\n"));
496 return;
499 DEBUG(2, ("Spoolss preforked child %d got client connection!\n",
500 (int)(data->pf->pid)));
502 named_pipe_accept_function(data->ev_ctx, data->msg_ctx,
503 SPOOLSS_PIPE_NAME, sd,
504 spoolss_client_terminated, data);
507 /* ==== Main Process Functions ==== */
509 extern pid_t background_lpq_updater_pid;
510 static char *bq_logfile;
512 static void check_updater_child(void)
514 int status;
515 pid_t pid;
517 if (background_lpq_updater_pid == -1) {
518 return;
521 pid = sys_waitpid(background_lpq_updater_pid, &status, WNOHANG);
522 if (pid > 0) {
523 DEBUG(2, ("The background queue child died... Restarting!\n"));
524 pid = start_background_queue(server_event_context(),
525 server_messaging_context(),
526 bq_logfile);
527 background_lpq_updater_pid = pid;
531 static bool spoolssd_schedule_check(struct tevent_context *ev_ctx,
532 struct messaging_context *msg_ctx,
533 struct timeval current_time);
534 static void spoolssd_check_children(struct tevent_context *ev_ctx,
535 struct tevent_timer *te,
536 struct timeval current_time,
537 void *pvt);
539 static void spoolssd_sigchld_handler(struct tevent_context *ev_ctx,
540 struct prefork_pool *pfp,
541 void *pvt)
543 struct messaging_context *msg_ctx;
545 msg_ctx = talloc_get_type_abort(pvt, struct messaging_context);
547 /* run pool management so we can fork/retire or increase
548 * the allowed connections per child based on load */
549 pfh_manage_pool(ev_ctx, msg_ctx, &pf_spoolss_cfg, spoolss_pool);
551 /* also check if the updater child is alive and well */
552 check_updater_child();
555 static bool spoolssd_setup_children_monitor(struct tevent_context *ev_ctx,
556 struct messaging_context *msg_ctx)
558 bool ok;
560 /* add our oun sigchld callback */
561 prefork_set_sigchld_callback(spoolss_pool,
562 spoolssd_sigchld_handler, msg_ctx);
564 ok = spoolssd_schedule_check(ev_ctx, msg_ctx,
565 tevent_timeval_current());
566 return ok;
569 static bool spoolssd_schedule_check(struct tevent_context *ev_ctx,
570 struct messaging_context *msg_ctx,
571 struct timeval current_time)
573 struct tevent_timer *te;
574 struct timeval next_event;
576 /* check situation again in 10 seconds */
577 next_event = tevent_timeval_current_ofs(10, 0);
579 /* TODO: check when the socket becomes readable, so that children
580 * are checked only when there is some activity ? */
581 te = tevent_add_timer(ev_ctx, spoolss_pool, next_event,
582 spoolssd_check_children, msg_ctx);
583 if (!te) {
584 DEBUG(2, ("Failed to set up children monitoring!\n"));
585 return false;
588 return true;
591 static void spoolssd_check_children(struct tevent_context *ev_ctx,
592 struct tevent_timer *te,
593 struct timeval current_time,
594 void *pvt)
596 struct messaging_context *msg_ctx;
598 msg_ctx = talloc_get_type_abort(pvt, struct messaging_context);
600 pfh_manage_pool(ev_ctx, msg_ctx, &pf_spoolss_cfg, spoolss_pool);
602 spoolssd_schedule_check(ev_ctx, msg_ctx, current_time);
605 static void print_queue_forward(struct messaging_context *msg,
606 void *private_data,
607 uint32_t msg_type,
608 struct server_id server_id,
609 DATA_BLOB *data)
611 messaging_send_buf(msg, pid_to_procid(background_lpq_updater_pid),
612 MSG_PRINTER_UPDATE, data->data, data->length);
615 static char *get_bq_logfile(void)
617 char *lfile = lp_logfile();
618 int rc;
620 if (lfile == NULL || lfile[0] == '\0') {
621 rc = asprintf(&lfile, "%s/log.%s.bq",
622 get_dyn_LOGFILEBASE(), DAEMON_NAME);
623 } else {
624 rc = asprintf(&lfile, "%s.bq", lp_logfile());
626 if (rc == -1) {
627 lfile = NULL;
629 return lfile;
632 pid_t start_spoolssd(struct tevent_context *ev_ctx,
633 struct messaging_context *msg_ctx)
635 struct rpc_srv_callbacks spoolss_cb;
636 struct dcerpc_binding_vector *v;
637 TALLOC_CTX *mem_ctx;
638 pid_t pid;
639 NTSTATUS status;
640 int listen_fd;
641 int ret;
642 bool ok;
644 DEBUG(1, ("Forking SPOOLSS Daemon\n"));
647 * Block signals before forking child as it will have to
648 * set its own handlers. Child will re-enable SIGHUP as
649 * soon as the handlers are set up.
651 BlockSignals(true, SIGTERM);
652 BlockSignals(true, SIGHUP);
654 pid = sys_fork();
656 if (pid == -1) {
657 DEBUG(0, ("Failed to fork SPOOLSS [%s]\n",
658 strerror(errno)));
661 /* parent or error */
662 if (pid != 0) {
664 /* Re-enable SIGHUP before returnig */
665 BlockSignals(false, SIGTERM);
666 BlockSignals(false, SIGHUP);
667 return pid;
670 /* child */
671 close_low_fds(false);
673 status = reinit_after_fork(msg_ctx,
674 ev_ctx,
675 procid_self(), true);
676 if (!NT_STATUS_IS_OK(status)) {
677 DEBUG(0,("reinit_after_fork() failed\n"));
678 smb_panic("reinit_after_fork() failed");
681 spoolss_reopen_logs(0);
682 pfh_daemon_config(DAEMON_NAME,
683 &pf_spoolss_cfg,
684 &default_pf_spoolss_cfg);
686 spoolss_setup_sig_term_handler(ev_ctx);
687 spoolss_setup_sig_hup_handler(ev_ctx, msg_ctx);
689 BlockSignals(false, SIGTERM);
690 BlockSignals(false, SIGHUP);
692 /* always start the backgroundqueue listner in spoolssd */
693 bq_logfile = get_bq_logfile();
694 pid = start_background_queue(ev_ctx, msg_ctx, bq_logfile);
695 if (pid > 0) {
696 background_lpq_updater_pid = pid;
699 /* the listening fd must be created before the children are actually
700 * forked out. */
701 listen_fd = create_named_pipe_socket(SPOOLSS_PIPE_NAME);
702 if (listen_fd == -1) {
703 exit(1);
706 ret = listen(listen_fd, pf_spoolss_cfg.max_allowed_clients);
707 if (ret == -1) {
708 DEBUG(0, ("Failed to listen on spoolss pipe - %s\n",
709 strerror(errno)));
710 exit(1);
713 /* start children before any more initialization is done */
714 ok = prefork_create_pool(ev_ctx, /* mem_ctx */
715 ev_ctx, msg_ctx,
716 1, &listen_fd,
717 pf_spoolss_cfg.min_children,
718 pf_spoolss_cfg.max_children,
719 &spoolss_children_main, NULL,
720 &spoolss_pool);
721 if (!ok) {
722 exit(1);
725 if (!serverid_register(procid_self(),
726 FLAG_MSG_GENERAL |
727 FLAG_MSG_PRINT_GENERAL)) {
728 exit(1);
731 if (!locking_init()) {
732 exit(1);
735 messaging_register(msg_ctx, ev_ctx,
736 MSG_SMB_CONF_UPDATED, smb_conf_updated);
737 messaging_register(msg_ctx, NULL, MSG_PRINTER_UPDATE,
738 print_queue_forward);
739 messaging_register(msg_ctx, ev_ctx, MSG_PRINTER_PCAP,
740 pcap_updated);
742 /* As soon as messaging is up check if pcap has been loaded already.
743 * If so then we probably missed a message and should load_printers()
744 * ourselves. If pcap has not been loaded yet, then ignore, we will get
745 * a message as soon as the bq process completes the reload. */
746 if (pcap_cache_loaded()) {
747 load_printers(ev_ctx, msg_ctx);
750 mem_ctx = talloc_new(NULL);
751 if (mem_ctx == NULL) {
752 exit(1);
756 * Initialize spoolss with an init function to convert printers first.
757 * static_init_rpc will try to initialize the spoolss server too but you
758 * can't register it twice.
760 spoolss_cb.init = spoolss_init_cb;
761 spoolss_cb.shutdown = spoolss_shutdown_cb;
762 spoolss_cb.private_data = msg_ctx;
764 status = rpc_winreg_init(NULL);
765 if (!NT_STATUS_IS_OK(status)) {
766 DEBUG(0, ("Failed to register winreg rpc inteface! (%s)\n",
767 nt_errstr(status)));
768 exit(1);
771 status = rpc_spoolss_init(&spoolss_cb);
772 if (!NT_STATUS_IS_OK(status)) {
773 DEBUG(0, ("Failed to register spoolss rpc inteface! (%s)\n",
774 nt_errstr(status)));
775 exit(1);
778 status = dcerpc_binding_vector_new(mem_ctx, &v);
779 if (!NT_STATUS_IS_OK(status)) {
780 DEBUG(0, ("Failed to create binding vector (%s)\n",
781 nt_errstr(status)));
782 exit(1);
785 status = dcerpc_binding_vector_add_np_default(&ndr_table_spoolss, v);
786 if (!NT_STATUS_IS_OK(status)) {
787 DEBUG(0, ("Failed to add np to binding vector (%s)\n",
788 nt_errstr(status)));
789 exit(1);
792 status = rpc_ep_register(ev_ctx, msg_ctx, &ndr_table_spoolss, v);
793 if (!NT_STATUS_IS_OK(status)) {
794 DEBUG(0, ("Failed to register spoolss endpoint! (%s)\n",
795 nt_errstr(status)));
796 exit(1);
799 talloc_free(mem_ctx);
801 ok = spoolssd_setup_children_monitor(ev_ctx, msg_ctx);
802 if (!ok) {
803 DEBUG(0, ("Failed to setup children monitoring!\n"));
804 exit(1);
807 DEBUG(1, ("SPOOLSS Daemon Started (%d)\n", getpid()));
809 pfh_manage_pool(ev_ctx, msg_ctx, &pf_spoolss_cfg, spoolss_pool);
811 /* loop forever */
812 ret = tevent_loop_wait(ev_ctx);
814 /* should not be reached */
815 DEBUG(0,("spoolssd tevent_loop_wait() exited with %d - %s\n",
816 ret, (ret == 0) ? "out of events" : strerror(errno)));
817 exit(1);