Binary files imap-4.7c.orig/src/imapd/.imapd.c.swp and imap-4.7c/src/imapd/.imapd.c.swp differ diff -cNr imap-4.7c.orig/src/imapd/Makefile imap-4.7c/src/imapd/Makefile *** imap-4.7c.orig/src/imapd/Makefile Thu Nov 4 01:50:56 1999 --- imap-4.7c/src/imapd/Makefile Tue May 2 22:18:45 2000 *************** *** 57,64 **** CCLIENTLIB = $C/c-client.a CC = `cat $C/CCTYPE` CFLAGS = -I$C `cat $C/CFLAGS` $(EXTRACFLAGS) -DANOFILE=\"$(ANO)\" \ ! -DALERTFILE=\"$(ALERT)\" -DUSERALERTFILE=\"$(USERALERT)\" ! LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS` all: imapd --- 57,64 ---- CCLIENTLIB = $C/c-client.a CC = `cat $C/CCTYPE` CFLAGS = -I$C `cat $C/CFLAGS` $(EXTRACFLAGS) -DANOFILE=\"$(ANO)\" \ ! -DALERTFILE=\"$(ALERT)\" -DUSERALERTFILE=\"$(USERALERT)\" -DDRAC_AUTH ! LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS` -ldrac -L/usr/lib/drac all: imapd diff -cNr imap-4.7c.orig/src/imapd/imapd.c imap-4.7c/src/imapd/imapd.c *** imap-4.7c.orig/src/imapd/imapd.c Tue Nov 16 20:14:39 1999 --- imap-4.7c/src/imapd/imapd.c Thu May 4 14:02:18 2000 *************** *** 33,38 **** --- 33,44 ---- * */ + #ifdef DRAC_AUTH + #include + #include + #include + #endif /* DRAC_AUTH */ + /* Primary I/O calls */ #define PBIN getchar /* primary byte input */ *************** *** 178,184 **** char *lasterror (void); /* Global storage */ ! char *version = "12.264"; /* version number of this server */ time_t alerttime = 0; /* time of last alert */ time_t sysalerttime = 0; /* time of last system alert */ --- 184,196 ---- char *lasterror (void); /* 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 = "12.264"; /* version number of this server */ time_t alerttime = 0; /* time of last alert */ time_t sysalerttime = 0; /* time of last system alert */ *************** *** 1151,1156 **** --- 1163,1206 ---- 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/mail/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 ("* ");