Index: imap/pop3d.c =================================================================== RCS file: /afs/andrew/system/cvs/src/cyrus/imap/pop3d.c,v retrieving revision 1.167 diff -u -r1.167 pop3d.c --- imap/pop3d.c 11 Apr 2005 06:57:35 -0000 1.167 +++ imap/pop3d.c 21 Feb 2006 19:11:39 -0000 @@ -882,13 +882,13 @@ prot_printf(popd_out, "-ERR No such message\r\n"); } else if (mboxstruct.pop3_new_uidl) { - prot_printf(popd_out, "+OK %u %lu.%u\r\n", msg, + prot_printf(popd_out, "+OK %u %lu.%.10u\r\n", msg, mboxstruct.uidvalidity, popd_msg[msg].uid); } else { /* old uidl format */ - prot_printf(popd_out, "+OK %u %u\r\n", + prot_printf(popd_out, "+OK %u %.10u\r\n", msg, popd_msg[msg].uid); } } @@ -897,11 +897,12 @@ for (msg = 1; msg <= popd_exists; msg++) { if (!popd_msg[msg].deleted) { if (mboxstruct.pop3_new_uidl) { - prot_printf(popd_out, "%u %lu.%u\r\n", msg, + prot_printf(popd_out, "%u %lu.%.10u\r\n", msg, mboxstruct.uidvalidity, popd_msg[msg].uid); } else { - prot_printf(popd_out, "%u %u\r\n", msg, + /* old uidl format */ + prot_printf(popd_out, "%u %.10u\r\n", msg, popd_msg[msg].uid); } } Index: lib/prot.c =================================================================== RCS file: /afs/andrew/system/cvs/src/cyrus/lib/prot.c,v retrieving revision 1.86 diff -u -r1.86 prot.c --- lib/prot.c 27 Feb 2004 22:08:56 -0000 1.86 +++ lib/prot.c 21 Feb 2006 19:11:39 -0000 @@ -856,78 +856,20 @@ } /* - * Stripped-down version of printf() that works on protection streams - * Only understands '%ld', '%lu', '%d', %u', '%s', '%c', and '%%' - * in the format string. + * Version of printf() that works on protection streams */ int prot_printf(struct protstream *s, const char *fmt, ...) { va_list pvar; - char *percent, *p; - long l; - unsigned long ul; - int i; - unsigned u; - char buf[30]; - va_start(pvar, fmt); + char buf[2048]; assert(s->write); - while ((percent = strchr(fmt, '%')) != 0) { - prot_write(s, fmt, percent-fmt); - switch (*++percent) { - case '%': - prot_putc('%', s); - break; - - case 'l': - switch (*++percent) { - case 'd': - l = va_arg(pvar, long); - snprintf(buf, sizeof(buf), "%ld", l); - prot_write(s, buf, strlen(buf)); - break; - - case 'u': - ul = va_arg(pvar, long); - snprintf(buf, sizeof(buf), "%lu", ul); - prot_write(s, buf, strlen(buf)); - break; - - default: - abort(); - } - break; - - case 'd': - i = va_arg(pvar, int); - snprintf(buf, sizeof(buf), "%d", i); - prot_write(s, buf, strlen(buf)); - break; - - case 'u': - u = va_arg(pvar, int); - snprintf(buf, sizeof(buf), "%u", u); - prot_write(s, buf, strlen(buf)); - break; - - case 's': - p = va_arg(pvar, char *); - prot_write(s, p, strlen(p)); - break; - - case 'c': - i = va_arg(pvar, int); - prot_putc(i, s); - break; - - default: - abort(); - } - fmt = percent+1; - } - prot_write(s, fmt, strlen(fmt)); + va_start(pvar, fmt); + vsnprintf(buf, sizeof(buf), fmt, pvar); va_end(pvar); + + prot_write(s, buf, strlen(buf)); if (s->error || s->eof) return EOF; return 0; }