Unbreak building of bundled tools.

Install the newly bundled tools: mailutil, dmail and tmail.
Tidy.
Add WITH_SSL_AND_PLAINTEXT knob, if you want to use plaintext
passwords.

Pointy hat to:	dougb
This commit is contained in:
Anders Nordby 2002-11-27 04:11:23 +00:00
parent e493b3047d
commit e88031e534
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=71139
10 changed files with 272 additions and 175 deletions

View File

@ -15,7 +15,7 @@ MASTER_SITES= ftp://ftp.cac.washington.edu/imap/%SUBDIR%/ \
ftp://ftp.funet.fi/pub/mirrors/ftp.cac.washington.edu/mail/%SUBDIR%/
PKGNAMESUFFIX= -uw
DISTNAME= imap-${PORTVERSION}
DISTFILES= ${DISTNAME}.tar.Z imap-utils.tar.Z
EXTRACT_SUFX= .tar.Z
MAINTAINER= anders@FreeBSD.org
@ -26,82 +26,60 @@ BUILD_DEPENDS= ${LOCALBASE}/lib/libdrac.a:${PORTSDIR}/mail/drac
WRKSRC= ${WRKDIR}/${DISTNAME}
MAN1= dmail.1 mailutil.1 tmail.1
MAN8= ipopd.8 imapd.8
ALL_TARGET= bsf
.if defined(WITH_SSL)
MAKE_ARGS+= SSLTYPE=unix.nopwd
.if defined(WITHOUT_SSL)
MAKE_ARGS+= SSLTYPE=none
.else
USE_OPENSSL= yes
.if defined(WITH_SSL_AND_PLAINTEXT)
MAKE_ARGS+= SSLTYPE=unix
.else
MAKE_ARGS+= SSLTYPE=unix.nopwd
.endif
.endif
# RFC 1730 (IMAP4 as opposed to IMAP4rev1) support
.if defined(WITH_RFC1730)
MAKE_ARGS+= RFC1730="-DRFC1730"
FORBIDDEN= "RFC 1730 support enables remote buffer overflow."
.endif
# Define this to get somewhat better interoperability with Netscape.
.if defined(WITH_NETSCAPE_BRAIN_DAMAGE)
MAKE_ARGS+= WITH_NETSCAPE_BRAIN_DAMAGE=yes
.endif
# Define this to get somewhat better interoperability with Microsoft
# Outlook and Outlook Express.
.if defined(WITH_MICROSOFT_BRAIN_DAMAGE)
MAKE_ARGS+= MSBD="-DMICROSOFT_BRAIN_DAMAGE"
# Define this to get possibly better interoperability with Microsoft Entourage.
.if defined(WITH_ENTOURAGE_BRAIN_DAMAGE)
MAKE_ARGS+= WITH_ENTOURAGE_BRAIN_DAMAGE=yes
.endif
# See src/imapd/Makefile for more information about these three options.
SOURCEDIRS_IMAPUTILS= chkmail dmail icat ifrom imapcopy imapxfer mbxcopy \
mbxcreat mbxcvt tmail
.if defined(WITH_ALL_IMAPUTILS)
MAN1= chkmail.1 dmail.1 icat.1 ifrom.1 imapcopy.1 imapxfer.1 mbxcopy.1 \
mbxcreat.1 mbxcvt.1 tmail.1
PLIST_SUB+= IMAPUTILS=''
.else
PLIST_SUB+= IMAPUTILS='@comment '
.endif
.include <bsd.port.pre.mk>
pre-extract:
@${SH} ${PKGREQ}.rev ${LOCALBASE}/include/c-client/portrevision.h ${PORTVERSION}
pre-build:
.if defined(WITH_SSL)
.if !defined(WITHOUT_SSL)
@${SH} ${PKGREQ}.ssl ${LOCALBASE}/include/c-client/portrevision.h yes
.else
@${SH} ${PKGREQ}.ssl ${LOCALBASE}/include/c-client/portrevision.h no
.endif
post-build:
@(cd ${WRKDIR}/mlock; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} all)
.if defined(WITH_ALL_IMAPUTILS)
.for d in ${SOURCEDIRS_IMAPUTILS}
@${ECHO} "Building ${d}."
(cd ${WRKDIR}/${d}; ${CC} ${CFLAGS} -I${LOCALBASE}/include/c-client \
-o ${d} ${d}.c -L${LOCALBASE}/lib -lc-client4 -lssl -lcrypto)
.endfor
.endif
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/imapd/imapd ${PREFIX}/libexec
${INSTALL_PROGRAM} ${WRKSRC}/ipopd/ipop2d ${PREFIX}/libexec
${INSTALL_PROGRAM} ${WRKSRC}/ipopd/ipop3d ${PREFIX}/libexec
${INSTALL_PROGRAM} ${WRKSRC}/imapd/imapd ${PREFIX}/libexec/
${INSTALL_PROGRAM} ${WRKSRC}/ipopd/ipop2d ${PREFIX}/libexec/
${INSTALL_PROGRAM} ${WRKSRC}/ipopd/ipop3d ${PREFIX}/libexec/
${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g mail -m 2711 \
${WRKDIR}/mlock/mlock ${PREFIX}/libexec
${WRKSRC}/mlock/mlock ${PREFIX}/libexec
${INSTALL_PROGRAM} ${WRKSRC}/mtest/mtest ${PREFIX}/bin/mboxtest
${INSTALL_MAN} \
${WRKSRC}/src/imapd/imapd.8c ${PREFIX}/man/man8/imapd.8
${INSTALL_MAN} \
${WRKSRC}/src/ipopd/ipopd.8c ${PREFIX}/man/man8/ipopd.8
.if defined(WITH_ALL_IMAPUTILS)
.for d in ${SOURCEDIRS_IMAPUTILS}
@${ECHO} "Installing ${d}."
${INSTALL_PROGRAM} ${WRKDIR}/${d}/${d} ${PREFIX}/bin
${INSTALL_MAN} ${WRKDIR}/${d}/${d}.1 ${PREFIX}/man/man1
.endfor
(cd ${PREFIX}/bin; ${LN} -s imapcopy imapmove)
(cd ${PREFIX}/bin; ${LN} -s mbxcopy mbxmove)
.endif
${INSTALL_PROGRAM} ${WRKSRC}/dmail/dmail ${PREFIX}/bin/
${INSTALL_PROGRAM} ${WRKSRC}/mailutil/mailutil ${PREFIX}/bin/
${INSTALL_PROGRAM} ${WRKSRC}/tmail/tmail ${PREFIX}/bin/
${INSTALL_MAN} ${WRKSRC}/src/dmail/dmail.1 ${PREFIX}/man/man1/
${INSTALL_MAN} ${WRKSRC}/src/mailutil/mailutil.1 ${PREFIX}/man/man1/
${INSTALL_MAN} ${WRKSRC}/src/tmail/tmail.1 ${PREFIX}/man/man1/
post-install:
@${CAT} ${PKGMESSAGE}
@ -113,7 +91,7 @@ post-install:
@${ECHO} "localhost"
@${ECHO} "================================================================================"
.endif
.if defined(WITH_SSL)
.if !defined(WITHOUT_SSL)
@${ECHO} "To create and install a new SSL certificate for imapd and ipop3d, type \"make"
@${ECHO} "cert\". Or install manually in ${PREFIX}/certs."
@${ECHO}

View File

@ -1,2 +1 @@
MD5 (imap-2002.tar.Z) = ab5a7afb25cbd037b4490c42e0fe235e
MD5 (imap-utils.tar.Z) = a54772a4954ecc145a5f962d8e6012bf

View File

@ -1,5 +1,5 @@
--- src/imapd/Makefile.orig Mon Nov 18 08:48:25 2002
+++ src/imapd/Makefile Tue Nov 26 02:07:06 2002
--- src/imapd/Makefile.orig Mon Nov 18 17:48:25 2002
+++ src/imapd/Makefile Wed Nov 27 02:28:00 2002
@@ -18,10 +18,10 @@
# CPYRIGHT, included with this Distribution.
@ -24,7 +24,16 @@
@@ -44,22 +46,21 @@
@@ -38,28 +40,29 @@
# broken program does a STATUS on the selected mailbox. This shouldn't be
# necessary, and it's been reported that Entourage works without having to
# un-comment this.
-#ENBD= -DENTOURAGE_BRAIN_DAMAGE
+.if defined(WITH_ENTOURAGE_BRAIN_DAMAGE)
+ENBD= -DENTOURAGE_BRAIN_DAMAGE
+.endif
# Get local definitions from c-client directory
C = ../c-client
@ -43,7 +52,7 @@
+CFLAGS+= -DETC_DIR=\"$(PREFIX)/etc\" -DDRAC_AUTH
+LDFLAGS+= -ldrac
+.endif
+CFLAGS+= $(RFC1730) $(NSBD) $(MSBD)
+CFLAGS+= $(NSBD) $(ENBD)
all: imapd

View File

@ -1,5 +1,5 @@
--- src/ipopd/ipop3d.c.orig Tue Dec 18 13:41:46 2001
+++ src/ipopd/ipop3d.c Tue Nov 26 02:15:13 2002
--- src/ipopd/ipop3d.c.orig Tue Dec 18 22:41:46 2001
+++ src/ipopd/ipop3d.c Wed Nov 27 05:09:13 2002
@@ -28,6 +28,11 @@
#include <time.h>
#include "c-client.h"
@ -12,64 +12,111 @@
#define CRLF PSOUT ("\015\012") /* primary output terpri */
@@ -54,6 +59,13 @@
#define STATUS "Status: %s%s\015\012"
#define SLEN (sizeof (STATUS)-3)
+#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 */
+
+
@@ -57,6 +62,12 @@
/* Global storage */
@@ -696,6 +708,46 @@
}
sprintf (tmp,"+OK Mailbox open, %lu messages\015\012",nmsgs);
PSOUT (tmp);
+ {
+ #ifdef 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 */
+ }
+#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 */
+
return TRANSACTION;
}
else sayonara = "-ERR Can't get lock. Mailbox in use\015\012";
char *version = "2001.80"; /* server version */
short state = AUTHORIZATION; /* server state */
short critical = NIL; /* non-zero if in critical code */
@@ -88,7 +99,53 @@
int mbxopen (char *mailbox);
long blat (char *text,long lines,unsigned long size);
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[])
@@ -207,9 +264,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=%ld/%ld",
user,tcp_clienthost (),nmsgs,stream->nmsgs);
+ }
else syslog (LOG_INFO,"Auth user=%.80s host=%.80s no mailbox",
user,tcp_clienthost ());
}
@@ -246,9 +307,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=%ld/%ld",
user,tcp_clienthost (),nmsgs,stream->nmsgs);
+ }
else syslog (LOG_INFO,"APOP user=%.80s host=%.80s no mailbox",
user,tcp_clienthost ());
}
@@ -577,6 +642,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=%ld/%ld",
t ? "Admin " : "",user,tcp_clienthost (),nmsgs,stream->nmsgs);

