1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-22 20:41:26 +00:00

* Update the imap-uw port to use PAM again, as it used to. We do have imap by

default in /etc/pam.conf, so it must be better to compile imap-uw with PAM
  authentication too no?
* Changed the PAM service name for the POP3 daemon from pop to pop3 as that is
  what we have in our default pam.conf.
* Update the port with optional DRAC support.

Approved by Maintainer

PR:		24135
Submitted by:	Anders Nordby <anders@fix.no>
This commit is contained in:
James E. Housley 2001-03-23 03:04:16 +00:00
parent 83dd1a7553
commit fb97d1d104
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=40240
7 changed files with 240 additions and 7 deletions

View File

@ -20,6 +20,9 @@ DISTFILES= ${DISTNAME}.tar.Z \
MAINTAINER= petef@databits.net
LIB_DEPENDS= c-client4.8:${PORTSDIR}/mail/cclient
.if defined(WITH_DRAC)
BUILD_DEPENDS= ${LOCALBASE}/lib/libdrac.a:${PORTSDIR}/mail/drac
.endif
MAN8= ipopd.8 imapd.8
ALL_TARGET= bsf
@ -46,6 +49,16 @@ do-install:
${INSTALL_MAN} \
${WRKSRC}/src/ipopd/ipopd.8c ${PREFIX}/man/man8/ipopd.8
.if defined(WITH_DRAC)
post-install:
@${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
post-install:
@${CAT} ${PKGMESSAGE}

View File

@ -1,5 +1,23 @@
--- src/osdep/unix/Makefile.orig Tue Oct 31 13:55:01 2000
+++ src/osdep/unix/Makefile Sun Dec 17 23:39:05 2000
--- src/osdep/unix/Makefile.old Tue Oct 31 22:55:01 2000
+++ src/osdep/unix/Makefile Sun Dec 31 19:11:17 2000
@@ -23,7 +23,7 @@
EXTRAAUTHENTICATORS=
SPECIALAUTHENTICATORS=
EXTRADRIVERS=mbox
-PASSWDTYPE=std
+PASSWDTYPE=pam
# Extended flags needed for non-standard passwd types. You may need to modify.
@@ -37,7 +37,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
# Build parameters normally set by the individual port
@@ -74,7 +74,7 @@
# Commands possibly overriden by the individual port

View File

@ -20,11 +20,17 @@
+#CCLIENTLIB = $C/c-client.a
CC = `cat $C/CCTYPE`
-CFLAGS = -I$C `cat $C/CFLAGS` $(EXTRACFLAGS) -DANOFILE=\"$(ANO)\" \
+.if defined(WITH_DRAC)
+CFLAGS = `cat $C/CFLAGS` -DANOFILE=\"$(ANO)\" -DETC_DIR=\"$(PREFIX)/etc\" \
+ -DALERTFILE=\"$(ALERT)\" -DUSERALERTFILE=\"$(USERALERT)\" -DDRAC_AUTH
+LDFLAGS = $(EXTRALDFLAGS) `cat $C/LDFLAGS` -ldrac
+.else
+CFLAGS = `cat $C/CFLAGS` -DANOFILE=\"$(ANO)\" \
-DALERTFILE=\"$(ALERT)\" -DUSERALERTFILE=\"$(USERALERT)\"
-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
+
+LDFLAGS = $(EXTRALDFLAGS) `cat $C/LDFLAGS`
+.endif
all: imapd

View File

@ -1,5 +1,5 @@
--- Makefile.orig Thu Nov 2 13:04:11 2000
+++ Makefile Mon Dec 18 01:13:25 2000
--- Makefile.old Thu Nov 2 22:04:11 2000
+++ Makefile Sun Dec 31 19:06:58 2000
@@ -43,6 +43,7 @@
# art AIX 2.2.1 for RT
# asv Altos SVR4
@ -8,6 +8,15 @@
# bs3 BSD/i386 3.0 and higher
# bsd generic BSD 4.3 (as in ancient 1980s version)
# bsf FreeBSD
@@ -153,7 +154,7 @@
# std system standard (typically passwd file), determined by port
# two try alternative (defined by CHECKPWALT), then std
-PASSWDTYPE=std
+PASSWDTYPE=pam
# The following extra compilation flags are defined. None of these flags are
@@ -272,12 +273,12 @@
# gradually-increasing intervals, starting at 2800-2900, and becoming
# permanent at 48,300.

View File

@ -1,6 +1,6 @@
--- src/ipopd/Makefile.orig Tue Apr 14 15:41:55 1998
+++ src/ipopd/Makefile Fri Jul 7 00:27:30 2000
@@ -32,29 +32,22 @@
--- src/ipopd/Makefile.old Wed Oct 25 01:55:07 2000
+++ src/ipopd/Makefile Sun Dec 31 18:23:16 2000
@@ -19,29 +19,27 @@
C = ../c-client
@ -13,8 +13,13 @@
CC = `cat $C/CCTYPE`
-CFLAGS = -I$C `cat $C/CFLAGS`
-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
+.if defined(WITH_DRAC)
+CFLAGS = `cat $C/CFLAGS` -DDRAC_AUTH -DETC_DIR=\"$(PREFIX)/etc\"
+LDFLAGS = `cat $C/LDFLAGS` -ldrac
+.else
+CFLAGS = `cat $C/CFLAGS`
+LDFLAGS = `cat $C/LDFLAGS`
+.endif
ipopd: ipop2d ipop3d

View File

@ -0,0 +1,83 @@
--- src/ipopd/ipop3d.c.old Wed Oct 25 01:15:46 2000
+++ src/ipopd/ipop3d.c Sun Jan 7 21:40:25 2001
@@ -35,6 +35,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 */
/* Autologout timer */
#define KODTIMEOUT 60*5
@@ -61,6 +66,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 = "2000.69"; /* server version */
short state = AUTHORIZATION; /* server state */
short critical = NIL; /* non-zero if in critical code */
@@ -104,7 +115,7 @@
#include "linkage.c"
/* initialize server */
server_init ((s = strrchr (argv[0],'/')) ? s + 1 : argv[0],
- "pop3","pop3s","pop",clkint,kodint,hupint,trmint);
+ "pop3","pop3s","pop3",clkint,kodint,hupint,trmint);
challenge[0] = '\0'; /* find the CRAM-MD5 authenticator */
if (i = mail_lookup_auth_name ("CRAM-MD5",NIL)) {
AUTHENTICATOR *a = mail_lookup_auth (i);
@@ -692,6 +703,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 /etc/mail/dracd.host config file");
+ 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 */
+ }
+
return TRANSACTION;
}
else sayonara = "-ERR Can't get lock. Mailbox in use\015\012";

