ports/mail/imap-uw/files/patch-ah
Nick Sayer 01436013af Mega cclient port SSL commit redux. This time with maintainer approval.
1. Add support for building cclient with SSL. Warn about the possibility
that some ports may have been missed and need ssl added at link time.

2. Update cclient and imap-uw to latest versions.

3. Fix pine4 to add ssl libraries. This can be used as a model for what
other ports may need to do.

4. Release MAINTAINERship (by request).

Submitted by:	anders@fix.no
Approved by:	petef@databits.net
2001-04-05 03:21:41 +00:00

83 lines
2.9 KiB
Text

--- src/ipopd/ipop3d.c.old Wed Apr 4 00:19:48 2001
+++ src/ipopd/ipop3d.c Wed Apr 4 00:28:24 2001
@@ -28,6 +28,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 */
#define CRLF PSOUT ("\015\012") /* primary output terpri */
@@ -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 */
+extern char *getenv ();
+#endif /* DRAC_AUTH */
+
char *version = "2001.75"; /* server version */
short state = AUTHORIZATION; /* server state */
short critical = NIL; /* non-zero if in critical code */
@@ -100,7 +111,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";