3 * Bacula Director daemon -- this is the main program
5 * Kern Sibbald, March MM
10 Copyright (C) 2000-2005 Kern Sibbald
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation; either version 2 of
15 the License, or (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
22 You should have received a copy of the GNU General Public
23 License along with this program; if not, write to the Free
24 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
32 /* Forward referenced subroutines */
33 static void terminate_dird(int sig);
34 static int check_resources();
36 /* Exported subroutines */
38 extern "C" void reload_config(int sig);
41 /* Imported subroutines */
42 JCR *wait_for_next_job(char *runjob);
43 void term_scheduler();
44 void term_ua_server();
45 void start_UA_server(dlist *addrs);
46 void init_job_server(int max_workers);
47 void term_job_server();
48 void store_jobtype(LEX *lc, RES_ITEM *item, int index, int pass);
49 void store_level(LEX *lc, RES_ITEM *item, int index, int pass);
50 void store_replace(LEX *lc, RES_ITEM *item, int index, int pass);
51 void init_device_resources();
53 static char *configfile = NULL;
54 static char *runjob = NULL;
55 static int background = 1;
56 static void init_reload(void);
58 /* Globals Exported */
59 DIRRES *director; /* Director resource */
63 /* Globals Imported */
64 extern int r_first, r_last; /* first and last resources */
65 extern RES_TABLE resources[];
66 extern RES **res_head;
67 extern RES_ITEM job_items[];
71 #define CONFIG_FILE "./bacula-dir.conf" /* default configuration file */
76 "Copyright (C) 2000-2005 Kern Sibbald.\n"
77 "\nVersion: " VERSION " (" BDATE ")\n\n"
78 "Usage: dird [-f -s] [-c config_file] [-d debug_level] [config_file]\n"
79 " -c <file> set configuration file to file\n"
80 " -dnn set debug level to nn\n"
81 " -f run in foreground (for debugging)\n"
83 " -r <job> run <job> now\n"
85 " -t test - read configuration and exit\n"
87 " -v verbose user messages\n"
88 " -? print this message.\n"
95 /*********************************************************************
97 * Main Bacula Server program
100 int main (int argc, char *argv[])
104 int no_signals = FALSE;
105 int test_config = FALSE;
110 my_name_is(argc, argv, "bacula-dir");
111 textdomain("bacula");
112 init_msg(NULL, NULL); /* initialize message handler */
114 daemon_start_time = time(NULL);
116 while ((ch = getopt(argc, argv, "c:d:fg:r:stu:v?")) != -1) {
118 case 'c': /* specify config file */
119 if (configfile != NULL) {
122 configfile = bstrdup(optarg);
125 case 'd': /* set debug level */
126 debug_level = atoi(optarg);
127 if (debug_level <= 0) {
130 Dmsg1(0, "Debug level = %d\n", debug_level);
133 case 'f': /* run in foreground */
137 case 'g': /* set group id */
141 case 'r': /* run job */
142 if (runjob != NULL) {
146 runjob = bstrdup(optarg);
150 case 's': /* turn off signals */
154 case 't': /* test config */
158 case 'u': /* set uid */
162 case 'v': /* verbose */
176 init_signals(terminate_dird);
180 if (configfile != NULL) {
183 configfile = bstrdup(*argv);
191 if (configfile == NULL) {
192 configfile = bstrdup(CONFIG_FILE);
195 parse_config(configfile);
197 if (init_tls() != 0) {
198 Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("TLS library initialization failed.\n"));
201 if (!check_resources()) {
202 Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
209 my_name_is(0, NULL, director->hdr.name); /* set user defined name */
211 FDConnectTimeout = (int)director->FDConnectTimeout;
212 SDConnectTimeout = (int)director->SDConnectTimeout;
216 init_stack_dump(); /* grab new pid */
219 /* Create pid must come after we are a daemon -- so we have our final pid */
220 create_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
221 read_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
223 drop(uid, gid); /* reduce priveleges if requested */
225 signal(SIGHUP, reload_config);
227 init_console_msg(working_directory);
229 init_python_interpreter(director->hdr.name, director->scripts_directory,
232 set_thread_concurrency(director->MaxConcurrentJobs * 2 +
233 4 /* UA */ + 4 /* sched+watchdog+jobsvr+misc */);
235 Dmsg0(200, "Start UA server\n");
236 start_UA_server(director->DIRaddrs);
238 start_watchdog(); /* start network watchdog thread */
240 init_jcr_subsystem(); /* start JCR watchdogs etc. */
242 init_job_server(director->MaxConcurrentJobs);
244 // init_device_resources();
246 Dmsg0(200, "wait for next job\n");
247 /* Main loop -- call scheduler to get next job to run */
248 while ((jcr = wait_for_next_job(runjob))) {
249 run_job(jcr); /* run job */
250 free_jcr(jcr); /* release jcr */
251 if (runjob) { /* command line, run a single job? */
252 break; /* yes, terminate */
259 /* Cleanup and then exit */
260 static void terminate_dird(int sig)
262 static bool already_here = false;
264 if (already_here) { /* avoid recursive temination problems */
268 generate_daemon_event(NULL, "Exit");
269 write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
270 delete_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
271 // signal(SIGCHLD, SIG_IGN); /* don't worry about children now */
277 if (configfile != NULL) {
280 if (debug_level > 5) {
281 print_memory_pool_stats();
283 free_config_resources();
285 term_msg(); /* terminate message handler */
288 close_memory_pool(); /* release free memory in pool */
293 struct RELOAD_TABLE {
298 static const int max_reloads = 10;
299 static RELOAD_TABLE reload_table[max_reloads];
301 static void init_reload(void)
303 for (int i=0; i < max_reloads; i++) {
304 reload_table[i].job_count = 0;
305 reload_table[i].res_table = NULL;
309 static void free_saved_resources(int table)
311 int num = r_last - r_first + 1;
312 RES **res_tab = reload_table[table].res_table;
314 Dmsg1(100, "res_tab for table %d already released.\n", table);
317 Dmsg1(100, "Freeing resources for table %d\n", table);
318 for (int j=0; j<num; j++) {
319 free_resource(res_tab[j], r_first + j);
322 reload_table[table].job_count = 0;
323 reload_table[table].res_table = NULL;
327 * Called here at the end of every job that was
328 * hooked decrementing the active job_count. When
329 * it goes to zero, no one is using the associated
330 * resource table, so free it.
332 static void reload_job_end_cb(JCR *jcr, void *ctx)
334 int reload_id = (int)((long int)ctx);
335 Dmsg3(100, "reload job_end JobId=%d table=%d cnt=%d\n", jcr->JobId,
336 reload_id, reload_table[reload_id].job_count);
339 if (--reload_table[reload_id].job_count <= 0) {
340 free_saved_resources(reload_id);
346 static int find_free_reload_table_entry()
349 for (int i=0; i < max_reloads; i++) {
350 if (reload_table[i].res_table == NULL) {
359 * If we get here, we have received a SIGHUP, which means to
360 * reread our configuration file.
362 * The algorithm used is as follows: we count how many jobs are
363 * running and mark the running jobs to make a callback on
364 * exiting. The old config is saved with the reload table
365 * id in a reload table. The new config file is read. Now, as
366 * each job exits, it calls back to the reload_job_end_cb(), which
367 * decrements the count of open jobs for the given reload table.
368 * When the count goes to zero, we release those resources.
369 * This allows us to have pointers into the resource table (from
370 * jobs), and once they exit and all the pointers are released, we
371 * release the old table. Note, if no new jobs are running since the
372 * last reload, then the old resources will be immediately release.
373 * A console is considered a job because it may have pointers to
374 * resources, but a SYSTEM job is not since it *should* not have any
375 * permanent pointers to jobs.
378 void reload_config(int sig)
380 static bool already_here = false;
383 int njobs = 0; /* number of running jobs */
388 abort(); /* Oops, recursion -> die */
392 sigaddset(&set, SIGHUP);
393 sigprocmask(SIG_BLOCK, &set, NULL);
395 // Jmsg(NULL, M_INFO, 0, "Entering experimental reload config code. Bug reports will not be accepted.\n");
400 table = find_free_reload_table_entry();
402 Jmsg(NULL, M_ERROR, 0, _("Too many open reload requests. Request ignored.\n"));
406 Dmsg1(100, "Reload_config njobs=%d\n", njobs);
407 reload_table[table].res_table = save_config_resources();
408 Dmsg1(100, "Saved old config in table %d\n", table);
410 ok = parse_config(configfile, 0); /* no exit on error */
412 Dmsg0(100, "Reloaded config file\n");
413 if (!ok || !check_resources()) {
414 rtable = find_free_reload_table_entry(); /* save new, bad table */
416 Jmsg(NULL, M_ERROR, 0, _("Please correct configuration file: %s\n"), configfile);
417 Jmsg(NULL, M_ERROR_TERM, 0, _("Out of reload table entries. Giving up.\n"));
419 Jmsg(NULL, M_ERROR, 0, _("Please correct configuration file: %s\n"), configfile);
420 Jmsg(NULL, M_ERROR, 0, _("Resetting previous configuration.\n"));
422 reload_table[rtable].res_table = save_config_resources();
423 /* Now restore old resoure values */
424 int num = r_last - r_first + 1;
425 RES **res_tab = reload_table[table].res_table;
426 for (int i=0; i<num; i++) {
427 res_head[i] = res_tab[i];
429 table = rtable; /* release new, bad, saved table below */
432 * Hook all active jobs so that they release this table
435 if (jcr->JobType != JT_SYSTEM) {
436 reload_table[table].job_count++;
437 job_end_push(jcr, reload_job_end_cb, (void *)((long int)table));
440 free_locked_jcr(jcr);
445 set_working_directory(director->working_directory);
446 FDConnectTimeout = director->FDConnectTimeout;
447 SDConnectTimeout = director->SDConnectTimeout;
448 Dmsg0(0, "Director's configuration file reread.\n");
450 // init_device_resources(); /* Update Device resources */
452 /* Now release saved resources, if no jobs using the resources */
454 free_saved_resources(table);
460 sigprocmask(SIG_UNBLOCK, &set, NULL);
461 signal(SIGHUP, reload_config);
462 already_here = false;
466 * Make a quick check to see that we have all the
469 * **** FIXME **** this routine could be a lot more
470 * intelligent and comprehensive.
472 static int check_resources()
479 job = (JOB *)GetNextRes(R_JOB, NULL);
480 director = (DIRRES *)GetNextRes(R_DIRECTOR, NULL);
482 Jmsg(NULL, M_FATAL, 0, _("No Director resource defined in %s\n"
483 "Without that I don't know who I am :-(\n"), configfile);
486 set_working_directory(director->working_directory);
487 if (!director->messages) { /* If message resource not specified */
488 director->messages = (MSGS *)GetNextRes(R_MSGS, NULL);
489 if (!director->messages) {
490 Jmsg(NULL, M_FATAL, 0, _("No Messages resource defined in %s\n"), configfile);
494 if (GetNextRes(R_DIRECTOR, (RES *)director) != NULL) {
495 Jmsg(NULL, M_FATAL, 0, _("Only one Director resource permitted in %s\n"),
500 /* tls_require implies tls_enable */
501 if (director->tls_require) {
502 director->tls_enable = true;
505 if (!director->tls_certfile && director->tls_enable) {
506 Jmsg(NULL, M_FATAL, 0, _("\"TLS Certificate\" file not defined for Director \"%s\" in %s.\n"),
507 director->hdr.name, configfile);
511 if (!director->tls_keyfile && director->tls_enable) {
512 Jmsg(NULL, M_FATAL, 0, _("\"TLS Key\" file not defined for Director \"%s\" in %s.\n"),
513 director->hdr.name, configfile);
517 if ((!director->tls_ca_certfile && !director->tls_ca_certdir) && director->tls_enable && director->tls_verify_peer) {
518 Jmsg(NULL, M_FATAL, 0, _("Neither \"TLS CA Certificate\" or \"TLS CA"
519 " Certificate Dir\" are defined for Director \"%s\" in %s."
520 " At least one CA certificate store is required"
521 " when using \"TLS Verify Peer\".\n"),
522 director->hdr.name, configfile);
526 /* If everything is well, attempt to initialize our per-resource TLS context */
527 if (OK && (director->tls_enable || director->tls_require)) {
528 /* Initialize TLS context:
529 * Args: CA certfile, CA certdir, Certfile, Keyfile,
530 * Keyfile PEM Callback, Keyfile CB Userdata, DHfile, Verify Peer */
531 director->tls_ctx = new_tls_context(director->tls_ca_certfile,
532 director->tls_ca_certdir, director->tls_certfile,
533 director->tls_keyfile, NULL, NULL, director->tls_dhfile,
534 director->tls_verify_peer);
536 if (!director->tls_ctx) {
537 Jmsg(NULL, M_FATAL, 0, _("Failed to initialize TLS context for Director \"%s\" in %s.\n"),
538 director->hdr.name, configfile);
542 #endif /* HAVE_TLS */
546 Jmsg(NULL, M_FATAL, 0, _("No Job records defined in %s\n"), configfile);
549 foreach_res(job, R_JOB) {
553 /* Handle Storage alists specifically */
554 JOB *jobdefs = job->jobdefs;
555 if (jobdefs->storage && !job->storage) {
557 job->storage = New(alist(10, not_owned_by_alist));
558 foreach_alist(st, jobdefs->storage) {
559 job->storage->append(st);
563 /* Transfer default items from JobDefs Resource */
564 for (i=0; job_items[i].name; i++) {
565 char **def_svalue, **svalue; /* string value */
566 int *def_ivalue, *ivalue; /* integer value */
567 int64_t *def_lvalue, *lvalue; /* 64 bit values */
570 Dmsg4(1400, "Job \"%s\", field \"%s\" bit=%d def=%d\n",
571 job->hdr.name, job_items[i].name,
572 bit_is_set(i, job->hdr.item_present),
573 bit_is_set(i, job->jobdefs->hdr.item_present));
575 if (!bit_is_set(i, job->hdr.item_present) &&
576 bit_is_set(i, job->jobdefs->hdr.item_present)) {
577 Dmsg2(400, "Job \"%s\", field \"%s\": getting default.\n",
578 job->hdr.name, job_items[i].name);
579 offset = (char *)(job_items[i].value) - (char *)&res_all;
581 * Handle strings and directory strings
583 if (job_items[i].handler == store_str ||
584 job_items[i].handler == store_dir) {
585 def_svalue = (char **)((char *)(job->jobdefs) + offset);
586 Dmsg5(400, "Job \"%s\", field \"%s\" def_svalue=%s item %d offset=%u\n",
587 job->hdr.name, job_items[i].name, *def_svalue, i, offset);
588 svalue = (char **)((char *)job + offset);
590 Pmsg1(000, "Hey something is wrong. p=0x%lu\n", *svalue);
592 *svalue = bstrdup(*def_svalue);
593 set_bit(i, job->hdr.item_present);
597 } else if (job_items[i].handler == store_res) {
598 def_svalue = (char **)((char *)(job->jobdefs) + offset);
599 Dmsg4(400, "Job \"%s\", field \"%s\" item %d offset=%u\n",
600 job->hdr.name, job_items[i].name, i, offset);
601 svalue = (char **)((char *)job + offset);
603 Pmsg1(000, "Hey something is wrong. p=0x%lu\n", *svalue);
605 *svalue = *def_svalue;
606 set_bit(i, job->hdr.item_present);
608 * Handle alist resources
610 } else if (job_items[i].handler == store_alist_res) {
611 if (bit_is_set(i, job->jobdefs->hdr.item_present)) {
612 set_bit(i, job->hdr.item_present);
615 * Handle integer fields
616 * Note, our store_yesno does not handle bitmaped fields
618 } else if (job_items[i].handler == store_yesno ||
619 job_items[i].handler == store_pint ||
620 job_items[i].handler == store_jobtype ||
621 job_items[i].handler == store_level ||
622 job_items[i].handler == store_pint ||
623 job_items[i].handler == store_replace) {
624 def_ivalue = (int *)((char *)(job->jobdefs) + offset);
625 Dmsg5(400, "Job \"%s\", field \"%s\" def_ivalue=%d item %d offset=%u\n",
626 job->hdr.name, job_items[i].name, *def_ivalue, i, offset);
627 ivalue = (int *)((char *)job + offset);
628 *ivalue = *def_ivalue;
629 set_bit(i, job->hdr.item_present);
631 * Handle 64 bit integer fields
633 } else if (job_items[i].handler == store_time ||
634 job_items[i].handler == store_size ||
635 job_items[i].handler == store_int64) {
636 def_lvalue = (int64_t *)((char *)(job->jobdefs) + offset);
637 Dmsg5(400, "Job \"%s\", field \"%s\" def_lvalue=%" lld " item %d offset=%u\n",
638 job->hdr.name, job_items[i].name, *def_lvalue, i, offset);
639 lvalue = (int64_t *)((char *)job + offset);
640 *lvalue = *def_lvalue;
641 set_bit(i, job->hdr.item_present);
647 * Ensure that all required items are present
649 for (i=0; job_items[i].name; i++) {
650 if (job_items[i].flags & ITEM_REQUIRED) {
651 if (!bit_is_set(i, job->hdr.item_present)) {
652 Jmsg(NULL, M_FATAL, 0, "\"%s\" directive in Job \"%s\" resource is required, but not found.\n",
653 job_items[i].name, job->hdr.name);
657 /* If this triggers, take a look at lib/parse_conf.h */
658 if (i >= MAX_RES_ITEMS) {
659 Emsg0(M_ERROR_TERM, 0, "Too many items in Job resource\n");
662 } /* End loop over Job res */
664 /* Loop over databases */
666 foreach_res(catalog, R_CATALOG) {
669 * Make sure we can open catalog, otherwise print a warning
670 * message because the server is probably not running.
672 db = db_init_database(NULL, catalog->db_name, catalog->db_user,
673 catalog->db_password, catalog->db_address,
674 catalog->db_port, catalog->db_socket,
675 catalog->mult_db_connections);
676 if (!db || !db_open_database(NULL, db)) {
677 Jmsg(NULL, M_FATAL, 0, _("Could not open database \"%s\".\n"),
680 Jmsg(NULL, M_FATAL, 0, _("%s"), db_strerror(db));
686 /* Loop over all pools, defining/updating them in each database */
688 foreach_res(pool, R_POOL) {
689 create_pool(NULL, db, pool, POOL_OP_UPDATE); /* update request */
693 foreach_res(store, R_STORAGE) {
696 if (store->media_type) {
697 bstrncpy(mr.MediaType, store->media_type, sizeof(mr.MediaType));
699 db_create_mediatype_record(NULL, db, &mr);
703 bstrncpy(sr.Name, store->name(), sizeof(sr.Name));
704 sr.AutoChanger = store->autochanger;
705 db_create_storage_record(NULL, db, &sr);
706 store->StorageId = sr.StorageId; /* set storage Id */
707 if (!sr.created) { /* if not created, update it */
708 db_update_storage_record(NULL, db, &sr);
712 /* tls_require implies tls_enable */
713 if (store->tls_require) {
714 store->tls_enable = true;
717 if ((!store->tls_ca_certfile && !store->tls_ca_certdir) && store->tls_enable) {
718 Jmsg(NULL, M_FATAL, 0, _("Neither \"TLS CA Certificate\""
719 " or \"TLS CA Certificate Dir\" are defined for Storage \"%s\" in %s.\n"),
720 store->hdr.name, configfile);
724 /* If everything is well, attempt to initialize our per-resource TLS context */
725 if (OK && (store->tls_enable || store->tls_require)) {
726 /* Initialize TLS context:
727 * Args: CA certfile, CA certdir, Certfile, Keyfile,
728 * Keyfile PEM Callback, Keyfile CB Userdata, DHfile, Verify Peer */
729 store->tls_ctx = new_tls_context(store->tls_ca_certfile,
730 store->tls_ca_certdir, store->tls_certfile,
731 store->tls_keyfile, NULL, NULL, NULL, true);
733 if (!store->tls_ctx) {
734 Jmsg(NULL, M_FATAL, 0, _("Failed to initialize TLS context for Storage \"%s\" in %s.\n"),
735 store->hdr.name, configfile);
739 #endif /* HAVE_TLS */
742 /* Loop over all counters, defining them in each database */
743 /* Set default value in all counters */
745 foreach_res(counter, R_COUNTER) {
746 /* Write to catalog? */
747 if (!counter->created && counter->Catalog == catalog) {
749 bstrncpy(cr.Counter, counter->hdr.name, sizeof(cr.Counter));
750 cr.MinValue = counter->MinValue;
751 cr.MaxValue = counter->MaxValue;
752 cr.CurrentValue = counter->MinValue;
753 if (counter->WrapCounter) {
754 bstrncpy(cr.WrapCounter, counter->WrapCounter->hdr.name, sizeof(cr.WrapCounter));
756 cr.WrapCounter[0] = 0; /* empty string */
758 if (db_create_counter_record(NULL, db, &cr)) {
759 counter->CurrentValue = cr.CurrentValue;
760 counter->created = true;
761 Dmsg2(100, "Create counter %s val=%d\n", counter->hdr.name, counter->CurrentValue);
764 if (!counter->created) {
765 counter->CurrentValue = counter->MinValue; /* default value */
768 db_close_database(NULL, db);
772 /* Loop over Consoles */
774 foreach_res(cons, R_CONSOLE) {
775 /* tls_require implies tls_enable */
776 if (cons->tls_require) {
777 cons->tls_enable = true;
780 if (!cons->tls_certfile && cons->tls_enable) {
781 Jmsg(NULL, M_FATAL, 0, _("\"TLS Certificate\" file not defined for Console \"%s\" in %s.\n"),
782 cons->hdr.name, configfile);
786 if (!cons->tls_keyfile && cons->tls_enable) {
787 Jmsg(NULL, M_FATAL, 0, _("\"TLS Key\" file not defined for Console \"%s\" in %s.\n"),
788 cons->hdr.name, configfile);
792 if ((!cons->tls_ca_certfile && !cons->tls_ca_certdir) && cons->tls_enable && cons->tls_verify_peer) {
793 Jmsg(NULL, M_FATAL, 0, _("Neither \"TLS CA Certificate\" or \"TLS CA"
794 " Certificate Dir\" are defined for Console \"%s\" in %s."
795 " At least one CA certificate store is required"
796 " when using \"TLS Verify Peer\".\n"),
797 cons->hdr.name, configfile);
800 /* If everything is well, attempt to initialize our per-resource TLS context */
801 if (OK && (cons->tls_enable || cons->tls_require)) {
802 /* Initialize TLS context:
803 * Args: CA certfile, CA certdir, Certfile, Keyfile,
804 * Keyfile PEM Callback, Keyfile CB Userdata, DHfile, Verify Peer */
805 cons->tls_ctx = new_tls_context(cons->tls_ca_certfile,
806 cons->tls_ca_certdir, cons->tls_certfile,
807 cons->tls_keyfile, NULL, NULL, cons->tls_dhfile, cons->tls_verify_peer);
809 if (!cons->tls_ctx) {
810 Jmsg(NULL, M_FATAL, 0, _("Failed to initialize TLS context for File daemon \"%s\" in %s.\n"),
811 cons->hdr.name, configfile);
817 #endif /* HAVE_TLS */
820 /* Loop over Clients */
822 foreach_res(client, R_CLIENT) {
823 /* tls_require implies tls_enable */
824 if (client->tls_require) {
825 client->tls_enable = true;
828 if ((!client->tls_ca_certfile && !client->tls_ca_certdir) && client->tls_enable) {
829 Jmsg(NULL, M_FATAL, 0, _("Neither \"TLS CA Certificate\""
830 " or \"TLS CA Certificate Dir\" are defined for File daemon \"%s\" in %s.\n"),
831 client->hdr.name, configfile);
835 /* If everything is well, attempt to initialize our per-resource TLS context */
836 if (OK && (client->tls_enable || client->tls_require)) {
837 /* Initialize TLS context:
838 * Args: CA certfile, CA certdir, Certfile, Keyfile,
839 * Keyfile PEM Callback, Keyfile CB Userdata, DHfile, Verify Peer */
840 client->tls_ctx = new_tls_context(client->tls_ca_certfile,
841 client->tls_ca_certdir, client->tls_certfile,
842 client->tls_keyfile, NULL, NULL, NULL,
845 if (!client->tls_ctx) {
846 Jmsg(NULL, M_FATAL, 0, _("Failed to initialize TLS context for File daemon \"%s\" in %s.\n"),
847 client->hdr.name, configfile);
852 #endif /* HAVE_TLS */
856 close_msg(NULL); /* close temp message handler */
857 init_msg(NULL, director->messages); /* open daemon message handler */