Index: head/mail/imap-uw/Makefile =================================================================== --- head/mail/imap-uw/Makefile (revision 490468) +++ head/mail/imap-uw/Makefile (revision 490469) @@ -1,111 +1,105 @@ # Created by: pst # $FreeBSD$ PORTNAME= imap PORTVERSION= 2007f PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= mail ipv6 MASTER_SITES= ftp://ftp.cac.washington.edu/imap/%SUBDIR%/ \ ftp://ftp.nuug.no/pub/anders/distfiles/%SUBDIR%/ \ http://atreides.freenix.no/~anders/%SUBDIR%/ \ ftp://ftp.funet.fi/pub/mirrors/ftp.cac.washington.edu/mail/%SUBDIR%/ MASTER_SITE_SUBDIR= . old PKGNAMESUFFIX= -uw MAINTAINER= ports@FreeBSD.org COMMENT= University of Washington IMAP4rev1/POP2/POP3 mail servers LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE.txt LIB_DEPENDS= libc-client4.so.9:mail/cclient CONFLICTS_INSTALL= panda-imap-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_DEFINE= SSL SSL_AND_PLAINTEXT NETSCAPE_BRAIN_DAMAGE DOCS OPTIONS_DEFAULT= SSL OPTIONS_SUB= yes 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 - -.if ${PORT_OPTIONS:MDRAC} -BUILD_DEPENDS= ${LOCALBASE}/lib/libdrac.a:mail/drac -MAKE_ARGS+= WITH_DRAC=yes -.endif .if ! ${PORT_OPTIONS:MSSL} MAKE_ARGS+= SSLTYPE=none SSLDIR=${OPENSSLBASE} .else USES+= ssl .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 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} ${FILESDIR}/pkg-req.rev ${LOCALBASE}/include/c-client/portrevision.h ${PORTVERSION} .if ${PORT_OPTIONS:MSSL} @${SH} ${FILESDIR}/pkg-req.ssl ${LOCALBASE}/include/c-client/portrevision.h yes .else @${SH} ${FILESDIR}/pkg-req.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_PROGRAM} ${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-DOCS-on: ${MKDIR} -m 0755 -p ${STAGEDIR}${DOCSDIR} @${TAR} -C ${WRKSRC}/docs -cf - . | \ (umask 022; ${TAR} -C ${STAGEDIR}${DOCSDIR} -xf -) 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 Index: head/mail/imap-uw/files/patch-src_imapd_imapd.c =================================================================== --- head/mail/imap-uw/files/patch-src_imapd_imapd.c (revision 490468) +++ head/mail/imap-uw/files/patch-src_imapd_imapd.c (nonexistent) @@ -1,89 +0,0 @@ ---- src/imapd/imapd.c.orig 2008-11-18 19:46:59.000000000 +0100 -+++ src/imapd/imapd.c 2009-01-16 10:23:02.000000000 +0100 -@@ -37,6 +37,11 @@ - #include "newsrc.h" - #include - -+#ifdef DRAC_AUTH -+#include -+#include -+#include -+#endif /* DRAC_AUTH */ - - #define CRLF PSOUT ("\015\012") /* primary output terpri */ - -@@ -207,6 +212,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 = "404"; /* edit number of this server */ - char *logout = "Logout"; /* syslogreason for logout */ - char *goodbye = NIL; /* bye reason */ -@@ -283,7 +294,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[]) -@@ -1525,6 +1579,9 @@ - lasterror ()); - return; - } -+ #ifdef DRAC_AUTH -+ drac_auth(); -+ #endif /* DRAC_AUTH */ - /* change in number of messages? */ - if (existsquelled || (nmsgs != stream->nmsgs)) { - PSOUT ("* "); Property changes on: head/mail/imap-uw/files/patch-src_imapd_imapd.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/mail/imap-uw/files/patch-src_imapd_Makefile =================================================================== --- head/mail/imap-uw/files/patch-src_imapd_Makefile (revision 490468) +++ head/mail/imap-uw/files/patch-src_imapd_Makefile (revision 490469) @@ -1,85 +1,81 @@ *** src/imapd/Makefile.orig Thu Aug 31 02:10:44 2006 --- src/imapd/Makefile Mon Jul 23 18:02:12 2007 *************** *** 25,35 **** # Last Edited: 30 August 2006 ! ALERT=/etc/imapd.alert USERALERT=.imapalert ! SHUTDOWN=/etc/nologin ! ANO=/etc/anonymous.newsgroups ! NNTP=/etc/imapd.nntp SHELL= /bin/sh --- 25,35 ---- # Last Edited: 30 August 2006 ! ALERT=$(PREFIX)/etc/imapd.alert USERALERT=.imapalert ! SHUTDOWN=$(PREFIX)/etc/nologin ! ANO=$(PREFIX)/etc/anonymous.newsgroups ! NNTP=$(PREFIX)//etc/imapd.nntp SHELL= /bin/sh *************** *** 37,64 **** # 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://www.washington.edu/pine\" # 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) $(ENBD) -DANOFILE=\"$(ANO)\" \ -DALERTFILE=\"$(ALERT)\" -DNNTPFILE=\"$(NNTP)\" \ -DUSERALERTFILE=\"$(USERALERT)\" -DSHUTDOWNFILE=\"$(SHUTDOWN)\" ! LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS` all: imapd ! imapd: $(CCLIENTLIB) 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 ---- 37,63 ---- +--- 37,59 ---- # 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. ! .if defined(WITH_NETSCAPE_BRAIN_DAMAGE) ! NSBD= -DNETSCAPE_BRAIN_DAMAGE=\"http://www.washington.edu/pine\" ! .endif # Get local definitions from c-client directory ! CFLAGS = -DNFSKLUDGE -I$(LOCALBASE)/include/c-client $(NSBD) \ ! -DANOFILE=\"$(ANO)\" \ -DALERTFILE=\"$(ALERT)\" -DNNTPFILE=\"$(NNTP)\" \ -DUSERALERTFILE=\"$(USERALERT)\" -DSHUTDOWNFILE=\"$(SHUTDOWN)\" ! LDFLAGS+= $(EXTRALDFLAGS) -L$(LOCALBASE)/lib -lc-client4 -! .if defined(WITH_DRAC) -! CFLAGS+= -DETC_DIR=\"$(PREFIX)/etc\" -DDRAC_AUTH -! LDFLAGS+= -ldrac -! .endif all: imapd ! imapd: imapd.o $(CC) $(CFLAGS) -o imapd imapd.o $(LDFLAGS) clean: rm -f *.o imapd || true Index: head/mail/imap-uw/files/patch-src_ipopd_Makefile =================================================================== --- head/mail/imap-uw/files/patch-src_ipopd_Makefile (revision 490468) +++ head/mail/imap-uw/files/patch-src_ipopd_Makefile (revision 490469) @@ -1,41 +1,37 @@ --- 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 @@ +@@ -19,29 +19,21 @@ 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 Index: head/mail/imap-uw/files/patch-src_ipopd_ipop3d.c =================================================================== --- head/mail/imap-uw/files/patch-src_ipopd_ipop3d.c (revision 490468) +++ head/mail/imap-uw/files/patch-src_ipopd_ipop3d.c (revision 490469) @@ -1,131 +1,11 @@ --- 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 - #include "c-client.h" - -+#ifdef DRAC_AUTH -+#include -+#include -+#include -+#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 @@ +@@ -113,7 +113,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); Index: head/mail/imap-uw/files/pkg-message.in =================================================================== --- head/mail/imap-uw/files/pkg-message.in (revision 490468) +++ head/mail/imap-uw/files/pkg-message.in (revision 490469) @@ -1,48 +1,43 @@ 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. -%%DRAC%%================================================================================ -%%DRAC%%To have DRAC working, you must create ${PREFIX}/etc/dracd.host, containing -%%DRAC%%the hostname of the DRAC server: -%%DRAC%% -%%DRAC%%localhost -%%DRAC%%================================================================================ +%%SSL%%================================================================================ %%SSL%% %%SSL%%To create and install a new SSL certificate for imapd and ipop3d, type \"make %%SSL%%cert\". Or install manually in ${PREFIX}/certs. %%SSL%% %%SSL%%Example inetd config for SSL only services: %%SSL%% %%SSL%%pop3s stream tcp nowait root ${PREFIX}/libexec/ipop3d ipop3d %%SSL%%imaps stream tcp nowait root ${PREFIX}/libexec/imapd imapd %%SSL%%================================================================================