From 7faf9394e3b40b9561762632b02bdf48a1667df2 Mon Sep 17 00:00:00 2001 From: Roman Bogorodskiy Date: Sun, 2 Jul 2006 05:09:15 +0000 Subject: This is a simple and small POP3 daemon implementation designed for Maildir support. It have direct support for authenticating regular unix users, has UIDL command support, can access maildirs in non-default location, and have support for external (pre-)authenticators. PR: ports/99704 Submitted by: Alexander Logvinov --- mail/mdpop3d/Makefile | 45 ++++++++++++++++++ mail/mdpop3d/distinfo | 3 ++ mail/mdpop3d/files/patch-mdpop3d.c | 97 ++++++++++++++++++++++++++++++++++++++ mail/mdpop3d/pkg-descr | 4 ++ mail/mdpop3d/pkg-plist | 1 + 5 files changed, 150 insertions(+) create mode 100644 mail/mdpop3d/Makefile create mode 100644 mail/mdpop3d/distinfo create mode 100644 mail/mdpop3d/files/patch-mdpop3d.c create mode 100644 mail/mdpop3d/pkg-descr create mode 100644 mail/mdpop3d/pkg-plist (limited to 'mail/mdpop3d') diff --git a/mail/mdpop3d/Makefile b/mail/mdpop3d/Makefile new file mode 100644 index 000000000000..6342ddc3f83a --- /dev/null +++ b/mail/mdpop3d/Makefile @@ -0,0 +1,45 @@ +# New ports collection makefile for: mdpop3d +# Date created: 2 July 2006 +# Whom: Alexander Logvinov +# +# $FreeBSD$ + +PORTNAME= mdpop3d +PORTVERSION= 0.97 +CATEGORIES= mail +MASTER_SITES= ftp://ftp.corpit.ru/home/mjt/mdpop3d/ +DISTNAME= ${PORTNAME}-${PORTVERSION} + +MAINTAINER= lightsquid@logvinov.com +COMMENT= A simple and small POP3 daemon implementation with Maildir support + +MAN8= mdpop3d.8 +MANCOMPRESSED= no + +OPTIONS= PAM "Build with PAM support" off \ + APOP "Build with APOP command support (requires PAM)" off + +.include + +post-patch: + @${REINPLACE_CMD} -e 's|LIBS = -lpam -ldl|LIBS = -lpam|' \ + ${WRKSRC}/Makefile +.if defined(WITHOUT_PAM) + @${REINPLACE_CMD} -e 's|LIBS = -lpam|LIBS = -lcrypt|' \ + ${WRKSRC}/Makefile + @${REINPLACE_CMD} -e 's|DEFS = -DUSE_PAM|#DEFS = -DUSE_PAM|' \ + ${WRKSRC}/Makefile + @${REINPLACE_CMD} -e 's|OPTS = -DUSE_APOP|#OPTS = -DUSE_APOP|' \ + ${WRKSRC}/Makefile +.endif + +.if defined(WITHOUT_APOP) + @${REINPLACE_CMD} -e 's|OPTS = -DUSE_APOP|#OPTS = -DUSE_APOP|' \ + ${WRKSRC}/Makefile +.endif + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${PREFIX}/libexec + ${INSTALL_MAN} ${WRKSRC}/mdpop3d.8 ${PREFIX}/man/man8 + +.include diff --git a/mail/mdpop3d/distinfo b/mail/mdpop3d/distinfo new file mode 100644 index 000000000000..6b697ac8e0d0 --- /dev/null +++ b/mail/mdpop3d/distinfo @@ -0,0 +1,3 @@ +MD5 (mdpop3d-0.97.tar.gz) = 57f6da1c5db5e3bf3fa98c3ecbdb5fa9 +SHA256 (mdpop3d-0.97.tar.gz) = 8202012c82d0880e1362e44cdfbbb69d0ed589087b468eda7b0466c49ade39fc +SIZE (mdpop3d-0.97.tar.gz) = 17110 diff --git a/mail/mdpop3d/files/patch-mdpop3d.c b/mail/mdpop3d/files/patch-mdpop3d.c new file mode 100644 index 000000000000..8b96d69dc1e2 --- /dev/null +++ b/mail/mdpop3d/files/patch-mdpop3d.c @@ -0,0 +1,97 @@ +--- mdpop3d.c.orig Tue Feb 27 00:12:50 2001 ++++ mdpop3d.c Sun Jul 2 10:31:40 2006 +@@ -67,8 +67,8 @@ + #ifdef USE_APOP + # error APOP requires PAM + #endif +-#include +-#include ++#include ++#include + #endif + + static const char *rhost; /* = NULL; remote host/addr for logging */ +@@ -258,7 +258,7 @@ + } + + static void info() { +- putline(OK "maildir: %d message(s) %ld octet(s)", cmsg, msgsz); ++ putline(OK "maildir: %d message(s) %ld octet(s)", cmsg, (long int)msgsz); + } + + static char *msgfn(int n) { +@@ -397,7 +397,8 @@ + int r; + struct popdata d; + const char *u = NULL; +- ++ const char **ptr_u = &u; ++ + d.pass = pass; + d.msg = NULL; + convstruct.appdata_ptr = &d; +@@ -416,7 +417,7 @@ + PAMOK(pam_set_item(pamh, PAM_RHOST, rhost)) && + PAMOK(pam_authenticate(pamh, 0)) && + PAMOK(pam_acct_mgmt(pamh, 0)) && +- PAMOK(pam_get_item(pamh, PAM_USER, (const void **)&u))) { ++ PAMOK(pam_get_item(pamh, PAM_USER, (const void **)ptr_u))) { + pw = getpwnam(u && *u ? u : user); /* use username from pam if any */ + if (!maildir) /* try to get MAILDIR from PAM */ + maildir = pam_getenv(pamh, maildirenv); +@@ -450,22 +451,17 @@ + return NULL; + + #else /* !USE_PAM */ +- +- char *p; +- if ((pw = getpwnam(user)) != NULL) { +- p = pw->pw_passwd; +- if (!p || !strcmp(p, "x")) { +- struct spwd *sp = getspnam(user); +- p = sp ? sp->sp_pwdp : NULL; +- endspent(); +- } +- if (p && strcmp(crypt(pass, p), p) == 0) ++ ++ pw = getpwnam(user); ++ endpwent(); ++ if (pw != NULL) ++ { ++ if (pw->pw_passwd && strcmp(crypt(pass, pw->pw_passwd), pw->pw_passwd) == 0) + return pw; + syslog(LOG_INFO, "[%s] login incorrect for [%s]", rhost, user); + } + else + syslog(LOG_INFO, "[%s] user unknown: [%s]", rhost, user); +- sleep(3); + putline(ERR "login incorrect"); + return NULL; + +@@ -565,7 +561,7 @@ + *s = ':'; + } + else +- putmline("%s%d %ld", code, n+1, msgp[n]->size); ++ putmline("%s%d %ld", code, n+1, (long int)msgp[n]->size); + } + + static void finalupdate() { +@@ -621,7 +617,7 @@ + + static void finallog(const char *why) { + syslog(LOG_INFO, "[%s][%s] %s (%d/%ld msgs/bytes left, %d/%ld deleted)", +- rhost, user, why, cmsg, msgsz, o_nmsg - cmsg, o_msgsz - msgsz); ++ rhost, user, why, cmsg, (long int)msgsz, o_nmsg - cmsg, (long int)o_msgsz - (long int)msgsz); + } + + static void die(const char *why) { +@@ -932,7 +928,7 @@ + else if (a) + extraarg(), --junk; + else +- putline(OK "%d %ld", cmsg, msgsz); ++ putline(OK "%d %ld", cmsg, (long int)msgsz); + } + + else if (!strcmp(line, "top") || !strcmp(line, "retr")) { diff --git a/mail/mdpop3d/pkg-descr b/mail/mdpop3d/pkg-descr new file mode 100644 index 000000000000..e51b6e865f5b --- /dev/null +++ b/mail/mdpop3d/pkg-descr @@ -0,0 +1,4 @@ +This is a simple and small POP3 daemon implementation designed for +Maildir support. It have direct support for authenticating regular +unix users, has UIDL command support, can access maildirs in +non-default location, and have support for external (pre-)authenticators. diff --git a/mail/mdpop3d/pkg-plist b/mail/mdpop3d/pkg-plist new file mode 100644 index 000000000000..0518d3e77783 --- /dev/null +++ b/mail/mdpop3d/pkg-plist @@ -0,0 +1 @@ +libexec/mdpop3d -- cgit v1.2.3