1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-15 07:56:36 +00:00

Update to 2.3.1.

This commit is contained in:
Hajimu UMEMOTO 2005-12-20 17:35:41 +00:00
parent 5f8bdca174
commit b87fc671c6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=151663
10 changed files with 10 additions and 672 deletions

View File

@ -6,7 +6,7 @@
#
PORTNAME= cyrus-imapd
PORTVERSION= 2.3.0
PORTVERSION= 2.3.1
#PORTREVISION= 0
CATEGORIES= mail ipv6
MASTER_SITES= ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ \
@ -181,8 +181,7 @@ CONFIGURE_ARGS+=--enable-netscapehack
.endif
.if defined(WITH_DRAC)
#EXTRA_PATCHES+= ${WRKSRC}/contrib/drac_auth.patch
EXTRA_PATCHES+= ${FILESDIR}/drac_auth.patch
EXTRA_PATCHES+= ${WRKSRC}/contrib/drac_auth.patch
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-cmulocal::berkdb.m4 \
${FILESDIR}/extra-patch-cmulocal::ucdsnmp.m4 \
${FILESDIR}/extra-patch-configure.in

View File

@ -1,3 +1,3 @@
MD5 (cyrus-imapd-2.3.0.tar.gz) = db628d09f65567ffaed0e8e276ff70ed
SHA256 (cyrus-imapd-2.3.0.tar.gz) = add45a75b1f04df3cd0ccfe85ad361aa4c3a240c4fa23143bee39ef8873a49f4
SIZE (cyrus-imapd-2.3.0.tar.gz) = 2209689
MD5 (cyrus-imapd-2.3.1.tar.gz) = cde15876d5c953bba9ad9f7811aff695
SHA256 (cyrus-imapd-2.3.1.tar.gz) = 79f95ed36160056f5ca60fad312fda8c6c95eafeab44f49b360b4a02790f156c
SIZE (cyrus-imapd-2.3.1.tar.gz) = 2212999

View File

