From f2a17fd3b862cf93cd8c9a40e513900f45ae2139 Mon Sep 17 00:00:00 2001 From: dinoex Date: Sat, 12 Jan 2002 13:04:42 +0000 Subject: - Update popa3d-0.5 - Cleanup POP_AFTERR_SMTP patches - honor CFLAGS - claim maintainership no response from previous maintainer since August 2001 --- mail/popa3d/Makefile | 19 +-- mail/popa3d/distinfo | 3 +- mail/popa3d/files.smtp/POPAUTH | 49 -------- mail/popa3d/files.smtp/patch-aa | 37 ------ mail/popa3d/files.smtp/patch-ab | 23 ---- mail/popa3d/files.smtp/patch-pop_auth.c | 11 -- mail/popa3d/files.smtp/patch-pop_pbs.c | 11 -- mail/popa3d/files.smtp/patch-pop_root.c | 18 --- mail/popa3d/files.smtp/popauth.m4 | 47 ------- mail/popa3d/files/POPAUTH | 49 ++++++++ mail/popa3d/files/patch-aa | 43 +++---- mail/popa3d/files/patch-ab | 40 +++--- mail/popa3d/files/pop-before-sendmail.patch | 184 ++++++++++++++++++++++++++++ mail/popa3d/files/popauth.m4 | 47 +++++++ mail/popa3d/pkg-plist | 2 +- 15 files changed, 321 insertions(+), 262 deletions(-) delete mode 100644 mail/popa3d/files.smtp/POPAUTH delete mode 100644 mail/popa3d/files.smtp/patch-aa delete mode 100644 mail/popa3d/files.smtp/patch-ab delete mode 100644 mail/popa3d/files.smtp/patch-pop_auth.c delete mode 100644 mail/popa3d/files.smtp/patch-pop_pbs.c delete mode 100644 mail/popa3d/files.smtp/patch-pop_root.c delete mode 100644 mail/popa3d/files.smtp/popauth.m4 create mode 100644 mail/popa3d/files/POPAUTH create mode 100644 mail/popa3d/files/pop-before-sendmail.patch create mode 100644 mail/popa3d/files/popauth.m4 (limited to 'mail') diff --git a/mail/popa3d/Makefile b/mail/popa3d/Makefile index a2c7e3f22505..671bda34f66f 100644 --- a/mail/popa3d/Makefile +++ b/mail/popa3d/Makefile @@ -6,7 +6,7 @@ # PORTNAME= popa3d -PORTVERSION= 0.4 +PORTVERSION= 0.5 CATEGORIES= mail MASTER_SITES= http://www.openwall.com/popa3d/ \ ftp://ftp.openwall.com/popa3d/ \ @@ -16,18 +16,12 @@ MASTER_SITES= http://www.openwall.com/popa3d/ \ PKGNAMESUFFIX?= -before-sendmail .endif -.if defined(SMTP_AFTER_POP3) -PATCH_SITES= http://www.openwall.com/popa3d/contrib/ -PATCHFILES= popa3d-0.4-before-sendmail.tar.gz -PATCH_DIST_STRIP= -p1 -.endif - -MAINTAINER= gonza@techline.ru +MAINTAINER= dinoex@FreeBSD.org ALL_TARGET= popa3d .if defined(SMTP_AFTER_POP3) -PATCHDIR= ${MASTERDIR}/files.smtp +EXTRA_PATCHES+= ${FILESDIR}/pop-before-sendmail.patch PLIST= ${WRKDIR}/.PLIST.more pre-configure: @@ -36,7 +30,6 @@ pre-configure: @${ECHO} "share/sendmail/cf/hack/popauth.m4" >>${PLIST} post-patch: - @${PERL5} -pi -e "s=LOG_MAIL=LOG_DAEMON=" ${WRKSRC}/params.h @${PERL5} -pi -e "s=db1/db.h=db.h=" ${WRKSRC}/pop_root.c .endif @@ -47,14 +40,14 @@ do-install: ${INSTALL} ${COPY} -o root -g wheel -m 500 \ ${WRKSRC}/popa3d ${PREFIX}/libexec/popa3d .if defined(SMTP_AFTER_POP3) - ${INSTALL_DATA} ${PATCHDIR}/popauth.m4 ${CFDIR}/hack + ${INSTALL_DATA} ${FILESDIR}/popauth.m4 ${CFDIR}/hack .endif .if !defined(NOPORTDOCS) ${MKDIR} ${PREFIX}/share/doc/popa3d ${INSTALL_MAN} ${WRKSRC}/DESIGN ${PREFIX}/share/doc/popa3d - ${INSTALL_MAN} ${WRKSRC}/COPYING ${PREFIX}/share/doc/popa3d + ${INSTALL_MAN} ${WRKSRC}/LICENSE ${PREFIX}/share/doc/popa3d .if defined(SMTP_AFTER_POP3) - ${INSTALL_DATA} ${PATCHDIR}/POPAUTH ${PREFIX}/share/doc/popa3d + ${INSTALL_DATA} ${FILESDIR}/POPAUTH ${PREFIX}/share/doc/popa3d .endif .endif diff --git a/mail/popa3d/distinfo b/mail/popa3d/distinfo index aff3cb035e42..f6f322249136 100644 --- a/mail/popa3d/distinfo +++ b/mail/popa3d/distinfo @@ -1,2 +1 @@ -MD5 (popa3d-0.4.tar.gz) = 4ce2ed209abeaeaae7724d8d24bb7dbf -MD5 (popa3d-0.4-before-sendmail.tar.gz) = 8e1aed8c86e1df777eee116667ad9d54 +MD5 (popa3d-0.5.tar.gz) = ffe1644da7ffd0e66bf7e1c671f729aa diff --git a/mail/popa3d/files.smtp/POPAUTH b/mail/popa3d/files.smtp/POPAUTH deleted file mode 100644 index abb368505724..000000000000 --- a/mail/popa3d/files.smtp/POPAUTH +++ /dev/null @@ -1,49 +0,0 @@ - popa3d patch for POP-before-SMTP and SMTP-after-POP - - Garry Glendown / Dec. 12th 2000 - -On the 'net there are a couple of solutions to allow for POP-before-SMTP -authentication in order to allow for relaying of mails. Anyway, the -solutions I found didn't really apeal to me, so I hacked popa3d a bit, -which we already used on one of our machines to serve mail to dialup -customers. - - Prerequisites - -This patch supplies data to sendmail to allow for certain IPs to use it -as a relaying host. In order to use with your sendmail installation, get -the popauth-hack (http://www.sendmail.org/~ca/email/rules/popauth.m4) -and install it by adding "HACK(`popauth')" to you .mc-file. - - Installing - -The patch - enabled through the POPB4SMTP-define in the Makefile - -accesses the file "/etc/mail/popauth.db" (create with "makemap hash -/etc/mail/popauth - #include -+#include - #include --#include - #include - - char addr_buf[256]; diff --git a/mail/popa3d/files.smtp/patch-pop_root.c b/mail/popa3d/files.smtp/patch-pop_root.c deleted file mode 100644 index cdc98a60e1f5..000000000000 --- a/mail/popa3d/files.smtp/patch-pop_root.c +++ /dev/null @@ -1,18 +0,0 @@ ---- pop_root.c.neu.orig Mon Jul 16 11:55:05 2001 -+++ pop_root.c Tue Jul 17 11:45:22 2001 -@@ -210,6 +210,7 @@ - sem=sem_attach(0x50413453); - sem_enter(sem); - db=dbopen("/etc/mail/popauth.db",O_RDWR,0664,DB_HASH,0 ); -+ if ( db != NULL ) { - key.data=client_addr(1); - key.size=strlen(key.data); - sprintf(ts,"%d",(int)time(0)); -@@ -233,6 +234,7 @@ - ret=db->seq(db,&key,&data,R_NEXT); - } - db->close(db); -+ } - sem_leave(sem); - #endif - diff --git a/mail/popa3d/files.smtp/popauth.m4 b/mail/popa3d/files.smtp/popauth.m4 deleted file mode 100644 index 2520978ad904..000000000000 --- a/mail/popa3d/files.smtp/popauth.m4 +++ /dev/null @@ -1,47 +0,0 @@ -divert(-1) -# -# Copyright (c) 2000 Claus Assmann -# -# In short: you can do whatever you want with this, but don't blame me! -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# -# -VERSIONID(`$Id: popauth.m4,v 1.5 2000/10/19 17:47:53 ca Exp $') - -LOCAL_CONFIG -ifdef(`DATABASE_MAP_TYPE', `', `define(`DATABASE_MAP_TYPE', `hash')') -Kpopauth ifelse(defn(`_ARG_'), `', - `DATABASE_MAP_TYPE -a /etc/mail/popauth', - `_ARG_') -ifdef(`CF_LEVEL', `dnl has been introduced in 8.10 -dnl this can be used to add a tag to entries in the map -dnl to restrict the access -ifdef(`POP_B4_SMTP_TAG',, `define(`POP_B4_SMTP_TAG', `POP:')')dnl -ifdef(`POP_TO', `dnl -ifdef(`_ARITH_MAP_', `', `dnl -define(`_ARITH_MAP_', `1')dnl -Karith arith') -')', `dnl -define(`POP_B4_SMTP_TAG', `')dnl -')dnl -LOCAL_RULESETS -SLocal_check_rcpt -R$* $: $(popauth `'$&{client_addr} $: $) -R $@ NoPopAuth -ifdef(`POP_TO', `dnl -R$+ $: $(arith - $@ $1 $@ $&t $) -R$+ $: $(arith l $@ $1 $@ POP_TO $) -RTRUE $# OK', ` -R$* $# OK') diff --git a/mail/popa3d/files/POPAUTH b/mail/popa3d/files/POPAUTH new file mode 100644 index 000000000000..abb368505724 --- /dev/null +++ b/mail/popa3d/files/POPAUTH @@ -0,0 +1,49 @@ + popa3d patch for POP-before-SMTP and SMTP-after-POP + + Garry Glendown / Dec. 12th 2000 + +On the 'net there are a couple of solutions to allow for POP-before-SMTP +authentication in order to allow for relaying of mails. Anyway, the +solutions I found didn't really apeal to me, so I hacked popa3d a bit, +which we already used on one of our machines to serve mail to dialup +customers. + + Prerequisites + +This patch supplies data to sendmail to allow for certain IPs to use it +as a relaying host. In order to use with your sendmail installation, get +the popauth-hack (http://www.sendmail.org/~ca/email/rules/popauth.m4) +and install it by adding "HACK(`popauth')" to you .mc-file. + + Installing + +The patch - enabled through the POPB4SMTP-define in the Makefile - +accesses the file "/etc/mail/popauth.db" (create with "makemap hash +/etc/mail/popauth ++#include ++#include ++#include ++#include ++ ++#ifdef POPB4SMTP ++#include ++#include ++#include ++#include ++#include ++#include ++#endif ++ ++#include "pop_db.h" ++ ++int log_error(char *s); ++ ++ ++/* Function from G.Glendown Dec 2000 */ ++ ++char addr_buf[256]; ++ ++char *client_addr(int fd) ++{ ++ struct sockaddr sa; ++ struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa); ++ int length = sizeof(sa); ++ ++ strcpy(addr_buf,"0.0.0.0"); ++ ++ if (fd == -1) { ++ return addr_buf; ++ } ++ ++ if (getpeername(fd, &sa, &length) < 0) { ++ return addr_buf; ++ } ++ ++ strcpy(addr_buf, (char *)inet_ntoa(sockin->sin_addr)); ++ return addr_buf; ++} ++ ++#ifdef POPB4SMTP ++ ++/* Function written by Dirk Meyer */ ++ ++void write_db_entry(void) ++{ ++ DB *db; ++ DBT key, data; ++ char ts[16]; ++ int ret, fd, st; ++ time_t tv; ++ ++ /* create is not set, this is intended, ++ function will be ignored, if database was not created */ ++ db = dbopen("/etc/mail/popauth.db", O_RDWR, 0644, DB_HASH, NULL); ++ if ( db == NULL ) ++ return; ++ ++ /* lock all changes */ ++ fd = db->fd(db); ++ if ( fd == -1 ) { ++ st = -1; ++ log_error( "db->fd() failed" ); ++ } else { ++ st = flock(fd, LOCK_EX); ++ } ++ ++ if (st == 0) { ++ /* generate entry */ ++ key.data = client_addr(1); ++ key.size = strlen(key.data); ++ sprintf(ts, "%lu", (long)time(NULL)); ++ data.data = ts; ++ data.size = strlen(ts); ++ db->put(db, &key, &data, 0); ++ db->sync(db,0); ++ ++ /* cleanup old entrys */ ++ ret = db->seq(db, &key, &data, R_FIRST); ++ while (!ret) { ++ data.size = data.size < 16 ? data.size : 15; ++ strncpy(ts,data.data, data.size); ++ ts[data.size] = 0; ++ tv = atol(ts); ++ if ((tv+VALIDTIME) < time(NULL)) { ++ db->del(db, &key, 0); ++ db->sync(db, 0); ++ /* start over */ ++ ret = db->seq(db, &key, &data, R_FIRST); ++ continue; ++ } ++ ret = db->seq(db, &key, &data, R_NEXT); ++ } ++ st = flock(fd, LOCK_UN); ++ } else { ++ log_error( "lock() failed" ); ++ } ++ db->close(db); ++} ++ ++#endif ++ +--- pop_db.h.orig Sat Dec 22 15:55:37 2001 ++++ pop_db.h Sat Dec 22 15:55:37 2001 +@@ -0,0 +1,4 @@ ++ ++char *client_addr(int fd); ++void write_db_entry(void); ++ +--- pop_root.c.orig Sat Sep 8 14:58:32 2001 ++++ pop_root.c Sat Dec 22 17:27:37 2001 +@@ -32,6 +32,9 @@ + #if POP_VIRTUAL + #include "virtual.h" + #endif ++#ifdef POPB4SMTP ++#include "pop_db.h" ++#endif + + #if !VIRTUAL_ONLY + extern struct passwd *auth_userpass(char *user, char *pass, int *known); +@@ -151,6 +154,10 @@ + if (!*pass) return AUTH_FAILED; + memset(pass, 0, strlen(pass)); + if (!*user) return AUTH_FAILED; ++ ++#ifdef POPB4SMTP ++ write_db_entry(); ++#endif + + if (set_user(pw)) return AUTH_FAILED; + diff --git a/mail/popa3d/files/popauth.m4 b/mail/popa3d/files/popauth.m4 new file mode 100644 index 000000000000..2520978ad904 --- /dev/null +++ b/mail/popa3d/files/popauth.m4 @@ -0,0 +1,47 @@ +divert(-1) +# +# Copyright (c) 2000 Claus Assmann +# +# In short: you can do whatever you want with this, but don't blame me! +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# +# +VERSIONID(`$Id: popauth.m4,v 1.5 2000/10/19 17:47:53 ca Exp $') + +LOCAL_CONFIG +ifdef(`DATABASE_MAP_TYPE', `', `define(`DATABASE_MAP_TYPE', `hash')') +Kpopauth ifelse(defn(`_ARG_'), `', + `DATABASE_MAP_TYPE -a /etc/mail/popauth', + `_ARG_') +ifdef(`CF_LEVEL', `dnl has been introduced in 8.10 +dnl this can be used to add a tag to entries in the map +dnl to restrict the access +ifdef(`POP_B4_SMTP_TAG',, `define(`POP_B4_SMTP_TAG', `POP:')')dnl +ifdef(`POP_TO', `dnl +ifdef(`_ARITH_MAP_', `', `dnl +define(`_ARITH_MAP_', `1')dnl +Karith arith') +')', `dnl +define(`POP_B4_SMTP_TAG', `')dnl +')dnl +LOCAL_RULESETS +SLocal_check_rcpt +R$* $: $(popauth `'$&{client_addr} $: $) +R $@ NoPopAuth +ifdef(`POP_TO', `dnl +R$+ $: $(arith - $@ $1 $@ $&t $) +R$+ $: $(arith l $@ $1 $@ POP_TO $) +RTRUE $# OK', ` +R$* $# OK') diff --git a/mail/popa3d/pkg-plist b/mail/popa3d/pkg-plist index 0567735d177d..ed48f930d33b 100644 --- a/mail/popa3d/pkg-plist +++ b/mail/popa3d/pkg-plist @@ -1,5 +1,5 @@ @comment $FreeBSD$ libexec/popa3d %%PORTDOCS%%share/doc/popa3d/DESIGN -%%PORTDOCS%%share/doc/popa3d/COPYING +%%PORTDOCS%%share/doc/popa3d/LICENSE %%PORTDOCS%%@dirrm share/doc/popa3d -- cgit