--- fetchmail-6.3.9/uid.c 2008-07-03 07:47:52.000000000 -0700 +++ fetchmail-6.3.9-roller/uid.c 2009-01-20 00:17:40.716965753 -0800 @@ -151,9 +151,11 @@ char saveddelim1; char *delimp2; char saveddelim2 = '\0'; /* pacify -Wall */ + int skipscratch; while (fgets(buf, POPBUFSIZE, tmpfp) != (char *)NULL) { + skipscratch = 0; /* * At this point, we assume the bug has two fields -- a user@host * part, and an ID part. Either field may contain spurious @ signs. @@ -211,13 +213,31 @@ *atsign = '\0'; host = atsign + 1; + /* find proper list and save it */ for (ctl = hostlist; ctl; ctl = ctl->next) { - if (strcasecmp(host, ctl->server.queryname) == 0 - && strcasecmp(user, ctl->remotename) == 0) { - save_str(&ctl->oldsaved, id, UID_SEEN); - break; - } + /* + * skipped servers go in the scratchlist + * 20090119 sethm@66asuym.icu + */ + if (!ctl->server.skip && ctl->server.uidl) { + if (strcasecmp(host, ctl->server.queryname) == 0 + && strcasecmp(user, ctl->remotename) == 0) { + save_str(&ctl->oldsaved, id, UID_SEEN); + + /* + * prevent duplicates in scratchlist + * 20090119 sethm@66asuym.icu + */ + skipscratch = 1; + + /* + * caused oldsaved to be empty on daemon start + * 20090119 sethm@66asuym.icu + */ + //break; + } + } } /* * If it's not in a host we're querying, @@ -232,7 +252,8 @@ if (delimp2 != NULL) { *delimp2 = saveddelim2; } - save_str(&scratchlist, buf, UID_SEEN); + if (!skipscratch) + save_str(&scratchlist, buf, UID_SEEN); } } } @@ -627,12 +648,19 @@ (void)unlink(newnam); /* remove file/link first */ if ((tmpfp = fopen(newnam, "w")) != (FILE *)NULL) { int errflg; + /* + * don't write skipped servers in this loop + * it will cause the uid file to grow if you have + * disabled a server entry with "skip" and it + * 20090119 - sethm@66asuym.icu + */ for (ctl = hostlist; ctl; ctl = ctl->next) { - for (idp = ctl->oldsaved; idp; idp = idp->next) - if (idp->val.status.mark == UID_SEEN + if (!ctl->server.skip && ctl->server.uidl) + for (idp = ctl->oldsaved; idp; idp = idp->next) + if (idp->val.status.mark == UID_SEEN || idp->val.status.mark == UID_DELETED) - fprintf(tmpfp, "%s@%s %s\n", - ctl->remotename, ctl->server.queryname, idp->id); + fprintf(tmpfp, "%s@%s %s\n", + ctl->remotename, ctl->server.queryname, idp->id); } for (idp = scratchlist; idp; idp = idp->next) fputs(idp->id, tmpfp);