1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

- Update popa3d-0.5

- Cleanup POP_AFTERR_SMTP patches
- honor CFLAGS

- claim maintainership
 no response from previous maintainer since August 2001
This commit is contained in:
Dirk Meyer 2002-01-12 13:04:42 +00:00
parent 8c1545f235
commit 12423e6cf0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=52969
13 changed files with 225 additions and 166 deletions

View File

@ -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

View File

@ -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

View File

@ -1,37 +0,0 @@
--- params.h.orig Tue Feb 1 09:16:24 2000
+++ params.h Sat Mar 4 16:12:48 2000
@@ -33,7 +33,7 @@
* An unprivileged dummy user to run as before authentication. The user
* and its UID must not be used for any other purpose.
*/
-#define POP_USER "popa3d"
+#define POP_USER "pop"
/*
* Sessions will be closed if idle for longer than POP_TIMEOUT seconds.
@@ -62,7 +62,7 @@
* Do we have shadow passwords? (Not for *BSD.)
* Note: password aging is not supported.
*/
-#define AUTH_SHADOW 1
+#define AUTH_SHADOW 0
/*
* A salt used to waste some CPU time on dummy crypt(3) calls and make
@@ -81,14 +81,14 @@
* Your mail spool directory. Note: only local (non-NFS) mode 775 mail
* spools are currently supported.
*/
-#define MAIL_SPOOL_PATH "/var/spool/mail"
+#define MAIL_SPOOL_PATH "/var/mail"
/*
* How do we talk to syslogd? These should be fine for most systems.
*/
#define SYSLOG_IDENT "popa3d"
#define SYSLOG_OPTIONS LOG_PID
-#define SYSLOG_FACILITY LOG_DAEMON
+#define SYSLOG_FACILITY LOG_MAIL
#define SYSLOG_PRIORITY LOG_NOTICE
/*

View File

@ -1,23 +0,0 @@
--- Makefile.orig Mon Jul 16 11:35:16 2001
+++ Makefile Mon Jul 16 11:43:29 2001
@@ -1,9 +1,8 @@
-CC = gcc
-LD = gcc
+CC? = gcc
RM = rm -f
CFLAGS = -c -Wall -O2 -fomit-frame-pointer -DPOPB4SMTP -DVALIDTIME=600
#LDFLAGS = -s
-LDFLAGS = -s -lcrypt -ldb1
+LDFLAGS = -s -lcrypt
PROJ = popa3d
@@ -14,7 +13,7 @@
misc.o pop_pbs.o
popa3d: $(OBJS)
- $(LD) $(LDFLAGS) $(OBJS) -o popa3d
+ $(CC) $(LDFLAGS) $(OBJS) -o popa3d
md5/md5.o: md5/md5.c md5/md5.h
$(CC) $(CFLAGS) -D_LIBC md5/md5.c -o md5/md5.o

View File

@ -1,11 +0,0 @@
--- pop_auth.c.orig Mon Jul 16 11:51:30 2001
+++ pop_auth.c Mon Jul 16 11:54:35 2001
@@ -12,6 +12,8 @@
#include "protocol.h"
#include "pop_auth.h"
+char *client_addr(int);
+
static char *pop_user, *pop_pass;
static int pop_auth_quit(char *params)

View File

@ -1,11 +0,0 @@
--- pop_pbs.c.orig Mon Jul 16 11:38:00 2001
+++ pop_pbs.c Mon Jul 16 11:41:40 2001
@@ -1,6 +1,7 @@
+#include <sys/types.h>
#include <sys/socket.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
-#include <sys/types.h>
#include <sys/stat.h>
char addr_buf[256];

View File

@ -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

View File

@ -1,37 +1,22 @@
--- params.h.orig Tue Feb 1 09:16:24 2000
+++ params.h Sat Mar 4 16:12:48 2000
@@ -33,7 +33,7 @@
* An unprivileged dummy user to run as before authentication. The user
* and its UID must not be used for any other purpose.
--- params.h.orig Tue Oct 16 06:10:34 2001
+++ params.h Sat Dec 22 11:57:52 2001
@@ -99,7 +99,7 @@
* A pseudo-user to run as before authentication. The user and its UID
* must not be used for any other purpose.
*/
-#define POP_USER "popa3d"
-#define POP_USER POP_SERVER
+#define POP_USER "pop"
/*
* Sessions will be closed if idle for longer than POP_TIMEOUT seconds.
@@ -62,7 +62,7 @@
* Do we have shadow passwords? (Not for *BSD.)
* Note: password aging is not supported.
* An empty directory to chroot to before authentication. The directory
@@ -142,8 +142,8 @@
*
* Note that there's no built-in password aging support.
*/
-#define AUTH_PASSWD 0
-#define AUTH_SHADOW 1
+#define AUTH_PASSWD 1
+#define AUTH_SHADOW 0
#define AUTH_PAM 0
#define AUTH_PAM_USERPASS 0
/*
* A salt used to waste some CPU time on dummy crypt(3) calls and make
@@ -81,14 +81,14 @@
* Your mail spool directory. Note: only local (non-NFS) mode 775 mail
* spools are currently supported.
*/
-#define MAIL_SPOOL_PATH "/var/spool/mail"
+#define MAIL_SPOOL_PATH "/var/mail"
/*
* How do we talk to syslogd? These should be fine for most systems.
*/
#define SYSLOG_IDENT "popa3d"
#define SYSLOG_OPTIONS LOG_PID
-#define SYSLOG_FACILITY LOG_DAEMON
+#define SYSLOG_FACILITY LOG_MAIL
#define SYSLOG_PRIORITY LOG_NOTICE
/*

View File

@ -1,24 +1,22 @@
--- Makefile.orig Tue Feb 1 06:56:46 2000
+++ Makefile Sat Mar 4 18:34:28 2000
@@ -1,9 +1,8 @@
--- Makefile.orig Sun Oct 28 02:10:49 2001
+++ Makefile Sat Dec 22 11:59:22 2001
@@ -1,15 +1,15 @@
-CC = gcc
-LD = gcc
+CC?= gcc
+CC? = gcc
+LD = ${CC}
RM = rm -f
CFLAGS = -c -Wall -O2 -fomit-frame-pointer
-LDFLAGS = -s
-#LDFLAGS = -s -lcrypt
+#LDFLAGS = -s
+LDFLAGS = -s -lcrypt
PROJ = popa3d
OBJS = md5/md5.o \
@@ -13,7 +12,7 @@
misc.o
popa3d: $(OBJS)
- $(LD) $(LDFLAGS) $(OBJS) -o popa3d
+ $(CC) $(LDFLAGS) $(OBJS) -o popa3d
md5/md5.o: md5/md5.c md5/md5.h
$(CC) $(CFLAGS) -D_LIBC md5/md5.c -o md5/md5.o
MKDIR = mkdir -p
INSTALL = install
-CFLAGS = -c -Wall -O2 -fomit-frame-pointer
+CFLAGS += -c -Wall -O2 -fomit-frame-pointer
# You may use OpenSSL's MD5 routines instead of the ones supplied here
#CFLAGS += -DHAVE_OPENSSL
LDFLAGS = -s
LIBS =
# Linux with glibc, FreeBSD, NetBSD
-#LIBS += -lcrypt
+LIBS += -lcrypt
# HP-UX trusted system
#LIBS += -lsec
# Solaris (POP_STANDALONE, POP_VIRTUAL)

View File

@ -0,0 +1,184 @@
--- Makefile.orig Sat Dec 22 12:00:30 2001
+++ Makefile Sat Dec 22 12:20:30 2001
@@ -39,6 +39,9 @@
misc.o \
md5/md5.o
+OBJS += pop_db.o
+CFLAGS += -DPOPB4SMTP -DVALIDTIME=600
+
all: $(PROJ)
popa3d: $(OBJS)
--- pop_auth.c.orig Thu Sep 6 01:52:35 2001
+++ pop_auth.c Sat Dec 22 17:41:02 2001
@@ -14,6 +14,7 @@
#if POP_VIRTUAL
#include "virtual.h"
#endif
+#include "pop_db.h"
static char *pop_user, *pop_pass;
@@ -75,15 +76,17 @@
#if POP_VIRTUAL
if (virtual_domain) {
syslog(result == AUTH_OK ? SYSLOG_PRI_LO : SYSLOG_PRI_HI,
- "Authentication %s for %s@%s",
+ "Authentication %s for %s@%s from %s",
result == AUTH_OK ? "passed" : "failed",
user ? user : "UNKNOWN USER",
- virtual_domain);
+ virtual_domain,
+ client_addr(1) );
return;
}
#endif
syslog(result == AUTH_OK ? SYSLOG_PRI_LO : SYSLOG_PRI_HI,
- "Authentication %s for %s",
+ "Authentication %s for %s from %s",
result == AUTH_OK ? "passed" : "failed",
- user ? user : "UNKNOWN USER");
+ user ? user : "UNKNOWN USER",
+ client_addr(1));
}
--- pop_db.c.orig Sat Dec 22 15:55:37 2001
+++ pop_db.c Sat Dec 22 17:41:50 2001
@@ -0,0 +1,107 @@
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/stat.h>
+
+#ifdef POPB4SMTP
+#include <fcntl.h>
+#include <db.h>
+#include <time.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#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;

View File

@ -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