Browse Source

ssmtp: revoke gnutls support

Drop gnutls and use openssl instead, due to excessive memory consumption in embedded environment for an additonal ssl library.

Signed-off-by: Dirk Brenken <dibdot@gmail.com>
Dirk Brenken 10 years ago
parent
commit
f267d2eaa6
3 changed files with 54 additions and 97 deletions
  1. 5
    5
      mail/ssmtp/Makefile
  2. 0
    60
      mail/ssmtp/patches/001-gnutls.patch
  3. 49
    32
      mail/ssmtp/patches/002-fix_pointer.patch

+ 5
- 5
mail/ssmtp/Makefile View File

9
 
9
 
10
 PKG_NAME:=ssmtp
10
 PKG_NAME:=ssmtp
11
 PKG_VERSION:=2.64
11
 PKG_VERSION:=2.64
12
-PKG_RELEASE:=1
12
+PKG_RELEASE:=1.1
13
 PKG_MAINTAINER:=Dirk Brenken <dibdot@gmail.com>
13
 PKG_MAINTAINER:=Dirk Brenken <dibdot@gmail.com>
14
 PKG_LICENSE:=GPL-2.0+
14
 PKG_LICENSE:=GPL-2.0+
15
 
15
 
24
 define Package/ssmtp
24
 define Package/ssmtp
25
   SECTION:=mail
25
   SECTION:=mail
26
   CATEGORY:=Mail
26
   CATEGORY:=Mail
27
-  DEPENDS:=+libgnutls-openssl
28
-  TITLE:=A minimal and secure mail sender with gnutls support
27
+  DEPENDS:=+libopenssl
28
+  TITLE:=A minimal and secure mail sender with ssl support
29
   URL:=http://packages.debian.org/ssmtp
29
   URL:=http://packages.debian.org/ssmtp
30
 endef
30
 endef
31
 
31
 
33
  A secure, effective and simple way of getting mail off a system to your
33
  A secure, effective and simple way of getting mail off a system to your
34
  mail hub. It contains no suid-binaries or other dangerous things - no
34
  mail hub. It contains no suid-binaries or other dangerous things - no
35
  mail spool to poke around in, and no daemons running in the background.
35
  mail spool to poke around in, and no daemons running in the background.
36
- mail is simply forwarded to the configured mailhost. Extremely easy
36
+ Mail is simply forwarded to the configured mailhost. Extremely easy
37
  configuration.
37
  configuration.
38
 endef
38
 endef
39
 
39
 
43
 endef
43
 endef
44
 
44
 
45
 CONFIGURE_VARS += \
45
 CONFIGURE_VARS += \
46
-	LIBS="$(TARGET_LDFLAGS) -lgnutls-openssl"
46
+	LIBS="$(TARGET_LDFLAGS) -lcrypto -lssl"
47
 
47
 
48
 CONFIGURE_ARGS += \
48
 CONFIGURE_ARGS += \
49
 	--enable-ssl
49
 	--enable-ssl

+ 0
- 60
mail/ssmtp/patches/001-gnutls.patch View File

1
---- a/configure
2
-+++ b/configure
3
-@@ -1562,7 +1562,7 @@ if test x$enableval = xyes ; then
4
- #define HAVE_SSL 1
5
- EOF
6
- 
7
--	LIBS="$LIBS -lssl"
8
-+	LIBS="$LIBS -lgnutls-openssl"
9
- fi
10
- enableval=""
11
- 
12
---- a/configure.in
13
-+++ b/configure.in
14
-@@ -52,7 +52,7 @@ AC_ARG_ENABLE(ssl,
15
- [  --enable-ssl           support for secure connection to mail server])
16
- if test x$enableval = xyes ; then
17
- 	AC_DEFINE(HAVE_SSL)
18
--	LIBS="$LIBS -lssl"
19
-+	LIBS="$LIBS -lgnutls-openssl"
20
- fi
21
- enableval=""
22
- 
23
---- a/ssmtp.c
24
-+++ b/ssmtp.c
25
-@@ -26,11 +26,7 @@
26
- #include <ctype.h>
27
- #include <netdb.h>
28
- #ifdef HAVE_SSL
29
--#include <openssl/crypto.h>
30
--#include <openssl/x509.h>
31
--#include <openssl/pem.h>
32
--#include <openssl/ssl.h>
33
--#include <openssl/err.h>
34
-+#include <gnutls/openssl.h>
35
- #endif
36
- #ifdef MD5AUTH
37
- #include "md5auth/hmac_md5.h"
38
-@@ -1133,7 +1129,7 @@ int smtp_open(char *host, int port)
39
- 	}
40
- 
41
- 	if(use_cert == True) { 
42
--		if(SSL_CTX_use_certificate_chain_file(ctx, tls_cert) <= 0) {
43
-+        if(SSL_CTX_use_certificate_file(ctx, tls_cert, SSL_FILETYPE_PEM) <= 0) {
44
- 			perror("Use certfile");
45
- 			return(-1);
46
- 		}
47
-@@ -1143,10 +1139,13 @@ int smtp_open(char *host, int port)
48
- 			return(-1);
49
- 		}
50
- 
51
-+#ifdef NOT_USED
52
- 		if(!SSL_CTX_check_private_key(ctx)) {
53
- 			log_event(LOG_ERR, "Private key does not match the certificate public key\n");
54
- 			return(-1);
55
- 		}
56
-+#endif
57
-+
58
- 	}
59
- #endif
60
- 

