From: John Gardiner Myers To: Cyrus beta testers Subject: Cyrus 1.4.11 patch The following patch brings Cyrus 1.4.10 to 1.4.11, fixing a bunch of reported bugs and a few new features. diff -cr imapd-1.4.10/doc/html/changes.html imapd-1.4.11/doc/html/changes.html *** imapd-1.4.10/doc/html/changes.html Wed Jul 24 15:10:24 1996 --- imapd-1.4.11/doc/html/changes.html Mon Aug 5 12:43:30 1996 *************** *** 29,34 **** --- 29,36 ----
  • New "krbck" program for diagnosing common kerberos problems. +
  • auth_unix no longer requires users to be in the passwd file. +
  • AUTHENTICATE command now reports the protection mechanism in use in the text of the tagged OK response *************** *** 101,107 ****
  • Add a bunch of prototype declararations to the code. !
  • In deliver, change the MULT support to instead use the MRSMTP syntax.
  • Implement some experimental protocol extensions for optimizing disconnected use resynchronization. Most extensions are disabled by --- 103,109 ----
  • Add a bunch of prototype declararations to the code. !
  • In deliver, change the MULT support to instead use the LMTP syntax.
  • Implement some experimental protocol extensions for optimizing disconnected use resynchronization. Most extensions are disabled by diff -cr imapd-1.4.10/imap/append.c imapd-1.4.11/imap/append.c *** imapd-1.4.10/imap/append.c Sat Jul 6 17:56:18 1996 --- imapd-1.4.11/imap/append.c Wed Jul 31 17:45:27 1996 *************** *** 27,32 **** --- 27,35 ---- * */ + #ifdef HAVE_UNISTD_H + #include + #endif #include #include #include diff -cr imapd-1.4.10/imap/deliver.c imapd-1.4.11/imap/deliver.c *** imapd-1.4.10/imap/deliver.c Tue Jul 2 12:31:57 1996 --- imapd-1.4.11/imap/deliver.c Wed Aug 28 15:51:14 1996 *************** *** 61,67 **** int dupelim = 0; struct protstream *savemsg(); ! char *convert_smtp(); main(argc, argv) int argc; --- 61,67 ---- int dupelim = 0; struct protstream *savemsg(); ! char *convert_lmtp(); main(argc, argv) int argc; *************** *** 71,77 **** int r; int exitval = 0; char *return_path = 0; ! int smtpflag = 0; char *mailboxname = 0; struct protstream *prot_f; unsigned size; --- 71,77 ---- int r; int exitval = 0; char *return_path = 0; ! int lmtpflag = 0; char *mailboxname = 0; struct protstream *prot_f; unsigned size; *************** *** 128,135 **** case 'E': exit(prunedelivered(atoi(optarg))); ! case 's': ! smtpflag = 1; break; case 'q': --- 128,135 ---- case 'E': exit(prunedelivered(atoi(optarg))); ! case 'l': ! lmtpflag = 1; break; case 'q': *************** *** 141,148 **** } } ! if (smtpflag) { ! smtpmode(quotaoverride); exit(0); } --- 141,148 ---- } } ! if (lmtpflag) { ! lmtpmode(quotaoverride); exit(0); } *************** *** 305,311 **** if (dot) *dot = '\0'; if (*user) { if (strlen(user) > sizeof(buf)-10) { ! return convert_smtp(IMAP_MAILBOX_NONEXISTENT); } strcpy(buf, "user."); strcat(buf, user); --- 305,311 ---- if (dot) *dot = '\0'; if (*user) { if (strlen(user) > sizeof(buf)-10) { ! return convert_lmtp(IMAP_MAILBOX_NONEXISTENT); } strcpy(buf, "user."); strcat(buf, user); *************** *** 315,321 **** r = mboxlist_lookup(user+1, (char **)0, (char **)0); } if (r) { ! return convert_smtp(r); } if (dot) *dot = '.'; --- 315,321 ---- r = mboxlist_lookup(user+1, (char **)0, (char **)0); } if (r) { ! return convert_lmtp(r); } if (dot) *dot = '.'; *************** *** 325,331 **** #define RCPT_GROW 3 /* XXX 30 */ ! smtpmode(quotaoverride) int quotaoverride; { char *return_path = 0; --- 325,331 ---- #define RCPT_GROW 3 /* XXX 30 */ ! lmtpmode(quotaoverride) int quotaoverride; { char *return_path = 0; *************** *** 349,355 **** gethostname(myhostname, sizeof(myhostname)-1); ! printf("220 %s ESMTP ready\r\n", myhostname); for (;;) { fflush(stdout); if (!fgets(buf, sizeof(buf)-1, stdin)) { --- 349,355 ---- gethostname(myhostname, sizeof(myhostname)-1); ! printf("220 %s LMTP ready\r\n", myhostname); for (;;) { fflush(stdout); if (!fgets(buf, sizeof(buf)-1, stdin)) { *************** *** 380,386 **** notifyheader, rcpt_addr[i][0] ? rcpt_addr[i] : (char *)0, p, quotaoverride); ! printf("%s\r\n", convert_smtp(r)); } prot_free(prot_f); goto rset; --- 380,386 ---- notifyheader, rcpt_addr[i][0] ? rcpt_addr[i] : (char *)0, p, quotaoverride); ! printf("%s\r\n", convert_lmtp(r)); } prot_free(prot_f); goto rset; *************** *** 387,392 **** --- 387,401 ---- } goto syntaxerr; + case 'l': + case 'L': + if (!strncasecmp(buf, "lhlo ", 5)) { + printf("250-%s\r\n250-8BITMIME\r\n250-ENHANCEDSTATUSCODES\r\n250 PIPELINING\r\n", + myhostname); + continue; + } + goto syntaxerr; + case 'm': case 'M': if (!strncasecmp(buf, "mail ", 5)) { *************** *** 402,412 **** printf("250 2.1.0 ok\r\n"); continue; } - else if (!strncasecmp(buf, "mhlo ", 5)) { - printf("250-%s\r\n250-8BITMIME\r\n250-ENHANCEDSTATUSCODES\r\n250 PIPELINING\r\n", - myhostname); - continue; - } goto syntaxerr; case 'n': --- 411,416 ---- *************** *** 482,493 **** struct protstream * ! savemsg(return_path, idptr, notifyptr, sizeptr, smtpmode) char *return_path; char **idptr; char **notifyptr; unsigned *sizeptr; ! int smtpmode; { FILE *f; char *hostname = 0; --- 486,497 ---- struct protstream * ! savemsg(return_path, idptr, notifyptr, sizeptr, lmtpmode) char *return_path; char **idptr; char **notifyptr; unsigned *sizeptr; ! int lmtpmode; { FILE *f; char *hostname = 0; *************** *** 504,510 **** /* Copy to temp file */ f = tmpfile(); if (!f) { ! if (smtpmode) { printf("451 4.3.%c cannot create temporary file: %s\r\n", ( #ifdef EDQUOT --- 508,514 ---- /* Copy to temp file */ f = tmpfile(); if (!f) { ! if (lmtpmode) { printf("451 4.3.%c cannot create temporary file: %s\r\n", ( #ifdef EDQUOT *************** *** 517,523 **** exit(EX_TEMPFAIL); } ! if (smtpmode) { printf("354 go ahead\r\n"); fflush(stdout); } --- 521,527 ---- exit(EX_TEMPFAIL); } ! if (lmtpmode) { printf("354 go ahead\r\n"); fflush(stdout); } *************** *** 561,570 **** *p = '\0'; } ! if (smtpmode && buf[0] == '.') { if (buf[1] == '\r' && buf[2] == '\n') { /* End of message */ ! goto smtpdot; } /* Remove the dot-stuffing */ fputs(buf+1, f); --- 565,579 ---- *p = '\0'; } ! /* Remove any lone CR characters */ ! while ((p = strchr(buf, '\r')) && p[1] != '\n') { ! strcpy(p, p+1); ! } ! ! if (lmtpmode && buf[0] == '.') { if (buf[1] == '\r' && buf[2] == '\n') { /* End of message */ ! goto lmtpdot; } /* Remove the dot-stuffing */ fputs(buf+1, f); *************** *** 629,647 **** } ! if (smtpmode) { /* Got a premature EOF -- toss message and exit */ exit(0); } ! smtpdot: fflush(f); if (ferror(f)) { ! if (!smtpmode) { perror("deliver: copying message"); exit(EX_TEMPFAIL); } ! while (smtpmode--) { printf("451 4.3.%c cannot copy message to temporary file: %s\r\n", ( #ifdef EDQUOT --- 638,656 ---- } ! if (lmtpmode) { /* Got a premature EOF -- toss message and exit */ exit(0); } ! lmtpdot: fflush(f); if (ferror(f)) { ! if (!lmtpmode) { perror("deliver: copying message"); exit(EX_TEMPFAIL); } ! while (lmtpmode--) { printf("451 4.3.%c cannot copy message to temporary file: %s\r\n", ( #ifdef EDQUOT *************** *** 654,664 **** return 0; } if (fstat(fileno(f), &sbuf) == -1) { ! if (!smtpmode) { perror("deliver: stating message"); exit(EX_TEMPFAIL); } ! while (smtpmode--) { printf("451 4.3.2 cannot stat message temporary file: %s\r\n", error_message(errno)); } --- 663,673 ---- return 0; } if (fstat(fileno(f), &sbuf) == -1) { ! if (!lmtpmode) { perror("deliver: stating message"); exit(EX_TEMPFAIL); } ! while (lmtpmode--) { printf("451 4.3.2 cannot stat message temporary file: %s\r\n", error_message(errno)); } *************** *** 810,816 **** return EX_SOFTWARE; } ! char *convert_smtp(r) int r; { switch (r) { --- 819,825 ---- return EX_SOFTWARE; } ! char *convert_lmtp(r) int r; { switch (r) { diff -cr imapd-1.4.10/imap/krbck.c imapd-1.4.11/imap/krbck.c *** imapd-1.4.10/imap/krbck.c Tue Jul 30 17:01:03 1996 --- imapd-1.4.11/imap/krbck.c Wed Jul 31 17:46:57 1996 *************** *** 323,331 **** --- 323,333 ---- case INTK_PROT: printf("\terror code indicates wrong protocol version (INTK_PROT)\n."); break; + #ifdef INTK_PW_NULL case INTK_PW_NULL: printf("\terror code indicates password was NULL\n"); break; + #endif case INTK_BADPW: printf("\terror code indicates bad password -- imap.%s@%s passwd in srvtab doesn't match kerberos database (INTK_BADPW)\n", phost, realm); diff -cr imapd-1.4.10/imap/mailbox.c imapd-1.4.11/imap/mailbox.c *** imapd-1.4.10/imap/mailbox.c Thu Jul 11 13:51:47 1996 --- imapd-1.4.11/imap/mailbox.c Wed Jul 31 17:45:53 1996 *************** *** 27,32 **** --- 27,35 ---- * */ + #ifdef HAVE_UNISTD_H + #include + #endif #include #include #include diff -cr imapd-1.4.10/imap/mboxlist.c imapd-1.4.11/imap/mboxlist.c *** imapd-1.4.10/imap/mboxlist.c Mon Jul 8 17:19:05 1996 --- imapd-1.4.11/imap/mboxlist.c Thu Aug 29 17:13:20 1996 *************** *** 668,674 **** else { /* Even admins can't rename users */ mboxlist_unlock(); ! return IMAP_PERMISSION_DENIED; } } else { --- 668,674 ---- else { /* Even admins can't rename users */ mboxlist_unlock(); ! return IMAP_MAILBOX_NOTSUPPORTED; } } else { *************** *** 1506,1512 **** quota.root = quota_path + strlen(quota_path); strcpy(quota.root, root); ! if (quota.fd = open(quota_path, O_RDWR, 0)) { /* Just lock and change it */ r = mailbox_lock_quota("a); --- 1506,1512 ---- quota.root = quota_path + strlen(quota_path); strcpy(quota.root, root); ! if ((quota.fd = open(quota_path, O_RDWR, 0)) != -1) { /* Just lock and change it */ r = mailbox_lock_quota("a); diff -cr imapd-1.4.10/imap/message.c imapd-1.4.11/imap/message.c *** imapd-1.4.10/imap/message.c Tue Jul 30 17:01:03 1996 --- imapd-1.4.11/imap/message.c Wed Jul 31 17:46:13 1996 *************** *** 27,32 **** --- 27,35 ---- * */ + #ifdef HAVE_UNISTD_H + #include + #endif #include #include #include diff -cr imapd-1.4.10/imap/pop3d.c imapd-1.4.11/imap/pop3d.c *** imapd-1.4.10/imap/pop3d.c Wed Jul 24 14:37:43 1996 --- imapd-1.4.11/imap/pop3d.c Tue Jul 30 12:10:27 1996 *************** *** 778,783 **** --- 778,787 ---- while (buf[strlen(buf)-1] != '\n' && fgets(buf, sizeof(buf), msgfile)); } fclose(msgfile); + + /* Protect against messages not ending in CRLF */ + if (buf[strlen(buf)-1] != '\n') prot_printf(popd_out, "\r\n"); + prot_printf(popd_out, ".\r\n"); } diff -cr imapd-1.4.10/imap/quota.c imapd-1.4.11/imap/quota.c *** imapd-1.4.10/imap/quota.c Mon Jul 8 17:20:54 1996 --- imapd-1.4.11/imap/quota.c Wed Aug 28 16:19:04 1996 *************** *** 182,187 **** --- 182,188 ---- xrealloc((char *)quota, quota_alloc * sizeof(struct quotaentry)); } quota[quota_num] = zeroquotaentry; + quota[quota_num].quota.fd = -1; quota[quota_num].quota.root = xstrdup(dirent->d_name); r = mailbox_read_quota("a[quota_num].quota); *************** *** 239,249 **** } } r = mailbox_open_header(name, 0, &mailbox); if (r) return r; if (thisquota == -1) { ! if (!partial && mailbox.quota.root) { r = fixquota_fixroot(&mailbox, (char *)0); if (r) { mailbox_close(&mailbox); --- 240,252 ---- } } + if (partial && thisquota == -1) return 0; + r = mailbox_open_header(name, 0, &mailbox); if (r) return r; if (thisquota == -1) { ! if (mailbox.quota.root) { r = fixquota_fixroot(&mailbox, (char *)0); if (r) { mailbox_close(&mailbox); diff -cr imapd-1.4.10/imap/seen_local.c imapd-1.4.11/imap/seen_local.c *** imapd-1.4.10/imap/seen_local.c Tue Jul 30 17:01:04 1996 --- imapd-1.4.11/imap/seen_local.c Fri Aug 2 12:14:18 1996 *************** *** 734,740 **** /* Simplify the iov by coalescing ajacent lines */ for (i = 0; i < newiov_num - 1; i++) { ! if (newiov[i].iov_base + newiov[i].iov_len == newiov[i+1].iov_base && !freenew[i] && !freenew[i]) { newiov[i+1].iov_base = newiov[i].iov_base; newiov[i+1].iov_len += newiov[i].iov_len; --- 734,740 ---- /* Simplify the iov by coalescing ajacent lines */ for (i = 0; i < newiov_num - 1; i++) { ! if ((char *)newiov[i].iov_base + newiov[i].iov_len == newiov[i+1].iov_base && !freenew[i] && !freenew[i]) { newiov[i+1].iov_base = newiov[i].iov_base; newiov[i+1].iov_len += newiov[i].iov_len; diff -cr imapd-1.4.10/imap/version.h imapd-1.4.11/imap/version.h *** imapd-1.4.10/imap/version.h Tue Jul 30 17:01:04 1996 --- imapd-1.4.11/imap/version.h Wed Jul 24 21:04:49 1996 *************** *** 1 **** ! #define CYRUS_VERSION "v1.4.10-Beta" --- 1 ---- ! #define CYRUS_VERSION "v1.4.11-Beta" diff -cr imapd-1.4.10/lib/acte_krb.c imapd-1.4.11/lib/acte_krb.c *** imapd-1.4.10/lib/acte_krb.c Sat May 18 23:16:31 1996 --- imapd-1.4.11/lib/acte_krb.c Sun Jul 28 14:09:38 1996 *************** *** 204,212 **** strncpy(instance, host_name->h_name, sizeof(instance)-1); instance[sizeof(instance)-1] = '\0'; if (p = strchr(instance, '.')) *p = '\0'; - strcpy(realm, krb_realmofhost(host_name->h_name)); /* Fetch imap.hostname service key */ (void) krb_mk_req(&authent, service, instance, realm, 0); --- 204,212 ---- strncpy(instance, host_name->h_name, sizeof(instance)-1); instance[sizeof(instance)-1] = '\0'; + strcpy(realm, krb_realmofhost(instance)); if (p = strchr(instance, '.')) *p = '\0'; /* Fetch imap.hostname service key */ (void) krb_mk_req(&authent, service, instance, realm, 0); diff -cr imapd-1.4.10/lib/auth_unix.c imapd-1.4.11/lib/auth_unix.c *** imapd-1.4.10/lib/auth_unix.c Tue Jun 11 10:56:59 1996 --- imapd-1.4.11/lib/auth_unix.c Wed Jul 24 21:12:50 1996 *************** *** 29,40 **** #include #include #include "auth.h" #include "xmalloc.h" struct auth_state { ! char userid[30]; char **group; int ngroups; }; --- 29,41 ---- #include #include + #include #include "auth.h" #include "xmalloc.h" struct auth_state { ! char userid[81]; char **group; int ngroups; }; *************** *** 79,87 **** char *auth_canonifyid(identifier) const char *identifier; { ! static char retbuf[30]; ! struct passwd *pwd; struct group *grp; if (strcasecmp(identifier, "anonymous") == 0) { return "anonymous"; --- 80,88 ---- char *auth_canonifyid(identifier) const char *identifier; { ! static char retbuf[81]; struct group *grp; + char *p; if (strcasecmp(identifier, "anonymous") == 0) { return "anonymous"; *************** *** 102,110 **** return retbuf; } ! pwd = getpwnam(retbuf); ! if (!pwd) return 0; ! strcpy(retbuf, pwd->pw_name); return retbuf; } --- 103,119 ---- return retbuf; } ! if (strlen(identifier) >= sizeof(retbuf)) return 0; ! ! p = retbuf; ! if (!isalpha(*identifier)) return 0; ! while (*identifier) { ! *p = *identifier++; ! if (!isalpha(*p) && !isdigit(*p) && *p != '-') return 0; ! p++; ! } ! *p = 0; ! return retbuf; } *************** *** 128,134 **** if (!strncmp(identifier, "group:", 6)) return 0; pwd = getpwnam(identifier); - if (!pwd) return 0; newstate = (struct auth_state *)xmalloc(sizeof(struct auth_state)); --- 137,142 ---- *************** *** 141,147 **** if (!strcmp(*mem, identifier)) break; } ! if (*mem || pwd->pw_gid == grp->gr_gid) { newstate->ngroups++; newstate->group = (char **)xrealloc((char *)newstate->group, newstate->ngroups * sizeof(char *)); --- 149,155 ---- if (!strcmp(*mem, identifier)) break; } ! if (*mem || (pwd && pwd->pw_gid == grp->gr_gid)) { newstate->ngroups++; newstate->group = (char **)xrealloc((char *)newstate->group, newstate->ngroups * sizeof(char *)); diff -cr imapd-1.4.10/lib/prot.c imapd-1.4.11/lib/prot.c *** imapd-1.4.10/lib/prot.c Fri Jul 12 14:42:41 1996 --- imapd-1.4.11/lib/prot.c Thu Aug 29 17:15:16 1996 *************** *** 69,74 **** --- 69,77 ---- newstream->error = 0; newstream->eof = 0; newstream->read_timeout = 0; + newstream->flushonread = 0; + newstream->readcallback_proc = 0; + newstream->readcallback_rock = 0; return newstream; } diff -cr imapd-1.4.10/lib/retry.c imapd-1.4.11/lib/retry.c *** imapd-1.4.10/lib/retry.c Wed Jul 24 15:20:47 1996 --- imapd-1.4.11/lib/retry.c Thu Aug 1 18:04:26 1996 *************** *** 115,121 **** for (i = 0; i < iovcnt; i++) { if (iov[i].iov_len > n) { ! iov[i].iov_base += n; iov[i].iov_len -= n; break; } --- 115,121 ---- for (i = 0; i < iovcnt; i++) { if (iov[i].iov_len > n) { ! iov[i].iov_base = (char *)iov[i].iov_base + n; iov[i].iov_len -= n; break; } diff -cr imapd-1.4.10/man/deliver.8 imapd-1.4.11/man/deliver.8 *** imapd-1.4.10/man/deliver.8 Tue Jul 2 11:51:42 1996 --- imapd-1.4.11/man/deliver.8 Sun Jul 28 15:37:54 1996 *************** *** 63,68 **** --- 63,77 ---- ]... .br .B deliver + .B \-l + [ + .B \-e + ] + [ + .B \-q + ] + .br + .B deliver .B \-E .I days .SH DESCRIPTION *************** *** 134,139 **** --- 143,150 ---- Set the system flag or keyword .I flag on the delivered message. + .B \-l + Accept messages using the LMTP protocol. .TP .BI \-E " days" Prune the duplicate delivery database of entries older than