From e4e4c748055c3e9ca2a3eb1b917e6feba67ec433 Mon Sep 17 00:00:00 2001 From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Thu, 22 Oct 2020 11:10:17 +0000 Subject: [PATCH] Clean up patches - Clean up REINPLACE_CMDs, use patches if possible - Set OPENSSL_LIBS instead of OPENSSL_LDFLAGS in order to remove one patch for the configure script - Patch ssmtp.8 to refer to the proper path for sendmail - Remove a patch adding strndup for FreeBSD 7. --- mail/ssmtp/Makefile | 12 +-- mail/ssmtp/files/patch-configure | 18 +---- mail/ssmtp/files/patch-md5auth-hmac_md5.c | 4 +- mail/ssmtp/files/patch-ssmtp.8 | 23 ++++++ mail/ssmtp/files/patch-ssmtp.c | 93 +++++++++-------------- mail/ssmtp/files/patch-ssmtp.conf | 11 ++- mail/ssmtp/files/patch-ssmtp.conf.5 | 20 +++++ 7 files changed, 98 insertions(+), 83 deletions(-) create mode 100644 mail/ssmtp/files/patch-ssmtp.8 create mode 100644 mail/ssmtp/files/patch-ssmtp.conf.5 diff --git a/mail/ssmtp/Makefile b/mail/ssmtp/Makefile index 843c9a2742c1..77e40bafc0b6 100644 --- a/mail/ssmtp/Makefile +++ b/mail/ssmtp/Makefile @@ -3,7 +3,7 @@ PORTNAME= ssmtp PORTVERSION= 2.64 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= mail MASTER_SITES= DEBIAN_POOL DISTFILES= ${PORTNAME}_${PORTVERSION}.orig${EXTRACT_SUFX} @@ -37,16 +37,18 @@ LOGFILE_CONFIGURE_ENABLE= logfile OPENSSL_USES= ssl OPENSSL_CONFIGURE_ENABLE= ssl OPENSSL_CFLAGS= -I${OPENSSLINC} -OPENSSL_LDFLAGS= -L${OPENSSLLIB} +OPENSSL_LIBS= -L${OPENSSLLIB} -lcrypto USERPREFS_CFLAGS= -DUSERPREFS XORIGIP_EXTRA_PATCHES= ${FILESDIR}/remote-addr.patch _MAILERCONF= /etc/mail/mailer.conf post-configure: - @${REINPLACE_CMD} -e "s,/etc/ssl/certs/ssmtp.pem,${PREFIX}/etc/ssmtp/ssmtp.pem,g" \ - ${WRKSRC}/ssmtp.c ${WRKSRC}/ssmtp.conf - @${REINPLACE_CMD} -e "s, /etc, ${PREFIX}/etc,g" ${WRKSRC}/ssmtp.8 + @${REINPLACE_CMD} "s|%%ETCDIR%%|${ETCDIR}|" \ + ${WRKSRC}/ssmtp.8 \ + ${WRKSRC}/ssmtp.c \ + ${WRKSRC}/ssmtp.conf \ + ${WRKSRC}/ssmtp.conf.5 do-install: ${INSTALL_PROGRAM} ${WRKSRC}/ssmtp ${STAGEDIR}${PREFIX}/sbin/ssmtp diff --git a/mail/ssmtp/files/patch-configure b/mail/ssmtp/files/patch-configure index ef3481f96d2d..18512823b398 100644 --- a/mail/ssmtp/files/patch-configure +++ b/mail/ssmtp/files/patch-configure @@ -1,17 +1,6 @@ ---- configure.orig Fri Sep 27 14:47:52 2002 -+++ configure Wed Oct 1 16:42:07 2003 -@@ -1340,7 +1340,7 @@ - #define HAVE_SSL 1 - EOF - -- LIBS="$LIBS -lssl" -+ LIBS="$LIBS $LDFLAGS -lssl -lcrypto" - fi - enableval="" - ---- configure.orig 2009-11-01 23:52:55.000000000 +0200 -+++ configure 2009-11-01 23:53:42.000000000 +0200 -@@ -1591,7 +1591,8 @@ +--- configure.orig 2020-10-22 09:36:35 UTC ++++ configure +@@ -1591,7 +1591,8 @@ if test x$enableval = xyes ; then #define MD5AUTH 1 EOF @@ -21,4 +10,3 @@ fi enableval="" - diff --git a/mail/ssmtp/files/patch-md5auth-hmac_md5.c b/mail/ssmtp/files/patch-md5auth-hmac_md5.c index eb21d712e86b..299a4e38e9bf 100644 --- a/mail/ssmtp/files/patch-md5auth-hmac_md5.c +++ b/mail/ssmtp/files/patch-md5auth-hmac_md5.c @@ -1,5 +1,5 @@ ---- md5auth/hmac_md5.c.orig 2009-11-23 11:45:41.000000000 +0200 -+++ md5auth/hmac_md5.c 2011-02-21 02:27:21.000000000 +0200 +--- md5auth/hmac_md5.c.orig 2009-11-23 09:45:41 UTC ++++ md5auth/hmac_md5.c @@ -1,7 +1,7 @@ #include #include diff --git a/mail/ssmtp/files/patch-ssmtp.8 b/mail/ssmtp/files/patch-ssmtp.8 new file mode 100644 index 000000000000..4a18ae192241 --- /dev/null +++ b/mail/ssmtp/files/patch-ssmtp.8 @@ -0,0 +1,23 @@ +--- ssmtp.8.orig 2008-02-29 02:50:15 UTC ++++ ssmtp.8 +@@ -5,7 +5,7 @@ ssmtp, sendmail \- send a message using smtp + .B ssmtp + .RI "[ " flags " ] [ " address " " ... " ]" + .br +-.B /usr/lib/sendmail ++.B /usr/libexec/sendmail/sendmail + .RI "[ " flags " ] [ " address " " ... " ]" + .br + .SH DESCRIPTION +@@ -268,9 +268,9 @@ Messages root sends will be identified as from jdoe@is + through mail.isp.com. + + .SH FILES +- /etc/ssmtp/ssmtp.conf - configuration file ++ %%ETCDIR%%/ssmtp.conf - configuration file + .br +- /etc/ssmtp/revaliases - reverse aliases file ++ %%ETCDIR%%/revaliases - reverse aliases file + + .SH SEE ALSO + RFC821, RFC822, ssmtp.conf(5). diff --git a/mail/ssmtp/files/patch-ssmtp.c b/mail/ssmtp/files/patch-ssmtp.c index 2d8432ac4ccc..92b93877ca4b 100644 --- a/mail/ssmtp/files/patch-ssmtp.c +++ b/mail/ssmtp/files/patch-ssmtp.c @@ -1,5 +1,5 @@ ---- ssmtp.c.orig 2009-11-23 11:55:11.000000000 +0200 -+++ ssmtp.c 2011-02-21 02:56:10.000000000 +0200 +--- ssmtp.c.orig 2020-10-22 09:36:35 UTC ++++ ssmtp.c @@ -25,6 +25,7 @@ #include #include @@ -8,7 +8,7 @@ #ifdef HAVE_SSL #include #include -@@ -55,21 +56,21 @@ +@@ -55,21 +56,21 @@ bool_t use_oldauth = False; /* use old AUTH LOGIN use #define ARPADATE_LENGTH 32 /* Current date in RFC format */ char arpadate[ARPADATE_LENGTH]; @@ -41,32 +41,7 @@ headers_t headers, *ht; -@@ -239,6 +240,24 @@ - } - #endif /* _GNU_SOURCE */ - -+#if defined(__FreeBSD_version) && __FreeBSD_version < 701101 -+char * -+strndup(const char *str, size_t n) -+{ -+ size_t len; -+ char *copy; -+ -+ for (len = 0; len < n && str[len]; len++) -+ continue; -+ -+ if ((copy = malloc(len + 1)) == NULL) -+ return (NULL); -+ memcpy(copy, str, len); -+ copy[len] = '\0'; -+ return (copy); -+} -+#endif -+ - /* - strip_pre_ws() -- Return pointer to first non-whitespace character - */ -@@ -261,7 +280,7 @@ +@@ -261,7 +262,7 @@ char *strip_post_ws(char *str) p = (str + strlen(str)); while(isspace(*--p)) { @@ -75,7 +50,7 @@ } return(p); -@@ -279,7 +298,7 @@ +@@ -279,7 +280,7 @@ char *addr_parse(char *str) #endif /* Simple case with email address enclosed in <> */ @@ -84,7 +59,7 @@ die("addr_parse(): strdup()"); } -@@ -287,7 +306,7 @@ +@@ -287,7 +288,7 @@ char *addr_parse(char *str) q++; if((p = strchr(q, '>'))) { @@ -93,7 +68,7 @@ } #if 0 -@@ -310,7 +329,7 @@ +@@ -310,7 +311,7 @@ char *addr_parse(char *str) q = strip_post_ws(p); if(*q == ')') { while((*--q != '(')); @@ -102,7 +77,7 @@ } (void)strip_post_ws(p); -@@ -363,7 +382,7 @@ +@@ -363,7 +364,7 @@ bool_t standardise(char *str, bool_t *linestart) *linestart = False; if((p = strchr(str, '\n'))) { @@ -111,7 +86,7 @@ *linestart = True; } return(leadingdot); -@@ -384,7 +403,7 @@ +@@ -384,7 +385,7 @@ void revaliases(struct passwd *pw) while(fgets(buf, sizeof(buf), fp)) { /* Make comments invisible */ if((p = strchr(buf, '#'))) { @@ -120,7 +95,7 @@ } /* Ignore malformed lines and comments */ -@@ -519,11 +538,11 @@ +@@ -519,11 +520,11 @@ void rcpt_save(char *str) #endif /* Ignore missing usernames */ @@ -134,7 +109,7 @@ die("rcpt_save() -- strdup() failed"); } -@@ -548,7 +567,7 @@ +@@ -548,7 +549,7 @@ void rcpt_parse(char *str) (void)fprintf(stderr, "*** rcpt_parse(): str = [%s]\n", str); #endif @@ -143,7 +118,7 @@ die("rcpt_parse(): strdup() failed"); } q = p; -@@ -576,7 +595,7 @@ +@@ -576,7 +577,7 @@ void rcpt_parse(char *str) } /* End of string? */ @@ -152,7 +127,7 @@ got_addr = True; } -@@ -584,7 +603,7 @@ +@@ -584,7 +585,7 @@ void rcpt_parse(char *str) if((*q == ',') && (in_quotes == False)) { got_addr = True; @@ -161,7 +136,7 @@ } if(got_addr) { -@@ -668,7 +687,7 @@ +@@ -668,7 +669,7 @@ void header_save(char *str) (void)fprintf(stderr, "header_save(): str = [%s]\n", str); #endif @@ -170,7 +145,7 @@ die("header_save() -- strdup() failed"); } ht->string = p; -@@ -676,7 +695,7 @@ +@@ -676,7 +677,7 @@ void header_save(char *str) if(strncasecmp(ht->string, "From:", 5) == 0) { #if 1 /* Hack check for NULL From: line */ @@ -179,7 +154,7 @@ return; } #endif -@@ -739,19 +758,19 @@ +@@ -739,19 +740,19 @@ header_parse() -- Break headers into seperate entries void header_parse(FILE *stream) { size_t size = BUF_SZ, len = 0; @@ -203,7 +178,7 @@ die("header_parse() -- realloc() failed"); } q = (p + len); -@@ -776,9 +795,9 @@ +@@ -776,9 +777,9 @@ void header_parse(FILE *stream) in_header = False; default: @@ -215,7 +190,7 @@ } header_save(p); -@@ -809,9 +828,9 @@ +@@ -809,9 +810,9 @@ void header_parse(FILE *stream) in_header = False; default: @@ -227,7 +202,7 @@ } header_save(p); -@@ -876,21 +895,27 @@ +@@ -876,21 +877,27 @@ bool_t read_config() char *rightside; /* Make comments invisible */ if((p = strchr(buf, '#'))) { @@ -259,7 +234,7 @@ die("parse_config() -- strdup() failed"); } -@@ -904,7 +929,7 @@ +@@ -904,7 +911,7 @@ bool_t read_config() port = atoi(r); } @@ -268,7 +243,7 @@ die("parse_config() -- strdup() failed"); } -@@ -949,7 +974,7 @@ +@@ -949,7 +956,7 @@ bool_t read_config() mail_domain = strdup(q); } @@ -277,7 +252,7 @@ die("parse_config() -- strdup() failed"); } rewrite_domain = True; -@@ -1025,7 +1050,7 @@ +@@ -1025,7 +1032,7 @@ bool_t read_config() } } else if(strcasecmp(p, "TLSCert") == 0) { @@ -286,7 +261,7 @@ die("parse_config() -- strdup() failed"); } -@@ -1036,7 +1061,7 @@ +@@ -1036,7 +1043,7 @@ bool_t read_config() #endif /* Command-line overrides these */ else if(strcasecmp(p, "AuthUser") == 0 && !auth_user) { @@ -295,7 +270,7 @@ die("parse_config() -- strdup() failed"); } -@@ -1045,7 +1070,7 @@ +@@ -1045,7 +1052,7 @@ bool_t read_config() } } else if(strcasecmp(p, "AuthPass") == 0 && !auth_pass) { @@ -304,7 +279,7 @@ die("parse_config() -- strdup() failed"); } -@@ -1054,7 +1079,7 @@ +@@ -1054,7 +1061,7 @@ bool_t read_config() } } else if(strcasecmp(p, "AuthMethod") == 0 && !auth_method) { @@ -313,7 +288,7 @@ die("parse_config() -- strdup() failed"); } -@@ -1107,11 +1132,11 @@ +@@ -1107,11 +1114,11 @@ int smtp_open(char *host, int port) #ifdef INET6 struct addrinfo hints, *ai0, *ai; char servname[NI_MAXSERV]; @@ -327,7 +302,7 @@ #endif #ifdef HAVE_SSL -@@ -1310,7 +1335,7 @@ +@@ -1310,7 +1317,7 @@ char *fd_gets(char *buf, int size, int fd) buf[i++] = c; } } @@ -336,7 +311,7 @@ return(buf); } -@@ -1435,14 +1460,14 @@ +@@ -1435,14 +1442,14 @@ int ssmtp(char *argv[]) } if((p = strtok(pw->pw_gecos, ";,"))) { @@ -353,7 +328,7 @@ uad = append_domain(pw->pw_name); } -@@ -1490,7 +1515,7 @@ +@@ -1490,7 +1497,7 @@ int ssmtp(char *argv[]) /* Try to log in if username was supplied */ if(auth_user) { #ifdef MD5AUTH @@ -362,7 +337,7 @@ auth_pass = strdup(""); } -@@ -1742,7 +1767,7 @@ +@@ -1742,7 +1749,7 @@ char **parse_options(int argc, char *argv[]) j = 0; add = 1; @@ -371,7 +346,7 @@ switch(argv[i][j]) { #ifdef INET6 case '6': -@@ -1760,14 +1785,14 @@ +@@ -1760,14 +1767,14 @@ char **parse_options(int argc, char *argv[]) if((!argv[i][(j + 1)]) && argv[(i + 1)]) { auth_user = strdup(argv[i+1]); @@ -388,7 +363,7 @@ die("parse_options() -- strdup() failed"); } } -@@ -1777,14 +1802,14 @@ +@@ -1777,14 +1784,14 @@ char **parse_options(int argc, char *argv[]) if((!argv[i][(j + 1)]) && argv[(i + 1)]) { auth_pass = strdup(argv[i+1]); @@ -405,7 +380,7 @@ die("parse_options() -- strdup() failed"); } } -@@ -1875,14 +1900,14 @@ +@@ -1875,14 +1882,14 @@ char **parse_options(int argc, char *argv[]) case 'F': if((!argv[i][(j + 1)]) && argv[(i + 1)]) { minus_F = strdup(argv[(i + 1)]); @@ -422,7 +397,7 @@ die("parse_options() -- strdup() failed"); } } -@@ -1894,14 +1919,14 @@ +@@ -1894,14 +1901,14 @@ char **parse_options(int argc, char *argv[]) case 'r': if((!argv[i][(j + 1)]) && argv[(i + 1)]) { minus_f = strdup(argv[(i + 1)]); diff --git a/mail/ssmtp/files/patch-ssmtp.conf b/mail/ssmtp/files/patch-ssmtp.conf index b59e9154f740..2fda6a02b143 100644 --- a/mail/ssmtp/files/patch-ssmtp.conf +++ b/mail/ssmtp/files/patch-ssmtp.conf @@ -1,6 +1,13 @@ ---- ssmtp.conf.orig 2020-03-05 16:17:25 UTC +--- ssmtp.conf.orig 2008-02-29 02:50:15 UTC +++ ssmtp.conf -@@ -41,3 +41,9 @@ hostname=_HOSTNAME_ +@@ -35,9 +35,15 @@ hostname=_HOSTNAME_ + #UseTLSCert=YES + + # Use this RSA certificate. +-#TLSCert=/etc/ssl/certs/ssmtp.pem ++#TLSCert=%%ETCDIR%%/ssmtp.pem + + # Get enhanced (*really* enhanced) debugging information in the logs # If you want to have debugging of the config file parsing, move this option # to the top of the config file and uncomment #Debug=YES diff --git a/mail/ssmtp/files/patch-ssmtp.conf.5 b/mail/ssmtp/files/patch-ssmtp.conf.5 new file mode 100644 index 000000000000..7ae9a17bf85b --- /dev/null +++ b/mail/ssmtp/files/patch-ssmtp.conf.5 @@ -0,0 +1,20 @@ +--- ssmtp.conf.5.orig 2020-10-22 09:43:05 UTC ++++ ssmtp.conf.5 +@@ -13,7 +13,7 @@ + .Sh DESCRIPTION + .Nm ssmtp + reads configuration data from +-.Pa /etc/ssmtp/ssmtp.conf ++.Pa %%ETCDIR%%/ssmtp.conf + The file contains keyword-argument pairs, one per line. + Lines starting with + .Ql # +@@ -69,7 +69,7 @@ May also be set to + .Dq cram-md5 . + .Sh FILES + .Bl -tag -width Ds +-.It Pa /etc/ssmtp/ssmtp.conf ++.It Pa %%ETCDIR%%/ssmtp.conf + Contains configuration data for + .Nm ssmtp . + .El