… | |
… | |
636 | |
636 | |
637 | fclose (f); |
637 | fclose (f); |
638 | } |
638 | } |
639 | else |
639 | else |
640 | { |
640 | { |
641 | slog (need_keys ? L_ERR : L_NOTICE, _("unable to open private rsa key file '%s': %s"), fname, strerror (errno)); |
|
|
642 | |
|
|
643 | if (need_keys) |
641 | if (need_keys) |
|
|
642 | { |
|
|
643 | slog (need_keys ? L_ERR : L_NOTICE, _("unable to open private rsa key file '%s': %s"), fname, strerror (errno)); |
644 | exit (EXIT_FAILURE); |
644 | exit (EXIT_FAILURE); |
|
|
645 | } |
645 | } |
646 | } |
646 | |
647 | |
647 | free (fname); |
648 | free (fname); |
648 | |
649 | |
649 | if (need_keys && ::thisnode |
650 | if (need_keys && ::thisnode |
… | |
… | |
653 | { |
654 | { |
654 | slog (L_NOTICE, _("private hostkey and public node key mismatch: is '%s' the correct node?"), ::thisnode); |
655 | slog (L_NOTICE, _("private hostkey and public node key mismatch: is '%s' the correct node?"), ::thisnode); |
655 | exit (EXIT_FAILURE); |
656 | exit (EXIT_FAILURE); |
656 | } |
657 | } |
657 | |
658 | |
|
|
659 | fname = conf.config_filename (conf.pidfilename); |
|
|
660 | free (conf.pidfilename); conf.pidfilename = fname; |
|
|
661 | |
658 | for (configuration::node_vector::iterator i = conf.nodes.begin(); i != conf.nodes.end(); ++i) |
662 | for (configuration::node_vector::iterator i = conf.nodes.begin(); i != conf.nodes.end(); ++i) |
659 | (*i)->finalise (); |
663 | (*i)->finalise (); |
660 | } |
664 | } |
661 | |
665 | |
662 | char * |
666 | char * |
663 | configuration::config_filename (const char *name, const char *dflt) |
667 | configuration::config_filename (const char *name, const char *dflt) |
664 | { |
668 | { |
665 | char *fname; |
669 | char *fname; |
666 | |
670 | |
667 | asprintf (&fname, name ? name : dflt, ::thisnode); |
671 | asprintf (&fname, name ? name : dflt, ::thisnode ? ::thisnode : "<unset>"); |
668 | |
672 | |
669 | if (!ABSOLUTE_PATH (fname)) |
673 | if (!ABSOLUTE_PATH (fname)) |
670 | { |
674 | { |
671 | char *rname = fname; |
675 | char *rname = fname; |
672 | asprintf (&fname, "%s/%s", confbase, rname); |
676 | asprintf (&fname, "%s/%s", confbase, rname); |