@ -1,294 +0,0 @@
Index: configure.in
diff -u configure.in.orig configure.in
--- configure.in.orig Wed Apr 13 05:05:20 2005
+++ configure.in Sat Dec 10 16:16:15 2005
@@ -1003,6 +1003,19 @@
SNMP_SUBDIRS=""
AC_SUBST(SNMP_SUBDIRS)
+dnl
+dnl Test for DRAC
+dnl
+DRACLIBS=
+AC_ARG_WITH(drac, [ --with-drac=DIR use DRAC library in <DIR> [no] ],
+ if test -d "$withval"; then
+ LDFLAGS="$LDFLAGS -L${withval}"
+ AC_CHECK_LIB(drac, dracauth,
+ AC_DEFINE(DRAC_AUTH,[],[Build DRAC support?])
+ DRACLIBS="-ldrac")
+ fi)
+AC_SUBST(DRACLIBS)
+
CMU_LIBWRAP
CMU_UCDSNMP
Index: imap/Makefile.in
diff -u imap/Makefile.in.orig imap/Makefile.in
--- imap/Makefile.in.orig Fri Nov 18 00:46:14 2005
+++ imap/Makefile.in Sat Dec 10 16:17:44 2005
@@ -66,6 +66,7 @@
SIEVE_LIBS = @SIEVE_LIBS@
IMAP_COM_ERR_LIBS = @IMAP_COM_ERR_LIBS@
LIB_WRAP = @LIB_WRAP@
+DRAC_LIBS = @DRACLIBS@
LIBS = $(IMAP_LIBS) $(IMAP_COM_ERR_LIBS)
DEPLIBS = ../lib/libcyrus.a ../lib/libcyrus_min.a @DEPLIBS@
@@ -202,17 +203,17 @@
imapd: xversion $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE)
$(CC) $(LDFLAGS) -o imapd \
$(SERVICE) $(IMAPDOBJS) mutex_fake.o \
- libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP)
+ libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP) $(DRAC_LIBS)
imapd.pure: $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE)
$(PURIFY) $(PUREOPT) $(CC) $(LDFLAGS) -o imapd.pure \
$(SERVICE) $(IMAPDOBJS) mutex_fake.o libimap.a \
- $(DEPLIBS) $(LIBS) $(LIB_WRAP)
+ $(DEPLIBS) $(LIBS) $(LIB_WRAP) $(DRAC_LIBS)
imapd.quant: $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE)
$(QUANTIFY) $(QUANTOPT) $(CC) $(LDFLAGS) -o imapd.quant \
$(SERVICE) $(IMAPDOBJS) mutex_fake.o libimap.a \
- $(DEPLIBS) $(LIBS) $(LIB_WRAP)
+ $(DEPLIBS) $(LIBS) $(LIB_WRAP) $(DRAC_LIBS) $(DRAC_LIBS)
mupdate: mupdate.o mupdate-slave.o mupdate-client.o mutex_pthread.o tls.o \
libimap.a $(DEPLIBS)
@@ -230,7 +231,7 @@
pop3d: pop3d.o proxy.o backend.o tls.o mutex_fake.o libimap.a \
$(DEPLIBS) $(SERVICE)
$(CC) $(LDFLAGS) -o pop3d pop3d.o proxy.o backend.o tls.o $(SERVICE) \
- mutex_fake.o libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP)
+ mutex_fake.o libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP) $(DRAC_LIBS)
nntpd: nntpd.o proxy.o backend.o index.o smtpclient.o spool.o tls.o \
mutex_fake.o nntp_err.o libimap.a $(DEPLIBS) $(SERVICE)
Index: imap/imapd.c
diff -u -p imap/imapd.c.orig imap/imapd.c
--- imap/imapd.c.orig Tue Nov 22 04:48:36 2005
+++ imap/imapd.c Sat Dec 10 16:16:16 2005
@@ -172,6 +172,18 @@ static struct proxy_context imapd_proxyc
1, 1, &imapd_authstate, &imapd_userisadmin, &imapd_userisproxyadmin
};
+#ifdef DRAC_AUTH
+static struct {
+ int interval; /* dracd "ping" interval; 0 = disabled */
+ unsigned long clientaddr;
+ struct prot_waitevent *event;
+} drac;
+
+extern int dracconn(char *server, char **errmsg);
+extern int dracsend(unsigned long userip, char **errmsg);
+extern int dracdisc(char **errmsg);
+#endif /* DRAC_AUTH */
+
/* current sub-user state */
static struct mailbox mboxstruct;
static struct mailbox *imapd_mailbox;
@@ -637,6 +649,23 @@ int service_init(int argc, char **argv,
idle_init();
}
+#ifdef DRAC_AUTH
+ /* setup for sending DRAC "pings" */
+ drac.event = NULL;
+ drac.interval = config_getint(IMAPOPT_DRACINTERVAL);
+ if (drac.interval < 0) drac.interval = 0;
+ if (drac.interval) {
+ char *err;
+
+ if (dracconn((char*) config_getstring(IMAPOPT_DRACHOST), &err) != 0) {
+ /* disable DRAC */
+ drac.interval = 0;
+ syslog(LOG_ERR, "dracconn: %s", err);
+ syslog(LOG_ERR, "DRAC notifications disabled");
+ }
+ }
+#endif /* DRAC_AUTH */
+
/* create connection to the SNMP listener, if available. */
snmp_connect(); /* ignore return code */
snmp_set_str(SERVER_NAME_VERSION,CYRUS_VERSION);
@@ -741,6 +770,15 @@ int service_main(int argc __attribute__(
imapd_haveaddr = 1;
}
}
+
+#ifdef DRAC_AUTH
+ if (((struct sockaddr *)&imapd_remoteaddr)->sa_family == AF_INET)
+ drac.clientaddr = ((struct sockaddr_in *)&imapd_remoteaddr)->sin_addr.s_addr;
+ else
+ drac.clientaddr = 0;
+ } else {
+ drac.clientaddr = 0;
+#endif /* DRAC_AUTH */
}
/* create the SASL connection */
@@ -783,6 +821,11 @@ int service_main(int argc __attribute__(
prot_flush(imapd_out);
snmp_increment(ACTIVE_CONNECTIONS, -1);
+#ifdef DRAC_AUTH
+ if (drac.event) prot_removewaitevent(imapd_in, drac.event);
+ drac.event = NULL;
+#endif /* DRAC_AUTH */
+
/* cleanup */
imapd_reset();
@@ -873,6 +916,10 @@ void shut_down(int code)
cyrus_done();
+#ifdef DRAC_AUTH
+ if (drac.interval) (void) dracdisc((char **)NULL);
+#endif /* DRAC_AUTH */
+
exit(code);
}
@@ -932,6 +979,35 @@ static void imapd_check(struct backend *
}
}
+#ifdef DRAC_AUTH
+/*
+ * Ping dracd every 'drac.interval' minutes
+ * to let it know that we are still connected
+ */
+struct prot_waitevent *drac_ping(struct protstream *s,
+ struct prot_waitevent *ev, void *rock)
+{
+ char *err;
+ static int nfailure = 0;
+
+ if (dracsend(drac.clientaddr, &err) != 0) {
+ syslog(LOG_ERR, "dracsend: %s", err);
+ if (++nfailure >= 3) {
+ /* can't contact dracd for 3 consecutive tries - disable DRAC */
+ prot_removewaitevent(s, ev);
+ drac.event = NULL;
+ syslog(LOG_ERR, "DRAC notifications disabled");
+ return NULL;
+ }
+ }
+ else
+ nfailure = 0;
+
+ ev->mark = time(NULL) + (drac.interval * 60);
+ return ev;
+}
+#endif /* DRAC_AUTH */
+
/*
* Top-level command loop parsing
*/
@@ -2030,6 +2106,11 @@ void cmd_login(char *tag, char *user)
prot_printf(imapd_out, "%s OK %s\r\n", tag, reply);
+#ifdef DRAC_AUTH
+ if (drac.interval && drac.clientaddr)
+ drac.event = prot_addwaitevent(imapd_in, 0 /* now */, drac_ping, NULL);
+#endif /* DRAC_AUTH */
+
/* Create telemetry log */
imapd_logfd = telemetry_log(imapd_userid, imapd_in, imapd_out, 0);
@@ -2178,6 +2259,11 @@ cmd_authenticate(char *tag, char *authty
prot_setsasl(imapd_in, imapd_saslconn);
prot_setsasl(imapd_out, imapd_saslconn);
+
+#ifdef DRAC_AUTH
+ if (drac.interval && drac.clientaddr)
+ drac.event = prot_addwaitevent(imapd_in, 0 /* now */, drac_ping, NULL);
+#endif /* DRAC_AUTH */
/* Create telemetry log */
imapd_logfd = telemetry_log(imapd_userid, imapd_in, imapd_out, 0);
Index: imap/pop3d.c
diff -u -p imap/pop3d.c.orig imap/pop3d.c
--- imap/pop3d.c.orig Sat Jun 4 08:07:46 2005
+++ imap/pop3d.c Sat Dec 10 16:16:16 2005
@@ -103,6 +103,10 @@ extern char *optarg;
extern int opterr;
+#ifdef DRAC_AUTH
+static int drac_enabled;
+extern int dracauth(char *server, unsigned long userip, char **errmsg);
+#endif /* DRAC_AUTH */
#ifdef HAVE_SSL
static SSL *tls_conn;
@@ -507,6 +511,10 @@ int service_main(int argc __attribute__(
prot_settimeout(popd_in, timeout*60);
prot_setflushonread(popd_in, popd_out);
+#ifdef DRAC_AUTH
+ drac_enabled = (config_getint(IMAPOPT_DRACINTERVAL) > 0);
+#endif /* DRAC_AUTH */
+
if (kflag) kpop();
/* we were connected on pop3s port so we should do
@@ -1636,6 +1644,21 @@ int openinbox(void)
popd_mailbox = &mboxstruct;
proc_register("pop3d", popd_clienthost, popd_userid,
popd_mailbox->name);
+
+#ifdef DRAC_AUTH
+ if (drac_enabled &&
+ ((struct sockaddr *)&popd_remoteaddr)->sa_family == AF_INET) {
+ char *err;
+
+ if (dracauth((char*) config_getstring(IMAPOPT_DRACHOST),
+ ((struct sockaddr_in *)&popd_remoteaddr)->sin_addr.s_addr, &err) != 0) {
+ /* disable DRAC */
+ drac_enabled = 0;
+ syslog(LOG_ERR, "dracauth: %s", err);
+ syslog(LOG_ERR, "DRAC notifications disabled");
+ }
+ }
+#endif /* DRAC_AUTH */
}
/* Create telemetry log */
Index: imap/version.c
diff -u -p imap/version.c.orig imap/version.c
--- imap/version.c.orig Thu Feb 17 06:06:19 2005
+++ imap/version.c Sat Dec 10 16:16:16 2005
@@ -151,6 +151,10 @@ void id_response(struct protstream *pout
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; %s", SIEVE_VERSION);
#endif
+#ifdef DRAC_AUTH
+ snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
+ "; DRAC");
+#endif
#ifdef HAVE_LIBWRAP
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; TCP Wrappers");
Index: lib/imapoptions
diff -u lib/imapoptions.orig lib/imapoptions
--- lib/imapoptions.orig Fri Nov 18 00:46:29 2005
+++ lib/imapoptions Sat Dec 10 16:19:44 2005
@@ -195,6 +195,14 @@
{ "deleteright", "c", STRING }
/* The right that a user needs to delete a mailbox. */
+{ "dracinterval", 5, INT }
+/* If nonzero, enables the use of DRAC (Dynamic Relay Authorization
+ Control) by the pop3d and imapd daemons. Also sets the interval
+ (in minutes) between re-authorization requests made by imapd. */
+
+{ "drachost", "localhost", STRING }
+/* Hostname of the RPC dracd server. */
+
{ "duplicate_db", "berkeley-nosync", STRINGLIST("berkeley", "berkeley-nosync", "skiplist") }
/* The cyrusdb backend to use for the duplicate delivery suppression
and sieve. */

