summaryrefslogtreecommitdiffstats
path: root/mail/imap-uw/files/patch-ah
diff options
context:
space:
mode:
Diffstat (limited to 'mail/imap-uw/files/patch-ah')
-rw-r--r--mail/imap-uw/files/patch-ah159
1 files changed, 103 insertions, 56 deletions
diff --git a/mail/imap-uw/files/patch-ah b/mail/imap-uw/files/patch-ah
index 0de7fd9..e747d3f 100644
--- a/mail/imap-uw/files/patch-ah
+++ b/mail/imap-uw/files/patch-ah
@@ -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)
+@@ -57,6 +62,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 */
+
+ 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 */
+
-
- /* 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
++/* DRAC Authorization
++ */
++void drac_auth ()
++{
++ if (time (0) > lastdrac + DRACTIMEOUT)
++ {
++ FILE *dracconf;
++ char host[100];
++ char *drachost;
++ char *err;
++ char *p;
+
- return TRANSACTION;
- }
- else sayonara = "-ERR Can't get lock. Mailbox in use\015\012";
++ 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);
OpenPOWER on IntegriCloud