1 |
flameeyes 11/01/19 13:39:17 |
2 |
|
3 |
Added: 0010_all_maxsysuid.patch |
4 |
0020_all_from-format-fix.patch |
5 |
0030_all_authpass.patch 0040_all_darwin7.patch |
6 |
0050_all_strndup.patch 0060_all_opessl_crypto.patch |
7 |
0070_all_solaris-basename.patch |
8 |
0080_all_gnutls.patch |
9 |
0090_all_debian-remote-addr.patch |
10 |
0100_all_ldflags.patch series |
11 |
Log: |
12 |
Import patches for new ssmtp-2.64 version. |
13 |
|
14 |
Revision Changes Path |
15 |
1.1 src/patchsets/ssmtp/2.64/0010_all_maxsysuid.patch |
16 |
|
17 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0010_all_maxsysuid.patch?rev=1.1&view=markup |
18 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0010_all_maxsysuid.patch?rev=1.1&content-type=text/plain |
19 |
|
20 |
Index: 0010_all_maxsysuid.patch |
21 |
=================================================================== |
22 |
Allow to specify the last used system user id, bug #231866 |
23 |
|
24 |
Index: ssmtp-2.64/ssmtp.c |
25 |
=================================================================== |
26 |
--- ssmtp-2.64.orig/ssmtp.c |
27 |
+++ ssmtp-2.64/ssmtp.c |
28 |
@@ -78,6 +78,7 @@ int log_level = 1; |
29 |
#else |
30 |
int log_level = 0; |
31 |
#endif |
32 |
+int minuserid = MAXSYSUID+1; |
33 |
int port = 25; |
34 |
#ifdef INET6 |
35 |
int p_family = PF_UNSPEC; /* Protocol family used in SMTP connection */ |
36 |
@@ -649,7 +650,7 @@ char *rcpt_remap(char *str) |
37 |
{ |
38 |
struct passwd *pw; |
39 |
if((root==NULL) || strlen(root)==0 || strchr(str, '@') || |
40 |
- ((pw = getpwnam(str)) == NULL) || (pw->pw_uid > MAXSYSUID)) { |
41 |
+ ((pw = getpwnam(str)) == NULL) || (pw->pw_uid >= minuserid)) { |
42 |
return(append_domain(str)); /* It's not a local systems-level user */ |
43 |
} |
44 |
else { |
45 |
@@ -898,6 +899,17 @@ bool_t read_config() |
46 |
log_event(LOG_INFO, "Set Root=\"%s\"\n", root); |
47 |
} |
48 |
} |
49 |
+ else if(strcasecmp(p, "MinUserId") == 0) { |
50 |
+ if((r = strdup(q)) == (char *)NULL) { |
51 |
+ die("parse_config() -- strdup() failed"); |
52 |
+ } |
53 |
+ |
54 |
+ minuserid = atoi(r); |
55 |
+ |
56 |
+ if(log_level > 0) { |
57 |
+ log_event(LOG_INFO, "Set MinUserId=\"%d\"\n", minuserid); |
58 |
+ } |
59 |
+ } |
60 |
else if(strcasecmp(p, "MailHub") == 0) { |
61 |
if((r = strchr(q, ':')) != NULL) { |
62 |
*r++ = '\0'; |
63 |
Index: ssmtp-2.64/ssmtp.conf |
64 |
=================================================================== |
65 |
--- ssmtp-2.64.orig/ssmtp.conf |
66 |
+++ ssmtp-2.64/ssmtp.conf |
67 |
@@ -2,10 +2,13 @@ |
68 |
# /etc/ssmtp.conf -- a config file for sSMTP sendmail. |
69 |
# |
70 |
|
71 |
-# The person who gets all mail for userids < 1000 |
72 |
+# The person who gets all mail for userids < MinUserId |
73 |
# Make this empty to disable rewriting. |
74 |
root=postmaster |
75 |
|
76 |
+# All mail delivered to userid >= MinUserId goes to user, not root. |
77 |
+#MinUserId=1000 |
78 |
+ |
79 |
# The place where the mail goes. The actual machine name is required |
80 |
# no MX records are consulted. Commonly mailhosts are named mail.domain.com |
81 |
# The example will fit if you are in domain.com and your mailhub is so named. |
82 |
|
83 |
|
84 |
|
85 |
1.1 src/patchsets/ssmtp/2.64/0020_all_from-format-fix.patch |
86 |
|
87 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0020_all_from-format-fix.patch?rev=1.1&view=markup |
88 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0020_all_from-format-fix.patch?rev=1.1&content-type=text/plain |
89 |
|
90 |
Index: 0020_all_from-format-fix.patch |
91 |
=================================================================== |
92 |
Index: ssmtp-2.64/ssmtp.c |
93 |
=================================================================== |
94 |
--- ssmtp-2.64.orig/ssmtp.c |
95 |
+++ ssmtp-2.64/ssmtp.c |
96 |
@@ -454,7 +454,7 @@ from_format() -- Generate standard From: |
97 |
*/ |
98 |
char *from_format(char *str, bool_t override_from) |
99 |
{ |
100 |
- char buf[(BUF_SZ + 1)]; |
101 |
+ char buf[(BUF_SZ + 1)] = ""; |
102 |
|
103 |
if(override_from) { |
104 |
if(minus_f) { |
105 |
|
106 |
|
107 |
|
108 |
1.1 src/patchsets/ssmtp/2.64/0030_all_authpass.patch |
109 |
|
110 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0030_all_authpass.patch?rev=1.1&view=markup |
111 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0030_all_authpass.patch?rev=1.1&content-type=text/plain |
112 |
|
113 |
Index: 0030_all_authpass.patch |
114 |
=================================================================== |
115 |
Index: ssmtp-2.64/ssmtp.c |
116 |
=================================================================== |
117 |
--- ssmtp-2.64.orig/ssmtp.c |
118 |
+++ ssmtp-2.64/ssmtp.c |
119 |
@@ -1057,7 +1057,8 @@ bool_t read_config() |
120 |
} |
121 |
} |
122 |
else if(strcasecmp(p, "AuthPass") == 0 && !auth_pass) { |
123 |
- if((auth_pass = strdup(q)) == (char *)NULL) { |
124 |
+ auth_pass = firsttok(&rightside, " \n\t"); |
125 |
+ if(auth_pass == (char *)NULL) { |
126 |
die("parse_config() -- strdup() failed"); |
127 |
} |
128 |
|
129 |
|
130 |
|
131 |
|
132 |
1.1 src/patchsets/ssmtp/2.64/0040_all_darwin7.patch |
133 |
|
134 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0040_all_darwin7.patch?rev=1.1&view=markup |
135 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0040_all_darwin7.patch?rev=1.1&content-type=text/plain |
136 |
|
137 |
Index: 0040_all_darwin7.patch |
138 |
=================================================================== |
139 |
Index: ssmtp-2.64/ssmtp.c |
140 |
=================================================================== |
141 |
--- ssmtp-2.64.orig/ssmtp.c |
142 |
+++ ssmtp-2.64/ssmtp.c |
143 |
@@ -13,6 +13,7 @@ |
144 |
#define VERSION "2.64" |
145 |
#define _GNU_SOURCE |
146 |
|
147 |
+#include <sys/types.h> |
148 |
#include <sys/socket.h> |
149 |
#include <netinet/in.h> |
150 |
#include <sys/param.h> |
151 |
|
152 |
|
153 |
|
154 |
1.1 src/patchsets/ssmtp/2.64/0050_all_strndup.patch |
155 |
|
156 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0050_all_strndup.patch?rev=1.1&view=markup |
157 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0050_all_strndup.patch?rev=1.1&content-type=text/plain |
158 |
|
159 |
Index: 0050_all_strndup.patch |
160 |
=================================================================== |
161 |
Compensate for platforms that don't have strndup, like Solaris |
162 |
|
163 |
Index: ssmtp-2.64/configure.in |
164 |
=================================================================== |
165 |
--- ssmtp-2.64.orig/configure.in |
166 |
+++ ssmtp-2.64/configure.in |
167 |
@@ -30,7 +30,7 @@ AC_SEARCH_LIBS(socket, socket) |
168 |
dnl Checks for library functions. |
169 |
AC_TYPE_SIGNAL |
170 |
AC_FUNC_VPRINTF |
171 |
-AC_CHECK_FUNCS(gethostname socket strdup strstr) |
172 |
+AC_CHECK_FUNCS(gethostname socket strdup strndup strstr) |
173 |
|
174 |
dnl Check for optional features |
175 |
AC_ARG_ENABLE(logfile, |
176 |
Index: ssmtp-2.64/ssmtp.c |
177 |
=================================================================== |
178 |
--- ssmtp-2.64.orig/ssmtp.c |
179 |
+++ ssmtp-2.64/ssmtp.c |
180 |
@@ -846,7 +846,16 @@ char *firsttok(char **s, const char *del |
181 |
if (!rest) { |
182 |
return NULL; |
183 |
} |
184 |
+#ifdef HAVE_STRNDUP |
185 |
tok=strndup(*s,rest-(*s)); |
186 |
+#else |
187 |
+ { |
188 |
+ size_t len = rest - (*s); |
189 |
+ tok = malloc(sizeof(char) * (len + 1)); |
190 |
+ memcpy(tok, *s, len); |
191 |
+ tok[len] = '\0'; |
192 |
+ } |
193 |
+#endif |
194 |
if (!tok) { |
195 |
die("firsttok() -- strndup() failed"); |
196 |
} |
197 |
|
198 |
|
199 |
|
200 |
1.1 src/patchsets/ssmtp/2.64/0060_all_opessl_crypto.patch |
201 |
|
202 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0060_all_opessl_crypto.patch?rev=1.1&view=markup |
203 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0060_all_opessl_crypto.patch?rev=1.1&content-type=text/plain |
204 |
|
205 |
Index: 0060_all_opessl_crypto.patch |
206 |
=================================================================== |
207 |
Fix linking error: |
208 |
|
209 |
Undefined symbols: |
210 |
"_X509_free", referenced from: |
211 |
_smtp_open in ssmtp.o |
212 |
ld: symbol(s) not found |
213 |
|
214 |
|
215 |
Index: ssmtp-2.64/configure.in |
216 |
=================================================================== |
217 |
--- ssmtp-2.64.orig/configure.in |
218 |
+++ ssmtp-2.64/configure.in |
219 |
@@ -52,7 +52,7 @@ AC_ARG_ENABLE(ssl, |
220 |
[ --enable-ssl support for secure connection to mail server]) |
221 |
if test x$enableval = xyes ; then |
222 |
AC_DEFINE(HAVE_SSL) |
223 |
- LIBS="$LIBS -lssl" |
224 |
+ LIBS="$LIBS -lssl -lcrypto" |
225 |
fi |
226 |
enableval="" |
227 |
|
228 |
|
229 |
|
230 |
|
231 |
1.1 src/patchsets/ssmtp/2.64/0070_all_solaris-basename.patch |
232 |
|
233 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0070_all_solaris-basename.patch?rev=1.1&view=markup |
234 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0070_all_solaris-basename.patch?rev=1.1&content-type=text/plain |
235 |
|
236 |
Index: 0070_all_solaris-basename.patch |
237 |
=================================================================== |
238 |
This function overshadows the one from libc on Solaris, and guess what, |
239 |
is hence never called. Since the original one has an entirely different |
240 |
contract, it results in unconditional segfaults lateron, so always use |
241 |
the internal copy as it's small enough not to care. |
242 |
|
243 |
Index: ssmtp-2.64/ssmtp.c |
244 |
=================================================================== |
245 |
--- ssmtp-2.64.orig/ssmtp.c |
246 |
+++ ssmtp-2.64/ssmtp.c |
247 |
@@ -224,11 +224,10 @@ void die(char *format, ...) |
248 |
exit(1); |
249 |
} |
250 |
|
251 |
-#ifndef _GNU_SOURCE |
252 |
/* |
253 |
-basename() -- Return last element of path |
254 |
+xbasename() -- Return last element of path |
255 |
*/ |
256 |
-char *basename(char *str) |
257 |
+char *xbasename(char *str) |
258 |
{ |
259 |
char *p; |
260 |
|
261 |
@@ -239,7 +238,6 @@ char *basename(char *str) |
262 |
|
263 |
return(strdup(p)); |
264 |
} |
265 |
-#endif /* _GNU_SOURCE */ |
266 |
|
267 |
/* |
268 |
strip_pre_ws() -- Return pointer to first non-whitespace character |
269 |
@@ -2089,7 +2087,7 @@ int main(int argc, char **argv) |
270 |
(void)signal(SIGTTOU, SIG_IGN); |
271 |
|
272 |
/* Set the globals */ |
273 |
- prog = basename(argv[0]); |
274 |
+ prog = xbasename(argv[0]); |
275 |
|
276 |
hostname = xgethostname(); |
277 |
|
278 |
|
279 |
|
280 |
|
281 |
1.1 src/patchsets/ssmtp/2.64/0080_all_gnutls.patch |
282 |
|
283 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0080_all_gnutls.patch?rev=1.1&view=markup |
284 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0080_all_gnutls.patch?rev=1.1&content-type=text/plain |
285 |
|
286 |
Index: 0080_all_gnutls.patch |
287 |
=================================================================== |
288 |
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=374327 |
289 |
|
290 |
GPL code linked against OpenSSL without exception |
291 |
|
292 |
[ Alejandro Rios ] |
293 |
* Initial port from openssl to gnutls |
294 |
|
295 |
[ Anibal Monsalve Salazar ] |
296 |
* configure: replaced -lssl with /usr/lib/libgnutls-openssl.so. |
297 |
* ssmtp.c: replaced SSL_CTX_use_certificate_chain_file with |
298 |
SSL_CTX_use_certificate_file and marked SSL_CTX_check_private_key |
299 |
as not used. |
300 |
|
301 |
Alejandro Rios <alerios@××××××.org> |
302 |
Anibal Monsalve Salazar <anibal@××××××.org> |
303 |
|
304 |
Index: ssmtp-2.64/ssmtp.c |
305 |
=================================================================== |
306 |
--- ssmtp-2.64.orig/ssmtp.c |
307 |
+++ ssmtp-2.64/ssmtp.c |
308 |
@@ -27,12 +27,16 @@ |
309 |
#include <ctype.h> |
310 |
#include <netdb.h> |
311 |
#ifdef HAVE_SSL |
312 |
+#ifdef HAVE_GNUTLS |
313 |
+#include <gnutls/openssl.h> |
314 |
+#else |
315 |
#include <openssl/crypto.h> |
316 |
#include <openssl/x509.h> |
317 |
#include <openssl/pem.h> |
318 |
#include <openssl/ssl.h> |
319 |
#include <openssl/err.h> |
320 |
#endif |
321 |
+#endif |
322 |
#ifdef MD5AUTH |
323 |
#include "md5auth/hmac_md5.h" |
324 |
#endif |
325 |
@@ -1154,7 +1158,11 @@ int smtp_open(char *host, int port) |
326 |
} |
327 |
|
328 |
if(use_cert == True) { |
329 |
+#ifdef HAVE_GNUTLS |
330 |
+ if(SSL_CTX_use_certificate_file(ctx, tls_cert, SSL_FILETYPE_PEM) <= 0) { |
331 |
+#else |
332 |
if(SSL_CTX_use_certificate_chain_file(ctx, tls_cert) <= 0) { |
333 |
+#endif |
334 |
perror("Use certfile"); |
335 |
return(-1); |
336 |
} |
337 |
@@ -1164,10 +1172,12 @@ int smtp_open(char *host, int port) |
338 |
return(-1); |
339 |
} |
340 |
|
341 |
+#ifndef HAVE_GNUTLS |
342 |
if(!SSL_CTX_check_private_key(ctx)) { |
343 |
log_event(LOG_ERR, "Private key does not match the certificate public key\n"); |
344 |
return(-1); |
345 |
} |
346 |
+#endif |
347 |
} |
348 |
#endif |
349 |
|
350 |
Index: ssmtp-2.64/configure.in |
351 |
=================================================================== |
352 |
--- ssmtp-2.64.orig/configure.in |
353 |
+++ ssmtp-2.64/configure.in |
354 |
@@ -50,11 +50,17 @@ enableval="" |
355 |
|
356 |
AC_ARG_ENABLE(ssl, |
357 |
[ --enable-ssl support for secure connection to mail server]) |
358 |
-if test x$enableval = xyes ; then |
359 |
- AC_DEFINE(HAVE_SSL) |
360 |
- LIBS="$LIBS -lssl -lcrypto" |
361 |
+AC_ARG_WITH([gnutls], |
362 |
+ AS_HELP_STRING([--with-gnutls], [Use GnuTLS for SSL support])) |
363 |
+if test x$enable_ssl = "xyes" ; then |
364 |
+ AC_DEFINE(HAVE_SSL) |
365 |
+ if test "x$with_gnutls" != "xyes"; then |
366 |
+ LIBS="$LIBS -lssl -lcrypto" |
367 |
+ else |
368 |
+ AC_DEFINE([HAVE_GNUTLS]) |
369 |
+ LIBS="-lgnutls-openssl" |
370 |
+ fi |
371 |
fi |
372 |
-enableval="" |
373 |
|
374 |
AC_ARG_ENABLE(inet6, |
375 |
[ --enable-inet6 support for IPv6 transport]) |
376 |
|
377 |
|
378 |
|
379 |
1.1 src/patchsets/ssmtp/2.64/0090_all_debian-remote-addr.patch |
380 |
|
381 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0090_all_debian-remote-addr.patch?rev=1.1&view=markup |
382 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0090_all_debian-remote-addr.patch?rev=1.1&content-type=text/plain |
383 |
|
384 |
Index: 0090_all_debian-remote-addr.patch |
385 |
=================================================================== |
386 |
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=557741 |
387 |
|
388 |
Patch by Victor Sudakov <sudakov@×××××××××××××.ru> |
389 |
Modified by Anibal Monsalve Salazar <anibal@××××××.org> |
390 |
|
391 |
Index: ssmtp-2.64/ssmtp.c |
392 |
=================================================================== |
393 |
--- ssmtp-2.64.orig/ssmtp.c |
394 |
+++ ssmtp-2.64/ssmtp.c |
395 |
@@ -1440,6 +1440,7 @@ ssmtp() -- send the message (exactly one |
396 |
int ssmtp(char *argv[]) |
397 |
{ |
398 |
char b[(BUF_SZ + 2)], *buf = b+1, *p, *q; |
399 |
+ char *remote_addr; |
400 |
#ifdef MD5AUTH |
401 |
char challenge[(BUF_SZ + 1)]; |
402 |
#endif |
403 |
@@ -1643,6 +1644,10 @@ int ssmtp(char *argv[]) |
404 |
outbytes += smtp_write(sock, "From: %s", from); |
405 |
} |
406 |
|
407 |
+ if(remote_addr=getenv("REMOTE_ADDR")) { |
408 |
+ outbytes += smtp_write(sock, "X-Originating-IP: %s", remote_addr); |
409 |
+ } |
410 |
+ |
411 |
if(have_date == False) { |
412 |
outbytes += smtp_write(sock, "Date: %s", arpadate); |
413 |
} |
414 |
|
415 |
|
416 |
|
417 |
1.1 src/patchsets/ssmtp/2.64/0100_all_ldflags.patch |
418 |
|
419 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0100_all_ldflags.patch?rev=1.1&view=markup |
420 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/0100_all_ldflags.patch?rev=1.1&content-type=text/plain |
421 |
|
422 |
Index: 0100_all_ldflags.patch |
423 |
=================================================================== |
424 |
Index: ssmtp-2.64/Makefile.in |
425 |
=================================================================== |
426 |
--- ssmtp-2.64.orig/Makefile.in |
427 |
+++ ssmtp-2.64/Makefile.in |
428 |
@@ -9,6 +9,8 @@ mandir=$(prefix)/man/man8 |
429 |
|
430 |
LN_S=@LN_S@ |
431 |
CC=@CC@ |
432 |
+LDFLAGS=@LDFLAGS@ |
433 |
+LIBS=@LIBS@ |
434 |
|
435 |
etcdir=@sysconfdir@ |
436 |
SSMTPCONFDIR=$(etcdir)/ssmtp |
437 |
@@ -79,7 +81,7 @@ uninstall-sendmail: uninstall |
438 |
|
439 |
# Binaries: |
440 |
ssmtp: $(OBJS) |
441 |
- $(CC) -o ssmtp $(OBJS) @LIBS@ $(CFLAGS) |
442 |
+ $(CC) $(CFLAGS) $(LDFLAGS) -o ssmtp $(OBJS) $(LIBS) |
443 |
|
444 |
.PHONY: clean |
445 |
clean: |
446 |
|
447 |
|
448 |
|
449 |
1.1 src/patchsets/ssmtp/2.64/series |
450 |
|
451 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/series?rev=1.1&view=markup |
452 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/ssmtp/2.64/series?rev=1.1&content-type=text/plain |
453 |
|
454 |
Index: series |
455 |
=================================================================== |
456 |
0010_all_maxsysuid.patch |
457 |
0020_all_from-format-fix.patch |
458 |
0030_all_authpass.patch |
459 |
0040_all_darwin7.patch |
460 |
0050_all_strndup.patch |
461 |
0060_all_opessl_crypto.patch |
462 |
0070_all_solaris-basename.patch |
463 |
0080_all_gnutls.patch |
464 |
0090_all_debian-remote-addr.patch |
465 |
0100_all_ldflags.patch |