View File

@ -31,30 +31,3 @@ diff -u imap/Makefile.in.orig imap/Makefile.in
pop3d: pop3d.o proxy.o backend.o tls.o mutex_fake.o libimap.a \
$(DEPLIBS) $(SERVICE)
@@ -247,10 +247,11 @@
$(DEPLIBS) $(LIBS) $(LIB_WRAP)
sync_server: sync_server.o sync_support.o sync_commit.o \
- imapparse.o tls.o libimap.a mutex_fake.o $(DEPLIBS) $(SERVICE)
+ imapparse.o tls.o libimap.a mutex_fake.o mboxkey.o \
+ $(DEPLIBS) $(SERVICE)
$(CC) $(LDFLAGS) -o \
sync_server sync_server.o sync_support.o sync_commit.o \
- imapparse.o tls.o $(SERVICE) libimap.a mutex_fake.o \
+ imapparse.o tls.o $(SERVICE) libimap.a mutex_fake.o mboxkey.o \
$(DEPLIBS) $(LIBS) $(LIB_WRAP)
### Command Line Utilities
@@ -336,10 +337,10 @@
backend.o tls.o imapparse.o libimap.a mutex_fake.o $(DEPLIBS) $(LIBS)
sync_reset: sync_reset.o sync_support.o sync_commit.o \
- libimap.a mutex_fake.o $(DEPLIBS)
+ libimap.a mutex_fake.o mboxkey.o $(DEPLIBS)
$(CC) $(LDFLAGS) -o \
sync_reset sync_reset.o sync_support.o sync_commit.o \
- libimap.a mutex_fake.o $(DEPLIBS) $(LIBS)
+ libimap.a mutex_fake.o mboxkey.o $(DEPLIBS) $(LIBS)
### Other Misc Targets

