Pārlūkot izejas kodu

ssmtp: move to github

Signed-off-by: Dirk Brenken <dibdot@gmail.com>
Dirk Brenken 10 gadus atpakaļ
vecāks
revīzija
62e7ac8d71

+ 64
- 0
mail/ssmtp/Makefile Parādīt failu

@@ -0,0 +1,64 @@
1
+#
2
+# Copyright (C) 2007-2014 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=ssmtp
11
+PKG_VERSION:=2.64
12
+PKG_RELEASE:=1
13
+PKG_MAINTAINER:=Dirk Brenken <dibdot@gmail.com>
14
+PKG_LICENSE:=GPL-2.0+
15
+
16
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.bz2
17
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/s/ssmtp
18
+PKG_MD5SUM:=65b4e0df4934a6cd08c506cabcbe584f
19
+
20
+include $(INCLUDE_DIR)/package.mk
21
+
22
+TARGET_CFLAGS += $(TARGET_CPPFLAGS)
23
+
24
+define Package/ssmtp
25
+  SECTION:=mail
26
+  CATEGORY:=Mail
27
+  DEPENDS:=+libgnutls-openssl
28
+  TITLE:=A minimal and secure mail sender with gnutls support
29
+  URL:=http://packages.debian.org/ssmtp
30
+endef
31
+
32
+define Package/ssmtp/description
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
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
37
+ configuration.
38
+endef
39
+
40
+define Package/ssmtp/conffiles
41
+/etc/ssmtp/ssmtp.conf
42
+/etc/ssmtp/revaliases
43
+endef
44
+
45
+CONFIGURE_VARS += \
46
+	LIBS="$(TARGET_LDFLAGS) -lgnutls-openssl"
47
+
48
+CONFIGURE_ARGS += \
49
+	--enable-ssl
50
+
51
+define Package/ssmtp/install
52
+	$(INSTALL_DIR) $(1)/etc/ssmtp
53
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/ssmtp.conf $(1)/etc/ssmtp/
54
+	$(INSTALL_DATA) $(PKG_BUILD_DIR)/revaliases $(1)/etc/ssmtp/
55
+	$(INSTALL_DIR) $(1)/usr/sbin
56
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/ssmtp $(1)/usr/sbin/
57
+endef
58
+
59
+define Package/ssmtp/postinst
60
+#!/bin/sh
61
+ln -sf ssmtp $${IPKG_INSTROOT}/usr/sbin/sendmail
62
+endef
63
+
64
+$(eval $(call BuildPackage,ssmtp))

+ 60
- 0
mail/ssmtp/patches/001-gnutls.patch Parādīt failu

@@ -0,0 +1,60 @@
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
+ 

+ 384
- 0
mail/ssmtp/patches/002-fix_pointer.patch Parādīt failu

