From 130a6b675e239623eaa243254d26332d171ae70b Mon Sep 17 00:00:00 2001 From: Sergei Kolobov Date: Sat, 8 Nov 2003 22:14:38 +0000 Subject: - Add WITH_USERPREFS knob: a user can set his own reverse alias, e.g.: % echo "nospam@cotds.org" > ~/.ssmtprc - Bump PORTREVISION PR: 59063 Submitted by: maintainer --- mail/ssmtp/Makefile | 10 ++++++++++ mail/ssmtp/files/patch-ssmtp.c | 45 +++++++++++++++++++++++++++++++++++++++--- mail/ssmtp/pkg-plist | 2 +- 3 files changed, 53 insertions(+), 4 deletions(-) (limited to 'mail/ssmtp') diff --git a/mail/ssmtp/Makefile b/mail/ssmtp/Makefile index c0491105d208..e0edfbe2502a 100644 --- a/mail/ssmtp/Makefile +++ b/mail/ssmtp/Makefile @@ -7,6 +7,7 @@ PORTNAME= ssmtp PORTVERSION= 2.60.4 +PORTREVISION= 1 CATEGORIES= mail ipv6 MASTER_SITES= ${MASTER_SITE_DEBIAN_POOL} DISTNAME= ${PORTNAME}_${PORTVERSION} @@ -30,6 +31,15 @@ TRUE= /usr/bin/true MAN8= ssmtp.8 +.if defined(WITH_USERPREFS) +CFLAGS+= -DUSERPREFS +.else +pre-everything:: + @${ECHO_CMD} 'If you want to let your users set their own revalias address,' + @${ECHO_CMD} 'please define WITH_USERPREFS (they just have to put their mail' + @${ECHO_CMD} 'address in ~/.ssmtprc).' +.endif + post-configure: @${REINPLACE_CMD} -e "s,/etc/ssl/certs/ssmtp.pem,${PREFIX}/etc/ssmtp/ssmtp.pem,g" \ ${WRKSRC}/ssmtp.c ${WRKSRC}/ssmtp.conf diff --git a/mail/ssmtp/files/patch-ssmtp.c b/mail/ssmtp/files/patch-ssmtp.c index 1baf75ad41e6..24e0044bc5c0 100644 --- a/mail/ssmtp/files/patch-ssmtp.c +++ b/mail/ssmtp/files/patch-ssmtp.c @@ -1,10 +1,49 @@ ---- ssmtp.c.orig Sun Dec 8 18:26:20 2002 -+++ ssmtp.c Mon Apr 7 01:24:52 2003 +--- ssmtp.c.orig Sat Nov 8 18:51:19 2003 ++++ ssmtp.c Sat Nov 8 19:01:07 2003 @@ -14,6 +14,7 @@ */ - #define VERSION "2.60.1" + #define VERSION "2.60.4" +#include #include #include #include +@@ -366,9 +367,36 @@ + { + char buf[(BUF_SZ + 1)], *p; + FILE *fp; +- ++#ifdef USERPREFS ++ char *file=NULL; ++ if (pw->pw_dir != NULL) { ++ file = (char *)malloc (strlen (pw->pw_dir) + 1 + strlen (".ssmtprc") + 1); ++ sprintf (file, "%s/.ssmtprc", pw->pw_dir); ++ } ++ ++ if ((file != NULL) && (fp = fopen(file, "r")) ) { ++ while(fgets(buf, sizeof(buf), fp)) { ++ /* Make comments invisible */ ++ if((p = strchr(buf, '#'))) { ++ *p = (char)NULL; ++ } ++ ++ /* Ignore malformed lines and comments */ ++ if(strchr(buf, '@') == (char *)NULL) { ++ continue; ++ } ++ if((p = strtok(buf, "\n"))) { ++ if((uad = strdup(p)) == (char *)NULL) { ++ die("revaliases() -- strdup() failed"); ++ } ++ } ++ } ++ fclose(fp); + /* Try to open the reverse aliases file */ +- if((fp = fopen(REVALIASES_FILE, "r"))) { ++ } else if ((fp = fopen(REVALIASES_FILE, "r"))) { ++#else ++ if ((fp = fopen(REVALIASES_FILE, "r"))) { ++#endif + /* Search if a reverse alias is defined for the sender */ + while(fgets(buf, sizeof(buf), fp)) { + /* Make comments invisible */ diff --git a/mail/ssmtp/pkg-plist b/mail/ssmtp/pkg-plist index ed049105c745..320ad3bbbed4 100644 --- a/mail/ssmtp/pkg-plist +++ b/mail/ssmtp/pkg-plist @@ -1,4 +1,4 @@ sbin/ssmtp etc/ssmtp/revaliases.sample etc/ssmtp/ssmtp.conf.sample -@dirrm etc/ssmtp +@unexec rmdir %D/etc/ssmtp 2> /dev/null || echo "If you don't plan to reinstall ssmtp, you can safely remove %D/etc/ssmtp" | fmt -- cgit v1.2.3