View File

@ -10,15 +10,6 @@ diff -u man/Makefile.in.orig man/Makefile.in
mandir = @mandir@
@@ -68,7 +69,7 @@
$(srcdir)/notifyd.8 $(srcdir)/chk_cyrus.8 $(srcdir)/mbexamine.8 \
$(srcdir)/nntpd.8 $(srcdir)/fetchnews.8 $(srcdir)/smmapd.8 \
$(srcdir)/sync_client.8 $(srcdir)/sync_server.8 $(srcdir)/sync_reset.8 \
- $(srcdir)/unexpunge.8
+ $(srcdir)/unexpunge.8 $(srcdir)/make_md5.8
all: $(MAN1) $(MAN3) $(MAN5) $(MAN8)
@@ -95,7 +96,7 @@
done
for file in $(MAN8); \

View File

@ -6,7 +6,7 @@
#
PORTNAME= cyrus-imapd
PORTVERSION= 2.3.0
PORTVERSION= 2.3.1
#PORTREVISION= 0
CATEGORIES= mail ipv6
MASTER_SITES= ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ \
@ -181,8 +181,7 @@ CONFIGURE_ARGS+=--enable-netscapehack
.endif
.if defined(WITH_DRAC)
#EXTRA_PATCHES+= ${WRKSRC}/contrib/drac_auth.patch
EXTRA_PATCHES+= ${FILESDIR}/drac_auth.patch
EXTRA_PATCHES+= ${WRKSRC}/contrib/drac_auth.patch
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-cmulocal::berkdb.m4 \
${FILESDIR}/extra-patch-cmulocal::ucdsnmp.m4 \
${FILESDIR}/extra-patch-configure.in

