Date: Sat, 15 Feb 92 17:21:08 -0500 From: Calvin Clark To: bugs@Athena.MIT.EDU Cc: postmaster@Athena.MIT.EDU Subject: changes for from and zmailnotify Reply-To: ckclark@mit.edu Since we are running a POP3 popper which supports the TOP command, I believe that from and zmailnotify should be changed to use TOP instead of RETR, in order to reduce load on the network and on the pop servers. There is no sense in retrieving the entire message with RETR if the program is just going to grep through the headers. Since the TOP command is an optional command in the POP3 protocol, I have made my changes conditional on HAVE_POP3_TOP being defined. Sites which have pop servers that don't support TOP should not define this, and RETR will be used instead. Of course, any site which is running a recent version of the Berkeley popper will have TOP. Included find two patches, one for from and one for zmailnotify. -Calvin P.S. I will make the appropriate changes for pfrom in the sipb locker. Someone who likes MH should grovel through the MH code and figure out if msgchk can be fixed in a similar fashion. #### Changes for "from" source #### diff -r -c /source/athena/athena.bin/from/Imakefile ./Imakefile *** /source/athena/athena.bin/from/Imakefile Fri Aug 16 16:04:09 1991 --- ./Imakefile Sat Feb 15 16:32:05 1992 *************** *** 6,12 **** AnsiCC() ! DEFINES = -DHESIOD -DKPOP -DOFF_SWITCH #ifdef _AUX_SOURCE LIBS = -lhesiod -lkrb -ldes -lPW -lc --- 6,12 ---- AnsiCC() ! DEFINES = -DHESIOD -DKPOP -DOFF_SWITCH -DHAVE_POP3_TOP #ifdef _AUX_SOURCE LIBS = -lhesiod -lkrb -ldes -lPW -lc diff -r -c /source/athena/athena.bin/from/from.c ./from.c *** /source/athena/athena.bin/from/from.c Mon Jan 6 16:11:24 1992 --- ./from.c Sat Feb 15 16:31:16 1992 *************** *** 360,366 **** --- 360,370 ---- int headers = 1; int scratch = 0; /* Scratch for action() */ + #ifdef HAVE_POP3_TOP + (void) sprintf(buf, "TOP %d 0", msgno); + #else (void) sprintf(buf, "RETR %d", msgno); + #endif if (popmail_debug) fprintf(stderr, "%s\n", buf); if (putline(buf, Errmsg, sfo) == NOTOK) return(NOTOK); #### Changes for "zmailnotify" source #### *** /source/athena/athena.lib/zephyr/clients/zmailnotify/Imakefile Mon Jul 8 09:22:23 1991 --- ./Imakefile Sat Feb 15 16:38:06 1992 *************** *** 10,16 **** LIBS= ${ZEPHYR_LIB} ${COMERR_LIB} ${KRB_LIB} ${DES_LIB} ${HES_LIB} LINTLIBS= ${ZEPHYR_LINTLIB} ${COMERR_LINTLIB} ${KRB_LINTLIB} ${DES_LINTLIB} ! DEFINES= -DKPOP SRCS = zmailnotify.c OBJS = zmailnotify.o --- 10,16 ---- LIBS= ${ZEPHYR_LIB} ${COMERR_LIB} ${KRB_LIB} ${DES_LIB} ${HES_LIB} LINTLIBS= ${ZEPHYR_LINTLIB} ${COMERR_LINTLIB} ${KRB_LINTLIB} ${DES_LINTLIB} ! DEFINES= -DKPOP -DHAVE_POP3_TOP SRCS = zmailnotify.c OBJS = zmailnotify.o diff -r -c /source/athena/athena.lib/zephyr/clients/zmailnotify/zmailnotify.c ./zmailnotify.c *** /source/athena/athena.lib/zephyr/clients/zmailnotify/zmailnotify.c Fri Mar 8 11:21:08 1991 --- ./zmailnotify.c Sat Feb 15 16:37:44 1992 *************** *** 239,245 **** int i; { int mbx_write(); ! if (pop_retr(i, mbx_write, 0) != OK) fatal_pop_err (); } --- 239,245 ---- int i; { int mbx_write(); ! if (pop_scan(i, mbx_write, 0) != OK) fatal_pop_err (); } *************** *** 479,490 **** } } ! pop_retr(msgno, action, arg) int (*action)(); { char buf[4096]; (void) sprintf(buf, "RETR %d", msgno); if (putline(buf, Errmsg, sfo) == NOTOK) return(NOTOK); if (getline(buf, sizeof buf, sfi) != OK) { --- 479,495 ---- } } ! pop_scan(msgno, action, arg) int (*action)(); { char buf[4096]; + #ifdef HAVE_POP3_TOP + (void) sprintf(buf, "TOP %d 0", msgno); + #else (void) sprintf(buf, "RETR %d", msgno); + #endif + if (putline(buf, Errmsg, sfo) == NOTOK) return(NOTOK); if (getline(buf, sizeof buf, sfi) != OK) { *************** *** 584,590 **** /*ARGSUSED*/ mbx_write(line, dummy) char *line; ! int dummy; /* for consistency with pop_retr */ { if (mailptr) { mailptr = realloc(mailptr,(unsigned)(strlen(mailptr)+strlen(line)+2)); --- 589,595 ---- /*ARGSUSED*/ mbx_write(line, dummy) char *line; ! int dummy; /* for consistency with pop_scan */ { if (mailptr) { mailptr = realloc(mailptr,(unsigned)(strlen(mailptr)+strlen(line)+2));