View File

@ -1,5 +1,5 @@
--- src/imapd/imapd.c.orig Mon Nov 18 14:29:04 2002
+++ src/imapd/imapd.c Tue Nov 26 02:19:34 2002
--- src/imapd/imapd.c.orig Mon Nov 18 23:29:04 2002
+++ src/imapd/imapd.c Wed Nov 27 05:10:42 2002
@@ -29,6 +29,11 @@
#include "c-client.h"
#include <sys/stat.h>
@ -12,63 +12,78 @@
#define CRLF PSOUT ("\015\012") /* primary output terpri */
@@ -176,6 +181,13 @@
void mm_list_work (char *what,int delimiter,char *name,long attributes);
char *lasterror (void);
@@ -178,6 +183,12 @@
+
/* Global storage */
+#ifdef DRAC_AUTH
+#define DRACTIMEOUT 10*60 /* check every 10 minutes */
+time_t lastdrac = 0; /* time of last drac check */
+#define DRACTIMEOUT 10*60 /* check every 10 minutes */
+time_t lastdrac = 0; /* time of last drac check */
+extern char *getenv ();
+#endif /* DRAC_AUTH */
+
/* Global storage */
char *version = "2002.332"; /* version number of this server */
@@ -1184,6 +1196,45 @@
time_t alerttime = 0; /* time of last alert */
time_t sysalerttime = 0; /* time of last system alert */
@@ -238,7 +249,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[])
@@ -1184,6 +1238,9 @@
lasterror ());
return;
}
+
+#ifdef 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 */
+
+ #ifdef DRAC_AUTH
+ drac_auth();
+ #endif /* DRAC_AUTH */
/* change in number of messages? */
if (existsquelled || (nmsgs != stream->nmsgs)) {
PSOUT ("* ");

View File

@ -0,0 +1,23 @@
--- src/dmail/Makefile.orig Wed Nov 27 04:10:53 2002
+++ src/dmail/Makefile Wed Nov 27 04:12:31 2002
@@ -23,17 +23,11 @@
# 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
+dmail: dmail.o
$(CC) $(CFLAGS) -o dmail dmail.o $(LDFLAGS)
-
-dmail.o: $C/mail.h $C/misc.h $C/osdep.h
-
-$(CCLIENTLIB):
- cd $C;make
clean:
rm -f *.o dmail

View File

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

View File

@ -0,0 +1,23 @@
--- src/tmail/Makefile.orig Wed Nov 27 04:13:15 2002
+++ src/tmail/Makefile Wed Nov 27 04:14:09 2002
@@ -23,17 +23,11 @@
# 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
+tmail: tmail.o
$(CC) $(CFLAGS) -o tmail tmail.o $(LDFLAGS)
-
-tmail.o: $C/mail.h $C/misc.h $C/osdep.h
-
-$(CCLIENTLIB):
- cd $C;make
clean:
rm -f *.o tmail

View File

@ -1,5 +1,5 @@
--- src/mailutil/Makefile.Dist Mon Nov 18 16:41:46 2002
+++ src/mailutil/Makefile Tue Nov 26 02:36:10 2002
--- 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 @@

View File

@ -1,17 +1,8 @@
bin/dmail
bin/mailutil
bin/mboxtest
bin/tmail
libexec/imapd
libexec/ipop2d
libexec/ipop3d
libexec/mlock
%%IMAPUTILS%%bin/chkmail
%%IMAPUTILS%%bin/dmail
%%IMAPUTILS%%bin/icat
%%IMAPUTILS%%bin/ifrom
%%IMAPUTILS%%bin/imapcopy
%%IMAPUTILS%%bin/imapmove
%%IMAPUTILS%%bin/imapxfer
%%IMAPUTILS%%bin/mbxcopy
%%IMAPUTILS%%bin/mbxmove
%%IMAPUTILS%%bin/mbxcreat
%%IMAPUTILS%%bin/mbxcvt
%%IMAPUTILS%%bin/tmail