View File

@ -1,3 +1,3 @@
MD5 (cyrus-imapd-2.3.0.tar.gz) = db628d09f65567ffaed0e8e276ff70ed
SHA256 (cyrus-imapd-2.3.0.tar.gz) = add45a75b1f04df3cd0ccfe85ad361aa4c3a240c4fa23143bee39ef8873a49f4
SIZE (cyrus-imapd-2.3.0.tar.gz) = 2209689
MD5 (cyrus-imapd-2.3.1.tar.gz) = cde15876d5c953bba9ad9f7811aff695
SHA256 (cyrus-imapd-2.3.1.tar.gz) = 79f95ed36160056f5ca60fad312fda8c6c95eafeab44f49b360b4a02790f156c
SIZE (cyrus-imapd-2.3.1.tar.gz) = 2212999

View File

@ -1,294 +0,0 @@
Index: configure.in
diff -u configure.in.orig configure.in
--- configure.in.orig Wed Apr 13 05:05:20 2005
+++ configure.in Sat Dec 10 16:16:15 2005
@@ -1003,6 +1003,19 @@
SNMP_SUBDIRS=""
AC_SUBST(SNMP_SUBDIRS)
+dnl
+dnl Test for DRAC
+dnl
+DRACLIBS=
+AC_ARG_WITH(drac, [ --with-drac=DIR use DRAC library in <DIR> [no] ],
+ if test -d "$withval"; then
+ LDFLAGS="$LDFLAGS -L${withval}"
+ AC_CHECK_LIB(drac, dracauth,
+ AC_DEFINE(DRAC_AUTH,[],[Build DRAC support?])
+ DRACLIBS="-ldrac")
+ fi)
+AC_SUBST(DRACLIBS)
+
CMU_LIBWRAP
CMU_UCDSNMP
Index: imap/Makefile.in
diff -u imap/Makefile.in.orig imap/Makefile.in
--- imap/Makefile.in.orig Fri Nov 18 00:46:14 2005
+++ imap/Makefile.in Sat Dec 10 16:17:44 2005
@@ -66,6 +66,7 @@
SIEVE_LIBS = @SIEVE_LIBS@
IMAP_COM_ERR_LIBS = @IMAP_COM_ERR_LIBS@
LIB_WRAP = @LIB_WRAP@
+DRAC_LIBS = @DRACLIBS@
LIBS = $(IMAP_LIBS) $(IMAP_COM_ERR_LIBS)
DEPLIBS = ../lib/libcyrus.a ../lib/libcyrus_min.a @DEPLIBS@
@@ -202,17 +203,17 @@
imapd: xversion $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE)
$(CC) $(LDFLAGS) -o imapd \
$(SERVICE) $(IMAPDOBJS) mutex_fake.o \
- libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP)
+ libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP) $(DRAC_LIBS)
imapd.pure: $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE)
$(PURIFY) $(PUREOPT) $(CC) $(LDFLAGS) -o imapd.pure \
$(SERVICE) $(IMAPDOBJS) mutex_fake.o libimap.a \
- $(DEPLIBS) $(LIBS) $(LIB_WRAP)
+ $(DEPLIBS) $(LIBS) $(LIB_WRAP) $(DRAC_LIBS)
imapd.quant: $(IMAPDOBJS) mutex_fake.o libimap.a $(DEPLIBS) $(SERVICE)
$(QUANTIFY) $(QUANTOPT) $(CC) $(LDFLAGS) -o imapd.quant \
$(SERVICE) $(IMAPDOBJS) mutex_fake.o libimap.a \
- $(DEPLIBS) $(LIBS) $(LIB_WRAP)
+ $(DEPLIBS) $(LIBS) $(LIB_WRAP) $(DRAC_LIBS) $(DRAC_LIBS)
mupdate: mupdate.o mupdate-slave.o mupdate-client.o mutex_pthread.o tls.o \
libimap.a $(DEPLIBS)
@@ -230,7 +231,7 @@
pop3d: pop3d.o proxy.o backend.o tls.o mutex_fake.o libimap.a \
$(DEPLIBS) $(SERVICE)
$(CC) $(LDFLAGS) -o pop3d pop3d.o proxy.o backend.o tls.o $(SERVICE) \
- mutex_fake.o libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP)
+ mutex_fake.o libimap.a $(DEPLIBS) $(LIBS) $(LIB_WRAP) $(DRAC_LIBS)
nntpd: nntpd.o proxy.o backend.o index.o smtpclient.o spool.o tls.o \
mutex_fake.o nntp_err.o libimap.a $(DEPLIBS) $(SERVICE)
Index: imap/imapd.c
diff -u -p imap/imapd.c.orig imap/imapd.c
--- imap/imapd.c.orig Tue Nov 22 04:48:36 2005
+++ imap/imapd.c Sat Dec 10 16:16:16 2005
@@ -172,6 +172,18 @@ static struct proxy_context imapd_proxyc
1, 1, &imapd_authstate, &imapd_userisadmin, &imapd_userisproxyadmin
};
+#ifdef DRAC_AUTH
+static struct {
+ int interval; /* dracd "ping" interval; 0 = disabled */
+ unsigned long clientaddr;
+ struct prot_waitevent *event;
+} drac;
+
+extern int dracconn(char *server, char **errmsg);
+extern int dracsend(unsigned long userip, char **errmsg);
+extern int dracdisc(char **errmsg);
+#endif /* DRAC_AUTH */
+
/* current sub-user state */
static struct mailbox mboxstruct;
static struct mailbox *imapd_mailbox;
@@ -637,6 +649,23 @@ int service_init(int argc, char **argv,
idle_init();
}
+#ifdef DRAC_AUTH
+ /* setup for sending DRAC "pings" */
+ drac.event = NULL;
+ drac.interval = config_getint(IMAPOPT_DRACINTERVAL);
+ if (drac.interval < 0) drac.interval = 0;
+ if (drac.interval) {
+ char *err;
+
+ if (dracconn((char*) config_getstring(IMAPOPT_DRACHOST), &err) != 0) {
+ /* disable DRAC */
+ drac.interval = 0;
+ syslog(LOG_ERR, "dracconn: %s", err);
+ syslog(LOG_ERR, "DRAC notifications disabled");
+ }
+ }
+#endif /* DRAC_AUTH */
+
/* create connection to the SNMP listener, if available. */
snmp_connect(); /* ignore return code */
snmp_set_str(SERVER_NAME_VERSION,CYRUS_VERSION);
@@ -741,6 +770,15 @@ int service_main(int argc __attribute__(
imapd_haveaddr = 1;
}
}
+
+#ifdef DRAC_AUTH
+ if (((struct sockaddr *)&imapd_remoteaddr)->sa_family == AF_INET)
+ drac.clientaddr = ((struct sockaddr_in *)&imapd_remoteaddr)->sin_addr.s_addr;
+ else
+ drac.clientaddr = 0;
+ } else {
+ drac.clientaddr = 0;
+#endif /* DRAC_AUTH */
}
/* create the SASL connection */
@@ -783,6 +821,11 @@ int service_main(int argc __attribute__(
prot_flush(imapd_out);
snmp_increment(ACTIVE_CONNECTIONS, -1);
+#ifdef DRAC_AUTH
+ if (drac.event) prot_removewaitevent(imapd_in, drac.event);
+ drac.event = NULL;
+#endif /* DRAC_AUTH */
+
/* cleanup */
imapd_reset();
@@ -873,6 +916,10 @@ void shut_down(int code)
cyrus_done();
+#ifdef DRAC_AUTH
+ if (drac.interval) (void) dracdisc((char **)NULL);
+#endif /* DRAC_AUTH */
+
exit(code);
}
@@ -932,6 +979,35 @@ static void imapd_check(struct backend *
}
}
+#ifdef DRAC_AUTH
+/*
+ * Ping dracd every 'drac.interval' minutes
+ * to let it know that we are still connected
+ */
+struct prot_waitevent *drac_ping(struct protstream *s,
+ struct prot_waitevent *ev, void *rock)
+{
+ char *err;
+ static int nfailure = 0;
+
+ if (dracsend(drac.clientaddr, &err) != 0) {
+ syslog(LOG_ERR, "dracsend: %s", err);
+ if (++nfailure >= 3) {
+ /* can't contact dracd for 3 consecutive tries - disable DRAC */
+ prot_removewaitevent(s, ev);
+ drac.event = NULL;
+ syslog(LOG_ERR, "DRAC notifications disabled");
+ return NULL;
+ }
+ }
+ else
+ nfailure = 0;
+
+ ev->mark = time(NULL) + (drac.interval * 60);
+ return ev;
+}
+#endif /* DRAC_AUTH */
+
/*
* Top-level command loop parsing
*/
@@ -2030,6 +2106,11 @@ void cmd_login(char *tag, char *user)
prot_printf(imapd_out, "%s OK %s\r\n", tag, reply);
+#ifdef DRAC_AUTH
+ if (drac.interval && drac.clientaddr)
+ drac.event = prot_addwaitevent(imapd_in, 0 /* now */, drac_ping, NULL);
+#endif /* DRAC_AUTH */
+
/* Create telemetry log */
imapd_logfd = telemetry_log(imapd_userid, imapd_in, imapd_out, 0);
@@ -2178,6 +2259,11 @@ cmd_authenticate(char *tag, char *authty
prot_setsasl(imapd_in, imapd_saslconn);
prot_setsasl(imapd_out, imapd_saslconn);
+
+#ifdef DRAC_AUTH
+ if (drac.interval && drac.clientaddr)
+ drac.event = prot_addwaitevent(imapd_in, 0 /* now */, drac_ping, NULL);
+#endif /* DRAC_AUTH */
/* Create telemetry log */
imapd_logfd = telemetry_log(imapd_userid, imapd_in, imapd_out, 0);
Index: imap/pop3d.c
diff -u -p imap/pop3d.c.orig imap/pop3d.c
--- imap/pop3d.c.orig Sat Jun 4 08:07:46 2005
+++ imap/pop3d.c Sat Dec 10 16:16:16 2005
@@ -103,6 +103,10 @@ extern char *optarg;
extern int opterr;
+#ifdef DRAC_AUTH
+static int drac_enabled;
+extern int dracauth(char *server, unsigned long userip, char **errmsg);
+#endif /* DRAC_AUTH */
#ifdef HAVE_SSL
static SSL *tls_conn;
@@ -507,6 +511,10 @@ int service_main(int argc __attribute__(
prot_settimeout(popd_in, timeout*60);
prot_setflushonread(popd_in, popd_out);
+#ifdef DRAC_AUTH
+ drac_enabled = (config_getint(IMAPOPT_DRACINTERVAL) > 0);
+#endif /* DRAC_AUTH */
+
if (kflag) kpop();
/* we were connected on pop3s port so we should do
@@ -1636,6 +1644,21 @@ int openinbox(void)
popd_mailbox = &mboxstruct;
proc_register("pop3d", popd_clienthost, popd_userid,
popd_mailbox->name);
+
+#ifdef DRAC_AUTH
+ if (drac_enabled &&
+ ((struct sockaddr *)&popd_remoteaddr)->sa_family == AF_INET) {
+ char *err;
+
+ if (dracauth((char*) config_getstring(IMAPOPT_DRACHOST),
+ ((struct sockaddr_in *)&popd_remoteaddr)->sin_addr.s_addr, &err) != 0) {
+ /* disable DRAC */
+ drac_enabled = 0;
+ syslog(LOG_ERR, "dracauth: %s", err);
+ syslog(LOG_ERR, "DRAC notifications disabled");
+ }
+ }
+#endif /* DRAC_AUTH */
}
/* Create telemetry log */
Index: imap/version.c
diff -u -p imap/version.c.orig imap/version.c
--- imap/version.c.orig Thu Feb 17 06:06:19 2005
+++ imap/version.c Sat Dec 10 16:16:16 2005
@@ -151,6 +151,10 @@ void id_response(struct protstream *pout
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; %s", SIEVE_VERSION);
#endif
+#ifdef DRAC_AUTH
+ snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
+ "; DRAC");
+#endif
#ifdef HAVE_LIBWRAP
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; TCP Wrappers");
Index: lib/imapoptions
diff -u lib/imapoptions.orig lib/imapoptions
--- lib/imapoptions.orig Fri Nov 18 00:46:29 2005
+++ lib/imapoptions Sat Dec 10 16:19:44 2005
@@ -195,6 +195,14 @@
{ "deleteright", "c", STRING }
/* The right that a user needs to delete a mailbox. */
+{ "dracinterval", 5, INT }
+/* If nonzero, enables the use of DRAC (Dynamic Relay Authorization
+ Control) by the pop3d and imapd daemons. Also sets the interval
+ (in minutes) between re-authorization requests made by imapd. */
+
+{ "drachost", "localhost", STRING }
+/* Hostname of the RPC dracd server. */
+
{ "duplicate_db", "berkeley-nosync", STRINGLIST("berkeley", "berkeley-nosync", "skiplist") }
/* The cyrusdb backend to use for the duplicate delivery suppression
and sieve. */