+ 49
- 32
mail/ssmtp/patches/002-fix_pointer.patch View File

1
 --- a/ssmtp.c
1
 --- a/ssmtp.c
2
 +++ b/ssmtp.c
2
 +++ b/ssmtp.c
3
-@@ -51,21 +51,21 @@ bool_t use_oldauth = False;		/* use old
3
+@@ -55,21 +55,21 @@ bool_t use_oldauth = False;		/* use old
4
  
4
  
5
  #define ARPADATE_LENGTH 32		/* Current date in RFC format */
5
  #define ARPADATE_LENGTH 32		/* Current date in RFC format */
6
  char arpadate[ARPADATE_LENGTH];
6
  char arpadate[ARPADATE_LENGTH];
32
  
32
  
33
  headers_t headers, *ht;
33
  headers_t headers, *ht;
34
  
34
  
35
-@@ -257,7 +257,7 @@ char *strip_post_ws(char *str)
35
+@@ -261,7 +261,7 @@ char *strip_post_ws(char *str)
36
  
36
  
37
  	p = (str + strlen(str));
37
  	p = (str + strlen(str));
38
  	while(isspace(*--p)) {
38
  	while(isspace(*--p)) {
41
  	}
41
  	}
42
  
42
  
43
  	return(p);
43
  	return(p);
44
-@@ -275,7 +275,7 @@ char *addr_parse(char *str)
44
+@@ -279,7 +279,7 @@ char *addr_parse(char *str)
45
  #endif
45
  #endif
46
  
46
  
47
  	/* Simple case with email address enclosed in <> */
47
  	/* Simple case with email address enclosed in <> */
50
  		die("addr_parse(): strdup()");
50
  		die("addr_parse(): strdup()");
51
  	}
51
  	}
52
  
52
  
53
-@@ -283,7 +283,7 @@ char *addr_parse(char *str)
53
+@@ -287,7 +287,7 @@ char *addr_parse(char *str)
54
  		q++;
54
  		q++;
55
  
55
  
56
  		if((p = strchr(q, '>'))) {
56
  		if((p = strchr(q, '>'))) {
59
  		}
59
  		}
60
  
60
  
61
  #if 0
61
  #if 0
62
-@@ -306,7 +306,7 @@ char *addr_parse(char *str)
62
+@@ -310,7 +310,7 @@ char *addr_parse(char *str)
63
  	q = strip_post_ws(p);
63
  	q = strip_post_ws(p);
64
  	if(*q == ')') {
64
  	if(*q == ')') {
65
  		while((*--q != '('));
65
  		while((*--q != '('));
68
  	}
68
  	}
69
  	(void)strip_post_ws(p);
69
  	(void)strip_post_ws(p);
70
  
70
  
