Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-plugins/files/
Date: Fri, 02 Sep 2022 11:31:32
Message-Id: 1662118249.119aa04460479ae3acfedc593fd7e4e06115ddf0.mjo@gentoo
1 commit: 119aa04460479ae3acfedc593fd7e4e06115ddf0
2 Author: Michael Mair-Keimberger <mmk <AT> levelnine <DOT> at>
3 AuthorDate: Thu Sep 1 15:56:02 2022 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 2 11:30:49 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=119aa044
7
8 net-analyzer/nagios-plugins: remove unused patch
9
10 Signed-off-by: Michael Mair-Keimberger <mmk <AT> levelnine.at>
11 Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
12 Closes: https://github.com/gentoo/gentoo/pull/27105
13
14 .../files/check_smtp-implicit-tls.patch | 145 ---------------------
15 1 file changed, 145 deletions(-)
16
17 diff --git a/net-analyzer/nagios-plugins/files/check_smtp-implicit-tls.patch b/net-analyzer/nagios-plugins/files/check_smtp-implicit-tls.patch
18 deleted file mode 100644
19 index a0f30d2efdbf..000000000000
20 --- a/net-analyzer/nagios-plugins/files/check_smtp-implicit-tls.patch
21 +++ /dev/null
22 @@ -1,145 +0,0 @@
23 -From 0a8cf08ebb0740aa55d6c60d3b79fcab282604fb Mon Sep 17 00:00:00 2001
24 -From: Franz Schwartau <franz@×××××××××××.org>
25 -Date: Tue, 1 Sep 2020 12:48:51 +0200
26 -Subject: [PATCH 1/3] Add support for SMTP over TLS
27 -
28 -This is commonly used on smtps (465) port.
29 -
30 -PROXY protocol is not implemented with TLS in check_smtp.c, yet.
31 ----
32 - plugins/check_smtp.c | 45 ++++++++++++++++++++++++++++++++++++--------
33 - 1 file changed, 37 insertions(+), 8 deletions(-)
34 -
35 -diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
36 -index 0b1c54d4..d5923a6a 100644
37 ---- a/plugins/check_smtp.c
38 -+++ b/plugins/check_smtp.c
39 -@@ -42,8 +42,8 @@ const char *email = "devel@××××××××××××××.org";
40 - #ifdef HAVE_SSL
41 - int check_cert = FALSE;
42 - int days_till_exp_warn, days_till_exp_crit;
43 --# define my_recv(buf, len) ((use_ssl && ssl_established) ? np_net_ssl_read(buf, len) : read(sd, buf, len))
44 --# define my_send(buf, len) ((use_ssl && ssl_established) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0))
45 -+# define my_recv(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_read(buf, len) : read(sd, buf, len))
46 -+# define my_send(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0))
47 - #else /* ifndef HAVE_SSL */
48 - # define my_recv(buf, len) read(sd, buf, len)
49 - # define my_send(buf, len) send(sd, buf, len, 0)
50 -@@ -107,6 +107,7 @@ double critical_time = 0;
51 - int check_critical_time = FALSE;
52 - int verbose = 0;
53 - int use_ssl = FALSE;
54 -+int use_starttls = FALSE;
55 - int use_sni = FALSE;
56 - short use_proxy_prefix = FALSE;
57 - short use_ehlo = FALSE;
58 -@@ -199,12 +200,25 @@ main (int argc, char **argv)
59 - result = my_tcp_connect (server_address, server_port, &sd);
60 -
61 - if (result == STATE_OK) { /* we connected */
62 -+#ifdef HAVE_SSL
63 -+ if (use_ssl) {
64 -+ result = np_net_ssl_init_with_hostname(sd, (use_sni ? server_address : NULL));
65 -+ if (result != STATE_OK) {
66 -+ printf (_("CRITICAL - Cannot create SSL context.\n"));
67 -+ close(sd);
68 -+ np_net_ssl_cleanup();
69 -+ return STATE_CRITICAL;
70 -+ } else {
71 -+ ssl_established = 1;
72 -+ }
73 -+ }
74 -+#endif
75 -
76 - /* If requested, send PROXY header */
77 - if (use_proxy_prefix) {
78 - if (verbose)
79 - printf ("Sending header %s\n", PROXY_PREFIX);
80 -- send(sd, PROXY_PREFIX, strlen(PROXY_PREFIX), 0);
81 -+ my_send(PROXY_PREFIX, strlen(PROXY_PREFIX));
82 - }
83 -
84 - /* watch for the SMTP connection string and */
85 -@@ -230,7 +244,7 @@ main (int argc, char **argv)
86 - }
87 -
88 - /* send the HELO/EHLO command */
89 -- send(sd, helocmd, strlen(helocmd), 0);
90 -+ my_send(helocmd, strlen(helocmd));
91 -
92 - /* allow for response to helo command to reach us */
93 - if (recvlines(buffer, MAX_INPUT_BUFFER) <= 0) {
94 -@@ -243,14 +257,14 @@ main (int argc, char **argv)
95 - }
96 - }
97 -
98 -- if(use_ssl && ! supports_tls){
99 -+ if(use_starttls && ! supports_tls){
100 - printf(_("WARNING - TLS not supported by server\n"));
101 - smtp_quit();
102 - return STATE_WARNING;
103 - }
104 -
105 - #ifdef HAVE_SSL
106 -- if(use_ssl) {
107 -+ if(use_starttls) {
108 - /* send the STARTTLS command */
109 - send(sd, SMTP_STARTTLS, strlen(SMTP_STARTTLS), 0);
110 -
111 -@@ -495,6 +509,7 @@ process_arguments (int argc, char **argv)
112 - {"use-ipv6", no_argument, 0, '6'},
113 - {"help", no_argument, 0, 'h'},
114 - {"lmtp", no_argument, 0, 'L'},
115 -+ {"ssl", no_argument, 0, 's'},
116 - {"starttls",no_argument,0,'S'},
117 - {"sni", no_argument, 0, SNI_OPTION},
118 - {"certificate",required_argument,0,'D'},
119 -@@ -516,7 +531,7 @@ process_arguments (int argc, char **argv)
120 - }
121 -
122 - while (1) {
123 -- c = getopt_long (argc, argv, "+hVv46Lrt:p:f:e:c:w:H:C:R:SD:F:A:U:P:q",
124 -+ c = getopt_long (argc, argv, "+hVv46Lrt:p:f:e:c:w:H:C:R:sSD:F:A:U:P:q",
125 - longopts, &option);
126 -
127 - if (c == -1 || c == EOF)
128 -@@ -633,9 +648,13 @@ process_arguments (int argc, char **argv)
129 - #else
130 - usage (_("SSL support not available - install OpenSSL and recompile"));
131 - #endif
132 -+ case 's':
133 -+ /* ssl */
134 -+ use_ssl = TRUE;
135 -+ break;
136 - case 'S':
137 - /* starttls */
138 -- use_ssl = TRUE;
139 -+ use_starttls = TRUE;
140 - use_ehlo = TRUE;
141 - break;
142 - case SNI_OPTION:
143 -@@ -694,6 +713,14 @@ process_arguments (int argc, char **argv)
144 - if (from_arg==NULL)
145 - from_arg = strdup(" ");
146 -
147 -+ if (use_starttls && use_ssl) {
148 -+ usage4 (_("Set either -s/--ssl or -S/--starttls"));
149 -+ }
150 -+
151 -+ if (use_ssl && use_proxy_prefix) {
152 -+ usage4 (_("PROXY protocol (-r/--proxy) is not implemented with SSL/TLS (-s/--ssl), yet."));
153 -+ }
154 -+
155 - return validate_arguments ();
156 - }
157 -
158 -@@ -851,6 +878,8 @@ print_help (void)
159 - #ifdef HAVE_SSL
160 - printf (" %s\n", "-D, --certificate=INTEGER[,INTEGER]");
161 - printf (" %s\n", _("Minimum number of days a certificate has to be valid."));
162 -+ printf (" %s\n", "-s, --ssl");
163 -+ printf (" %s\n", _("Use SSL/TLS for the connection."));
164 - printf (" %s\n", "-S, --starttls");
165 - printf (" %s\n", _("Use STARTTLS for the connection."));
166 - printf (" %s\n", "--sni");
167 -