View File

@ -31,30 +31,3 @@ diff -u imap/Makefile.in.orig imap/Makefile.in
pop3d: pop3d.o proxy.o backend.o tls.o mutex_fake.o libimap.a \
$(DEPLIBS) $(SERVICE)
@@ -247,10 +247,11 @@
$(DEPLIBS) $(LIBS) $(LIB_WRAP)
sync_server: sync_server.o sync_support.o sync_commit.o \
- imapparse.o tls.o libimap.a mutex_fake.o $(DEPLIBS) $(SERVICE)
+ imapparse.o tls.o libimap.a mutex_fake.o mboxkey.o \
+ $(DEPLIBS) $(SERVICE)
$(CC) $(LDFLAGS) -o \
sync_server sync_server.o sync_support.o sync_commit.o \
- imapparse.o tls.o $(SERVICE) libimap.a mutex_fake.o \
+ imapparse.o tls.o $(SERVICE) libimap.a mutex_fake.o mboxkey.o \
$(DEPLIBS) $(LIBS) $(LIB_WRAP)
### Command Line Utilities
@@ -336,10 +337,10 @@
backend.o tls.o imapparse.o libimap.a mutex_fake.o $(DEPLIBS) $(LIBS)
sync_reset: sync_reset.o sync_support.o sync_commit.o \
- libimap.a mutex_fake.o $(DEPLIBS)
+ libimap.a mutex_fake.o mboxkey.o $(DEPLIBS)
$(CC) $(LDFLAGS) -o \
sync_reset sync_reset.o sync_support.o sync_commit.o \
- libimap.a mutex_fake.o $(DEPLIBS) $(LIBS)
+ libimap.a mutex_fake.o mboxkey.o $(DEPLIBS) $(LIBS)
### Other Misc Targets

View File

@ -10,15 +10,6 @@ diff -u man/Makefile.in.orig man/Makefile.in
mandir = @mandir@
@@ -68,7 +69,7 @@
$(srcdir)/notifyd.8 $(srcdir)/chk_cyrus.8 $(srcdir)/mbexamine.8 \
$(srcdir)/nntpd.8 $(srcdir)/fetchnews.8 $(srcdir)/smmapd.8 \
$(srcdir)/sync_client.8 $(srcdir)/sync_server.8 $(srcdir)/sync_reset.8 \
- $(srcdir)/unexpunge.8
+ $(srcdir)/unexpunge.8 $(srcdir)/make_md5.8
all: $(MAN1) $(MAN3) $(MAN5) $(MAN8)
@@ -95,7 +96,7 @@
done
for file in $(MAN8); \