71
-@@ -359,7 +359,7 @@ bool_t standardise(char *str, bool_t *li
71
+@@ -363,7 +363,7 @@ bool_t standardise(char *str, bool_t *li
72
  	*linestart = False;
72
  	*linestart = False;
73
  
73
  
74
  	if((p = strchr(str, '\n'))) {
74
  	if((p = strchr(str, '\n'))) {
77
  		*linestart = True;
77
  		*linestart = True;
78
  	}
78
  	}
79
  	return(leadingdot);
79
  	return(leadingdot);
80
-@@ -380,7 +380,7 @@ void revaliases(struct passwd *pw)
80
+@@ -384,7 +384,7 @@ void revaliases(struct passwd *pw)
81
  		while(fgets(buf, sizeof(buf), fp)) {
81
  		while(fgets(buf, sizeof(buf), fp)) {
82
  			/* Make comments invisible */
82
  			/* Make comments invisible */
83
  			if((p = strchr(buf, '#'))) {
83
  			if((p = strchr(buf, '#'))) {
86
  			}
86
  			}
87
  
87
  
88
  			/* Ignore malformed lines and comments */
88
  			/* Ignore malformed lines and comments */
89
-@@ -515,11 +515,11 @@ void rcpt_save(char *str)
89
+@@ -519,11 +519,11 @@ void rcpt_save(char *str)
90
  #endif
90
  #endif
91
  
91
  
92
  	/* Ignore missing usernames */
92
  	/* Ignore missing usernames */
100
  		die("rcpt_save() -- strdup() failed");
100
  		die("rcpt_save() -- strdup() failed");
101
  	}
101
  	}
102
  
102
  
103
-@@ -544,7 +544,7 @@ void rcpt_parse(char *str)
103
+@@ -548,7 +548,7 @@ void rcpt_parse(char *str)
104
  	(void)fprintf(stderr, "*** rcpt_parse(): str = [%s]\n", str);
104
  	(void)fprintf(stderr, "*** rcpt_parse(): str = [%s]\n", str);
105
  #endif
105
  #endif
106
  
106
  
109
  		die("rcpt_parse(): strdup() failed");
109
  		die("rcpt_parse(): strdup() failed");
110
  	}
110
  	}
111
  	q = p;
111
  	q = p;
112
-@@ -572,7 +572,7 @@ void rcpt_parse(char *str)
112
+@@ -576,7 +576,7 @@ void rcpt_parse(char *str)
113
  		}
113
  		}
114
  
114
  
115
  		/* End of string? */
115
  		/* End of string? */
118
  			got_addr = True;
118
  			got_addr = True;
119
  		}
119
  		}
120
  
120
  
121
-@@ -580,7 +580,7 @@ void rcpt_parse(char *str)
121
+@@ -584,7 +584,7 @@ void rcpt_parse(char *str)
122
  		if((*q == ',') && (in_quotes == False)) {
122
  		if((*q == ',') && (in_quotes == False)) {
123
  			got_addr = True;
123
  			got_addr = True;
124
  
124
  
127
  		}
127
  		}
128
  
128
  
129
  		if(got_addr) {
129
  		if(got_addr) {
130
-@@ -664,7 +664,7 @@ void header_save(char *str)
130
+@@ -668,7 +668,7 @@ void header_save(char *str)
131
  	(void)fprintf(stderr, "header_save(): str = [%s]\n", str);
131
  	(void)fprintf(stderr, "header_save(): str = [%s]\n", str);
132
  #endif
132
  #endif
133
  
133
  
136
  		die("header_save() -- strdup() failed");
136
  		die("header_save() -- strdup() failed");
137
  	}
137
  	}
138
  	ht->string = p;
138
  	ht->string = p;
139
-@@ -672,7 +672,7 @@ void header_save(char *str)
139
+@@ -676,7 +676,7 @@ void header_save(char *str)
140
  	if(strncasecmp(ht->string, "From:", 5) == 0) {
140
  	if(strncasecmp(ht->string, "From:", 5) == 0) {
141
  #if 1
141
  #if 1
142
  		/* Hack check for NULL From: line */
142
  		/* Hack check for NULL From: line */
145
  			return;
145
  			return;
146
  		}
146
  		}
147
  #endif
147
  #endif
148
-@@ -735,19 +735,19 @@ header_parse() -- Break headers into sep
148
+@@ -739,19 +739,19 @@ header_parse() -- Break headers into sep
149
  void header_parse(FILE *stream)
149
  void header_parse(FILE *stream)
150
  {
150
  {
151
  	size_t size = BUF_SZ, len = 0;
151
  	size_t size = BUF_SZ, len = 0;
169
  				die("header_parse() -- realloc() failed");
169
  				die("header_parse() -- realloc() failed");
170
  			}
170
  			}
171
  			q = (p + len);
171
  			q = (p + len);
172
-@@ -772,9 +772,9 @@ void header_parse(FILE *stream)
172
+@@ -776,9 +776,9 @@ void header_parse(FILE *stream)
173
  						in_header = False;
173
  						in_header = False;
174
  
174
  
175
  				default:
175
  				default:
181
  						}
181
  						}
182
  						header_save(p);
182
  						header_save(p);
183
  
183
  
184
-@@ -805,9 +805,9 @@ void header_parse(FILE *stream)
184
+@@ -809,9 +809,9 @@ void header_parse(FILE *stream)
185
  						in_header = False;
185
  						in_header = False;
186
  
186
  
187
  				default:
187
  				default:
193
  						}
193
  						}
194
  						header_save(p);
194
  						header_save(p);
195
  
195
  
196
-@@ -872,11 +872,11 @@ bool_t read_config()
196
+@@ -876,11 +876,11 @@ bool_t read_config()
197
  		char *rightside;