View File

@ -0,0 +1,99 @@
--- src/imapd/imapd.c.old Sat Nov 18 05:16:29 2000
+++ src/imapd/imapd.c Sun Dec 31 18:53:25 2000
@@ -17,7 +17,7 @@
* The full text of our legal notices is contained in the file called
* CPYRIGHT, included with this Distribution.
*/
-
+
/* Primary I/O calls */
#define PBIN getchar /* primary byte input */
@@ -43,6 +43,11 @@
#include "c-client.h"
#include <sys/stat.h>
+#ifdef DRAC_AUTH
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+#endif /* DRAC_AUTH */
/* Timeouts and timers */
@@ -66,7 +71,7 @@
#define SELECT 1
#define OPEN 2
#define LOGOUT 3
-
+
/* Body text fetching */
typedef struct text_args {
@@ -98,7 +103,7 @@
char *date; /* current date */
STRING *message; /* strintstruct of message */
} MSGDATA;
-
+
/* Function prototypes */
int main (int argc,char *argv[]);
@@ -181,6 +186,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 = "2000.284"; /* version number of this server */
time_t alerttime = 0; /* time of last alert */
time_t sysalerttime = 0; /* time of last system alert */
@@ -1131,6 +1142,44 @@
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 /etc/mail/dracd.host config file");
+ 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 */
/* change in number of messages? */
if (existsquelled || (nmsgs != stream->nmsgs)) {
PSOUT ("* ");