From owner-freebsd-hackers Mon Feb 17 14:16:46 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id OAA19707 for hackers-outgoing; Mon, 17 Feb 1997 14:16:46 -0800 (PST) Received: from precipice.shockwave.com (ppp-206-170-5-164.rdcy01.pacbell.net [206.170.5.164]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id OAA19701 for ; Mon, 17 Feb 1997 14:16:41 -0800 (PST) Received: from shockwave.com (localhost.shockwave.com [127.0.0.1]) by precipice.shockwave.com (8.8.4/8.7.3) with ESMTP id OAA28519; Mon, 17 Feb 1997 14:16:27 -0800 (PST) Message-Id: <199702172216.OAA28519@precipice.shockwave.com> To: hackers@freebsd.org, fetchmail-friends@snark.thyrsus.com Subject: looking for QualComm qpopper testers to try new patch Date: Mon, 17 Feb 1997 14:16:27 -0800 From: Paul Traina Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I've got a patch to QualComm's QPOP 2.2 that generates Return-Path: lines in place of the ommitted "From_" line information (which QPOP has incorrectly ignored for years). This patch should work well with the newly updated version of Fetchmail that now respects Return-Path: lines. I'm looking for victims who UNDERSTAND THE POP PROTOCOL to test this patch. I know it generates the Return-Path: properly, but I don't know if it is handling the UIDL generation in a deterministic fashion (I hope it is). Note: UIDL's generated by this new version of QPOP include the Return-Path: line in their calcualtion, whereas the old QPOP did not. Therefore on-the fly UIDL generation is different in the new version, However, since QPOP stores the first calcualted UIDL, this /shouldn't/ cause your MUA to think old messages are now new again. Of course, that's what I need someone to test (since I don't use UIDLs). If you don't know what a UIDL is, and why it's used, or you're not sure your MUA is using UIDLs to determine which messages it has already seen, then please don't bother testing this. Things I need answered: (a) Did this cause you to download old messages left on server as if they were new again? (hopefully not) (b) If you leave mail on the server, do you get stuck downloading that same message over and over again every time you start your pop client. Thanks, Paul --- pop_dropcopy.c Mon Feb 17 13:14:18 1997 +++ pop_dropcopy.c Mon Feb 17 14:00:12 1997 @@ -160,6 +160,37 @@ return(ti != 0); } +char * +return_path (const char *unixfrom) +{ + static char tmpbuf[BUFSIZ]; + int fromlen = sizeof("From ") - 1; + const char *fp, *hp, *cp, *ep; + + /* if it doesn't start with a From_, it's not */ + if (strncmp(unixfrom, "From ", fromlen)) + return NULL; + + fp = unixfrom + fromlen; + hp = cp = strchr(fp, ' '); + while (hp = strchr(++hp, 'r')) + if (!strncmp(hp, "remote from", sizeof("remote from") - 1)) { + hp = strrchr(hp, ' '); + break; + } + + if (hp) { + ep = strrchr(++hp, '\n'); + snprintf(tmpbuf, sizeof(tmpbuf), "Return-Path: %.*s!%.*s\n", + ep - hp, hp, + cp - fp, fp); + } else + snprintf(tmpbuf, sizeof(tmpbuf), "Return-Path: %.*s\n", + cp - fp, fp); + + return tmpbuf; +} + /* Hashing to a spool directory helps reduce the lookup time for sites * with thousands of mail spool files. Unix uses a linear list to * save directory information and the following methods attempt to @@ -284,6 +315,7 @@ char buffer[MAXLINELEN]; /* Read buffer */ MD5_CTX mdContext; unsigned char digest[16]; + char *rpath; #ifdef DEBUG if(p->debug) @@ -349,6 +381,13 @@ (p->mmdf_separator ? !strcmp(p->mmdf_separator, buffer) : isfromline(buffer))) { + if (!p->mmdf_separator) { + rpath = return_path(buffer); + pop_log(p, POP_ERR, "From: %s rpath: %s", buffer, rpath); + if (rpath) + snprintf(buffer, sizeof(buffer), rpath); + } + if (expecting_trailer) { /* skip over the MMDF trailer */ expecting_trailer = 0; @@ -394,6 +433,7 @@ mp->retr_flag = FALSE; mp->orig_retr_state = FALSE; mp->uidl_str = "\n"; + mp->return_path = rpath ? strdup(rpath) : NULL; #ifdef DEBUG if(p->debug) pop_log(p,POP_DEBUG, "Msg %d being added to list", mp->number); @@ -511,6 +551,7 @@ int content_length, content_nchar, cont_len; MD5_CTX mdContext; unsigned char digest[16]; + char *rpath; FILE *mail_drop; /* Streams for fids */ @@ -583,6 +624,13 @@ (p->mmdf_separator ? !strcmp(p->mmdf_separator, buffer) : isfromline(buffer))) { + if (!p->mmdf_separator) { + rpath = return_path(buffer); + pop_log(p, POP_ERR, "From: %s rpath: %s", buffer, rpath); + if (rpath) + snprintf(buffer, sizeof(buffer), rpath); + } + if (expecting_trailer) { expecting_trailer = 0; continue; @@ -628,6 +676,7 @@ mp->retr_flag = FALSE; mp->orig_retr_state = FALSE; mp->uidl_str = "\n"; + mp->return_path = rpath ? strdup(rpath) : NULL; #ifdef DEBUG if(p->debug) --- pop_send.c Mon Feb 17 13:14:25 1997 +++ pop_send.c Mon Feb 17 13:15:28 1997 @@ -84,6 +84,9 @@ /* Skip the first line (the sendmail "From" or MMDF line) */ (void)fgets (buffer,MAXMSGLINELEN,p->drop); + if (mp->return_path) + pop_sendline(p, mp->return_path); + /* Send the header of the message followed by a blank line */ while (fgets(buffer, MAXMSGLINELEN, p->drop)) { if (!strncasecmp(buffer, "Content-Length:", 15) || --- popper.h Mon Feb 17 13:15:44 1997 +++ popper.h Mon Feb 17 13:35:48 1997 @@ -260,6 +263,8 @@ Used for RSET cmd. */ char *uidl_str; /* Cache of the UIDL str for faster access */ + char *return_path; /* Cache of the rpath str for + faster access */ } MsgInfoList; typedef struct { /* POP parameter block */