summaryrefslogtreecommitdiffstats
path: root/plugins/check_tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_tcp.c')
-rw-r--r--plugins/check_tcp.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 09806373..924322e4 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -89,6 +89,14 @@ const int DEFAULT_NNTPS_PORT = 563;
89const int DEFAULT_CLAMD_PORT = 3310; 89const int DEFAULT_CLAMD_PORT = 3310;
90 90
91int main(int argc, char **argv) { 91int main(int argc, char **argv) {
92#ifdef __OpenBSD__
93 /* - rpath is required to read --extra-opts (given up later)
94 * - inet is required for sockets
95 * - unix is required for Unix domain sockets
96 * - dns is required for name lookups */
97 pledge("stdio rpath inet unix dns", NULL);
98#endif // __OpenBSD__
99
92 setlocale(LC_ALL, ""); 100 setlocale(LC_ALL, "");
93 bindtextdomain(PACKAGE, LOCALEDIR); 101 bindtextdomain(PACKAGE, LOCALEDIR);
94 textdomain(PACKAGE); 102 textdomain(PACKAGE);
@@ -216,6 +224,10 @@ int main(int argc, char **argv) {
216 usage4(_("Could not parse arguments")); 224 usage4(_("Could not parse arguments"));
217 } 225 }
218 226
227#ifdef __OpenBSD__
228 pledge("stdio inet unix dns", NULL);
229#endif // __OpenBSD__
230
219 config = paw.config; 231 config = paw.config;
220 232
221 if (verbosity > 0) { 233 if (verbosity > 0) {
@@ -550,7 +562,7 @@ static check_tcp_config_wrapper process_arguments(int argc, char **argv, check_t
550 int option_index = 562 int option_index =
551 getopt_long(argc, argv, "+hVv46EAH:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:", longopts, &option); 563 getopt_long(argc, argv, "+hVv46EAH:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:", longopts, &option);
552 564
553 if (option_index == -1 || option_index == EOF || option_index == 1) { 565 if (CHECK_EOF(option_index) || option_index == 1) {
554 break; 566 break;
555 } 567 }
556 568
@@ -571,11 +583,7 @@ static check_tcp_config_wrapper process_arguments(int argc, char **argv, check_t
571 address_family = AF_INET; 583 address_family = AF_INET;
572 break; 584 break;
573 case '6': // Apparently unused TODO 585 case '6': // Apparently unused TODO
574#ifdef USE_IPV6
575 address_family = AF_INET6; 586 address_family = AF_INET6;
576#else
577 usage4(_("IPv6 support not available"));
578#endif
579 break; 587 break;
580 case 'H': /* hostname */ 588 case 'H': /* hostname */
581 config.host_specified = true; 589 config.host_specified = true;
@@ -675,7 +683,7 @@ static check_tcp_config_wrapper process_arguments(int argc, char **argv, check_t
675 break; 683 break;
676 case 'D': /* Check SSL cert validity - days 'til certificate expiration */ 684 case 'D': /* Check SSL cert validity - days 'til certificate expiration */
677#ifdef HAVE_SSL 685#ifdef HAVE_SSL
678# ifdef USE_OPENSSL /* XXX */ 686# ifdef MOPL_USE_OPENSSL /* XXX */
679 { 687 {
680 char *temp; 688 char *temp;
681 if ((temp = strchr(optarg, ',')) != NULL) { 689 if ((temp = strchr(optarg, ',')) != NULL) {
@@ -700,7 +708,7 @@ static check_tcp_config_wrapper process_arguments(int argc, char **argv, check_t
700 config.check_cert = true; 708 config.check_cert = true;
701 config.use_tls = true; 709 config.use_tls = true;
702 } break; 710 } break;
703# endif /* USE_OPENSSL */ 711# endif /* MOPL_USE_OPENSSL */
704#endif 712#endif
705 /* fallthrough if we don't have ssl */ 713 /* fallthrough if we don't have ssl */
706 case 'S': 714 case 'S':