197
  		char *rightside;
198
  		/* Make comments invisible */
198
  		/* Make comments invisible */
199
  		if((p = strchr(buf, '#'))) {
199
  		if((p = strchr(buf, '#'))) {
207
  
207
  
208
  		/* Parse out keywords */
208
  		/* Parse out keywords */
209
  		p=firsttok(&begin, "= \t\n");
209
  		p=firsttok(&begin, "= \t\n");
210
-@@ -886,7 +886,7 @@ bool_t read_config()
210
+@@ -890,7 +890,7 @@ bool_t read_config()
211
  		}
211
  		}
212
  		if(p && q) {
212
  		if(p && q) {
213
  			if(strcasecmp(p, "Root") == 0) {
213
  			if(strcasecmp(p, "Root") == 0) {
216
  					die("parse_config() -- strdup() failed");
216
  					die("parse_config() -- strdup() failed");
217
  				}
217
  				}
218
  
218
  
219
-@@ -900,7 +900,7 @@ bool_t read_config()
219
+@@ -904,7 +904,7 @@ bool_t read_config()
220
  					port = atoi(r);
220
  					port = atoi(r);
221
  				}
221
  				}
222
  
222
  
225
  					die("parse_config() -- strdup() failed");
225
  					die("parse_config() -- strdup() failed");
226
  				}
226
  				}
227
  
227
  
228
-@@ -945,7 +945,7 @@ bool_t read_config()
228
+@@ -949,7 +949,7 @@ bool_t read_config()
229
  					mail_domain = strdup(q);
229
  					mail_domain = strdup(q);
230
  				}
230
  				}
231
  
231
  
234
  					die("parse_config() -- strdup() failed");
234
  					die("parse_config() -- strdup() failed");
235
  				}
235
  				}
236
  				rewrite_domain = True;
236
  				rewrite_domain = True;
237
-@@ -1021,7 +1021,7 @@ bool_t read_config()
237
+@@ -1025,7 +1025,7 @@ bool_t read_config()
238
  				}
238
  				}
239
  			}
239
  			}
240
  			else if(strcasecmp(p, "TLSCert") == 0) {
240
  			else if(strcasecmp(p, "TLSCert") == 0) {
243
  					die("parse_config() -- strdup() failed");
243
  					die("parse_config() -- strdup() failed");
244
  				}
244
  				}
245
  
245
  
246
-@@ -1032,7 +1032,7 @@ bool_t read_config()
246
+@@ -1036,7 +1036,7 @@ bool_t read_config()
247
  #endif
247
  #endif
248
  			/* Command-line overrides these */
248
  			/* Command-line overrides these */
249
  			else if(strcasecmp(p, "AuthUser") == 0 && !auth_user) {
249
  			else if(strcasecmp(p, "AuthUser") == 0 && !auth_user) {
252
  					die("parse_config() -- strdup() failed");
252
  					die("parse_config() -- strdup() failed");
253
  				}
253
  				}
254
  
254
  
255
-@@ -1041,7 +1041,7 @@ bool_t read_config()
255
+@@ -1045,7 +1045,7 @@ bool_t read_config()
256
  				}
256
  				}
257
  			}
257
  			}
258
  			else if(strcasecmp(p, "AuthPass") == 0 && !auth_pass) {
258
  			else if(strcasecmp(p, "AuthPass") == 0 && !auth_pass) {
261
  					die("parse_config() -- strdup() failed");
261
  					die("parse_config() -- strdup() failed");
262
  				}
262
  				}
263
  
263
  
264
-@@ -1050,7 +1050,7 @@ bool_t read_config()
264
+@@ -1054,7 +1054,7 @@ bool_t read_config()
265
  				}
265
  				}
266
  			}
266
  			}
267
  			else if(strcasecmp(p, "AuthMethod") == 0 && !auth_method) {
267
  			else if(strcasecmp(p, "AuthMethod") == 0 && !auth_method) {
270
  					die("parse_config() -- strdup() failed");
270
  					die("parse_config() -- strdup() failed");
271
  				}
271
  				}
272
  
272
  
