summaryrefslogtreecommitdiffstats
path: root/plugins/check_smtp.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_smtp.c')
-rw-r--r--plugins/check_smtp.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index e806ad29..701af7b0 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*/);
101static int verbose = 0; 100static int verbose = 0;
102 101
103int main(int argc, char **argv) { 102int 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) {
@@ -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);