diff options
Diffstat (limited to 'plugins/check_smtp.c')
| -rw-r--r-- | plugins/check_smtp.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index e806ad29..24883fd8 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | #include "base64.h" | 37 | #include "base64.h" |
| 38 | #include "regex.h" | 38 | #include "regex.h" |
| 39 | 39 | ||
| 40 | #include <bits/getopt_ext.h> | ||
| 41 | #include <ctype.h> | 40 | #include <ctype.h> |
| 42 | #include <string.h> | 41 | #include <string.h> |
| 43 | #include "check_smtp.d/config.h" | 42 | #include "check_smtp.d/config.h" |
| @@ -101,6 +100,14 @@ static int my_close(int /*socket_descriptor*/); | |||
| 101 | static int verbose = 0; | 100 | static int verbose = 0; |
| 102 | 101 | ||
| 103 | 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 | |||
| 104 | setlocale(LC_ALL, ""); | 111 | setlocale(LC_ALL, ""); |
| 105 | bindtextdomain(PACKAGE, LOCALEDIR); | 112 | bindtextdomain(PACKAGE, LOCALEDIR); |
| 106 | textdomain(PACKAGE); | 113 | textdomain(PACKAGE); |
| @@ -114,6 +121,10 @@ int main(int argc, char **argv) { | |||
| 114 | usage4(_("Could not parse arguments")); | 121 | usage4(_("Could not parse arguments")); |
| 115 | } | 122 | } |
| 116 | 123 | ||
| 124 | #ifdef __OpenBSD__ | ||
| 125 | pledge("stdio inet unix dns", NULL); | ||
| 126 | #endif // __OpenBSD__ | ||
| 127 | |||
| 117 | const check_smtp_config config = tmp_config.config; | 128 | const check_smtp_config config = tmp_config.config; |
| 118 | 129 | ||
| 119 | if (config.output_format_is_set) { | 130 | if (config.output_format_is_set) { |
| @@ -724,7 +735,7 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) { | |||
| 724 | break; | 735 | break; |
| 725 | case 'c': /* critical time threshold */ { | 736 | case 'c': /* critical time threshold */ { |
| 726 | mp_range_parsed tmp = mp_parse_range_string(optarg); | 737 | mp_range_parsed tmp = mp_parse_range_string(optarg); |
| 727 | if (tmp.error != MP_PARSING_SUCCES) { | 738 | if (tmp.error != MP_PARSING_SUCCESS) { |
| 728 | die(STATE_UNKNOWN, "failed to parse critical time threshold"); | 739 | die(STATE_UNKNOWN, "failed to parse critical time threshold"); |
| 729 | } | 740 | } |
| 730 | result.config.connection_time = | 741 | result.config.connection_time = |
| @@ -732,7 +743,7 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) { | |||
| 732 | } break; | 743 | } break; |
| 733 | case 'w': /* warning time threshold */ { | 744 | case 'w': /* warning time threshold */ { |
| 734 | mp_range_parsed tmp = mp_parse_range_string(optarg); | 745 | mp_range_parsed tmp = mp_parse_range_string(optarg); |
| 735 | if (tmp.error != MP_PARSING_SUCCES) { | 746 | if (tmp.error != MP_PARSING_SUCCESS) { |
| 736 | die(STATE_UNKNOWN, "failed to parse warning time threshold"); | 747 | die(STATE_UNKNOWN, "failed to parse warning time threshold"); |
| 737 | } | 748 | } |
| 738 | result.config.connection_time = | 749 | result.config.connection_time = |
| @@ -808,11 +819,7 @@ check_smtp_config_wrapper process_arguments(int argc, char **argv) { | |||
| 808 | address_family = AF_INET; | 819 | address_family = AF_INET; |
| 809 | break; | 820 | break; |
| 810 | case '6': | 821 | case '6': |
| 811 | #ifdef USE_IPV6 | ||
| 812 | address_family = AF_INET6; | 822 | address_family = AF_INET6; |
| 813 | #else | ||
| 814 | usage4(_("IPv6 support not available")); | ||
| 815 | #endif | ||
| 816 | break; | 823 | break; |
| 817 | case 'V': /* version */ | 824 | case 'V': /* version */ |
| 818 | print_revision(progname, NP_VERSION); | 825 | print_revision(progname, NP_VERSION); |
