diff options
Diffstat (limited to 'plugins/check_smtp.c')
| -rw-r--r-- | plugins/check_smtp.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index e8c35f58..24883fd8 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
| @@ -100,6 +100,14 @@ static int my_close(int /*socket_descriptor*/); | |||
| 100 | static int verbose = 0; | 100 | static int verbose = 0; |
| 101 | 101 | ||
| 102 | int main(int argc, char **argv) { | 102 | int main(int argc, char **argv) { |
| 103 | #ifdef __OpenBSD__ | ||
| 104 | /* - rpath is required to read --extra-opts (given up later) | ||
| 105 | * - inet is required for sockets | ||
| 106 | * - unix is required for Unix domain sockets | ||
| 107 | * - dns is required for name lookups */ | ||
| 108 | pledge("stdio rpath inet unix dns", NULL); | ||
| 109 | #endif // __OpenBSD__ | ||
| 110 | |||
| 103 | setlocale(LC_ALL, ""); | 111 | setlocale(LC_ALL, ""); |
| 104 | bindtextdomain(PACKAGE, LOCALEDIR); | 112 | bindtextdomain(PACKAGE, LOCALEDIR); |
| 105 | textdomain(PACKAGE); | 113 | textdomain(PACKAGE); |
| @@ -113,6 +121,10 @@ int main(int argc, char **argv) { | |||
| 113 | usage4(_("Could not parse arguments")); | 121 | usage4(_("Could not parse arguments")); |
| 114 | } | 122 | } |
| 115 | 123 | ||
| 124 | #ifdef __OpenBSD__ | ||
| 125 | pledge("stdio inet unix dns", NULL); | ||
| 126 | #endif // __OpenBSD__ | ||
| 127 | |||
| 116 | const check_smtp_config config = tmp_config.config; | 128 | const check_smtp_config config = tmp_config.config; |
| 117 | 129 | ||
| 118 | if (config.output_format_is_set) { | 130 | if (config.output_format_is_set) { |
| @@ -723,7 +735,7 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) { | |||
| 723 | break; | 735 | break; |
| 724 | case 'c': /* critical time threshold */ { | 736 | case 'c': /* critical time threshold */ { |
| 725 | mp_range_parsed tmp = mp_parse_range_string(optarg); | 737 | mp_range_parsed tmp = mp_parse_range_string(optarg); |
| 726 | if (tmp.error != MP_PARSING_SUCCES) { | 738 | if (tmp.error != MP_PARSING_SUCCESS) { |
| 727 | die(STATE_UNKNOWN, "failed to parse critical time threshold"); | 739 | die(STATE_UNKNOWN, "failed to parse critical time threshold"); |
| 728 | } | 740 | } |
| 729 | result.config.connection_time = | 741 | result.config.connection_time = |
| @@ -731,7 +743,7 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) { | |||
| 731 | } break; | 743 | } break; |
| 732 | case 'w': /* warning time threshold */ { | 744 | case 'w': /* warning time threshold */ { |
| 733 | mp_range_parsed tmp = mp_parse_range_string(optarg); | 745 | mp_range_parsed tmp = mp_parse_range_string(optarg); |
| 734 | if (tmp.error != MP_PARSING_SUCCES) { | 746 | if (tmp.error != MP_PARSING_SUCCESS) { |
| 735 | die(STATE_UNKNOWN, "failed to parse warning time threshold"); | 747 | die(STATE_UNKNOWN, "failed to parse warning time threshold"); |
| 736 | } | 748 | } |
| 737 | result.config.connection_time = | 749 | result.config.connection_time = |
| @@ -807,11 +819,7 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) { | |||
| 807 | address_family = AF_INET; | 819 | address_family = AF_INET; |
| 808 | break; | 820 | break; |
| 809 | case '6': | 821 | case '6': |
| 810 | #ifdef USE_IPV6 | ||
| 811 | address_family = AF_INET6; | 822 | address_family = AF_INET6; |
| 812 | #else | ||
| 813 | usage4(_("IPv6 support not available")); | ||
| 814 | #endif | ||
| 815 | break; | 823 | break; |
| 816 | case 'V': /* version */ | 824 | case 'V': /* version */ |
| 817 | print_revision(progname, NP_VERSION); | 825 | print_revision(progname, NP_VERSION); |
