aboutsummaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorThierry Thomas <thierry@FreeBSD.org>2014-12-14 17:56:14 +0000
committerThierry Thomas <thierry@FreeBSD.org>2014-12-14 17:56:14 +0000
commit69d0a0a2587baa86415d5b3cdc6a59afa7ae2ca1 (patch)
tree04a33ff4ac942f99bcc586ad49b302bf830b43bf /mail
parentb3ff4a92e17993b54fc5a0e0c61a4099ce92b8e5 (diff)
downloadports-69d0a0a2587baa86415d5b3cdc6a59afa7ae2ca1.tar.gz
ports-69d0a0a2587baa86415d5b3cdc6a59afa7ae2ca1.zip
Notes
Diffstat (limited to 'mail')
-rw-r--r--mail/Makefile2
-rw-r--r--mail/cclient/Makefile2
-rw-r--r--mail/imap-uw/Makefile4
-rw-r--r--mail/panda-cclient/Makefile115
-rw-r--r--mail/panda-cclient/distinfo2
-rw-r--r--mail/panda-cclient/files/patch-Makefile78
-rw-r--r--mail/panda-cclient/files/patch-src_osdep_unix_Makefile152
-rw-r--r--mail/panda-cclient/files/patch-src_osdep_unix_os_bsi.h21
-rw-r--r--mail/panda-cclient/pkg-descr9
-rw-r--r--mail/panda-cclient/pkg-message-ssl5
-rw-r--r--mail/panda-cclient/pkg-plist36
-rw-r--r--mail/panda-imap/Makefile131
-rw-r--r--mail/panda-imap/distinfo2
-rw-r--r--mail/panda-imap/files/imap-uw.cnf34
-rw-r--r--mail/panda-imap/files/patch-Makefile110
-rw-r--r--mail/panda-imap/files/patch-src-dmail-Makefile26
-rw-r--r--mail/panda-imap/files/patch-src-mlock-Makefile12
-rw-r--r--mail/panda-imap/files/patch-src-osdep-unix-env_unix.c11
-rw-r--r--mail/panda-imap/files/patch-src-tmail-Makefile26
-rw-r--r--mail/panda-imap/files/patch-src__imapd__imapd.811
-rw-r--r--mail/panda-imap/files/patch-src__ipopd__ipopd.814
-rw-r--r--mail/panda-imap/files/patch-src_imapd_Makefile61
-rw-r--r--mail/panda-imap/files/patch-src_imapd_imapd.c89
-rw-r--r--mail/panda-imap/files/patch-src_ipopd_Makefile41
-rw-r--r--mail/panda-imap/files/patch-src_ipopd_ipop3d.c131
-rw-r--r--mail/panda-imap/files/patch-src_mailutil_Makefile28
-rw-r--r--mail/panda-imap/files/patch-src_mtest_Makefile30
-rw-r--r--mail/panda-imap/files/patch-src_mtest_mtest.c47
-rw-r--r--mail/panda-imap/files/patch-src_osdep_unix_Makefile154
-rw-r--r--mail/panda-imap/files/patch-src_osdep_unix_os_bsi.h21
-rw-r--r--mail/panda-imap/files/pkg-message.in33
-rw-r--r--mail/panda-imap/pkg-descr6
-rw-r--r--mail/panda-imap/pkg-plist91
-rw-r--r--mail/panda-imap/pkg-req.rev23
-rw-r--r--mail/panda-imap/pkg-req.ssl27
35 files changed, 1584 insertions, 1 deletions
diff --git a/mail/Makefile b/mail/Makefile
index 7d7476b5b54b..87f80482ffe5 100644
--- a/mail/Makefile
+++ b/mail/Makefile
@@ -422,6 +422,8 @@
SUBDIR += p5-WWW-Hotmail
SUBDIR += p5-ZConf-Mail
SUBDIR += p5-qpsmtpd
+ SUBDIR += panda-cclient
+ SUBDIR += panda-imap
SUBDIR += pantomime
SUBDIR += pathalias
SUBDIR += pear-Contact_Vcard_Build
diff --git a/mail/cclient/Makefile b/mail/cclient/Makefile
index de325e8faa3d..caeb2528add5 100644
--- a/mail/cclient/Makefile
+++ b/mail/cclient/Makefile
@@ -19,6 +19,8 @@ COMMENT= Mark Crispin's C-client mail access routines
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE.txt
+CONFLICTS_INSTALL= panda-cclient-20*
+
OPTIONS_DEFINE= SSL SSL_AND_PLAINTEXT IPV6 MBX_DEFAULT
OPTIONS_DEFAULT= SSL
SSL_AND_PLAINTEXT_DESC= Allow plain text passwords and SSL
diff --git a/mail/imap-uw/Makefile b/mail/imap-uw/Makefile
index 9bc79c1cd3f4..d368033707cc 100644
--- a/mail/imap-uw/Makefile
+++ b/mail/imap-uw/Makefile
@@ -18,7 +18,9 @@ COMMENT= University of Washington IMAP4rev1/POP2/POP3 mail servers
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE.txt
-LIB_DEPENDS= libc-client4.so:${PORTSDIR}/mail/cclient
+LIB_DEPENDS= libc-client4.so.9:${PORTSDIR}/mail/cclient
+
+CONFLICTS_INSTALL= panda-imap-20*
DOCSDIR= ${PREFIX}/share/doc/${PORTNAME}${PKGNAMESUFFIX}
SUB_FILES= pkg-message
diff --git a/mail/panda-cclient/Makefile b/mail/panda-cclient/Makefile
new file mode 100644
index 000000000000..f763b515c635
--- /dev/null
+++ b/mail/panda-cclient/Makefile
@@ -0,0 +1,115 @@
+# Created by: Kelly Yancey <kbyanc@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME= cclient
+PORTVERSION= 20130621
+CATEGORIES= mail devel ipv6
+PKGNAMEPREFIX= panda-
+DISTNAME= panda-imap-${PORTVERSION}
+
+MAINTAINER= thierry@FreeBSD.org
+COMMENT= Mark Crispin's C-client mail access routines forked from UW
+
+LICENSE= APACHE20
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+USE_GITHUB= yes
+GH_ACCOUNT= jonabbey
+GH_PROJECT= ${PORTNAME}
+GH_TAGNAME= ${GH_COMMIT}
+GH_COMMIT= 7905901
+
+CONFLICTS_INSTALL= cclient-20*
+
+OPTIONS_DEFINE= SSL SSL_AND_PLAINTEXT IPV6 MBX_DEFAULT
+OPTIONS_DEFAULT= SSL
+SSL_AND_PLAINTEXT_DESC= Allow plain text passwords and SSL
+MBX_DEFAULT_DESC= Use MBX as default mailbox format
+
+MAKE_JOBS_UNSAFE= yes
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MSSL}
+USE_OPENSSL= yes
+PKGMESSAGE= pkg-message-ssl
+.endif
+
+.include <bsd.port.pre.mk>
+
+USE_LDCONFIG= yes
+ALL_TARGET= bsf
+.if ! ${PORT_OPTIONS:MSSL}
+MAKE_ARGS+= SSLTYPE=none SSLDIR=${OPENSSLBASE}
+.else
+.if ${PORT_OPTIONS:MSSL_AND_PLAINTEXT}
+MAKE_ARGS+= SSLTYPE=unix SSLDIR=${OPENSSLDIR}
+.else
+MAKE_ARGS+= SSLTYPE=unix.nopwd SSLDIR=${OPENSSLDIR}
+.endif
+.endif
+
+WRKSRC= ${WRKDIR}/${GH_ACCOUNT}-${DISTNAME:C|${PORTVERSION}|${GH_COMMIT}|}
+MAKE_ARGS+= EXTRACFLAGS="${CFLAGS}"
+
+SHLIBBASE= c-client4
+SHLIBMAJ= 10
+SHLIBNAME= lib${SHLIBBASE}.so.${SHLIBMAJ}
+MAKE_ENV+= SHLIBNAME=${SHLIBNAME} SHLIBBASE=${SHLIBBASE}
+PLIST_SUB= SHLIBNAME=${SHLIBNAME} SHLIBBASE=${SHLIBBASE}
+
+pre-configure:
+.for file in Makefile src/osdep/unix/Makefile src/osdep/unix/Makefile.gss
+ ${REINPLACE_CMD} -e "s|/usr/local|${PREFIX}|g" ${WRKSRC}/${file}
+.endfor
+ ${REINPLACE_CMD} -e "s:/etc/ssl/certs:${PREFIX}/certs:g; \
+ s:/etc/ssl/private:${PREFIX}/certs:g" ${WRKSRC}/Makefile
+ ${REINPLACE_CMD} -e "s:/etc/c-client.cf:${PREFIX}/etc/c-client.cf:" \
+ ${WRKSRC}/src/osdep/unix/env_unix.h
+.if ${PORT_OPTIONS:MSSL}
+ ${REINPLACE_CMD} -e " \
+ s:SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib:SSLINCLUDE=${OPENSSLINC} SSLLIB=${OPENSSLLIB}: \
+ " ${WRKSRC}/Makefile
+.endif
+.if ${PORT_OPTIONS:MIPV6}
+ ${REINPLACE_CMD} -e "s|^IP=4|IP=6|" ${WRKSRC}/Makefile \
+ ${WRKSRC}/src/osdep/unix/Makefile
+.endif
+.if ${PORT_OPTIONS:MMBX_DEFAULT}
+ ${REINPLACE_CMD} -e "s|^CREATEPROTO=unixproto|CREATEPROTO=mbxproto|" \
+ ${WRKSRC}/src/osdep/unix/Makefile
+.endif
+
+post-configure:
+ @${ECHO_MSG} ">> The c-client shared library will be named ${SHLIBNAME}"
+
+HEADERS= c-client.h dummy.h env.h env_unix.h fdstring.h flockcyg.h \
+ flocksim.h flstring.h fs.h ftl.h imap4r1.h linkage.c linkage.h \
+ mail.h misc.h netmsg.h newsrc.h nl.h nntp.h osdep.h pseudo.h \
+ rfc822.h smtp.h sslio.h tcp.h tcp_unix.h unix.h utf8.h \
+ utf8aux.h
+PORTREV_H= ${WRKDIR}/portrevision.h
+
+post-build:
+ @${ECHO_CMD} "#define CCLIENT_PORTVERSION \"${PORTVERSION}\"" >${PORTREV_H}
+.if ${PORT_OPTIONS:MSSL}
+ @${ECHO_CMD} "#define CCLIENT_SSLENABLED \"yes\"" >>${PORTREV_H}
+.else
+ @${ECHO_CMD} "#define CCLIENT_SSLENABLED \"no\"" >>${PORTREV_H}
+.endif
+
+do-install:
+ ${MKDIR} ${STAGEDIR}${PREFIX}/include/c-client
+.for f in ${HEADERS}
+ ${INSTALL_DATA} ${WRKSRC}/c-client/${f} ${STAGEDIR}${PREFIX}/include/c-client
+.endfor
+ ${INSTALL_LIB} ${WRKSRC}/c-client/${SHLIBNAME} ${STAGEDIR}${PREFIX}/lib
+ ${LN} -sf ${SHLIBNAME} ${STAGEDIR}${PREFIX}/lib/lib${SHLIBBASE}.so
+ ${INSTALL_DATA} ${WRKSRC}/c-client/c-client.a \
+ ${STAGEDIR}${PREFIX}/lib/lib${SHLIBBASE}.a
+ ${INSTALL_DATA} ${WRKSRC}/c-client/CFLAGS ${STAGEDIR}${PREFIX}/include/c-client
+ ${INSTALL_DATA} ${WRKSRC}/c-client/LDFLAGS ${STAGEDIR}${PREFIX}/include/c-client
+ ${INSTALL_DATA} ${WRKSRC}/c-client/OSCFLAGS ${STAGEDIR}${PREFIX}/include/c-client
+ ${INSTALL_DATA} ${PORTREV_H} ${STAGEDIR}${PREFIX}/include/c-client
+
+.include <bsd.port.post.mk>
diff --git a/mail/panda-cclient/distinfo b/mail/panda-cclient/distinfo
new file mode 100644
index 000000000000..4c9501f1047c
--- /dev/null
+++ b/mail/panda-cclient/distinfo
@@ -0,0 +1,2 @@
+SHA256 (panda-imap-20130621.tar.gz) = 75696352efb56ac1c652e8df4f54ea6c3160fd6aa2cf078f793fac06733bc5b1
+SIZE (panda-imap-20130621.tar.gz) = 2065425
diff --git a/mail/panda-cclient/files/patch-Makefile b/mail/panda-cclient/files/patch-Makefile
new file mode 100644
index 000000000000..1e10918790a8
--- /dev/null
+++ b/mail/panda-cclient/files/patch-Makefile
@@ -0,0 +1,78 @@
+*** Makefile.orig Wed May 9 00:50:45 2007
+--- Makefile Mon Jul 23 16:02:26 2007
+***************
+*** 294,300 ****
+
+ # Make the IMAP Toolkit
+
+! all: c-client SPECIALS rebuild bundled
+
+ c-client:
+ @echo Not processed yet. In a first-time build, you must specify
+--- 294,300 ----
+
+ # Make the IMAP Toolkit
+
+! all: c-client SPECIALS rebuild
+
+ c-client:
+ @echo Not processed yet. In a first-time build, you must specify
+***************
+*** 559,567 ****
+ @echo + In order to rectify this problem, you MUST build with:
+ @echo ++ SSLTYPE=$(SSLTYPE).nopwd
+ @echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+- @echo
+- @echo Do you want to continue this build anyway? Type y or n please:
+- @$(SH) -c 'read x; case "$$x" in y) exit 0;; *) (make nounenc;exit 1);; esac'
+
+ nounenc:
+ @echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+--- 559,564 ----
+***************
+*** 582,590 ****
+ @echo ++ SSLTYPE=nopwd
+ @echo + You must also have OpenSSL or equivalent installed.
+ @echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+- @echo
+- @echo Do you want to continue this build anyway? Type y or n please:
+- @$(SH) -c 'read x; case "$$x" in y) exit 0;; *) (make nonossl;exit 1);; esac'
+
+ nonossl:
+ @echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+--- 579,584 ----
+***************
+*** 659,665 ****
+ $(TOOLS)/$@ "$(LN)" src/tmail tmail
+ $(LN) $(TOOLS)/$@ .
+
+! build: OSTYPE rebuild rebuildclean bundled
+
+ OSTYPE:
+ @$(MAKE) ip$(IP)
+--- 653,659 ----
+ $(TOOLS)/$@ "$(LN)" src/tmail tmail
+ $(LN) $(TOOLS)/$@ .
+
+! build: OSTYPE rebuild rebuildclean
+
+ OSTYPE:
+ @$(MAKE) ip$(IP)
+***************
+*** 679,686 ****
+ @$(SH) -c '(test $(BUILDTYPE) = rebuild -o $(BUILDTYPE) = `$(CAT) OSTYPE`) || (echo Already built for `$(CAT) OSTYPE` -- you must do \"make clean\" first && exit 1)'
+ @echo Rebuilding c-client for `$(CAT) OSTYPE`...
+ @$(TOUCH) SPECIALS
+! $(CD) c-client;$(MAKE) all CC=`$(CAT) CCTYPE` \
+! CFLAGS="`$(CAT) CFLAGS`" `$(CAT) SPECIALS`
+
+ rebuildclean:
+ $(SH) -c '$(RM) rebuild || true'
+--- 673,679 ----
+ @$(SH) -c '(test $(BUILDTYPE) = rebuild -o $(BUILDTYPE) = `$(CAT) OSTYPE`) || (echo Already built for `$(CAT) OSTYPE` -- you must do \"make clean\" first && exit 1)'
+ @echo Rebuilding c-client for `$(CAT) OSTYPE`...
+ @$(TOUCH) SPECIALS
+! $(CD) c-client;$(MAKE) all CFLAGS="`$(CAT) CFLAGS`" `$(CAT) SPECIALS`
+
+ rebuildclean:
+ $(SH) -c '$(RM) rebuild || true'
diff --git a/mail/panda-cclient/files/patch-src_osdep_unix_Makefile b/mail/panda-cclient/files/patch-src_osdep_unix_Makefile
new file mode 100644
index 000000000000..a86ec16f592d
--- /dev/null
+++ b/mail/panda-cclient/files/patch-src_osdep_unix_Makefile
@@ -0,0 +1,152 @@
+--- src/osdep/unix/Makefile.orig 2013-06-21 23:29:17.000000000 +0200
++++ src/osdep/unix/Makefile 2014-12-01 22:35:23.000000000 +0100
+@@ -30,9 +30,9 @@
+
+ EXTRAAUTHENTICATORS=
+ EXTRADRIVERS=mbox
+-PASSWDTYPE=std
+-SSLTYPE=nopwd
+-IP=4
++PASSWDTYPE=pam
++SSLTYPE=unix.nopwd
++IP=6
+
+
+ # The optimization level here for GCC ports is set here for a reason. It's
+@@ -56,13 +56,13 @@
+
+ # Extended flags needed for SSL. You may need to modify.
+
+-SSLDIR=/usr/local/ssl
+-SSLCERTS=$(SSLDIR)/certs
++#SSLDIR=/usr/local/ssl
++SSLCERTS=$(PREFIX)/certs
+ SSLKEYS=$(SSLCERTS)
+ SSLINCLUDE=$(SSLDIR)/include
+ SSLLIB=$(SSLDIR)/lib
+
+-SSLCRYPTO=-lcrypto
++SSLCRYPTO=-lcrypto -lcrypt
+
+ # Older versions of MIT Kerberos also have a libcrypto. If so, you may need
+ # to use this instead
+@@ -89,7 +89,7 @@
+ # AFSLDFLAGS may also need -L/usr/ucblib -lucb
+ DCECFLAGS= -DDCE_MINIMAL -DPASSWD_OVERRIDE=\"/opt/pop3/passwd/passwd\"
+ DCELDFLAGS= -ldce
+-PAMLDFLAGS= -lpam -ldl
++PAMLDFLAGS= # -lpam -lcrypt
+
+
+ # Build parameters normally set by the individual port
+@@ -132,7 +132,7 @@
+ # Commands possibly overriden by the individual port
+
+ ARRC=ar rc
+-CC=cc
++#CC=cc
+ LN=ln -s
+ RANLIB=ranlib
+
+@@ -156,7 +156,7 @@
+ dummy.o pseudo.o netmsg.o flstring.o fdstring.o \
+ rfc822.o nntp.o smtp.o imap4r1.o pop3.o \
+ unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o
+-CFLAGS=-g
++CFLAGS+=$(BASECFLAGS) $(EXTRACFLAGS)
+
+ CAT=cat
+ MAKE=make
+@@ -173,6 +173,10 @@
+ PASSWDTYPE=$(PASSWDTYPE) SSLTYPE=$(SSLTYPE) IP=$(IP)
+
+
++# Need this for the shared library rule to work correctly
++.SUFFIXES: .o .so
++SOFILES=${BINARIES:.o=.so}
++
+ # Here if no make argument established
+
+ missing: osdep.h
+@@ -261,13 +265,14 @@
+ BASECFLAGS="-g -Dconst="
+
+ bsf: # FreeBSD
+- $(BUILD) `$(CAT) SPECIALS` OS=$@ \
++ $(BUILD) `$(CAT) SPECIALS` OS=$@ CHECKPW=pam \
+ SIGTYPE=psx CRXTYPE=nfs \
+ SPOOLDIR=/var \
+ ACTIVEFILE=/usr/local/news/lib/active \
+ RSHPATH=/usr/bin/rsh \
++ LOCKPGM=$(PREFIX)/libexec/mlock \
+ BASECFLAGS="$(GCCCFLAGS)" \
+- BASELDFLAGS="-lcrypt"
++ BASELDFLAGS="-lpam"
+
+ bsi: # BSD/i386
+ $(BUILD) `$(CAT) SPECIALS` OS=$@ \
+@@ -863,23 +868,31 @@
+
+ # Build it!
+
+-build: clean once $(ARCHIVE)
++build: clean once $(ARCHIVE) $(SHLIBNAME)
+
+-all: $(ARCHIVE)
++all: $(ARCHIVE) $(SHLIBNAME)
+
+ $(ARCHIVE): $(BINARIES)
+ sh -c '$(RM) $(ARCHIVE) || true'
+ @$(CAT) ./ARCHIVE
+ @$(SH) ./ARCHIVE
+
++$(SHLIBNAME): $(SOFILES)
++ $(CC) -shared -Wl,-soname=$(SHLIBNAME) -o $(SHLIBNAME) $(SOFILES) `cat LDFLAGS`
++ $(LN) $(SHLIBNAME) lib$(SHLIBBASE).so
++
++.c.so: osdep.h
++ $(CC) -fPIC -DPIC -c `cat CFLAGS` ${@:.so=.c} -o $@
++
+ .c.o:
+- `$(CAT) CCTYPE` -c `$(CAT) CFLAGS` $*.c
++ $(CC) -c `cat CFLAGS` $*.c
+
+
+ # Cleanup
+
+ clean:
+ sh -c '$(RM) auths.c crexcl.c ip_unix.c linkage.[ch] siglocal.c osdep*.[ch] *.o ARCHIVE *FLAGS *TYPE $(ARCHIVE) || true'
++ sh -c '$(RM) *.so $(SHLIBNAME)'
+
+
+ # Dependencies
+@@ -914,7 +927,7 @@
+
+ # OS-dependent
+
+-osdep.o:mail.h misc.h env.h fs.h ftl.h nl.h tcp.h \
++OSDEPS= mail.h misc.h env.h fs.h ftl.h nl.h tcp.h \
+ osdep.h env_unix.h tcp_unix.h \
+ osdep.c env_unix.c fs_unix.c ftl_unix.c nl_unix.c tcp_unix.c ip_unix.c\
+ auths.c crexcl.c flockcyg.c flocklnx.c flocksim.c fsync.c \
+@@ -928,12 +941,19 @@
+ write.c sslstdio.c \
+ strerror.c strpbrk.c strstr.c strtok.c strtoul.c \
+ OSCFLAGS
++
++osdep.o: $(OSDEPS)
++ $(CC) `$(CAT) CFLAGS` `$(CAT) OSCFLAGS` -c osdep.c
++ @echo ========================================================================
+ @echo Building OS-dependent module
+ @echo If you get No such file error messages for files x509.h, ssl.h,
+ @echo pem.h, buffer.h, bio.h, and crypto.h, that means that OpenSSL
+ @echo is not installed on your system. Either install OpenSSL first
+ @echo or build with command: make `$(CAT) OSTYPE` SSLTYPE=none
+- `$(CAT) CCTYPE` -c `$(CAT) CFLAGS` `$(CAT) OSCFLAGS` -c osdep.c
++ @echo ========================================================================
++
++osdep.so: $(OSDEPS)
++ $(CC) -fPIC -DPIC -c `$(CAT) CFLAGS` `$(CAT) OSCFLAGS` osdep.c -o $@
+
+ osdep.c: osdepbas.c osdepckp.c osdeplog.c osdepssl.c
+ $(CAT) osdepbas.c osdepckp.c osdeplog.c osdepssl.c > osdep.c
diff --git a/mail/panda-cclient/files/patch-src_osdep_unix_os_bsi.h b/mail/panda-cclient/files/patch-src_osdep_unix_os_bsi.h
new file mode 100644
index 000000000000..ade4d1289237
--- /dev/null
+++ b/mail/panda-cclient/files/patch-src_osdep_unix_os_bsi.h
@@ -0,0 +1,21 @@
+--- src/osdep/unix/os_bsi.h.orig Wed Apr 11 10:53:03 2001
++++ src/osdep/unix/os_bsi.h Wed Apr 11 10:55:32 2001
+@@ -22,7 +22,18 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <sys/types.h>
++
++/*
++ * FreeBSD v3.x and onward whines about <sys/dir.h> being obsolete, so switch
++ * to POSIX semantics.
++ */
++#if __FreeBSD__ >= 3
++#include <dirent.h>
++#define direct dirent
++#else
+ #include <sys/dir.h>
++#endif
++
+ #include <fcntl.h>
+ #include <syslog.h>
+ #include <sys/file.h>
diff --git a/mail/panda-cclient/pkg-descr b/mail/panda-cclient/pkg-descr
new file mode 100644
index 000000000000..922dcd510fc0
--- /dev/null
+++ b/mail/panda-cclient/pkg-descr
@@ -0,0 +1,9 @@
+C-client is a common API for accessing mailboxes. It is used internally by
+the popular PINE mail reader as well as the University of Washington's IMAP
+server.
+
+This is the version forked from UW by the original author Mark Crispin.
+
+For more information, please see the UW IMAP homepage:
+
+WWW: http://www.washington.edu/imap/
diff --git a/mail/panda-cclient/pkg-message-ssl b/mail/panda-cclient/pkg-message-ssl
new file mode 100644
index 000000000000..e73be9237982
--- /dev/null
+++ b/mail/panda-cclient/pkg-message-ssl
@@ -0,0 +1,5 @@
+================================================================================
+Warning: You have chosen to include SSL support. Applications/ports that use
+the cclient library but do not support SSL may stop working or have problems
+linking. Linking them explicitly with ssl (-lssl -lcrypto) may or may not help.
+================================================================================
diff --git a/mail/panda-cclient/pkg-plist b/mail/panda-cclient/pkg-plist
new file mode 100644
index 000000000000..f948c0970bee
--- /dev/null
+++ b/mail/panda-cclient/pkg-plist
@@ -0,0 +1,36 @@
+include/c-client/c-client.h
+include/c-client/dummy.h
+include/c-client/env.h
+include/c-client/env_unix.h
+include/c-client/fdstring.h
+include/c-client/flockcyg.h
+include/c-client/flocksim.h
+include/c-client/flstring.h
+include/c-client/fs.h
+include/c-client/ftl.h
+include/c-client/imap4r1.h
+include/c-client/linkage.c
+include/c-client/linkage.h
+include/c-client/mail.h
+include/c-client/misc.h
+include/c-client/netmsg.h
+include/c-client/newsrc.h
+include/c-client/nl.h
+include/c-client/nntp.h
+include/c-client/osdep.h
+include/c-client/pseudo.h
+include/c-client/rfc822.h
+include/c-client/smtp.h
+include/c-client/sslio.h
+include/c-client/tcp.h
+include/c-client/tcp_unix.h
+include/c-client/unix.h
+include/c-client/utf8.h
+include/c-client/utf8aux.h
+include/c-client/portrevision.h
+include/c-client/CFLAGS
+include/c-client/LDFLAGS
+include/c-client/OSCFLAGS
+lib/%%SHLIBNAME%%
+lib/libc-client4.a
+lib/libc-client4.so
diff --git a/mail/panda-imap/Makefile b/mail/panda-imap/Makefile
new file mode 100644
index 000000000000..614127a2bf41
--- /dev/null
+++ b/mail/panda-imap/Makefile
@@ -0,0 +1,131 @@
+# Created by: pst
+# $FreeBSD$
+
+PORTNAME= panda-imap
+PORTVERSION= 20130621
+CATEGORIES= mail ipv6
+
+MAINTAINER= thierry@FreeBSD.org
+COMMENT= IMAP4rev1/POP2/POP3 mail servers forked from imap-uw
+
+LICENSE= APACHE20
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+LIB_DEPENDS= libc-client4.so.10:${PORTSDIR}/mail/panda-cclient
+
+USE_GITHUB= yes
+GH_ACCOUNT= jonabbey
+GH_PROJECT= ${PORTNAME}
+GH_TAGNAME= ${GH_COMMIT}
+GH_COMMIT= 7905901
+
+CONFLICTS_INSTALL= imap-uw-20*
+
+DOCSDIR= ${PREFIX}/share/doc/${PORTNAME}${PKGNAMESUFFIX}
+SUB_FILES= pkg-message
+
+MAKE_JOBS_UNSAFE= yes
+
+ALL_TARGET= bsf
+
+# This port must have the same SSL settings as mail/cclient, which it depends on
+# To make MBX format the default mailbox format, change the settings of cclient
+
+OPTIONS_DEFINE= SSL SSL_AND_PLAINTEXT DRAC NETSCAPE_BRAIN_DAMAGE DOCS
+OPTIONS_DEFAULT= SSL
+SSL_DESC= Compile with SSL support
+SSL_AND_PLAINTEXT_DESC= Allow plain text passwords and SSL
+DRAC_DESC= Dynamically open MTA for relaying
+NETSCAPE_BRAIN_DAMAGE_DESC= See Makefile for documentation
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MDRAC}
+BUILD_DEPENDS+= ${LOCALBASE}/lib/libdrac.a:${PORTSDIR}/mail/drac
+MAKE_ARGS+= WITH_DRAC=yes
+.endif
+
+.if ! ${PORT_OPTIONS:MSSL}
+MAKE_ARGS+= SSLTYPE=none SSLDIR=${OPENSSLBASE}
+.else
+USE_OPENSSL= yes
+.if ${PORT_OPTIONS:MSSL_AND_PLAINTEXT}
+MAKE_ARGS+= SSLTYPE=unix
+.else
+MAKE_ARGS+= SSLTYPE=unix.nopwd
+.endif
+.endif
+
+# Define this to get somewhat better interoperability with Netscape.
+.if ${PORT_OPTIONS:MNETSCAPE_BRAIN_DAMAGE}
+MAKE_ARGS+= WITH_NETSCAPE_BRAIN_DAMAGE=yes
+.endif
+# See src/imapd/Makefile for more information about these three options.
+
+.include <bsd.port.pre.mk>
+post-patch:
+ @${REINPLACE_CMD} -e "s:/etc/c-client.cf:${PREFIX}/etc/c-client.cf:" \
+ ${WRKSRC}/docs/imaprc.txt
+ @${RM} ${WRKSRC}/docs/imaprc.txt.bak
+
+pre-build:
+ @${SH} ${PKGREQ}.rev ${LOCALBASE}/include/c-client/portrevision.h ${PORTVERSION}
+.if ${PORT_OPTIONS:MSSL}
+ @${SH} ${PKGREQ}.ssl ${LOCALBASE}/include/c-client/portrevision.h yes
+.else
+ @${SH} ${PKGREQ}.ssl ${LOCALBASE}/include/c-client/portrevision.h no
+.endif
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/imapd/imapd ${STAGEDIR}${PREFIX}/libexec/
+ ${INSTALL_PROGRAM} ${WRKSRC}/ipopd/ipop2d ${STAGEDIR}${PREFIX}/libexec/
+ ${INSTALL_PROGRAM} ${WRKSRC}/ipopd/ipop3d ${STAGEDIR}${PREFIX}/libexec/
+ ${INSTALL} ${COPY} ${STRIP} \
+ ${WRKSRC}/mlock/mlock ${STAGEDIR}${PREFIX}/libexec
+ ${INSTALL_PROGRAM} ${WRKSRC}/mtest/mtest ${STAGEDIR}${PREFIX}/bin/mboxtest
+ ${INSTALL_MAN} \
+ ${WRKSRC}/src/imapd/imapd.8 ${STAGEDIR}${PREFIX}/man/man8/imapd.8
+ ${INSTALL_MAN} \
+ ${WRKSRC}/src/ipopd/ipopd.8 ${STAGEDIR}${PREFIX}/man/man8/ipopd.8
+ ${INSTALL_PROGRAM} ${WRKSRC}/dmail/dmail ${STAGEDIR}${PREFIX}/bin/
+ ${INSTALL_PROGRAM} ${WRKSRC}/mailutil/mailutil ${STAGEDIR}${PREFIX}/bin/
+ ${INSTALL_PROGRAM} ${WRKSRC}/tmail/tmail ${STAGEDIR}${PREFIX}/bin/
+ ${INSTALL_MAN} ${WRKSRC}/src/dmail/dmail.1 ${STAGEDIR}${PREFIX}/man/man1/
+ ${INSTALL_MAN} ${WRKSRC}/src/mailutil/mailutil.1 ${STAGEDIR}${PREFIX}/man/man1/
+ ${INSTALL_MAN} ${WRKSRC}/src/tmail/tmail.1 ${STAGEDIR}${PREFIX}/man/man1/
+
+post-install:
+ @${CAT} ${PKGMESSAGE}
+.if ${PORT_OPTIONS:MDRAC}
+ @${ECHO} "================================================================================"
+ @${ECHO} "To have DRAC working, you must create ${PREFIX}/etc/dracd.host, containing"
+ @${ECHO} "the hostname of the DRAC server:"
+ @${ECHO}
+ @${ECHO} "localhost"
+ @${ECHO} "================================================================================"
+.endif
+.if ${PORT_OPTIONS:MSSL}
+ @${ECHO}
+ @${ECHO} "To create and install a new SSL certificate for imapd and ipop3d, type \"make"
+ @${ECHO} "cert\". Or install manually in ${PREFIX}/certs."
+ @${ECHO}
+ @${ECHO} "Example inetd config for SSL only services:"
+ @${ECHO}
+ @${ECHO} "pop3s stream tcp nowait root ${PREFIX}/libexec/ipop3d ipop3d"
+ @${ECHO} "imaps stream tcp nowait root ${PREFIX}/libexec/imapd imapd"
+ @${ECHO} "================================================================================"
+.endif
+.if ${PORT_OPTIONS:MDOCS}
+ ${MKDIR} -m 0755 -p ${STAGEDIR}${DOCSDIR}
+ ${TAR} -C ${WRKSRC}/docs -cf - . | \
+ (umask 022; ${TAR} -C ${STAGEDIR}${DOCSDIR} -xf -)
+.endif
+
+cert:
+ ${INSTALL} -d -o root -g wheel -m 0755 ${PREFIX}/certs
+ openssl req -new -x509 -days 365 -nodes -config ${FILESDIR}/imap-uw.cnf -out ${PREFIX}/certs/imapd.pem -keyout ${PREFIX}/certs/imapd.pem
+ openssl x509 -subject -dates -fingerprint -noout -in ${PREFIX}/certs/imapd.pem
+ ${CHMOD} 700 ${PREFIX}/certs/imapd.pem
+ ${LN} -s ${PREFIX}/certs/imapd.pem ${PREFIX}/certs/ipop3d.pem
+
+.include <bsd.port.post.mk>
diff --git a/mail/panda-imap/distinfo b/mail/panda-imap/distinfo
new file mode 100644
index 000000000000..4c9501f1047c
--- /dev/null
+++ b/mail/panda-imap/distinfo
@@ -0,0 +1,2 @@
+SHA256 (panda-imap-20130621.tar.gz) = 75696352efb56ac1c652e8df4f54ea6c3160fd6aa2cf078f793fac06733bc5b1
+SIZE (panda-imap-20130621.tar.gz) = 2065425
diff --git a/mail/panda-imap/files/imap-uw.cnf b/mail/panda-imap/files/imap-uw.cnf
new file mode 100644
index 000000000000..06610801707b
--- /dev/null
+++ b/mail/panda-imap/files/imap-uw.cnf
@@ -0,0 +1,34 @@
+HOME= .
+RANDFILE = $ENV::HOME/.rnd
+
+[ req ]
+default_bits = 1024
+encrypt_key = yes
+distinguished_name = req_dn
+x509_extensions = cert_type
+
+[ req_dn ]
+countryName = Country Name (2 letter code)
+countryName_default = NO
+countryName_min = 2
+countryName_max = 2
+
+stateOrProvinceName = State or Province Name (full name)
+stateOrProvinceName_default = Some-State
+
+localityName = Locality Name (eg, city)
+
+0.organizationName = Organization Name (eg, company)
+0.organizationName_default = FooBar Inc.
+
+organizationalUnitName = Organizational Unit Name (eg, section)
+#organizationalUnitName_default =
+
+0.commonName = Common Name (FQDN of your server)
+
+1.commonName = Common Name (default)
+1.commonName_value = localhost
+
+[ cert_type ]
+nsCertType = server
+
diff --git a/mail/panda-imap/files/patch-Makefile b/mail/panda-imap/files/patch-Makefile
new file mode 100644
index 000000000000..1da592cee2a5
--- /dev/null
+++ b/mail/panda-imap/files/patch-Makefile
@@ -0,0 +1,110 @@
+*** Makefile.orig Wed May 9 00:50:45 2007
+--- Makefile Mon Jul 23 17:45:00 2007
+***************
+*** 164,170 ****
+ # std system standard (typically passwd file), determined by port
+ # two try alternative (defined by CHECKPWALT), then std
+
+! PASSWDTYPE=std
+
+
+ # SSL type. Defines whether or not SSL support is on this system
+--- 164,170 ----
+ # std system standard (typically passwd file), determined by port
+ # two try alternative (defined by CHECKPWALT), then std
+
+! PASSWDTYPE=pam
+
+
+ # SSL type. Defines whether or not SSL support is on this system
+***************
+*** 253,264 ****
+ # British. As of 2005, the Julian calendar and the Gregorian calendar
+ # diverge by 15 days.
+
+! EXTRACFLAGS=
+
+
+ # Extra linker flags (additional/alternative libraries, etc.)
+
+! EXTRALDFLAGS=
+
+
+ # Special make flags (e.g. to override make environment variables)
+--- 253,264 ----
+ # British. As of 2005, the Julian calendar and the Gregorian calendar
+ # diverge by 15 days.
+
+! EXTRACFLAGS=-I$(PREFIX)/include/c-client
+
+
+ # Extra linker flags (additional/alternative libraries, etc.)
+
+! EXTRALDFLAGS=-L$(PREFIX)/lib -lc-client4
+
+
+ # Special make flags (e.g. to override make environment variables)
+***************
+*** 294,306 ****
+
+ # Make the IMAP Toolkit
+
+! all: c-client SPECIALS rebuild bundled
+!
+! c-client:
+! @echo Not processed yet. In a first-time build, you must specify
+! @echo the system type so that the sources are properly processed.
+! @false
+!
+
+ SPECIALS:
+ echo $(SPECIALS) > SPECIALS
+--- 294,300 ----
+
+ # Make the IMAP Toolkit
+
+! all: bundled
+
+ SPECIALS:
+ echo $(SPECIALS) > SPECIALS
+***************
+*** 559,567 ****
+ @echo + In order to rectify this problem, you MUST build with:
+ @echo ++ SSLTYPE=$(SSLTYPE).nopwd
+ @echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+- @echo
+- @echo Do you want to continue this build anyway? Type y or n please:
+- @$(SH) -c 'read x; case "$$x" in y) exit 0;; *) (make nounenc;exit 1);; esac'
+
+ nounenc:
+ @echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+--- 553,558 ----
+***************
+*** 582,590 ****
+ @echo ++ SSLTYPE=nopwd
+ @echo + You must also have OpenSSL or equivalent installed.
+ @echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+- @echo
+- @echo Do you want to continue this build anyway? Type y or n please:
+- @$(SH) -c 'read x; case "$$x" in y) exit 0;; *) (make nonossl;exit 1);; esac'
+
+ nonossl:
+ @echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+--- 573,578 ----
+***************
+*** 659,665 ****
+ $(TOOLS)/$@ "$(LN)" src/tmail tmail
+ $(LN) $(TOOLS)/$@ .
+
+! build: OSTYPE rebuild rebuildclean bundled
+
+ OSTYPE:
+ @$(MAKE) ip$(IP)
+--- 647,653 ----
+ $(TOOLS)/$@ "$(LN)" src/tmail tmail
+ $(LN) $(TOOLS)/$@ .
+
+! build: bundled
+
+ OSTYPE:
+ @$(MAKE) ip$(IP)
diff --git a/mail/panda-imap/files/patch-src-dmail-Makefile b/mail/panda-imap/files/patch-src-dmail-Makefile
new file mode 100644
index 000000000000..ec87408b7a51
--- /dev/null
+++ b/mail/panda-imap/files/patch-src-dmail-Makefile
@@ -0,0 +1,26 @@
+--- src/dmail/Makefile.orig 2008-06-04 20:18:34.000000000 +0200
++++ src/dmail/Makefile 2009-01-16 10:28:52.000000000 +0100
+@@ -31,20 +31,12 @@
+
+ # Get local definitions from c-client directory
+
+-CC = `cat $C/CCTYPE`
+-CFLAGS = -I$C `cat $C/CFLAGS`
+-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
++CFLAGS+= -DNFSKLUDGE -I$(LOCALBASE)/include/c-client
++LDFLAGS+= -L$(LOCALBASE)/lib -lc-client4
+
+-dmail: $(CCLIENTLIB) dmail.o dquota.o
++dmail: dmail.o dquota.o
+ $(CC) $(CFLAGS) -o dmail dmail.o dquota.o $(LDFLAGS)
+
+-dmail.o: $C/mail.h $C/misc.h $C/osdep.h dquota.h
+-
+-dquota.o: dquota.h
+-
+-$(CCLIENTLIB):
+- cd $C;make
+-
+ clean:
+ rm -f *.o dmail
+
diff --git a/mail/panda-imap/files/patch-src-mlock-Makefile b/mail/panda-imap/files/patch-src-mlock-Makefile
new file mode 100644
index 000000000000..279633e872b9
--- /dev/null
+++ b/mail/panda-imap/files/patch-src-mlock-Makefile
@@ -0,0 +1,12 @@
+--- src/mlock/Makefile.orig Wed Nov 27 04:06:19 2002
++++ src/mlock/Makefile Wed Nov 27 04:09:37 2002
+@@ -22,8 +22,7 @@
+
+ # Get local definitions from c-client directory
+
+-CC = `cat $C/CCTYPE`
+-CFLAGS = `cat $C/CFLAGS`
++CFLAGS+= -DNFSKLUDGE
+
+ all: mlock
+
diff --git a/mail/panda-imap/files/patch-src-osdep-unix-env_unix.c b/mail/panda-imap/files/patch-src-osdep-unix-env_unix.c
new file mode 100644
index 000000000000..034709596f47
--- /dev/null
+++ b/mail/panda-imap/files/patch-src-osdep-unix-env_unix.c
@@ -0,0 +1,11 @@
+--- src/osdep/unix/env_unix.c.orig 2013-06-21 23:29:17.000000000 +0200
++++ src/osdep/unix/env_unix.c 2014-11-23 22:48:04.000000000 +0100
+@@ -76,7 +76,7 @@
+ static short anonymous = NIL; /* is anonymous */
+ static short blackBox = NIL; /* is a black box */
+ static short closedBox = NIL; /* is a closed box (uses chroot() jail) */
+-static long restrictBox = NIL; /* is a restricted box */
++static long restrictBox = -1; /* is a restricted box */
+ static short has_no_life = NIL; /* is a cretin with no life */
+ /* block environment init */
+ static short block_env_init = NIL;
diff --git a/mail/panda-imap/files/patch-src-tmail-Makefile b/mail/panda-imap/files/patch-src-tmail-Makefile
new file mode 100644
index 000000000000..f45c29d32d2d
--- /dev/null
+++ b/mail/panda-imap/files/patch-src-tmail-Makefile
@@ -0,0 +1,26 @@
+--- src/tmail/Makefile.orig 2008-06-04 20:18:34.000000000 +0200
++++ src/tmail/Makefile 2009-01-16 10:30:24.000000000 +0100
+@@ -31,20 +31,12 @@
+
+ # Get local definitions from c-client directory
+
+-CC = `cat $C/CCTYPE`
+-CFLAGS = -I$C `cat $C/CFLAGS`
+-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
++CFLAGS+= -DNFSKLUDGE -I$(LOCALBASE)/include/c-client
++LDFLAGS+= -L$(LOCALBASE)/lib -lc-client4
+
+-tmail: $(CCLIENTLIB) tmail.o tquota.o
++tmail: tmail.o tquota.o
+ $(CC) $(CFLAGS) -o tmail tmail.o tquota.o $(LDFLAGS)
+
+-tmail.o: $C/mail.h $C/misc.h $C/osdep.h tquota.h
+-
+-tquota.o: tquota.h
+-
+-$(CCLIENTLIB):
+- cd $C;make
+-
+ clean:
+ rm -f *.o tmail
+
diff --git a/mail/panda-imap/files/patch-src__imapd__imapd.8 b/mail/panda-imap/files/patch-src__imapd__imapd.8
new file mode 100644
index 000000000000..dfc14334836e
--- /dev/null
+++ b/mail/panda-imap/files/patch-src__imapd__imapd.8
@@ -0,0 +1,11 @@
+--- src/imapd/imapd.8.orig Sun Sep 30 16:06:25 2007
++++ src/imapd/imapd.8 Sun Sep 30 16:06:38 2007
+@@ -16,7 +16,7 @@
+ .SH NAME
+ IMAPd \- Internet Message Access Protocol server
+ .SH SYNOPSIS
+-.B /usr/etc/imapd
++.B /usr/local/libexec/imapd
+ .SH DESCRIPTION
+ .I imapd
+ is a server which supports the
diff --git a/mail/panda-imap/files/patch-src__ipopd__ipopd.8 b/mail/panda-imap/files/patch-src__ipopd__ipopd.8
new file mode 100644
index 000000000000..a712defab505
--- /dev/null
+++ b/mail/panda-imap/files/patch-src__ipopd__ipopd.8
@@ -0,0 +1,14 @@
+--- src/ipopd/ipopd.8.orig Sun Sep 30 16:08:01 2007
++++ src/ipopd/ipopd.8 Sun Sep 30 16:08:10 2007
+@@ -16,9 +16,9 @@
+ .SH NAME
+ IPOPd \- Post Office Protocol server
+ .SH SYNOPSIS
+-.B /usr/etc/ipop2d
++.B /usr/local/libexec/ipop2d
+ .PP
+-.B /usr/etc/ipop3d
++.B /usr/local/libexec/ipop3d
+ .SH DESCRIPTION
+ .I ipop2d
+ and
diff --git a/mail/panda-imap/files/patch-src_imapd_Makefile b/mail/panda-imap/files/patch-src_imapd_Makefile
new file mode 100644
index 000000000000..ef72fc24c6aa
--- /dev/null
+++ b/mail/panda-imap/files/patch-src_imapd_Makefile
@@ -0,0 +1,61 @@
+--- src/imapd/Makefile.orig 2013-06-21 23:29:17.000000000 +0200
++++ src/imapd/Makefile 2014-12-14 14:44:16.000000000 +0100
+@@ -26,11 +26,11 @@
+ # http://www.apache.org/licenses/LICENSE-2.0
+
+
+-ALERT=/etc/imapd.alert
++ALERT=$(PREFIX)/etc/imapd.alert
+ USERALERT=.imapalert
+-SHUTDOWN=/etc/nologin
+-ANO=/etc/anonymous.newsgroups
+-NNTP=/etc/imapd.nntp
++SHUTDOWN=$(PREFIX)/etc/nologin
++ANO=$(PREFIX)/etc/anonymous.newsgroups
++NNTP=$(PREFIX)//etc/imapd.nntp
+ SHELL= /bin/sh
+
+
+@@ -38,7 +38,9 @@
+ # causes the "Manage Mail" menu item to open the given URL, e.g. to point to
+ # an alternative IMAP client (e.g. Pine) or perhaps to a homebrew mail
+ # account management page.
+-#NSBD= -DNETSCAPE_BRAIN_DAMAGE=\"http://sourceforge.net/projects/re-alpine\"
++.if defined(WITH_NETSCAPE_BRAIN_DAMAGE)
++NSBD= -DNETSCAPE_BRAIN_DAMAGE=\"http://sourceforge.net/projects/re-alpine\"
++.endif
+
+ # Un-comment to enable the ESEARCH command. Unfortunately, the iOS4 Mail
+ # client misinterprets the ESEARCH results due to an ambiguity in RFC 4731.
+@@ -46,23 +48,21 @@
+
+ # Get local definitions from c-client directory
+
+-C = ../c-client
+-CCLIENTLIB = $C/c-client.a
+-CC = `cat $C/CCTYPE`
+-CFLAGS = -I$C `cat $C/CFLAGS` $(NSBD) $(ESEARCH) -DANOFILE=\"$(ANO)\" \
++CFLAGS = -DNFSKLUDGE -I$(LOCALBASE)/include/c-client $(NSBD) \
++ -DANOFILE=\"$(ANO)\" \
+ -DALERTFILE=\"$(ALERT)\" -DNNTPFILE=\"$(NNTP)\" \
+ -DUSERALERTFILE=\"$(USERALERT)\" -DSHUTDOWNFILE=\"$(SHUTDOWN)\"
+-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
++LDFLAGS+= $(EXTRALDFLAGS) -L$(LOCALBASE)/lib -lc-client4
++.if defined(WITH_DRAC)
++CFLAGS+= -DETC_DIR=\"$(PREFIX)/etc\" -DDRAC_AUTH
++LDFLAGS+= -ldrac
++.endif
+
+ all: imapd
+
+-imapd: $(CCLIENTLIB) imapd.o
++imapd: imapd.o
+ $(CC) $(CFLAGS) -o imapd imapd.o $(LDFLAGS)
+
+-imapd.o: $C/mail.h $C/misc.h $C/osdep.h
+-
+-$(CCLIENTLIB):
+- cd $C;make
+
+ clean:
+ rm -f *.o imapd || true
diff --git a/mail/panda-imap/files/patch-src_imapd_imapd.c b/mail/panda-imap/files/patch-src_imapd_imapd.c
new file mode 100644
index 000000000000..a6988d8ea9e3
--- /dev/null
+++ b/mail/panda-imap/files/patch-src_imapd_imapd.c
@@ -0,0 +1,89 @@
+--- src/imapd/imapd.c.orig 2013-06-21 23:29:17.000000000 +0200
++++ src/imapd/imapd.c 2014-11-23 22:59:07.000000000 +0100
+@@ -37,6 +37,11 @@
+ #include "newsrc.h"
+ #include <sys/stat.h>
+
++#ifdef DRAC_AUTH
++#include <netinet/in.h>
++#include <arpa/inet.h>
++#include <stdlib.h>
++#endif /* DRAC_AUTH */
+
+ #define CRLF PSOUT ("\015\012") /* primary output terpri */
+
+@@ -214,6 +219,12 @@
+
+ /* Global storage */
+
++#ifdef DRAC_AUTH
++#define DRACTIMEOUT 10*60 /* check every 10 minutes */
++time_t lastdrac = 0; /* time of last drac check */
++extern char *getenv ();
++#endif /* DRAC_AUTH */
++
+ char *version = "417"; /* edit number of this server */
+ char *logout = "Logout"; /* syslogreason for logout */
+ char *goodbye = NIL; /* bye reason */
+@@ -294,7 +305,50 @@
+ msg_string_next, /* get next byte in string structure */
+ msg_string_setpos /* set position in string structure */
+ };
+-
++
++#ifdef DRAC_AUTH
++/* DRAC Authorization
++ */
++void drac_auth ()
++{
++ if (time (0) > lastdrac + DRACTIMEOUT)
++ {
++ FILE *dracconf;
++ char host[100];
++ char *drachost;
++ char *err;
++ char *p;
++
++ if ( (dracconf = fopen(ETC_DIR "/dracd.host", "r")) == NULL)
++ {
++ syslog (LOG_INFO, "dracd: error opening %s/dracd.host config file",ETC_DIR);
++ exit(1);
++ }
++
++ fgets(host, 100, dracconf);
++ p = strchr(host, '\n');
++ if(p != NULL)
++ *p = '\0';
++ fclose(dracconf);
++
++ if( drachost = (host) )
++ {
++ struct sockaddr_in sin;
++ int sinlen = sizeof (struct sockaddr_in);
++ char *client = getpeername (0,(struct sockaddr *) &sin,(void *) &sinlen) ?
++ "UNKNOWN" : inet_ntoa (sin.sin_addr);
++
++ lastdrac = time(0);
++
++ if (dracauth(drachost, inet_addr(client), &err) != 0)
++ syslog (LOG_INFO, err);
++ else
++ syslog (LOG_INFO, "dracd: authorized ip %s", client);
++ }
++ }
++}
++#endif /* DRAC_AUTH */
++
+ /* Main program */
+
+ int main (int argc,char *argv[])
+@@ -1613,6 +1667,9 @@
+ lasterror ());
+ return;
+ }
++ #ifdef DRAC_AUTH
++ drac_auth();
++ #endif /* DRAC_AUTH */
+ /* change in number of messages? */
+ if (existsquelled || (nmsgs != stream->nmsgs)) {
+ PSOUT ("* ");
diff --git a/mail/panda-imap/files/patch-src_ipopd_Makefile b/mail/panda-imap/files/patch-src_ipopd_Makefile
new file mode 100644
index 000000000000..2464eff218fd
--- /dev/null
+++ b/mail/panda-imap/files/patch-src_ipopd_Makefile
@@ -0,0 +1,41 @@
+--- src/ipopd/Makefile.orig Wed Oct 25 01:55:07 2000
++++ src/ipopd/Makefile Mon Oct 1 03:44:26 2001
+@@ -19,29 +19,25 @@
+
+
+ C = ../c-client
+-CCLIENTLIB = $C/c-client.a
++#CCLIENTLIB = $C/c-client.a
+ SHELL = /bin/sh
+
+ # Get local definitions from c-client directory
+
+-CC = `cat $C/CCTYPE`
+-CFLAGS = -I$C `cat $C/CFLAGS`
+-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
++CFLAGS+= -DNFSKLUDGE -I$(LOCALBASE)/include/c-client
++LDFLAGS+= -L$(LOCALBASE)/lib -lc-client4
++.if defined(WITH_DRAC)
++CFLAGS+= -DDRAC_AUTH -DETC_DIR=\"$(PREFIX)/etc\"
++LDFLAGS+= -ldrac
++.endif
+
+ ipopd: ipop2d ipop3d
+
+-ipop2d: $(CCLIENTLIB) ipop2d.o
++ipop2d: ipop2d.o
+ $(CC) $(CFLAGS) -o ipop2d ipop2d.o $(LDFLAGS)
+
+-ipop3d: $(CCLIENTLIB) ipop3d.o
++ipop3d: ipop3d.o
+ $(CC) $(CFLAGS) -o ipop3d ipop3d.o $(LDFLAGS)
+-
+-ipop2d.o: $C/mail.h $C/misc.h $C/osdep.h
+-
+-ipop3d.o: $C/mail.h $C/misc.h $C/osdep.h
+-
+-$(CCLIENTLIB):
+- cd $C;make
+
+ clean:
+ rm -f *.o ipop2d ipop3d || true
diff --git a/mail/panda-imap/files/patch-src_ipopd_ipop3d.c b/mail/panda-imap/files/patch-src_ipopd_ipop3d.c
new file mode 100644
index 000000000000..a9f3715c6158
--- /dev/null
+++ b/mail/panda-imap/files/patch-src_ipopd_ipop3d.c
@@ -0,0 +1,131 @@
+--- src/ipopd/ipop3d.c.orig 2008-06-04 20:18:34.000000000 +0200
++++ src/ipopd/ipop3d.c 2009-01-16 10:19:50.000000000 +0100
+@@ -34,6 +34,11 @@
+ #include <time.h>
+ #include "c-client.h"
+
++#ifdef DRAC_AUTH
++#include <netinet/in.h>
++#include <arpa/inet.h>
++#include <stdlib.h>
++#endif /* DRAC_AUTH */
+
+ #define CRLF PSOUT ("\015\012") /* primary output terpri */
+
+@@ -59,6 +64,12 @@
+
+ /* Global storage */
+
++#ifdef DRAC_AUTH
++#define DRACTIMEOUT 10*60 /* check every 10 minutes */
++time_t lastdrac = 0; /* time of last drac check */
++extern char *getenv ();
++#endif /* DRAC_AUTH */
++
+ char *version = "104"; /* edit number of this server */
+ short state = AUTHORIZATION; /* server state */
+ short critical = NIL; /* non-zero if in critical code */
+@@ -100,7 +111,53 @@
+ int mbxopen (char *mailbox);
+ long blat (char *text,long lines,unsigned long size,STRING *st);
+ void rset ();
+-
++#ifdef DRAC_AUTH
++void drac_auth();
++#endif /* DRAC_AUTH */
++
++#ifdef DRAC_AUTH
++/* DRAC Authorization
++ */
++void drac_auth ()
++{
++ if (time (0) > lastdrac + DRACTIMEOUT)
++ {
++ FILE *dracconf;
++ char host[100];
++ char *drachost;
++ char *err;
++ char *p;
++
++ if ( (dracconf = fopen(ETC_DIR "/dracd.host", "r")) == NULL)
++ {
++ syslog (LOG_INFO, "dracd: error opening %s/dracd.host config file",ETC_DIR);
++ exit(1);
++ }
++
++ fgets(host, 100, dracconf);
++ p = strchr(host, '\n');
++ if(p != NULL)
++ *p = '\0';
++ fclose(dracconf);
++
++ if( drachost = (host) )
++ {
++ struct sockaddr_in sin;
++ int sinlen = sizeof (struct sockaddr_in);
++ char *client = getpeername (0,(struct sockaddr *) &sin,(void *) &sinlen) ?
++ "UNKNOWN" : inet_ntoa (sin.sin_addr);
++
++ lastdrac = time(0);
++
++ if (dracauth(drachost, inet_addr(client), &err) != 0)
++ syslog (LOG_INFO, err);
++ else
++ syslog (LOG_INFO, "dracd: authorized ip %s", client);
++ }
++ }
++}
++#endif /* DRAC_AUTH */
++
+ /* Main program */
+
+ int main (int argc,char *argv[])
+@@ -113,7 +170,7 @@
+ (((s = strrchr (argv[0],'/')) || (s = strrchr (argv[0],'\\'))) ?
+ s+1 : argv[0]) : "ipop3d";
+ /* set service name before linkage */
+- mail_parameters (NIL,SET_SERVICENAME,(void *) "pop");
++ mail_parameters (NIL,SET_SERVICENAME,(void *) "pop3");
+ #include "linkage.c"
+ /* initialize server */
+ server_init (pgmname,"pop3","pop3s",clkint,kodint,hupint,trmint,NIL);
+@@ -228,9 +285,13 @@
+ syslog (LOG_INFO,"AUTHENTICATE %s failure host=%.80s",s,
+ tcp_clienthost ());
+ }
+- else if ((state = mbxopen ("INBOX")) == TRANSACTION)
++ else if ((state = mbxopen ("INBOX")) == TRANSACTION) {
++ #ifdef DRAC_AUTH
++ drac_auth();
++ #endif /* DRAC_AUTH */
+ syslog (LOG_INFO,"Auth user=%.80s host=%.80s nmsgs=%lu/%lu",
+ user,tcp_clienthost (),nmsgs,stream->nmsgs);
++ }
+ else syslog (LOG_INFO,"Auth user=%.80s host=%.80s no mailbox",
+ user,tcp_clienthost ());
+ }
+@@ -260,9 +321,13 @@
+ PSOUT ("-ERR Missing APOP argument\015\012");
+ else if (!(user = apop_login (challenge,s,t,argc,argv)))
+ PSOUT ("-ERR Bad APOP\015\012");
+- else if ((state = mbxopen ("INBOX")) == TRANSACTION)
++ else if ((state = mbxopen ("INBOX")) == TRANSACTION) {
++ #ifdef DRAC_AUTH
++ drac_auth();
++ #endif /* DRAC_AUTH */
+ syslog (LOG_INFO,"APOP user=%.80s host=%.80s nmsgs=%lu/%lu",
+ user,tcp_clienthost (),nmsgs,stream->nmsgs);
++ }
+ else syslog (LOG_INFO,"APOP user=%.80s host=%.80s no mailbox",
+ user,tcp_clienthost ());
+ }
+@@ -665,6 +730,9 @@
+ /* attempt the login */
+ if (server_login (user,pass,t,argc,argv)) {
+ int ret = mbxopen ("INBOX");
++ #ifdef DRAC_AUTH
++ drac_auth();
++ #endif /* DRAC_AUTH */
+ if (ret == TRANSACTION) /* mailbox opened OK? */
+ syslog (LOG_INFO,"%sLogin user=%.80s host=%.80s nmsgs=%lu/%lu",
+ t ? "Admin " : "",user,tcp_clienthost (),nmsgs,stream->nmsgs);
diff --git a/mail/panda-imap/files/patch-src_mailutil_Makefile b/mail/panda-imap/files/patch-src_mailutil_Makefile
new file mode 100644
index 000000000000..eb7a3dd9f880
--- /dev/null
+++ b/mail/panda-imap/files/patch-src_mailutil_Makefile
@@ -0,0 +1,28 @@
+--- src/mailutil/Makefile.orig Tue Nov 19 01:41:46 2002
++++ src/mailutil/Makefile Wed Nov 27 03:51:27 2002
+@@ -19,22 +19,15 @@
+
+
+ C = ../c-client
+-CCLIENTLIB = $C/c-client.a
+ SHELL = /bin/sh
+
+ # Get local definitions from c-client directory
+
+-CC = `cat $C/CCTYPE`
+-CFLAGS = -I$C `cat $C/CFLAGS`
+-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
++CFLAGS+= -DNFSKLUDGE -I$(LOCALBASE)/include/c-client
++LDFLAGS+= -L$(LOCALBASE)/lib -lc-client4
+
+-mailutil: $(CCLIENTLIB) mailutil.o
++mailutil: mailutil.o
+ $(CC) $(CFLAGS) -o mailutil mailutil.o $(LDFLAGS)
+-
+-mailutil.o: $C/mail.h $C/misc.h $C/osdep.h
+-
+-$(CCLIENTLIB):
+- cd $C;make
+
+ clean:
+ rm -f *.o mailutil
diff --git a/mail/panda-imap/files/patch-src_mtest_Makefile b/mail/panda-imap/files/patch-src_mtest_Makefile
new file mode 100644
index 000000000000..041d6a63b98e
--- /dev/null
+++ b/mail/panda-imap/files/patch-src_mtest_Makefile
@@ -0,0 +1,30 @@
+--- src/mtest/Makefile.orig Wed Oct 25 01:55:39 2000
++++ src/mtest/Makefile Mon Oct 1 03:42:11 2001
+@@ -19,24 +19,17 @@
+
+
+ C = ../c-client
+-CCLIENTLIB = $C/c-client.a
+ SHELL = /bin/sh
+
+ # Get local definitions from c-client directory
+
+-CC = `cat $C/CCTYPE`
+-CFLAGS = -I$C `cat $C/CFLAGS`
+-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
++CFLAGS+= -DNFSKLUDGE -I$(LOCALBASE)/include/c-client
++LDFLAGS+= -L$(LOCALBASE)/lib -lc-client4
+
+ all: mtest
+
+-mtest: $(CCLIENTLIB) mtest.o
++mtest: mtest.o
+ $(CC) $(CFLAGS) -o mtest mtest.o $(LDFLAGS)
+-
+-mtest.o: $C/mail.h $C/misc.h $C/osdep.h $C/rfc822.h $C/smtp.h $C/nntp.h
+-
+-$(CCLIENTLIB):
+- cd $C;make
+
+ clean:
+ rm -f *.o mtest || true
diff --git a/mail/panda-imap/files/patch-src_mtest_mtest.c b/mail/panda-imap/files/patch-src_mtest_mtest.c
new file mode 100644
index 000000000000..a3b490909a09
--- /dev/null
+++ b/mail/panda-imap/files/patch-src_mtest_mtest.c
@@ -0,0 +1,47 @@
+--- src/mtest/mtest.c.orig Sat May 29 08:07:06 1999
++++ src/mtest/mtest.c Sun Dec 19 15:29:29 1999
+@@ -95,6 +95,7 @@
+ void status (MAILSTREAM *stream);
+ void prompt (char *msg,char *txt);
+ void smtptest (long debug);
++char *safegets(char *buf);
+
+ /* Main program - initialization */
+
+@@ -528,7 +529,7 @@
+ void prompt (char *msg,char *txt)
+ {
+ printf ("%s",msg);
+- gets (txt);
++ safegets (txt);
+ }
+
+ /* Interfaces to C-client */
+@@ -713,7 +714,7 @@
+ puts (" Msg (end with a line with only a '.'):");
+ body->type = TYPETEXT;
+ *text = '\0';
+- while (gets (line)) {
++ while (safegets (line)) {
+ if (line[0] == '.') {
+ if (line[1] == '\0') break;
+ else strcat (text,".");
+@@ -744,4 +745,18 @@
+ else puts ("[Can't open connection to any server]");
+ mail_free_envelope (&msg);
+ mail_free_body (&body);
++}
++
++char *safegets(char *buf) {
++ char *p;
++
++ if (!fgets(buf, MAILTMPLEN, stdin)) {
++ return NULL;
++ }
++
++ if ((p = strchr(buf, '\n')) != NULL) {
++ *p = '\0';
++ }
++
++ return buf;
+ }
diff --git a/mail/panda-imap/files/patch-src_osdep_unix_Makefile b/mail/panda-imap/files/patch-src_osdep_unix_Makefile
new file mode 100644
index 000000000000..d81228f915c0
--- /dev/null
+++ b/mail/panda-imap/files/patch-src_osdep_unix_Makefile
@@ -0,0 +1,154 @@
+*** src/osdep/unix/Makefile.orig Sun Jun 17 17:37:44 2007
+--- src/osdep/unix/Makefile Mon Jul 23 17:34:03 2007
+***************
+*** 54,66 ****
+
+ # Extended flags needed for SSL. You may need to modify.
+
+! SSLDIR=/usr/local/ssl
+! SSLCERTS=$(SSLDIR)/certs
+ SSLKEYS=$(SSLCERTS)
+ SSLINCLUDE=$(SSLDIR)/include
+ SSLLIB=$(SSLDIR)/lib
+
+! SSLCRYPTO=-lcrypto
+
+ # Older versions of MIT Kerberos also have a libcrypto. If so, you may need
+ # to use this instead
+--- 54,66 ----
+
+ # Extended flags needed for SSL. You may need to modify.
+
+! #SSLDIR=/usr/local/ssl
+! SSLCERTS=$(PREFIX)/certs
+ SSLKEYS=$(SSLCERTS)
+ SSLINCLUDE=$(SSLDIR)/include
+ SSLLIB=$(SSLDIR)/lib
+
+! SSLCRYPTO=-lcrypto -lcrypt
+
+ # Older versions of MIT Kerberos also have a libcrypto. If so, you may need
+ # to use this instead
+***************
+*** 73,79 ****
+
+ SSLCFLAGS= -I$(SSLINCLUDE) -I$(SSLINCLUDE)/openssl\
+ -DSSL_CERT_DIRECTORY=\"$(SSLCERTS)\" -DSSL_KEY_DIRECTORY=\"$(SSLKEYS)\"
+! SSLLDFLAGS= -L$(SSLLIB) -lssl $(SSLCRYPTO) $(SSLRSA)
+
+
+ # Extended flags needed for non-standard passwd types. You may need to modify.
+--- 73,79 ----
+
+ SSLCFLAGS= -I$(SSLINCLUDE) -I$(SSLINCLUDE)/openssl\
+ -DSSL_CERT_DIRECTORY=\"$(SSLCERTS)\" -DSSL_KEY_DIRECTORY=\"$(SSLKEYS)\"
+! SSLLDFLAGS= # -L$(SSLLIB) -lssl $(SSLCRYPTO) $(SSLRSA)
+
+
+ # Extended flags needed for non-standard passwd types. You may need to modify.
+***************
+*** 87,93 ****
+ # AFSLDFLAGS may also need -L/usr/ucblib -lucb
+ DCECFLAGS= -DDCE_MINIMAL -DPASSWD_OVERRIDE=\"/opt/pop3/passwd/passwd\"
+ DCELDFLAGS= -ldce
+! PAMLDFLAGS= -lpam -ldl
+
+
+ # Build parameters normally set by the individual port
+--- 87,93 ----
+ # AFSLDFLAGS may also need -L/usr/ucblib -lucb
+ DCECFLAGS= -DDCE_MINIMAL -DPASSWD_OVERRIDE=\"/opt/pop3/passwd/passwd\"
+ DCELDFLAGS= -ldce
+! PAMLDFLAGS= # -lpam -lcrypt
+
+
+ # Build parameters normally set by the individual port
+***************
+*** 125,131 ****
+ # Commands possibly overriden by the individual port
+
+ ARRC=ar rc
+! CC=cc
+ LN=ln -s
+ RANLIB=ranlib
+
+--- 125,131 ----
+ # Commands possibly overriden by the individual port
+
+ ARRC=ar rc
+! CC?=cc
+ LN=ln -s
+ RANLIB=ranlib
+
+***************
+*** 149,155 ****
+ dummy.o pseudo.o netmsg.o flstring.o fdstring.o \
+ rfc822.o nntp.o smtp.o imap4r1.o pop3.o \
+ unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o
+! CFLAGS=-g
+
+ CAT=cat
+ MAKE=make
+--- 149,155 ----
+ dummy.o pseudo.o netmsg.o flstring.o fdstring.o \
+ rfc822.o nntp.o smtp.o imap4r1.o pop3.o \
+ unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o
+! CFLAGS+=$(BASECFLAGS) $(EXTRACFLAGS)
+
+ CAT=cat
+ MAKE=make
+***************
+*** 232,237 ****
+--- 232,246 ----
+ BASECFLAGS="-g -B/usr/lib/big/ -Dvoid=char -Dconst=" \
+ RANLIB=true ARRC="ar -rc"
+
++ bfp: # FreeBSD Pluggable Authentication Modules
++ $(BUILD) `cat SPECIALS` OS=bsi SIGTYPE=psx CHECKPW=pam \
++ SPOOLDIR=/var \
++ ACTIVEFILE=/usr/local/news/lib/active \
++ RSHPATH=/usr/bin/rsh \
++ LOCKPGM=$(PREFIX)/libexec/mlock \
++ BASECFLAGS="-DNFSKLUDGE" \
++ BASELDFLAGS="-lpam -lcrypt"
++
+ bs3: # BSD/i386 3.0 or higher
+ $(BUILD) `$(CAT) SPECIALS` OS=bsi \
+ CHECKPW=bsi LOGINPW=bsi CRXTYPE=nfs \
+***************
+*** 251,258 ****
+ SPOOLDIR=/var \
+ ACTIVEFILE=/usr/local/news/lib/active \
+ RSHPATH=/usr/bin/rsh \
+ BASECFLAGS="$(GCCCFLAGS)" \
+! BASELDFLAGS="-lcrypt"
+
+ bsi: # BSD/i386
+ $(BUILD) `$(CAT) SPECIALS` OS=$@ \
+--- 260,268 ----
+ SPOOLDIR=/var \
+ ACTIVEFILE=/usr/local/news/lib/active \
+ RSHPATH=/usr/bin/rsh \
++ LOCKPGM=$(PREFIX)/libexec/mlock \
+ BASECFLAGS="$(GCCCFLAGS)" \
+! BASELDFLAGS=""
+
+ bsi: # BSD/i386
+ $(BUILD) `$(CAT) SPECIALS` OS=$@ \
+***************
+*** 842,848 ****
+
+ build: clean once $(ARCHIVE)
+
+! all: $(ARCHIVE)
+
+ $(ARCHIVE): $(BINARIES)
+ sh -c '$(RM) $(ARCHIVE) || true'
+--- 852,858 ----
+
+ build: clean once $(ARCHIVE)
+
+! all: onceenv
+
+ $(ARCHIVE): $(BINARIES)
+ sh -c '$(RM) $(ARCHIVE) || true'
diff --git a/mail/panda-imap/files/patch-src_osdep_unix_os_bsi.h b/mail/panda-imap/files/patch-src_osdep_unix_os_bsi.h
new file mode 100644
index 000000000000..4615f235b3fb
--- /dev/null
+++ b/mail/panda-imap/files/patch-src_osdep_unix_os_bsi.h
@@ -0,0 +1,21 @@
+--- src/osdep/unix/os_bsi.h.orig Sat Oct 19 20:30:04 1996
++++ src/osdep/unix/os_bsi.h Sun May 24 10:46:33 1998
+@@ -37,7 +37,18 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <sys/types.h>
++
++/*
++ * FreeBSD v3.x and onward whines about <sys/dir.h> being obsolete, so switch
++ * to POSIX semantics.
++ */
++#if __FreeBSD__ >= 3
++#include <dirent.h>
++#define direct dirent
++#else
+ #include <sys/dir.h>
++#endif
++
+ #include <fcntl.h>
+ #include <syslog.h>
+ #include <sys/file.h>
diff --git a/mail/panda-imap/files/pkg-message.in b/mail/panda-imap/files/pkg-message.in
new file mode 100644
index 000000000000..21f0badd3448
--- /dev/null
+++ b/mail/panda-imap/files/pkg-message.in
@@ -0,0 +1,33 @@
+The ipop2d, ipop3d, and imapd daemons should be invoked by your
+/etc/inetd.conf file with lines such as:
+
+pop2 stream tcp nowait root %%PREFIX%%/libexec/ipop2d ipop2d
+pop3 stream tcp nowait root %%PREFIX%%/libexec/ipop3d ipop3d
+imap4 stream tcp nowait root %%PREFIX%%/libexec/imapd imapd
+
+If PAM authentication support has been compiled in you will need to add
+something like the following lines to /etc/pam.conf (PAM authentication is
+default):
+
+imap auth required pam_unix.so
+imap account required pam_unix.so
+imap session required pam_unix.so
+pop3 auth required pam_unix.so
+pop3 account required pam_unix.so
+pop3 session required pam_unix.so
+
+The pam_unix module does not have session support, so we do not use it for
+session management. Be sure to read up on pam.conf(5).
+
+To configure imap-uw read %%DOCSDIR%%/imaprc.txt. Particularly consider
+changing mail-subdirectory to mail to have ~/mail the default mail
+directory as is default in some MUAs, and to avoid having the whole home
+dir accessed.
+
+===> NB: IMAP-UW now rejects non-encrypted logins by default. To change this
+===> behaviour, recompile and reinstall cclient and imap-uw ports with one of
+===> the following make variables defined:
+
+WITHOUT_SSL - build without SSL/encryption support.
+WITH_SSL_AND_PLAINTEXT - build with SSL/encryption support, but allow
+non-encrypted logins.
diff --git a/mail/panda-imap/pkg-descr b/mail/panda-imap/pkg-descr
new file mode 100644
index 000000000000..8d2d08d22ee5
--- /dev/null
+++ b/mail/panda-imap/pkg-descr
@@ -0,0 +1,6 @@
+This is the IMAP4rev1 server from the University of Washington.
+Included are (almost) backwards-compatible POP2 and POP3 servers.
+
+This is the version forked from UW by the original author Mark Crispin.
+
+WWW: http://www.washington.edu/imap/
diff --git a/mail/panda-imap/pkg-plist b/mail/panda-imap/pkg-plist
new file mode 100644
index 000000000000..d2be7228b523
--- /dev/null
+++ b/mail/panda-imap/pkg-plist
@@ -0,0 +1,91 @@
+bin/dmail
+bin/mailutil
+bin/mboxtest
+bin/tmail
+libexec/imapd
+libexec/ipop2d
+libexec/ipop3d
+@(,mail,2711) libexec/mlock
+man/man1/dmail.1.gz
+man/man1/mailutil.1.gz
+man/man1/tmail.1.gz
+man/man8/ipopd.8.gz
+man/man8/imapd.8.gz
+%%PORTDOCS%%%%DOCSDIR%%/BUILD
+%%PORTDOCS%%%%DOCSDIR%%/CONFIG
+%%PORTDOCS%%%%DOCSDIR%%/FAQ.html
+%%PORTDOCS%%%%DOCSDIR%%/FAQ.txt
+%%PORTDOCS%%%%DOCSDIR%%/IPv6.txt
+%%PORTDOCS%%%%DOCSDIR%%/RELNOTES
+%%PORTDOCS%%%%DOCSDIR%%/SSLBUILD
+%%PORTDOCS%%%%DOCSDIR%%/Y2K
+%%PORTDOCS%%%%DOCSDIR%%/bugs.txt
+%%PORTDOCS%%%%DOCSDIR%%/calendar.txt
+%%PORTDOCS%%%%DOCSDIR%%/commndmt.txt
+%%PORTDOCS%%%%DOCSDIR%%/drivers.txt
+%%PORTDOCS%%%%DOCSDIR%%/formats.txt
+%%PORTDOCS%%%%DOCSDIR%%/imaprc.txt
+%%PORTDOCS%%%%DOCSDIR%%/internal.txt
+%%PORTDOCS%%%%DOCSDIR%%/locking.txt
+%%PORTDOCS%%%%DOCSDIR%%/md5.txt
+%%PORTDOCS%%%%DOCSDIR%%/mixfmt.txt
+%%PORTDOCS%%%%DOCSDIR%%/naming.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/README
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc1732.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc1733.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc2061.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc2062.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc2087.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc2088.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc2177.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc2180.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc2193.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc2195.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc2221.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc2342.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc2683.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc2971.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc3348.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc3501.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc3502.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc3503.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc3516.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc3656.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc3691.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4314.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4315.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4422.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4466.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4467.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4468.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4469.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4505.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4549.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4551.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4616.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4731.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4752.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4790.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4959.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc4978.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5032.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5051.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5092.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5161.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5162.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5234.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5255.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5256.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5257.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5258.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5259.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5267.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5464.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5465.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5466.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5524.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5530.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5593.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5738.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5788.txt
+%%PORTDOCS%%%%DOCSDIR%%/rfc/rfc5819.txt
diff --git a/mail/panda-imap/pkg-req.rev b/mail/panda-imap/pkg-req.rev
new file mode 100644
index 000000000000..33ce1bc506fe
--- /dev/null
+++ b/mail/panda-imap/pkg-req.rev
@@ -0,0 +1,23 @@
+#! /bin/sh
+# anders@fix.no, 2001-06-19
+
+if [ ! -f "$1" ]
+then
+ echo "Your installation of the cclient port is outdated. Please delete it before"
+ echo "continuing."
+ exit 1
+fi
+
+portver=`grep "^#define CCLIENT_PORTVERSION" $1 | awk '{print $3}' \
+| sed s/\"//g`
+
+if [ "$portver" = "$2" ]
+then
+ echo "Your imap-uw port matches the version of your cclient port. Fine."
+ exit 0
+else
+ echo "Your cclient port (PORTVERSION $portver) does not match the version of imap-uw"
+ echo "(PORTVERSION $2) you are trying to install. Please delete your"
+ echo "installation of the cclient port before continuing."
+ exit 1
+fi
diff --git a/mail/panda-imap/pkg-req.ssl b/mail/panda-imap/pkg-req.ssl
new file mode 100644
index 000000000000..881c5ef9049e
--- /dev/null
+++ b/mail/panda-imap/pkg-req.ssl
@@ -0,0 +1,27 @@
+#! /bin/sh
+# anders@fix.no, 2001-06-19
+
+sslenabled=`grep "^#define CCLIENT_SSLENABLED" $1 | awk '{print $3}' \
+| sed s/\"//g`
+
+case $2 in
+yes)
+ if [ "$sslenabled" = "yes" ]
+ then
+ echo "SSL check passed. We want SSL support, and cclient has it. Good."
+ exit 0
+ else
+ echo "SSL check failed. We want SSL support, but cclient doesn't have it."
+ echo "Please recompile and reinstall the cclient port with WITH_SSL=yes set."
+ exit 1
+ fi
+ ;;
+*)
+ if [ "$sslenabled" = "yes" ]
+ then
+ echo "You did not want SSL (by not defining WITH_SSL). Funny thing is, your cclient"
+ echo "port has SSL support installed."
+ exit 0
+ fi
+ ;;
+esac