273
-@@ -1309,7 +1309,7 @@ char *fd_gets(char *buf, int size, int f
273
+@@ -1119,14 +1119,11 @@ int smtp_open(char *host, int port)
274
+ 	char buf[(BUF_SZ + 1)];
275
+ 
276
+ 	/* Init SSL stuff */
277
+-	SSL_CTX *ctx;
278
+-	SSL_METHOD *meth;
279
++	SSL_CTX *ctx = NULL;
280
+ 	X509 *server_cert;
281
+-
282
+ 	SSL_load_error_strings();
283
+ 	SSLeay_add_ssl_algorithms();
284
+-	meth=SSLv23_client_method();
285
+-	ctx = SSL_CTX_new(meth);
286
++	ctx = SSL_CTX_new(SSLv23_client_method());
287
+ 	if(!ctx) {
288
+ 		log_event(LOG_ERR, "No SSL support initiated\n");
289
+ 		return(-1);
290
+@@ -1310,7 +1307,7 @@ char *fd_gets(char *buf, int size, int f
274
  			buf[i++] = c;
291
  			buf[i++] = c;
275
  		}
292
  		}
276
  	}
293
  	}
279
  
296
  
280
  	return(buf);
297
  	return(buf);
281
  }
298
  }
282
-@@ -1433,14 +1433,14 @@ int ssmtp(char *argv[])
299
+@@ -1434,14 +1431,14 @@ int ssmtp(char *argv[])
283
  	}
300
  	}
284
  
301
  
285
  	if((p = strtok(pw->pw_gecos, ";,"))) {
302
  	if((p = strtok(pw->pw_gecos, ";,"))) {
296
  		uad = append_domain(pw->pw_name);
313
  		uad = append_domain(pw->pw_name);
297
  	}
314
  	}
298
  
315
  
299
-@@ -1488,7 +1488,7 @@ int ssmtp(char *argv[])
316
+@@ -1489,7 +1486,7 @@ int ssmtp(char *argv[])
300
  	/* Try to log in if username was supplied */
317
  	/* Try to log in if username was supplied */
301
  	if(auth_user) {
318
  	if(auth_user) {
302
  #ifdef MD5AUTH
319
  #ifdef MD5AUTH
305
  			auth_pass = strdup("");
322
  			auth_pass = strdup("");
306
  		}
323
  		}
307
  
324
  
308
-@@ -1736,7 +1736,7 @@ char **parse_options(int argc, char *arg
325
+@@ -1737,7 +1734,7 @@ char **parse_options(int argc, char *arg
309
  		j = 0;
326
  		j = 0;
310
  
327
  
311
  		add = 1;
328
  		add = 1;
314
  			switch(argv[i][j]) {
331
  			switch(argv[i][j]) {
315
  #ifdef INET6
332
  #ifdef INET6
316
  			case '6':
333
  			case '6':
317
-@@ -1754,14 +1754,14 @@ char **parse_options(int argc, char *arg
334
+@@ -1755,14 +1752,14 @@ char **parse_options(int argc, char *arg
318
  					if((!argv[i][(j + 1)])
335
  					if((!argv[i][(j + 1)])
319
  						&& argv[(i + 1)]) {
336
  						&& argv[(i + 1)]) {
320
  						auth_user = strdup(argv[i+1]);
337
  						auth_user = strdup(argv[i+1]);
331
  							die("parse_options() -- strdup() failed");
348
  							die("parse_options() -- strdup() failed");
332
  						}
349
  						}
333
  					}
350
  					}
334
-@@ -1771,14 +1771,14 @@ char **parse_options(int argc, char *arg
351
+@@ -1772,14 +1769,14 @@ char **parse_options(int argc, char *arg
335
  					if((!argv[i][(j + 1)])
352
  					if((!argv[i][(j + 1)])
336
  						&& argv[(i + 1)]) {
353
  						&& argv[(i + 1)]) {
337
  						auth_pass = strdup(argv[i+1]);
354
  						auth_pass = strdup(argv[i+1]);
348
  							die("parse_options() -- strdup() failed");
365
  							die("parse_options() -- strdup() failed");
349
  						}
366
  						}
350
  					}
367
  					}
351
-@@ -1869,14 +1869,14 @@ char **parse_options(int argc, char *arg
368
+@@ -1870,14 +1867,14 @@ char **parse_options(int argc, char *arg
352
  			case 'F':
369
  			case 'F':
353
  				if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
370
  				if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
354
  					minus_F = strdup(argv[(i + 1)]);
371
  					minus_F = strdup(argv[(i + 1)]);
365
  						die("parse_options() -- strdup() failed");
382
  						die("parse_options() -- strdup() failed");
366
  					}
383
  					}
367
  				}
384
  				}
368
-@@ -1888,14 +1888,14 @@ char **parse_options(int argc, char *arg
385
+@@ -1889,14 +1886,14 @@ char **parse_options(int argc, char *arg
369
  			case 'r':
386
  			case 'r':
370
  				if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
387
  				if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
371
  					minus_f = strdup(argv[(i + 1)]);
388
  					minus_f = strdup(argv[(i + 1)]);