*** /tmp/imap-4.7c/src/imapd/imapd.c Tue Nov 16 19:14:39 1999 --- src/imapd/imapd.c Mon Jun 26 18:45:46 2000 *************** *** 240,245 **** --- 240,248 ---- unsigned long i,j,k,m,uid; long f; char *s,*t,*u,*v,tmp[MAILTMPLEN]; + char *err; + char *ip_address; + int dracauth_val; struct stat sbuf; time_t autologouttime = 0; #include "linkage.c" *************** *** 454,459 **** --- 457,471 ---- state = SELECT; syslog (LOG_INFO,"Login user=%.80s host=%.80s",user, tcp_clienthost ()); + ip_address = tcp_clienthost2(); + dracauth_val = dracauth("localhost", inet_addr(ip_address),&err); + if(dracauth_val == 0){ + syslog(LOG_INFO,"Dracauth succeeded for user=%.80s host=%.80s",user, tcp_clienthost()); + } + else{ + syslog(LOG_INFO,"Dracauth FAILED for user=%.80s host=%.80s",user, tcp_clienthost()); + syslog(LOG_INFO, "This address got passed to dracauth: %s", ip_address); + } } else response = "%.80s NO %.80s failed\015\012"; } *** /tmp/imap-4.7c/src/imapd/Makefile Thu Nov 4 00:50:56 1999 --- src/imapd/Makefile Thu Jun 22 08:06:58 2000 *************** *** 63,69 **** all: imapd imapd: $(CCLIENTLIB) imapd.o ! $(CC) $(CFLAGS) -o imapd imapd.o $(LDFLAGS) imapd.o: $C/mail.h $C/misc.h $C/osdep.h --- 63,69 ---- all: imapd imapd: $(CCLIENTLIB) imapd.o ! $(CC) $(CFLAGS) -o imapd imapd.o /usr/lib/libdrac.a $(LDFLAGS) imapd.o: $C/mail.h $C/misc.h $C/osdep.h *** /tmp/imap-4.7c/src/ipopd/Makefile Tue Apr 14 16:41:55 1998 --- src/ipopd/Makefile Thu Jun 22 08:06:15 2000 *************** *** 44,53 **** ipopd: ipop2d ipop3d ipop2d: $(CCLIENTLIB) ipop2d.o ! $(CC) $(CFLAGS) -o ipop2d ipop2d.o $(LDFLAGS) ipop3d: $(CCLIENTLIB) ipop3d.o ! $(CC) $(CFLAGS) -o ipop3d ipop3d.o $(LDFLAGS) ipop2d.o: $C/mail.h $C/misc.h $C/osdep.h --- 44,53 ---- ipopd: ipop2d ipop3d ipop2d: $(CCLIENTLIB) ipop2d.o ! $(CC) $(CFLAGS) -o ipop2d ipop2d.o /usr/lib/libdrac.a $(LDFLAGS) ipop3d: $(CCLIENTLIB) ipop3d.o ! $(CC) $(CFLAGS) -o ipop3d ipop3d.o /usr/lib/libdrac.a $(LDFLAGS) ipop2d.o: $C/mail.h $C/misc.h $C/osdep.h *** /tmp/imap-4.7c/src/ipopd/ipop3d.c Tue Nov 16 19:28:38 1999 --- src/ipopd/ipop3d.c Mon Jun 26 18:36:41 2000 *************** *** 212,220 **** else PSOUT ("-ERR Missing username argument\015\012"); } else if (user && *user && !strcmp (s,"PASS")) { ! if ((state = login (t,argc,argv)) == TRANSACTION) ! syslog (LOG_INFO,"Login user=%.80s host=%.80s nmsgs=%ld/%ld", user,tcp_clienthost (),nmsgs,stream->nmsgs); } else if (!strcmp (s,"AUTH")) { --- 212,233 ---- else PSOUT ("-ERR Missing username argument\015\012"); } else if (user && *user && !strcmp (s,"PASS")) { ! if ((state = login (t,argc,argv)) == TRANSACTION){ ! char *err; ! char *ip_address; ! int dracauth_val; ! syslog (LOG_INFO,"Login user=%.80s host=%.80s nmsgs=%ld/%ld", user,tcp_clienthost (),nmsgs,stream->nmsgs); + ip_address = tcp_clienthost2(); + dracauth_val = dracauth("localhost", inet_addr(ip_address), &err); + if(dracauth_val == 0){ + syslog(LOG_INFO,"Dracauth succeeded for user=%.80s host=%.80s",user, tcp_clienthost ()); + } + else{ + syslog(LOG_INFO,"Dracauth FAILED for user=%.80s host=%.80s",user, tcp_clienthost ()); + syslog(LOG_INFO, "This address got passed to dracauth: %s", ip_address); + } + } } else if (!strcmp (s,"AUTH")) { *** /tmp/imap-4.7c/src/osdep/unix/tcp_unix.c Fri Oct 29 18:01:12 1999 --- src/osdep/unix/tcp_unix.c Mon Jun 26 15:31:34 2000 *************** *** 32,38 **** * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ ! #undef write /* don't use redefined write() */ static tcptimeout_t tmoh = NIL; /* TCP timeout handler routine */ --- 32,38 ---- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ ! #include #undef write /* don't use redefined write() */ static tcptimeout_t tmoh = NIL; /* TCP timeout handler routine */ *************** *** 729,734 **** --- 729,735 ---- */ static char *myClientHost = NIL; + static char *myClientHost2 = NIL; char *tcp_clienthost () { *************** *** 742,747 **** --- 743,759 ---- return myClientHost; } + char *tcp_clienthost2 () + { + struct sockaddr_in sin; + int sinlen = sizeof (struct sockaddr_in); + /* get stdin's peer name */ + myClientHost2 = getpeername (0,(struct sockaddr *) &sin,(void *) &sinlen) ? + cpystr ("UNKNOWN") : tcp_name2 (&sin,T); + + myClientHost2 = tcp_name2 (&sin,T); + return myClientHost2; + } /* TCP/IP get server host name (server calls only) * Returns: server host name *************** *** 826,830 **** --- 838,872 ---- (*bn) (BLOCK_NONE,NIL); /* alarms OK now */ } else sprintf (s = tmp,"[%s]",inet_ntoa (sin->sin_addr)); + return cpystr (s); + } + + char *tcp_name2 (struct sockaddr_in *sin,long flag) + { + char *s,tmp[MAILTMPLEN]; + if (allowreversedns) { + struct hostent *he; + blocknotify_t bn = (blocknotify_t)mail_parameters(NIL,GET_BLOCKNOTIFY,NIL); + void *data; + (*bn) (BLOCK_DNSLOOKUP,NIL); /* quell alarms */ + data = (*bn) (BLOCK_SENSITIVE,NIL); + /* translate address to name */ + if (!(he = gethostbyaddr ((char *) &sin->sin_addr, + sizeof (struct in_addr),sin->sin_family))){ + sprintf (s = tmp,"%s",inet_ntoa (sin->sin_addr)); + } + /* else if (flag){ + sprintf (s = tmp,"%s %s",he->h_name, inet_ntoa (sin->sin_addr)); + }*/ + else if (flag){ + sprintf(s = tmp, "%s", inet_ntoa(sin->sin_addr)); + } + else{ s = he->h_name; } + (*bn) (BLOCK_NONSENSITIVE,data); + (*bn) (BLOCK_NONE,NIL); /* alarms OK now */ + } + else{ + sprintf (s = tmp,"%s",inet_ntoa (sin->sin_addr)); + } return cpystr (s); } *** /tmp/imap-4.7c/src/osdep/unix/env_unix.c Wed May 3 11:33:01 2000 --- src/osdep/unix/env_unix.c Thu Jun 22 07:47:35 2000 *************** *** 546,552 **** nslist[0] = &nshome,nslist[1] = &nsblackother,nslist[2] = &nsshared; else { /* not a black box */ nslist[0] = &nshome,nslist[1] = &nsunixother,nslist[2] = &nsshared; ! myHomeDir = cpystr (home);/* use real home directory */ /* make sure user rc files don't try this */ blackBoxDir = blackBoxDefaultHome = ""; } --- 546,555 ---- nslist[0] = &nshome,nslist[1] = &nsblackother,nslist[2] = &nsshared; else { /* not a black box */ nslist[0] = &nshome,nslist[1] = &nsunixother,nslist[2] = &nsshared; ! /* TOMKI */ ! /* myHomeDir = cpystr (home);/* use real home directory */ ! sprintf (tmp,"%s/imapmail",home); ! myHomeDir = cpystr (tmp); /* make sure user rc files don't try this */ blackBoxDir = blackBoxDefaultHome = ""; }