@@ -0,0 +1,384 @@
1
+--- a/ssmtp.c
2
++++ b/ssmtp.c
3
+@@ -51,21 +51,21 @@ bool_t use_oldauth = False;		/* use old
4
+ 
5
+ #define ARPADATE_LENGTH 32		/* Current date in RFC format */
6
+ char arpadate[ARPADATE_LENGTH];
7
+-char *auth_user = (char)NULL;
8
+-char *auth_pass = (char)NULL;
9
+-char *auth_method = (char)NULL;		/* Mechanism for SMTP authentication */
10
+-char *mail_domain = (char)NULL;
11
+-char *from = (char)NULL;		/* Use this as the From: address */
12
++char *auth_user = NULL;
13
++char *auth_pass = NULL;
14
++char *auth_method = NULL;		/* Mechanism for SMTP authentication */
15
++char *mail_domain = NULL;
16
++char *from = NULL;		/* Use this as the From: address */
17
+ char *hostname;
18
+ char *mailhost = "mailhub";
19
+-char *minus_f = (char)NULL;
20
+-char *minus_F = (char)NULL;
21
++char *minus_f = NULL;
22
++char *minus_F = NULL;
23
+ char *gecos;
24
+-char *prog = (char)NULL;
25
++char *prog = NULL;
26
+ char *root = NULL;
27
+ char *tls_cert = "/etc/ssl/certs/ssmtp.pem";	/* Default Certificate */
28
+-char *uad = (char)NULL;
29
+-char *config_file = (char)NULL;		/* alternate configuration file */
30
++char *uad = NULL;
31
++char *config_file = NULL;		/* alternate configuration file */
32
+ 
33
+ headers_t headers, *ht;
34
+ 
35
+@@ -257,7 +257,7 @@ char *strip_post_ws(char *str)
36
+ 
37
+ 	p = (str + strlen(str));
38
+ 	while(isspace(*--p)) {
39
+-		*p = (char)NULL;
40
++		*p = '\0';
41
+ 	}
42
+ 
43
+ 	return(p);
44
+@@ -275,7 +275,7 @@ char *addr_parse(char *str)
45
+ #endif
46
+ 
47
+ 	/* Simple case with email address enclosed in <> */
48
+-	if((p = strdup(str)) == (char *)NULL) {
49
++	if((p = strdup(str)) == NULL) {
50
+ 		die("addr_parse(): strdup()");
51
+ 	}
52
+ 
53
+@@ -283,7 +283,7 @@ char *addr_parse(char *str)
54
+ 		q++;
55
+ 
56
+ 		if((p = strchr(q, '>'))) {
57
+-			*p = (char)NULL;
58
++			*p = '\0';
59
+ 		}
60
+ 
61
+ #if 0
62
+@@ -306,7 +306,7 @@ char *addr_parse(char *str)
63
+ 	q = strip_post_ws(p);
64
+ 	if(*q == ')') {
65
+ 		while((*--q != '('));
66
+-		*q = (char)NULL;
67
++		*q = '\0';
68
+ 	}
69
+ 	(void)strip_post_ws(p);
70
+ 
71
+@@ -359,7 +359,7 @@ bool_t standardise(char *str, bool_t *li
72
+ 	*linestart = False;
73
+ 
74
+ 	if((p = strchr(str, '\n'))) {
75
+-		*p = (char)NULL;
76
++		*p = '\0';
77
+ 		*linestart = True;
78
+ 	}
79
+ 	return(leadingdot);
80
+@@ -380,7 +380,7 @@ void revaliases(struct passwd *pw)
81
+ 		while(fgets(buf, sizeof(buf), fp)) {
82
+ 			/* Make comments invisible */
83
+ 			if((p = strchr(buf, '#'))) {
84
+-				*p = (char)NULL;
85
++				*p = '\0';
86
+ 			}
87
+ 
88
+ 			/* Ignore malformed lines and comments */
89
+@@ -515,11 +515,11 @@ void rcpt_save(char *str)
90
+ #endif
91
+ 
92
+ 	/* Ignore missing usernames */
93
+-	if(*str == (char)NULL) {
94
++	if(*str == '\0') {
95
+ 		return;
96
+ 	}
97
+ 
98
+-	if((rt->string = strdup(str)) == (char *)NULL) {
99
++	if((rt->string = strdup(str)) == NULL) {
100
+ 		die("rcpt_save() -- strdup() failed");
101
+ 	}
102
+ 
103
+@@ -544,7 +544,7 @@ void rcpt_parse(char *str)
104
+ 	(void)fprintf(stderr, "*** rcpt_parse(): str = [%s]\n", str);
105
+ #endif
106
+ 
107
+-	if((p = strdup(str)) == (char *)NULL) {
108
++	if((p = strdup(str)) == NULL) {
109
+ 		die("rcpt_parse(): strdup() failed");
110
+ 	}
111
+ 	q = p;
112
+@@ -572,7 +572,7 @@ void rcpt_parse(char *str)
113
+ 		}
114
+ 
115
+ 		/* End of string? */
116
+-		if(*(q + 1) == (char)NULL) {
117
++		if(*(q + 1) == '\0') {
118
+ 			got_addr = True;
119
+ 		}
120
+ 
121
+@@ -580,7 +580,7 @@ void rcpt_parse(char *str)
122
+ 		if((*q == ',') && (in_quotes == False)) {
123
+ 			got_addr = True;
124
+ 
125
+-			*q = (char)NULL;
126
++			*q = '\0';
127
+ 		}
128
+ 
129
+ 		if(got_addr) {
130
+@@ -664,7 +664,7 @@ void header_save(char *str)
131
+ 	(void)fprintf(stderr, "header_save(): str = [%s]\n", str);
132
+ #endif
133
+ 
134
+-	if((p = strdup(str)) == (char *)NULL) {
135
++	if((p = strdup(str)) == NULL) {
136
+ 		die("header_save() -- strdup() failed");
137
+ 	}
138
+ 	ht->string = p;
139
+@@ -672,7 +672,7 @@ void header_save(char *str)
140
+ 	if(strncasecmp(ht->string, "From:", 5) == 0) {
141
+ #if 1
142
+ 		/* Hack check for NULL From: line */
143
+-		if(*(p + 6) == (char)NULL) {
144
++		if(*(p + 6) == '\0') {
145
+ 			return;
146
+ 		}
147
+ #endif
148
+@@ -735,19 +735,19 @@ header_parse() -- Break headers into sep
149
+ void header_parse(FILE *stream)
150
+ {
151
+ 	size_t size = BUF_SZ, len = 0;
152
+-	char *p = (char *)NULL, *q;
153
++	char *p = NULL, *q;
154
+ 	bool_t in_header = True;
155
+-	char l = (char)NULL;
156
++	char l = '\0';
157
+ 	int c;
158
+ 
159
+ 	while(in_header && ((c = fgetc(stream)) != EOF)) {
160
+ 		/* Must have space for up to two more characters, since we
161
+ 			may need to insert a '\r' */
162
+-		if((p == (char *)NULL) || (len >= (size - 1))) {
163
++		if((p == NULL) || (len >= (size - 1))) {
164
+ 			size += BUF_SZ;
165
+ 
166
+ 			p = (char *)realloc(p, (size * sizeof(char)));
167
+-			if(p == (char *)NULL) {
168
++			if(p == NULL) {
169
+ 				die("header_parse() -- realloc() failed");
170
+ 			}
171
+ 			q = (p + len);
172
+@@ -772,9 +772,9 @@ void header_parse(FILE *stream)
173
+ 						in_header = False;
174
+ 
175
+ 				default:
176
+-						*q = (char)NULL;
177
++						*q = '\0';
178
+ 						if((q = strrchr(p, '\n'))) {
179
+-							*q = (char)NULL;
180
++							*q = '\0';
181
+ 						}
182
+ 						header_save(p);
183
+ 
184
+@@ -805,9 +805,9 @@ void header_parse(FILE *stream)
185
+ 						in_header = False;
186
+ 
187
+ 				default:
188
+-						*q = (char)NULL;
189
++						*q = '\0';
190
+ 						if((q = strrchr(p, '\n'))) {
191
+-							*q = (char)NULL;
192
++							*q = '\0';
193
+ 						}
194
+ 						header_save(p);
195
+ 
196
+@@ -872,11 +872,11 @@ bool_t read_config()
197
+ 		char *rightside;
198
+ 		/* Make comments invisible */
199
+ 		if((p = strchr(buf, '#'))) {
200
+-			*p = (char)NULL;
201
++			*p = '\0';
202
+ 		}
203
+ 
204
+ 		/* Ignore malformed lines and comments */
205
+-		if(strchr(buf, '=') == (char *)NULL) continue;
206
++		if(strchr(buf, '=') == NULL) continue;
207
+ 
208
+ 		/* Parse out keywords */
209
+ 		p=firsttok(&begin, "= \t\n");
210
+@@ -886,7 +886,7 @@ bool_t read_config()
211
+ 		}
212
+ 		if(p && q) {
213
+ 			if(strcasecmp(p, "Root") == 0) {
214
+-				if((root = strdup(q)) == (char *)NULL) {
215
++				if((root = strdup(q)) == NULL) {
216
+ 					die("parse_config() -- strdup() failed");
217
+ 				}
218
+ 
219
+@@ -900,7 +900,7 @@ bool_t read_config()
220
+ 					port = atoi(r);
221
+ 				}
222
+ 
223
+-				if((mailhost = strdup(q)) == (char *)NULL) {
224
++				if((mailhost = strdup(q)) == NULL) {
225
+ 					die("parse_config() -- strdup() failed");
226
+ 				}
227
+ 
228
+@@ -945,7 +945,7 @@ bool_t read_config()
229
+ 					mail_domain = strdup(q);
230
+ 				}
231
+ 
232
+-				if(mail_domain == (char *)NULL) {
233
++				if(mail_domain == NULL) {
234
+ 					die("parse_config() -- strdup() failed");
235
+ 				}
236
+ 				rewrite_domain = True;
237
+@@ -1021,7 +1021,7 @@ bool_t read_config()
238
+ 				}
239
+ 			}
240
+ 			else if(strcasecmp(p, "TLSCert") == 0) {
241
+-				if((tls_cert = strdup(q)) == (char *)NULL) {
242
++				if((tls_cert = strdup(q)) == NULL) {
243
+ 					die("parse_config() -- strdup() failed");
244
+ 				}
245
+ 
246
+@@ -1032,7 +1032,7 @@ bool_t read_config()
247
+ #endif
248
+ 			/* Command-line overrides these */
249
+ 			else if(strcasecmp(p, "AuthUser") == 0 && !auth_user) {
250
+-				if((auth_user = strdup(q)) == (char *)NULL) {
251
++				if((auth_user = strdup(q)) == NULL) {
252
+ 					die("parse_config() -- strdup() failed");
253
+ 				}
254
+ 
255
+@@ -1041,7 +1041,7 @@ bool_t read_config()
256
+ 				}
257
+ 			}
258
+ 			else if(strcasecmp(p, "AuthPass") == 0 && !auth_pass) {
259
+-				if((auth_pass = strdup(q)) == (char *)NULL) {
260
++				if((auth_pass = strdup(q)) == NULL) {
261
+ 					die("parse_config() -- strdup() failed");
262
+ 				}
263
+ 
264
+@@ -1050,7 +1050,7 @@ bool_t read_config()
265
+ 				}
266
+ 			}
267
+ 			else if(strcasecmp(p, "AuthMethod") == 0 && !auth_method) {
268
+-				if((auth_method = strdup(q)) == (char *)NULL) {
269
++				if((auth_method = strdup(q)) == NULL) {
270
+ 					die("parse_config() -- strdup() failed");
271
+ 				}
272
+ 
273
+@@ -1309,7 +1309,7 @@ char *fd_gets(char *buf, int size, int f
274
+ 			buf[i++] = c;
275
+ 		}
276
+ 	}
277
+-	buf[i] = (char)NULL;
278
++	buf[i] = '\0';
279
+ 
280
+ 	return(buf);
281
+ }
282
+@@ -1433,14 +1433,14 @@ int ssmtp(char *argv[])
283
+ 	}
284
+ 
285
+ 	if((p = strtok(pw->pw_gecos, ";,"))) {
286
+-		if((gecos = strdup(p)) == (char *)NULL) {
287
++		if((gecos = strdup(p)) == NULL) {
288
+ 			die("ssmtp() -- strdup() failed");
289
+ 		}
290
+ 	}
291
+ 	revaliases(pw);
292
+ 
293
+ 	/* revaliases() may have defined this */
294
+-	if(uad == (char *)NULL) {
295
++	if(uad == NULL) {
296
+ 		uad = append_domain(pw->pw_name);
297
+ 	}
298
+ 
299
+@@ -1488,7 +1488,7 @@ int ssmtp(char *argv[])
300
+ 	/* Try to log in if username was supplied */
301
+ 	if(auth_user) {
302
+ #ifdef MD5AUTH
303
+-		if(auth_pass == (char *)NULL) {
304
++		if(auth_pass == NULL) {
305
+ 			auth_pass = strdup("");
306
+ 		}
307
+ 
308
+@@ -1736,7 +1736,7 @@ char **parse_options(int argc, char *arg
309
+ 		j = 0;
310
+ 
311
+ 		add = 1;
312
+-		while(argv[i][++j] != (char)NULL) {
313
++		while(argv[i][++j] != '\0') {
314
+ 			switch(argv[i][j]) {
315
+ #ifdef INET6
316
+ 			case '6':
317
+@@ -1754,14 +1754,14 @@ char **parse_options(int argc, char *arg
318
+ 					if((!argv[i][(j + 1)])
319
+ 						&& argv[(i + 1)]) {
320
+ 						auth_user = strdup(argv[i+1]);
321
+-						if(auth_user == (char *)NULL) {
322
++						if(auth_user == NULL) {
323
+ 							die("parse_options() -- strdup() failed");
324
+ 						}
325
+ 						add++;
326
+ 					}
327
+ 					else {
328
+ 						auth_user = strdup(argv[i]+j+1);
329
+-						if(auth_user == (char *)NULL) {
330
++						if(auth_user == NULL) {
331
+ 							die("parse_options() -- strdup() failed");
332
+ 						}
333
+ 					}
334
+@@ -1771,14 +1771,14 @@ char **parse_options(int argc, char *arg
335
+ 					if((!argv[i][(j + 1)])
336
+ 						&& argv[(i + 1)]) {
337
+ 						auth_pass = strdup(argv[i+1]);
338
+-						if(auth_pass == (char *)NULL) {
339
++						if(auth_pass == NULL) {
340
+ 							die("parse_options() -- strdup() failed");
341
+ 						}
342
+ 						add++;
343
+ 					}
344
+ 					else {
345
+ 						auth_pass = strdup(argv[i]+j+1);
346
+-						if(auth_pass == (char *)NULL) {
347
++						if(auth_pass == NULL) {
348
+ 							die("parse_options() -- strdup() failed");
349
+ 						}
350
+ 					}
351
+@@ -1869,14 +1869,14 @@ char **parse_options(int argc, char *arg
352
+ 			case 'F':
353
+ 				if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
354
+ 					minus_F = strdup(argv[(i + 1)]);
355
+-					if(minus_F == (char *)NULL) {
356
++					if(minus_F == NULL) {
357
+ 						die("parse_options() -- strdup() failed");
358
+ 					}
359
+ 					add++;
360
+ 				}
361
+ 				else {
362
+ 					minus_F = strdup(argv[i]+j+1);
363
+-					if(minus_F == (char *)NULL) {
364
++					if(minus_F == NULL) {
365
+ 						die("parse_options() -- strdup() failed");
366
+ 					}
367
+ 				}
368
+@@ -1888,14 +1888,14 @@ char **parse_options(int argc, char *arg
369
+ 			case 'r':
370
+ 				if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
371
+ 					minus_f = strdup(argv[(i + 1)]);
372
+-					if(minus_f == (char *)NULL) {
373
++					if(minus_f == NULL) {
374
+ 						die("parse_options() -- strdup() failed");
375
+ 					}
376
+ 					add++;
377
+ 				}
378
+ 				else {
379
+ 					minus_f = strdup(argv[i]+j+1);
380
+-					if(minus_f == (char *)NULL) {
381
++					if(minus_f == NULL) {
382
+ 						die("parse_options() -- strdup() failed");
383
+ 					}
384
+ 				}