summaryrefslogtreecommitdiffstats
path: root/source/n/alpine/maildir.patch
diff options
context:
space:
mode:
author Patrick J Volkerding <volkerdi@slackware.com>2022-06-06 20:57:15 +0000
committer Eric Hameleers <alien@slackware.com>2022-06-07 07:00:10 +0200
commit0c63f7504daccbf4cc384855d9728d40e8c64eae (patch)
treed82c9435cffe62cc38fb4db9a0d7c0783f652ce8 /source/n/alpine/maildir.patch
parent3909811c024d360abcea79183d32b21b082f6df9 (diff)
downloadcurrent-0c63f7504daccbf4cc384855d9728d40e8c64eae.tar.gz
current-0c63f7504daccbf4cc384855d9728d40e8c64eae.tar.xz
Mon Jun 6 20:57:15 UTC 202220220606205715
a/btrfs-progs-5.18.1-x86_64-1.txz: Upgraded. a/kernel-generic-5.17.13-x86_64-1.txz: Upgraded. a/kernel-huge-5.17.13-x86_64-1.txz: Upgraded. a/kernel-modules-5.17.13-x86_64-1.txz: Upgraded. d/kernel-headers-5.17.13-x86-1.txz: Upgraded. d/pahole-1.23-x86_64-1.txz: Added. Thanks to xaizek and PiterPunk. k/kernel-source-5.17.13-noarch-1.txz: Upgraded. l/gmime-3.2.12-x86_64-1.txz: Upgraded. l/imagemagick-7.1.0_37-x86_64-1.txz: Upgraded. l/python-setuptools_scm-6.4.2-x86_64-1.txz: Upgraded. n/alpine-2.26-x86_64-1.txz: Upgraded. n/mutt-2.2.6-x86_64-1.txz: Upgraded. isolinux/initrd.img: Rebuilt. kernels/*: Upgraded. testing/packages/linux-5.18.x/kernel-generic-5.18.2-x86_64-1.txz: Added. testing/packages/linux-5.18.x/kernel-headers-5.18.2-x86-1.txz: Added. testing/packages/linux-5.18.x/kernel-huge-5.18.2-x86_64-1.txz: Added. testing/packages/linux-5.18.x/kernel-modules-5.18.2-x86_64-1.txz: Added. testing/packages/linux-5.18.x/kernel-source-5.18.2-noarch-1.txz: Added. usb-and-pxe-installers/usbboot.img: Rebuilt.
Diffstat (limited to 'source/n/alpine/maildir.patch')
-rw-r--r--source/n/alpine/maildir.patch807
1 files changed, 461 insertions, 346 deletions
diff --git a/source/n/alpine/maildir.patch b/source/n/alpine/maildir.patch
index 560fe9699..f745f8cac 100644
--- a/source/n/alpine/maildir.patch
+++ b/source/n/alpine/maildir.patch
@@ -1,9 +1,9 @@
-diff -rc alpine-2.24/alpine/alpine.c alpine-2.24.maildir/alpine/alpine.c
-*** alpine-2.24/alpine/alpine.c 2020-10-10 00:24:28.216554908 -0600
---- alpine-2.24.maildir/alpine/alpine.c 2020-10-10 00:26:49.964167282 -0600
+diff -rc alpine-2.26/alpine/alpine.c alpine-2.26.maildir/alpine/alpine.c
+*** alpine-2.26/alpine/alpine.c 2022-06-02 18:14:00.463274817 -0600
+--- alpine-2.26.maildir/alpine/alpine.c 2022-06-02 18:14:52.219147911 -0600
***************
-*** 591,596 ****
---- 591,601 ----
+*** 593,598 ****
+--- 593,603 ----
if(F_ON(F_MAILDROPS_PRESERVE_STATE, ps_global))
mail_parameters(NULL, SET_SNARFPRESERVE, (void *) TRUE);
@@ -15,12 +15,12 @@ diff -rc alpine-2.24/alpine/alpine.c alpine-2.24.maildir/alpine/alpine.c
rvl = 0L;
if(pine_state->VAR_NNTPRANGE){
if(!SVAR_NNTPRANGE(pine_state, rvl, tmp_20k_buf, SIZEOF_20KBUF))
-diff -rc alpine-2.24/alpine/confscroll.c alpine-2.24.maildir/alpine/confscroll.c
-*** alpine-2.24/alpine/confscroll.c 2020-10-10 00:24:28.216554908 -0600
---- alpine-2.24.maildir/alpine/confscroll.c 2020-10-10 00:26:49.968167384 -0600
+diff -rc alpine-2.26/alpine/confscroll.c alpine-2.26.maildir/alpine/confscroll.c
+*** alpine-2.26/alpine/confscroll.c 2022-06-02 18:14:00.463274817 -0600
+--- alpine-2.26.maildir/alpine/confscroll.c 2022-06-02 18:14:52.223147900 -0600
***************
-*** 5567,5572 ****
---- 5567,5578 ----
+*** 5565,5570 ****
+--- 5565,5576 ----
(void *)var->current_val.p);
}
#endif
@@ -33,11 +33,11 @@ diff -rc alpine-2.24/alpine/confscroll.c alpine-2.24.maildir/alpine/confscroll.c
else if(revert && standard_radio_var(ps, var)){
cur_rule_value(var, TRUE, FALSE);
-diff -rc alpine-2.24/imap/src/c-client/mail.c alpine-2.24.maildir/imap/src/c-client/mail.c
-*** alpine-2.24/imap/src/c-client/mail.c 2020-10-10 00:24:28.200554500 -0600
---- alpine-2.24.maildir/imap/src/c-client/mail.c 2020-10-10 00:26:49.968167384 -0600
+diff -rc alpine-2.26/imap/src/c-client/mail.c alpine-2.26.maildir/imap/src/c-client/mail.c
+*** alpine-2.26/imap/src/c-client/mail.c 2022-06-02 18:14:00.471274797 -0600
+--- alpine-2.26.maildir/imap/src/c-client/mail.c 2022-06-02 18:14:52.223147900 -0600
***************
-*** 1063,1069 ****
+*** 1071,1077 ****
MAILSTREAM *ts;
char *s,*t,tmp[MAILTMPLEN];
size_t i;
@@ -45,7 +45,7 @@ diff -rc alpine-2.24/imap/src/c-client/mail.c alpine-2.24.maildir/imap/src/c-cli
/* never allow names with newlines */
if ((s = strpbrk (mailbox,"\015\012")) != NULL) {
MM_LOG ("Can't create mailbox with such a name",ERROR);
---- 1063,1069 ----
+--- 1071,1077 ----
MAILSTREAM *ts;
char *s,*t,tmp[MAILTMPLEN];
size_t i;
@@ -54,8 +54,8 @@ diff -rc alpine-2.24/imap/src/c-client/mail.c alpine-2.24.maildir/imap/src/c-cli
if ((s = strpbrk (mailbox,"\015\012")) != NULL) {
MM_LOG ("Can't create mailbox with such a name",ERROR);
***************
-*** 1087,1092 ****
---- 1087,1094 ----
+*** 1095,1100 ****
+--- 1095,1102 ----
return NIL;
}
@@ -65,8 +65,8 @@ diff -rc alpine-2.24/imap/src/c-client/mail.c alpine-2.24.maildir/imap/src/c-cli
if ((mailbox[0] == '#') && ((mailbox[1] == 'd') || (mailbox[1] == 'D')) &&
((mailbox[2] == 'r') || (mailbox[2] == 'R')) &&
***************
-*** 1117,1122 ****
---- 1119,1131 ----
+*** 1125,1130 ****
+--- 1127,1139 ----
(((*mailbox == '{') || (*mailbox == '#')) &&
(stream = mail_open (NIL,mailbox,OP_PROTOTYPE | OP_SILENT))))
d = stream->dtb;
@@ -80,12 +80,12 @@ diff -rc alpine-2.24/imap/src/c-client/mail.c alpine-2.24.maildir/imap/src/c-cli
else if ((*mailbox != '{') && (ts = default_proto (NIL))) d = ts->dtb;
else { /* failed utterly */
sprintf (tmp,"Can't create mailbox %.80s: indeterminate format",mailbox);
-diff -rc alpine-2.24/imap/src/c-client/mail.h alpine-2.24.maildir/imap/src/c-client/mail.h
-*** alpine-2.24/imap/src/c-client/mail.h 2020-10-10 00:24:28.200554500 -0600
---- alpine-2.24.maildir/imap/src/c-client/mail.h 2020-10-10 00:26:49.968167384 -0600
+diff -rc alpine-2.26/imap/src/c-client/mail.h alpine-2.26.maildir/imap/src/c-client/mail.h
+*** alpine-2.26/imap/src/c-client/mail.h 2022-06-02 18:14:00.471274797 -0600
+--- alpine-2.26.maildir/imap/src/c-client/mail.h 2022-06-02 18:14:52.239147861 -0600
***************
-*** 383,388 ****
---- 383,392 ----
+*** 389,394 ****
+--- 389,398 ----
#define SET_SCANCONTENTS (long) 573
#define GET_MHALLOWINBOX (long) 574
#define SET_MHALLOWINBOX (long) 575
@@ -96,9 +96,19 @@ diff -rc alpine-2.24/imap/src/c-client/mail.h alpine-2.24.maildir/imap/src/c-cli
/* Driver flags */
-diff -rc alpine-2.24/imap/src/osdep/unix/dummy.c alpine-2.24.maildir/imap/src/osdep/unix/dummy.c
-*** alpine-2.24/imap/src/osdep/unix/dummy.c 2020-10-10 00:24:28.192554297 -0600
---- alpine-2.24.maildir/imap/src/osdep/unix/dummy.c 2020-10-10 00:26:49.972167485 -0600
+diff -rc alpine-2.26/imap/src/osdep/unix/dummy.c alpine-2.26.maildir/imap/src/osdep/unix/dummy.c
+*** alpine-2.26/imap/src/osdep/unix/dummy.c 2022-06-02 18:14:00.475274788 -0600
+--- alpine-2.26.maildir/imap/src/osdep/unix/dummy.c 2022-06-02 18:14:52.243147852 -0600
+***************
+*** 33,38 ****
+--- 33,39 ----
+ #include <pwd.h>
+ #include <sys/stat.h>
+ #include "dummy.h"
++ #include "maildir.h"
+ #include "misc.h"
+
+ /* Function prototypes */
***************
*** 104,116 ****
* Accepts: mailbox name
@@ -114,7 +124,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/dummy.c alpine-2.24.maildir/imap/src/os
/* indeterminate clearbox INBOX */
if (!*s) return &dummydriver;
else if (!stat (s,&sbuf)) switch (sbuf.st_mode & S_IFMT) {
---- 104,122 ----
+--- 105,123 ----
* Accepts: mailbox name
* Returns: our driver if name is valid, NIL otherwise
*/
@@ -144,7 +154,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/dummy.c alpine-2.24.maildir/imap/src/os
return NIL;
}
---- 125,133 ----
+--- 126,134 ----
return &dummydriver;
}
/* blackbox INBOX does not exist yet */
@@ -156,7 +166,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/dummy.c alpine-2.24.maildir/imap/src/os
***************
*** 453,458 ****
---- 460,467 ----
+--- 461,468 ----
{
char *s,tmp[MAILTMPLEN];
long ret = NIL;
@@ -167,7 +177,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/dummy.c alpine-2.24.maildir/imap/src/os
sprintf (tmp,"Can't create %.80s: invalid name",mailbox);
***************
*** 518,523 ****
---- 527,540 ----
+--- 528,541 ----
{
struct stat sbuf;
char *s,tmp[MAILTMPLEN];
@@ -180,7 +190,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/dummy.c alpine-2.24.maildir/imap/src/os
+ return maildir_delete(stream, tmp);
+ }
if (!(s = dummy_file (tmp,mailbox))) {
- sprintf (tmp,"Can't delete - invalid name: %.80s",s);
+ sprintf (tmp,"Can't delete - invalid name: %.80s",mailbox);
MM_LOG (tmp,ERROR);
***************
*** 543,554 ****
@@ -196,7 +206,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/dummy.c alpine-2.24.maildir/imap/src/os
MM_LOG (mbx,ERROR);
return NIL;
}
---- 560,582 ----
+--- 561,583 ----
long dummy_rename (MAILSTREAM *stream,char *old,char *newname)
{
struct stat sbuf;
@@ -236,7 +246,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/dummy.c alpine-2.24.maildir/imap/src/os
return T; /* return success */
}
---- 592,607 ----
+--- 593,608 ----
}
}
/* rename of non-ex INBOX creates dest */
@@ -253,17 +263,17 @@ diff -rc alpine-2.24/imap/src/osdep/unix/dummy.c alpine-2.24.maildir/imap/src/os
return T; /* return success */
}
-diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/osdep/unix/maildir.c
-*** alpine-2.24/imap/src/osdep/unix/maildir.c 2020-10-10 00:26:50.012168504 -0600
---- alpine-2.24.maildir/imap/src/osdep/unix/maildir.c 2020-10-10 00:26:49.972167485 -0600
+diff -rc alpine-2.26/imap/src/osdep/unix/maildir.c alpine-2.26.maildir/imap/src/osdep/unix/maildir.c
+*** alpine-2.26/imap/src/osdep/unix/maildir.c 2022-06-02 18:14:52.323147655 -0600
+--- alpine-2.26.maildir/imap/src/osdep/unix/maildir.c 2022-06-02 18:14:52.251147832 -0600
***************
*** 0 ****
---- 1,2671 ----
+--- 1,2865 ----
+ /*
-+ * Maildir driver for Alpine 2.20
++ * Maildir driver for Alpine 2.25
+ *
-+ * Written by Eduardo Chappa <alpine.chappa@gmx.com>
-+ * Last Update: June 10, 2014
++ * Written by Eduardo Chappa <alpine.chappa@yandex.com>
++ * Last Update: October 16, 2021.
+ *
+ */
+
@@ -282,6 +292,117 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ #include "dummy.h"
+ #include "maildir.h"
+
++ /*
++ * A few definitions that try to make this module portable to other
++ * platforms (e.g. Cygwin). This module is based on the information from
++ * http://cr.yp.to/proto/maildir.html
++ */
++
++ /* First we deal with the separator character */
++ #ifndef FLAGSEP
++ #define FLAGSEP ':'
++ #endif
++ #define SIZESEP ','
++
++ const char sep1[] = {FLAGSEP, '1', ',', '\0'}; /* experimental semantics*/
++ const char sep2[] = {FLAGSEP, '2', ',', '\0'}; /* Flags Information */
++ const char sep3[] = {FLAGSEP, '3', ',', '\0'}; /* Grrrr.... */
++ const char *sep[] = { sep1, sep2, sep3, NULL};
++ #define MDSEP(i) sep[((i) - 1)]
++
++ /* Now we deal with flags. Woohoo! */
++ const int mdimapflags[] = {Draft, Flagged, Replied, Seen, Trashed, EmptyFlag, EndFlags};
++ const int mdkwdflags[] = {Passed, EmptyFlag, EndFlags};
++
++ /* this array lists the codes for mdflgnms (maildir flag names) above */
++ const char *mdflags[] = { "D", "F", "P", "R", "S", "T", "", NULL};
++ /* and as characters too */
++ const char cmdflags[] = { 'D', 'F', 'P', 'R', 'S', 'T', '0', '\0'};
++
++ /* MDFLAG(Seen, elt->seen) */
++ #define MDFLAG(i,j) mdflags[j ? (i) : EmptyFlag]
++ /* MDFLAGC(Seen) */
++ #define MDFLAGC(i) cmdflags[(i)]
++
++ /* Now we deal with the directory structure */
++ char *mdstruct[] = {"cur", "tmp", "new", NULL};
++ #define MDNAME(i) mdstruct[(i)]
++ #define MDFLD(X, Y, i) do { snprintf((X), sizeof((X)), "%.*s/%.*s", \
++ (int) (sizeof((X)) - 6), (Y), \
++ 3, mdstruct[(i)]); \
++ (X)[sizeof((X)) - 1] = '\0'; \
++ } while(0)
++
++ #define MSGPATH(X, Y, Z,i) do { snprintf((X), sizeof((X)), "%.*s/%.*s/%.*s", \
++ (int) strlen((Y)), (Y), \
++ 3, mdstruct[(i)], \
++ (int)(sizeof((X)) - strlen((Y)) - 3 - 3), (Z)); \
++ (X)[sizeof((X)) - 1] = '\0'; \
++ } while(0)
++
++ /* Files associated to a maildir directory */
++
++ #define MDUIDVALIDITY ".uidvalidity" /* support for old maildirs */
++ #define MDDIR ".mdir" /* this folder is a directory */
++ #define MDUIDLAST ".uidlast" /* last assigned uid */
++ #define MDUIDTEMP ".uidtemp" /* We assign uid's no one else */
++
++ /* Support of Courier Structure */
++ #define CCLIENT 0
++ #define COURIER 1
++ #define IS_CCLIENT(t) \
++ (((t) && (t)[0] == '#' && ((t)[1] == 'm' || (t)[1] == 'M')\
++ && ((t)[2] == 'd' || (t)[2] == 'D')\
++ && (t)[3] == '/' && (t)[4] != '\0') ? 1 : 0)
++
++ #define IS_COURIER(t) \
++ (((t) && (t)[0] == '#' && ((t)[1] == 'm' || (t)[1] == 'M')\
++ && ((t)[2] == 'c' || (t)[2] == 'C')\
++ && (t)[3] == '/' && (t)[4] != '\0') ? 1 : 0)
++ #define MDPREFIX(s) ((s) ? "#mc/" : "#md/")
++ #define MDSEPARATOR(s) ((s) ? '.' : '/')
++
++ /* UID Support */
++
++ #define MAXTEMPUID (unsigned long) 180L
++ const char mduid[] = {',','u','=','\0'};
++ #define MDUIDSEP mduid
++
++ /* Now we deal with messages filenames */
++ char mdlocaldomain[MAILTMPLEN+1] = {'\0'};
++ pid_t mypid = (pid_t) 0;
++ static char *mdfpath = NULL;
++ static char myMdInboxDir[50] = { '\0' };/* Location of the Maildir INBOX */
++ static long CourierStyle = CCLIENT;
++
++ #define CHUNK 16384 /* from unix.h */
++
++ /* In gdb this is the *(struct maildir_local *)stream->local structure */
++ typedef struct maildir_local {
++ unsigned int dirty : 1; /* diskcopy needs updating */
++ unsigned int courier : 1; /* It is Courier style file system */
++ unsigned int link : 1; /* There is a symbolic link */
++ int candouid; /* we can assign uids and no one else */
++ char *uidtempfile; /* path to uid temp file */
++ int fd; /* fd of open message */
++ char *dir; /* mail directory name */
++ char **path; /* path to directories cur, new and tmp */
++ unsigned char *buf; /* temporary buffer */
++ unsigned long buflen; /* current size of temporary buffer */
++ time_t scantime; /* last time directory scanned */
++ } MAILDIRLOCAL;
++
++ /* Convenient access to local data */
++ #define LOCAL ((MAILDIRLOCAL *) stream->local)
++
++ #define MDFILE(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->name)
++ #define MDLOC(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->loc)
++ #define MDPOS(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->pos)
++ #define MDSIZE(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->size)
++ #define MDATIME(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->atime)
++ #define MDMTIME(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->mtime)
++ #define MDCTIME(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->ctime)
++
+ /* Driver dispatch used by MAIL */
+ DRIVER maildirdriver = {
+ "md", /* driver name, yes it's md, not maildir */
@@ -797,26 +918,31 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ MM_CRITICAL(stream);
+
+ maildir_scandir (LOCAL->path[New], &namesnew, &nfilesnew, &scan_err, CCLIENT);
-+ if (scan_err < 0)
++ if (scan_err < 0){
++ if(namesnew){
++ for(i = 0L; i < nfilesnew; i++)
++ fs_give((void **)&namesnew[i]);
++ fs_give((void **) &namesnew);
++ }
+ maildir_abort(stream);
++ }
+
+ /* Scan old messages first, escoba! */
-+ if(stream->rdonly ||
-+ (LOCAL && ((maildir_initial_check(stream, Cur) == 0)
-+ || nfilesnew > 0L))){
++ if(stream->rdonly
++ || (LOCAL && ((maildir_initial_check(stream, Cur) == 0)
++ || nfilesnew > 0L))){
+ LOCAL->scantime = maildir_scandir (LOCAL->path[Cur], &namescur, &nfilescur,
+ &scan_err, CCLIENT);
+ if (scan_err < 0){
-+ if(namesnew){
-+ for(i = 0L; i < nfilesnew; i++)
-+ fs_give((void **)&namesnew[i]);
-+ fs_give((void **) &namesnew);
++ if(namescur){
++ for(i = 0L; i < nfilescur; i++)
++ fs_give((void **)&namescur[i]);
++ fs_give((void **) &namescur);
+ }
+ maildir_abort(stream);
+ }
+ }
-+ if(LOCAL && (maildir_initial_check(stream, New) == 0)
-+ && (nfilescur > 0L)){
++ if(LOCAL && (maildir_initial_check(stream, New) == 0) && (nfilescur > 0L)){
+ while(LOCAL && loop < 10){
+ if(nfilesnew == 0L)
+ maildir_scandir (LOCAL->path[New], &namesnew, &nfilesnew, &scan_err, CCLIENT);
@@ -913,7 +1039,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ unsigned long i, new = 0L, l, uid_last;
+ unsigned long recent = stream ? stream->recent : 0L;
+ int d = 0, f = 0, r = 0, s = 0, t = 0;
-+ int we_compute, in_list;
++ int we_compute, in_list, len;
+ int silent = stream ? stream->silent : NIL;
+ MESSAGECACHE *elt;
+
@@ -939,6 +1065,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+
+ stream->silent = T;
+ uid_last = 0L;
++ len = LOCAL->path[Cur] ? (int) strlen(LOCAL->path[Cur]) : 0;
+ for (we_compute = 0, i = l = 1L; l <= nfiles; l++){
+ unsigned long pos, uid;
+ if (dirtype == New && !stream->rdonly){ /* move new messages to cur */
@@ -953,7 +1080,10 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ *(mdstr+1) = '2';
+ else
+ strcat(tmp, MDSEP(2));
-+ snprintf(newfile, sizeof(newfile), "%s/%s", LOCAL->path[Cur], tmp);
++ snprintf(newfile, sizeof(newfile), "%.*s/%.*s",
++ len, LOCAL->path[Cur] ? LOCAL->path[Cur] : "",
++ (int) sizeof(newfile) - len, tmp);
++ newfile[sizeof(newfile)-1] = '\0';
+ if(rename (file, newfile) != 0){
+ mm_log("Unable to read new mail!", WARN);
+ continue;
@@ -1115,6 +1245,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ }
+
+ MSGPATH(tmp, LOCAL->dir, MDFILE(elt), MDLOC(elt));
++
+ if (LOCAL->fd < 0) /* if file closed ? */
+ LOCAL->fd = open(tmp,O_RDONLY,NIL);
+
@@ -1136,26 +1267,16 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ STRING bs;
+ char *s,tmp[CHUNK];
+ unsigned long msgno = elt->msgno;
-+ static int try = 0;
+
+ if (length)
+ *length = 0L;
+ LOCAL->buf[0] = '\0';
+
+ MSGPATH(tmp, LOCAL->dir, MDFILE(elt), MDLOC(elt));
-+ if (LOCAL->fd < 0) /* if file closed ? */
-+ LOCAL->fd = open(tmp,O_RDONLY,NIL);
-+
-+ if (LOCAL->fd < 0){ /* flag change? */
-+ if (try < 5){
-+ try++;
-+ if (maildir_update_elt_maildirp(stream, msgno) > 0)
-+ try = 0;
-+ return maildir_text_work(stream, mail_elt(stream, msgno),length, flags);
-+ }
-+ try = 0;
-+ return NULL;
-+ }
++ if (LOCAL->fd < 0 && ((LOCAL->fd = open (tmp,O_RDONLY,NIL)) < 0))
++ return maildir_update_elt_maildirp(stream, msgno) > 0
++ ? maildir_text_work(stream, mail_elt(stream, msgno),length, flags)
++ : NULL;
+
+ lseek (LOCAL->fd, elt->private.msg.text.offset,L_SET);
+
@@ -1242,41 +1363,40 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ int
+ maildir_update_elt_maildirp(MAILSTREAM *stream, unsigned long msgno)
+ {
-+ struct direct **names = NIL;
-+ unsigned long i, nfiles, pos;
-+ int d = 0, f = 0 , r = 0, s = 0, t = 0, in_list, scan_err;
-+ MESSAGECACHE *elt;
++ struct direct **names = NIL;
++ unsigned long i, nfiles, pos;
++ int d = 0, f = 0 , r = 0, s = 0, t = 0, in_list, scan_err;
++ MESSAGECACHE *elt;
+
-+ maildir_scandir (LOCAL->path[Cur], &names, &nfiles, &scan_err, CCLIENT);
++ maildir_scandir (LOCAL->path[Cur], &names, &nfiles, &scan_err, CCLIENT);
+
-+ elt = mail_elt (stream,msgno);
++ if(scan_err < 0) return -1;
+
-+ in_list = nfiles > 0L
-+ ? maildir_message_in_list(MDFILE(elt), names, 0L, nfiles - 1L, &pos)
-+ : NIL;
++ elt = mail_elt (stream,msgno);
+
-+ if (in_list && pos >= 0L && pos < nfiles
-+ && !strcmp(MDFILE(elt), names[pos]->d_name)){
-+ in_list = NIL;
-+ maildir_abort(stream);
-+ }
++ in_list = nfiles > 0L
++ ? maildir_message_in_list(MDFILE(elt), names, 0L, nfiles - 1L, &pos)
++ : 0;
+
-+ if (in_list && pos >= 0L && pos < nfiles){
++ if (in_list && pos >= 0L && pos < nfiles
++ && strcmp(MDFILE(elt), names[pos]->d_name)){
+ maildir_free_file_only((void **)&elt->private.spare.ptr);
+ MDFILE(elt) = cpystr(names[pos]->d_name);
+ maildir_getflag(MDFILE(elt), &d, &f, &r ,&s, &t);
+ if (elt->draft != d || elt->flagged != f ||
-+ elt->answered != r || elt->seen != s || elt->deleted != t){
-+ elt->draft = d; elt->flagged = f; elt->answered = r;
-+ elt->seen = s; elt->deleted = t;
-+ MM_FLAGS(stream, msgno);
-+ }
-+ }
-+ for (i = 0L; i < nfiles; i++)
++ elt->answered != r || elt->seen != s || elt->deleted != t){
++ elt->draft = d; elt->flagged = f; elt->answered = r;
++ elt->seen = s; elt->deleted = t;
++ MM_FLAGS(stream, msgno);
++ }
++ }
++ else in_list = 0; /* we did not update the file name */
++
++ for (i = 0L; i < nfiles; i++)
+ fs_give((void **) &names[i]);
-+ if (names)
++ if (names)
+ fs_give((void **) &names);
-+ return in_list ? 1 : -1;
++ return in_list ? 1 : -1;
+ }
+
+ /* Maildir fetch message header */
@@ -1284,9 +1404,8 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ char *maildir_header (MAILSTREAM *stream,unsigned long msgno,
+ unsigned long *length, long flags)
+ {
-+ char tmp[MAILTMPLEN], *s;
++ char tmp[MAILTMPLEN], *s = NULL;
+ MESSAGECACHE *elt;
-+ static int try = 0;
+
+ if (length) *length = 0;
+ if (flags & FT_UID || !LOCAL) return ""; /* UID call "impossible" */
@@ -1295,23 +1414,12 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ maildir_parse_message(stream, msgno, MDLOC(elt));
+
+ MSGPATH(tmp, LOCAL->dir, MDFILE(elt), MDLOC(elt));
-+ if (LOCAL->fd < 0)
-+ LOCAL->fd = open (tmp,O_RDONLY,NIL);
-+
-+ if (LOCAL->fd < 0 && errno == EACCES){
-+ mm_log ("Message exists but can not be read. Envelope and body lost!",ERROR);
-+ return NULL;
-+ }
-+
-+ if (LOCAL->fd < 0){ /* flag change? */
-+ if (try < 5){
-+ try++;
-+ if (maildir_update_elt_maildirp(stream, msgno) > 0)
-+ try = 0;
-+ return maildir_header(stream, msgno, length, flags);
-+ }
-+ try = 0;
-+ return NULL;
++ if (LOCAL->fd < 0 && ((LOCAL->fd = open (tmp,O_RDONLY,NIL)) < 0)){
++ if(errno == EACCES)
++ mm_log ("Message exists but can not be read. Envelope and body lost!",ERROR);
++ return maildir_update_elt_maildirp(stream, msgno) > 0
++ ? maildir_header(stream, msgno, length, flags)
++ : NULL;
+ }
+
+ if (flags & FT_INTERNAL){
@@ -1405,9 +1513,9 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ ret = (void *) myMdInboxDir;
+ break;
+ case SET_COURIERSTYLE:
-+ CourierStyle = (long) value;
++ CourierStyle = * (long *) value; /* fix by Chris Caputo */
+ case GET_COURIERSTYLE:
-+ ret = (void *) CourierStyle;
++ ret = (void *) &CourierStyle; /* fix by Chris Caputo */
+ break;
+ case GET_DIRFMTTEST:
+ ret = (void *) maildir_dirfmttest;
@@ -1424,9 +1532,12 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ DirNamesType i;
+
+ for (i = Cur; i != EndDir; i++){
++ int len;
+ MDFLD(tmp, mailbox, i);
++ len = (int) strlen(tmp);
+ if (mkdir(tmp, 0700) && errno != EEXIST){ /* try to make new dir */
-+ snprintf (err, sizeof(err), "Can't create %s: %s", tmp, strerror(errno));
++ snprintf (err, sizeof(err), "Can't create %.*s: %.*s", len, tmp, (int)(sizeof(err) - len - 16), strerror(errno));
++ err[sizeof(err) - 1] = '\0';
+ mm_log (err,ERROR);
+ return NIL;
+ }
@@ -1494,9 +1605,14 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ if(style == CCLIENT){
+ if(!courier){
+ FILE *fp = NULL;
-+ snprintf(tmp2, sizeof(tmp2), "%s%s", tmp, MDDIR);
++ int len = (int) (sizeof(tmp2) - strlen(MDDIR)) - 1;
++ snprintf(tmp2, sizeof(tmp2), "%.*s%.*s", len, tmp, (int) strlen(MDDIR), MDDIR);
++ tmp2[sizeof(tmp2) - 1] = '\0';
+ if ((fp = fopen(tmp2,"w")) == NULL){
-+ snprintf (err, sizeof(err), "Problem creating %s: %s", tmp2, strerror(errno));
++ snprintf (err, sizeof(err), "Problem creating %.*s: %.*s",
++ len, tmp2,
++ (int) sizeof(err) - len - 19, strerror(errno));
++ err[sizeof(err) - 1] = '\0';
+ mm_log (err,ERROR);
+ return NIL;
+ }
@@ -1545,14 +1661,21 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ errno = ENOENT;
+ try = MAXTRY;
+ }
-+ if (*fn) /* new oldfile! */
-+ snprintf (oldfile,sizeof(oldfile),"%s/%s", LOCAL->path[Cur], fn);
++ if (*fn){ /* new oldfile! */
++ snprintf (oldfile,sizeof(oldfile),"%.*s/%.*s",
++ (int) strlen(LOCAL->path[Cur]), LOCAL->path[Cur],
++ (int) (sizeof(oldfile) - strlen(LOCAL->path[Cur])),fn);
++ oldfile[sizeof(oldfile) - 1] = '\0';
++ }
+ if ((s = strrchr (MDFILE(elt), FLAGSEP))) *s = '\0';
+ snprintf (fn, sizeof(fn), "%s%s%s%s%s%s%s", MDFILE(elt), MDSEP(2),
+ MDFLAG(Draft, elt->draft), MDFLAG(Flagged, elt->flagged),
+ MDFLAG(Replied, elt->answered), MDFLAG(Seen, elt->seen),
+ MDFLAG(Trashed, elt->deleted));
-+ snprintf (newfile, sizeof(newfile), "%s/%s",LOCAL->path[Cur],fn);
++ snprintf (newfile, sizeof(newfile), "%.*s/%.*s",
++ (int) strlen(LOCAL->path[Cur]), LOCAL->path[Cur],
++ (int) (sizeof(newfile) - strlen(LOCAL->path[Cur]) - 4), fn);
++ newfile[sizeof(newfile) - 1] = '\0';
+ if (ren != 0 && rename (oldfile,newfile) >= 0)
+ try = -1;
+ }
@@ -1637,17 +1760,16 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ if (((fd = open (path,O_RDONLY,NIL)) < 0)
+ ||((!elt->rfc822_size &&
+ ((stat(path, &sbuf) < 0) || !S_ISREG (sbuf.st_mode)))))
-+ return NIL;
-+ if(!elt->rfc822_size)
-+ MDSIZE(elt) = sbuf.st_size;
-+ s = (char *) fs_get(MDSIZE(elt) + 1);
-+ read (fd,s,MDSIZE(elt));
-+ s[MDSIZE(elt)] = '\0';
-+ close (fd);
-+ len = strcrlfcpy (&LOCAL->buf,&LOCAL->buflen, s, MDSIZE(elt));
-+ INIT (&st,mail_string, LOCAL->buf, len);
-+ elt->rfc822_size = len;
-+ fs_give ((void **)&s);
++ return NIL;
++ if(!elt->rfc822_size) MDSIZE(elt) = sbuf.st_size;
++ s = (char *) fs_get(MDSIZE(elt) + 1);
++ read (fd,s,MDSIZE(elt));
++ s[MDSIZE(elt)] = '\0';
++ close (fd);
++ len = strcrlfcpy (&LOCAL->buf,&LOCAL->buflen, s, MDSIZE(elt));
++ INIT (&st,mail_string, LOCAL->buf, len);
++ elt->rfc822_size = len;
++ fs_give ((void **)&s);
+
+ flags[0] = flags[1] = '\0';
+ if (elt->seen) strcat (flags," \\Seen");
@@ -1729,11 +1851,12 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+
+ f = mail_parse_flags (stream,flags,&uf);
+ do {
-+ /* build file name we will use */
-+ snprintf (file, sizeof(file), "%lu.%d_%09u.%s%s%s%s%s%s",
-+ ti, mypid, transact++, mdlocaldomain, (f ? MDSEP(2) : ""),
-+ MDFLAG(Draft, f&fDRAFT), MDFLAG(Flagged, f&fFLAGGED),
-+ MDFLAG(Replied, f&fANSWERED), MDFLAG(Seen, f&fSEEN));
++ /* build file name we will use, fix by Chris Caputo */
++ snprintf (file, sizeof(file), "%lu.%d_%09u.%.*s%.*s%.*s%.*s%.*s%.*s",
++ ti, mypid, transact++,
++ (int)(sizeof(file) - 50), mdlocaldomain, (int) strlen(MDSEP(2)), (f ? MDSEP(2) : ""),
++ 1, MDFLAG(Draft, f&fDRAFT), 1, MDFLAG(Flagged, f&fFLAGGED),
++ 1, MDFLAG(Replied, f&fANSWERED), 1, MDFLAG(Seen, f&fSEEN));
+ /* build tmp file name */
+ if (maildir_file_path(mailbox, tmp, sizeof(tmp))) /* copy in TMP */
+ MSGPATH(path1, tmp, file, Tmp);
@@ -1792,7 +1915,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ {
+ DIR *dirp;
+ struct direct *d;
-+ int i, remove_dir = 0, mddir = 0, rv, error = 0;
++ int i, remove_dir = 0, mddir = 0, rv, error = 0, len;
+ char tmp[MAILTMPLEN],tmp2[MAILTMPLEN], realname[MAILTMPLEN];
+ struct stat sbuf;
+ int courier = IS_COURIER(mailbox);
@@ -1825,18 +1948,28 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ maildir_file_path(mailbox, realname, sizeof(realname));
+
+ if (remove_dir){
-+ snprintf(tmp, sizeof(tmp), "%s/%s", realname, MDDIR);
++ snprintf(tmp, sizeof(tmp), "%.*s/%.*s", (int) (sizeof(tmp) - strlen(MDDIR) - 2), realname, (int) strlen(MDDIR), MDDIR);
++ tmp[sizeof(tmp) - 1] = '\0';
+ if ((rv = stat (tmp,&sbuf)) == 0 && S_ISREG(sbuf.st_mode))
+ rv = unlink(tmp);
+ else if (errno == ENOENT)
+ rv = 0;
+ if (rv != 0){
-+ snprintf(tmp, sizeof(tmp), "Can not remove %s/%s: %s", tmp2, MDDIR, strerror(errno));
++ len = (int) strlen(tmp2);
++ snprintf(tmp, sizeof(tmp), "Can not remove %.*s/%.*s: %.*s",
++ len, tmp2,
++ (int) strlen(MDDIR), MDDIR,
++ (int) (sizeof(tmp) - strlen(MDDIR)) - len - 19, strerror(errno));
++ tmp[sizeof(tmp) - 1] = '\0';
+ mm_log (tmp,ERROR);
+ return NIL;
+ }
+ if (!maildir_valid(realname) && rmdir(realname) != 0){
-+ snprintf(tmp, sizeof(tmp), "Can not remove %s/: %s", mailbox, strerror(errno));
++ len = (int) strlen(mailbox);
++ snprintf(tmp, sizeof(tmp), "Can not remove %.*s/: %.*s",
++ len, mailbox,
++ (int)(sizeof(tmp) - len - 19), strerror(errno));
++ tmp[sizeof(tmp)-1] = '\0';
+ mm_log (tmp, ERROR);
+ return NIL;
+ }
@@ -1847,16 +1980,28 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ MDFLD(tmp, realname, i);
+
+ if (!(dirp = opendir (tmp))){
-+ snprintf(tmp, sizeof(tmp), "Can not read %s/: %s", mailbox, strerror(errno));
++ len = (int) strlen(mailbox);
++ snprintf(tmp, sizeof(tmp), "Can not read %.*s/: %.*s",
++ len, mailbox,
++ (int)(sizeof(tmp) - len - 19), strerror(errno));
++ tmp[sizeof(tmp)-1] = '\0';
+ mm_log (tmp, ERROR);
+ return NIL;
+ }
+
+ while ((d = readdir(dirp)) != NULL){
++ len = (int) strlen(tmp);
+ if (strcmp(d->d_name, ".") && strcmp(d->d_name,"..")){
-+ snprintf(tmp2, sizeof(tmp2), "%s/%s", tmp, d->d_name);
++ snprintf(tmp2, sizeof(tmp2), "%.*s/%.*s",
++ len, tmp,
++ (int) (sizeof(tmp) - len) -1, d->d_name);
++ tmp2[sizeof(tmp2) - 1] = '\0';
+ if (unlink(tmp2) != 0){
-+ snprintf(tmp2, sizeof(tmp2), "Can not remove %s: %s", mailbox, strerror(errno));
++ len = (int) strlen(mailbox);
++ snprintf(tmp2, sizeof(tmp2), "Can not remove %.*s: %.*s",
++ len, mailbox,
++ (int)(sizeof(tmp2) - len - 18), strerror(errno));
++ tmp2[sizeof(tmp2)-1] = '\0';
+ mm_log (tmp2, ERROR);
+ return NIL;
+ }
@@ -1864,7 +2009,11 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ }
+ closedir(dirp);
+ if (rmdir(tmp) != 0){
-+ snprintf(tmp, sizeof(tmp), "Can not remove %s: %s", mailbox, strerror(errno));
++ len = (int) strlen(mailbox);
++ snprintf(tmp, sizeof(tmp), "Can not remove %.*s: %.*s",
++ len, mailbox,
++ (int)(sizeof(tmp) - len - 18), strerror(errno));
++ tmp[sizeof(tmp)-1] = '\0';
+ mm_log (tmp, ERROR);
+ return NIL;
+ }
@@ -1875,7 +2024,11 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ */
+
+ if(!(dirp = opendir (realname))){
-+ snprintf(tmp, sizeof(tmp), "Can not read %s/: %s", realname, strerror(errno));
++ len = (int) strlen(realname);
++ snprintf(tmp, sizeof(tmp), "Can not read %.*s/: %.*s",
++ len, realname,
++ (int)(sizeof(tmp) - len - 16), strerror(errno));
++ tmp[sizeof(tmp)-1] = '\0';
+ mm_log (tmp, ERROR);
+ return NIL;
+ }
@@ -1887,7 +2040,11 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ || !strncmp(d->d_name, MDUIDTEMP, strlen(MDUIDTEMP)))){
+ if(strcmp(d->d_name, MDDIR) == 0)
+ mddir++;
-+ snprintf(tmp, sizeof(tmp), "%s/%s", realname, d->d_name);
++ len = (int) strlen(realname);
++ snprintf(tmp, sizeof(tmp), "%.*s/%.*s",
++ len, realname,
++ (int)(sizeof(tmp) - len - 2), strerror(errno));
++ tmp[sizeof(tmp)-1] = '\0';
+ if (unlink(tmp) != 0)
+ error++;
+ }
@@ -1895,7 +2052,11 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ closedir(dirp);
+ if (error ||
+ (maildir_dir_is_empty(mailbox) && mddir == 0 && rmdir(realname) < 0)){
-+ snprintf(tmp, sizeof(tmp), "Can not remove folder %s: %s", mailbox, strerror(errno));
++ len = (int) strlen(mailbox);
++ snprintf(tmp, sizeof(tmp), "Can not remove folder %.*s: %.*s",
++ len, mailbox,
++ (int)(sizeof(tmp) - len - 16), strerror(errno));
++ tmp[sizeof(tmp)-1] = '\0';
+ mm_log (tmp, ERROR);
+ return NIL;
+ }
@@ -1907,38 +2068,53 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ char tmp[MAILTMPLEN], tmpnew[MAILTMPLEN], realold[MAILTMPLEN];
+ char realnew[MAILTMPLEN];
+ int courier = IS_COURIER(old) && IS_COURIER(new);
-+ int i;
++ int i, len;
+ long rv = LONGT;
+ COURIER_S *cdir;
+
+ if((IS_COURIER(old) || IS_COURIER(new)) && !courier){
-+ snprintf (tmp, sizeof(tmp), "Can't rename mailbox %s to %s", old, new);
++ len = (int) strlen(old);
++ snprintf (tmp, sizeof(tmp), "Can't rename mailbox %.*s to %.*s",
++ len, old,
++ (int) sizeof(tmp) - len - 26, new);
++ tmp[sizeof(tmp) - 1] = '\0';
+ mm_log (tmp, ERROR);
+ return NIL;
+ }
+
+ if (!maildir_valid(old)){
-+ snprintf (tmp, sizeof(tmp), "Can't rename mailbox %s: folder not in maildir format",old);
++ snprintf (tmp, sizeof(tmp), "Can't rename mailbox %.*s: folder not in maildir format",
++ (int) sizeof(tmp) - 52, old);
++ tmp[sizeof(tmp) - 1] = '\0';
+ mm_log (tmp, ERROR);
+ return NIL;
+ }
+ maildir_file_path(old, realold, sizeof(realold));
+ if (!maildir_valid_name(new) && new[0] == '#'){
-+ snprintf (tmp, sizeof(tmp), "Cannot rename mailbox %s: folder not in maildir format", new);
++ snprintf (tmp, sizeof(tmp), "Cannot rename mailbox %.*s: folder not in maildir format",
++ (int) sizeof(tmp) - 53, new);
++ tmp[sizeof(tmp) - 1] = '\0';
+ mm_log (tmp, ERROR);
+ return NIL;
+ }
+ maildir_file_path(new, realnew, sizeof(realnew));
+ if (access(tmpnew,F_OK) == 0){ /* new mailbox name must not exist */
-+ snprintf (tmp, sizeof(tmp), "Cannot rename to mailbox %s: destination already exists", new);
++ snprintf (tmp, sizeof(tmp), "Cannot rename to mailbox %.*s: destination already exists",
++ (int)(sizeof(tmp) - 54), new);
++ tmp[sizeof(tmp) - 1] = '\0';
+ mm_log (tmp, ERROR);
+ return NIL;
+ }
+
+ if(!courier){
+ if (rename(realold, realnew)){ /* try to rename the directory */
-+ snprintf(tmp, sizeof(tmp), "Can't rename mailbox %s to %s: %s", old, new,
-+ strerror(errno));
++ int len2 = (int) strlen(new);
++ len = (int) strlen(old);
++ snprintf(tmp, sizeof(tmp), "Can't rename mailbox %.*s to %.*s: %.*s",
++ len, old,
++ len2, new,
++ (int) sizeof(tmp) - len - len2 - 28, strerror(errno));
++ tmp[sizeof(tmp) - 1] = '\0';
+ mm_log(tmp,ERROR);
+ return NIL;
+ }
@@ -1948,12 +2124,21 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ cdir = courier_list_dir(old);
+ for (i = 0; cdir && i < cdir->total; i++){
+ if(strstr(cdir->data[i]->name, old)){
-+ snprintf(tmp, sizeof(tmp), "%s%s", new, cdir->data[i]->name+strlen(old));
++ len = (int) strlen(new);
++ snprintf(tmp, sizeof(tmp), "%.*s%.*s",
++ len, new,
++ (int) sizeof(tmp) - len - 1, cdir->data[i]->name+strlen(old));
++ tmp[sizeof(tmp) - 1] = '\0';
+ maildir_file_path(cdir->data[i]->name, realold, sizeof(realold));
+ maildir_file_path(tmp, realnew, sizeof(realnew));
+ if (rename(realold, realnew)){
-+ snprintf (tmp, sizeof(tmp), "Can't rename mailbox %s to %s: %s", old, new,
-+ strerror(errno));
++ int len2 = (int) strlen(new);
++ len = (int) strlen(old);
++ snprintf (tmp, sizeof(tmp), "Can't rename mailbox %.*s to %.*s: %.*s",
++ len, old,
++ len2, new,
++ (int) sizeof(tmp) - len - len2 - 28, strerror(errno));
++ tmp[sizeof(tmp) - 1] = '\0';
+ mm_log(tmp,ERROR);
+ rv = NIL;
+ }
@@ -2008,6 +2193,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ char curdir[MAILTMPLEN],name[MAILTMPLEN], tmp[MAILTMPLEN];
+ char realpat[MAILTMPLEN];
+ long i;
++ int len;
+ char *maildirpath = mdirpath();
+
+ snprintf(curdir, sizeof(curdir), "%s/%s/", myrootdir(pat), dir ? dir : maildirpath);
@@ -2031,22 +2217,25 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ mm_list (stream,'/', pat, LATT_NOSELECT);
+ }
+
++ len = (int) strlen(name);
+ while ((d = readdir (dp)) != NULL)
+ if(strcmp(d->d_name, ".") && strcmp(d->d_name,"..")
+ && strcmp(d->d_name, MDNAME(Cur))
+ && strcmp(d->d_name, MDNAME(Tmp))
+ && strcmp(d->d_name, MDNAME(New))){
+
-+ if (dir) snprintf (tmp, sizeof(tmp), "%s%s", name,d->d_name);
++ if (dir) snprintf (tmp, sizeof(tmp), "%.*s%.*s", len, name,(int) sizeof(tmp) - len - 1, d->d_name);
+ else strcpy(tmp, d->d_name);
++ tmp[sizeof(tmp) - 1] = '\0';
+
+ if(pmatch_full (tmp, pat,'/')){
+ snprintf(tmp, sizeof(tmp), "%s/%s/%s", myrootdir(d->d_name),
+ (dir ? dir : maildirpath), d->d_name);
+ if(stat (tmp,&sbuf) == 0
+ && ((sbuf.st_mode & S_IFMT) == S_IFDIR)){
-+ if (dir) snprintf (tmp, sizeof(tmp), "%s%s", name,d->d_name);
++ if (dir) snprintf (tmp, sizeof(tmp), "%.*s%.*s", len, name, (int) sizeof(tmp) - len - 1, d->d_name);
+ else strcpy(tmp, d->d_name);
++ tmp[sizeof(tmp) - 1] = '\0';
+ i = maildir_valid(tmp)
+ ? (maildir_contains_folder(dir, d->d_name)
+ ? LATT_HASCHILDREN
@@ -2247,6 +2436,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ char tmp[MAILTMPLEN], *b;
+ int offset = 0;
+ int tmpd, tmpf, tmpr, tmps, tmpt;
++ int done = 0; /* fix by Chris Caputo */
+
+ if(d) *d = 0;
+ if(f) *f = 0;
@@ -2256,7 +2446,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+
+ tmpd = tmpf = tmpr = tmps = tmpt = NIL; /* no flags set by default */
+ strcpy(tmp,name);
-+ while ((b = strrchr(tmp+offset, FLAGSEP)) != NULL){
++ while (!done && (b = strrchr(tmp+offset, FLAGSEP)) != NULL){ /* fix by Chris Caputo */
+ char flag,last;
+ int k;
+ if (!++b) break;
@@ -2276,11 +2466,12 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ }
+ b[k] = last;
+ b += k;
-+ for (; tmp[offset] && tmp[offset] != FLAGSEP; offset++);
-+ offset++;
+ break;
-+ default: break; /* Should we crash?... Nahhh */
++ default: done++; /* fix by Chris Caputo */
++ break;
+ }
++ offset++;
++ for (; tmp[offset] && tmp[offset] != FLAGSEP; offset++);
+ }
+ if(d) *d = tmpd;
+ if(f) *f = tmpf;
@@ -2357,7 +2548,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ maildir_contains_folder(char *dirname, char *name)
+ {
+ char tmp[MAILTMPLEN], tmp2[MAILTMPLEN];
-+ int rv = 0;
++ int rv = 0, len;
+ DIR *dir;
+ struct direct *d;
+
@@ -2370,13 +2561,16 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ if (!(dir = opendir (tmp2)))
+ return NIL;
+
++ len = (int) strlen(tmp2);
++
+ while ((d = readdir(dir)) != NULL){
+ if (strcmp(d->d_name, ".") && strcmp(d->d_name,"..")
+ && strcmp(d->d_name, MDNAME(Cur))
+ && strcmp(d->d_name, MDNAME(Tmp))
+ && strcmp(d->d_name, MDNAME(New))){
+
-+ snprintf(tmp, sizeof(tmp), "%s/%s", tmp2, d->d_name);
++ snprintf(tmp, sizeof(tmp), "%.*s/%.*s", len, tmp2, (int) sizeof(tmp) - len - 2, d->d_name);
++ tmp[sizeof(tmp) - 1] = '\0';
+ if(maildir_valid(tmp)){
+ rv++;
+ break;
@@ -2408,7 +2602,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ maildir_dir_is_empty(char *mailbox)
+ {
+ char tmp[MAILTMPLEN], tmp2[MAILTMPLEN], tmp3[MAILTMPLEN],*s;
-+ int rv = 1, courier = IS_COURIER(mailbox);
++ int rv = 1, courier = IS_COURIER(mailbox), len;
+ DIR *dir;
+ struct direct *d;
+ struct stat sbuf;
@@ -2417,16 +2611,19 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+
+ if(courier){
+ strcpy(tmp3, tmp2);
-+ if(s = strrchr(tmp2, '/'))
++ if((s = strrchr(tmp2, '/')) != NULL)
+ *s = '\0';
+ }
+
+ if (!(dir = opendir (tmp2)))
+ return rv;
+
++ len = (int) strlen(tmp2);
++
+ if(courier){
+ while((d = readdir(dir)) != NULL){
-+ snprintf(tmp, sizeof(tmp), "%s/%s", tmp2, d->d_name);
++ snprintf(tmp, sizeof(tmp), "%.*s/%.*s", len, tmp2, (int)(sizeof(tmp) - len - 2),d->d_name);
++ tmp[sizeof(tmp) - 1] = '\0';
+ if(!strncmp(tmp, tmp3, strlen(tmp3))
+ && tmp[strlen(tmp3)] == '.'){
+ rv = 0;
@@ -2436,7 +2633,8 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ }
+ else
+ while ((d = readdir(dir)) != NULL){
-+ snprintf(tmp, sizeof(tmp), "%s/%s", tmp2, d->d_name);
++ snprintf(tmp, sizeof(tmp), "%.*s/%.*s", len, tmp2, (int)(sizeof(tmp) - len - 2), d->d_name);
++ tmp[sizeof(tmp) - 1] = '\0';
+ if (strcmp(d->d_name, ".")
+ && strcmp(d->d_name,"..")
+ && strcmp(d->d_name, MDNAME(Cur))
@@ -2444,6 +2642,12 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ && strcmp(d->d_name, MDNAME(New))
+ && strcmp(d->d_name, MDDIR)
+ && strcmp(d->d_name, MDUIDVALIDITY)
++ && strncmp(d->d_name, MDUIDTEMP, 8)
++ && strcmp(d->d_name, ".mbsyncstate")
++ && strcmp(d->d_name, ".mbsyncstate")
++ && strcmp(d->d_name, ".mbsyncstate.new")
++ && strcmp(d->d_name, ".mbsyncstate.journal")
++ && strcmp(d->d_name, ".mbsyncstate.lock")
+ && !(d->d_name[0] == '.'
+ && stat (tmp,&sbuf) == 0
+ && S_ISREG(sbuf.st_mode))){
@@ -2675,7 +2879,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ }
+ else
+ cdir->data[i]->attribute = LATT_NOSELECT;
-+ cdir->data[i]->attribute += maildir_any_new_msgs(cdir->data[i]->name)
++ cdir->data[i]->attribute += maildir_any_new_msgs(cdir->data[i]->name)
+ ? LATT_MARKED : LATT_UNMARKED;
+ }
+
@@ -2737,7 +2941,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ if(ownuid == 0 && existuid == 0){ /* nobody owns the uid? */
+ FILE *fp;
+ snprintf(tmp, sizeof(tmp), "%s/%s.%d.%lu", LOCAL->dir, MDUIDTEMP, mypid, time(0));
-+ if(fp = fopen(tmp, "w")){
++ if((fp = fopen(tmp, "w")) != NULL){
+ fclose(fp);
+ if(LOCAL->uidtempfile)
+ fs_give((void **)&LOCAL->uidtempfile);
@@ -2839,7 +3043,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+
+ snprintf(tmp, sizeof(tmp), "%s/%s.%010lu.%010lu", LOCAL->dir, MDUIDLAST,
+ uid_last, uid_validity);
-+ if(fp = fopen(tmp, "w"))
++ if((fp = fopen(tmp, "w")) != NULL)
+ fclose(fp);
+ }
+
@@ -2870,7 +3074,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+
+ snprintf(old, sizeof(old), "%s/%s/%s", LOCAL->dir, MDNAME(Cur), MDFILE(elt));
+ t = MDFILE(elt);
-+ if(s = strstr(MDFILE(elt), MDUIDSEP)){
++ if((s = strstr(MDFILE(elt), MDUIDSEP)) != NULL){
+ *s = '\0';
+ s += strlen(MDUIDSEP);
+ strtoul(s, &s, 10);
@@ -2930,94 +3134,16 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.c alpine-2.24.maildir/imap/src/
+ LOCAL->uidtempfile = cpystr(tmp);
+ }
+ }
-diff -rc alpine-2.24/imap/src/osdep/unix/maildir.h alpine-2.24.maildir/imap/src/osdep/unix/maildir.h
-*** alpine-2.24/imap/src/osdep/unix/maildir.h 2020-10-10 00:26:50.012168504 -0600
---- alpine-2.24.maildir/imap/src/osdep/unix/maildir.h 2020-10-10 00:26:49.972167485 -0600
+diff -rc alpine-2.26/imap/src/osdep/unix/maildir.h alpine-2.26.maildir/imap/src/osdep/unix/maildir.h
+*** alpine-2.26/imap/src/osdep/unix/maildir.h 2022-06-02 18:14:52.323147655 -0600
+--- alpine-2.26.maildir/imap/src/osdep/unix/maildir.h 2022-06-02 18:14:52.251147832 -0600
***************
*** 0 ****
---- 1,226 ----
-+ /*
-+ * A few definitions that try to make this module portable to other
-+ * platforms (e.g. Cygwin). This module is based on the information from
-+ * http://cr.yp.to/proto/maildir.html
-+ */
-+
-+ /* First we deal with the separator character */
-+ #ifndef FLAGSEP
-+ #define FLAGSEP ':'
-+ #endif
-+ #define SIZESEP ','
-+
-+ const char sep1[] = {FLAGSEP, '1', ',', '\0'}; /* experimental semantics*/
-+ const char sep2[] = {FLAGSEP, '2', ',', '\0'}; /* Flags Information */
-+ const char sep3[] = {FLAGSEP, '3', ',', '\0'}; /* Grrrr.... */
-+
-+ const char *sep[] = { sep1, sep2, sep3, NULL};
-+
-+ #define MDSEP(i) sep[((i) - 1)]
-+
-+ /* Now we deal with flags. Woohoo! */
+--- 1,122 ----
+ typedef enum {Draft, Flagged, Passed, Replied, Seen, Trashed,
+ EmptyFlag, EndFlags} MdFlagNamesType;
-+ const int mdimapflags[] = {Draft, Flagged, Replied, Seen, Trashed, EmptyFlag, EndFlags};
-+ const int mdkwdflags[] = {Passed, EmptyFlag, EndFlags};
-+
-+ /* this array lists the codes for mdflgnms (maildir flag names) above */
-+ const char *mdflags[] = { "D", "F", "P", "R", "S", "T", "", NULL};
-+ /* and as characters too */
-+ const char cmdflags[] = { 'D', 'F', 'P', 'R', 'S', 'T', '0', '\0'};
-+
-+ /* MDFLAG(Seen, elt->seen) */
-+ #define MDFLAG(i,j) mdflags[j ? (i) : EmptyFlag]
-+ /* MDFLAGC(Seen) */
-+ #define MDFLAGC(i) cmdflags[(i)]
+
-+ /* Now we deal with the directory structure */
+ typedef enum {Cur, Tmp, New, EndDir} DirNamesType;
-+ char *mdstruct[] = {"cur", "tmp", "new", NULL};
-+ #define MDNAME(i) mdstruct[(i)]
-+ #define MDFLD(tmp, dir, i) sprintf((tmp),"%s/%s", (dir), mdstruct[(i)])
-+ #define MSGPATH(tmp, dir, msg,i) sprintf((tmp),"%s/%s/%s", (dir), mdstruct[(i)],(msg))
-+
-+ /* Files associated to a maildir directory */
-+
-+ #define MDUIDVALIDITY ".uidvalidity" /* support for old maildirs */
-+ #define MDDIR ".mdir" /* this folder is a directory */
-+ #define MDUIDLAST ".uidlast" /* last assigned uid */
-+ #define MDUIDTEMP ".uidtemp" /* We assign uid's no one else */
-+
-+
-+
-+ /* Support of Courier Structure */
-+ #define CCLIENT 0
-+ #define COURIER 1
-+ #define IS_CCLIENT(t) \
-+ (((t) && (t)[0] == '#' && ((t)[1] == 'm' || (t)[1] == 'M')\
-+ && ((t)[2] == 'd' || (t)[2] == 'D')\
-+ && (t)[3] == '/' && (t)[4] != '\0') ? 1 : 0)
-+
-+ #define IS_COURIER(t) \
-+ (((t) && (t)[0] == '#' && ((t)[1] == 'm' || (t)[1] == 'M')\
-+ && ((t)[2] == 'c' || (t)[2] == 'C')\
-+ && (t)[3] == '/' && (t)[4] != '\0') ? 1 : 0)
-+ #define MDPREFIX(s) ((s) ? "#mc/" : "#md/")
-+ #define MDSEPARATOR(s) ((s) ? '.' : '/')
-+
-+ /* UID Support */
-+
-+ #define MAXTEMPUID (unsigned long) 180L
-+ const char mduid[] = {',','u','=','\0'};
-+ #define MDUIDSEP mduid
-+
-+
-+ /* Now we deal with messages filenames */
-+ char mdlocaldomain[MAILTMPLEN+1] = {'\0'};
-+ pid_t mypid = (pid_t) 0;
-+ static char *mdfpath = NULL;
-+ static char myMdInboxDir[50] = { '\0' };/* Location of the Maildir INBOX */
-+ static long CourierStyle = CCLIENT;
-+
-+ #define CHUNK 16384 /* from unix.h */
+
+ typedef struct courier_local {
+ char *name; /* name of directory/folder */
@@ -3031,24 +3157,6 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.h alpine-2.24.maildir/imap/src/
+ COURIERLOCAL **data;
+ } COURIER_S;
+
-+ /* In gdb this is the *(struct maildir_local *)stream->local structure */
-+ typedef struct maildir_local {
-+ unsigned int dirty : 1; /* diskcopy needs updating */
-+ unsigned int courier : 1; /* It is Courier style file system */
-+ unsigned int link : 1; /* There is a symbolic link */
-+ int candouid; /* we can assign uids and no one else */
-+ char *uidtempfile; /* path to uid temp file */
-+ int fd; /* fd of open message */
-+ char *dir; /* mail directory name */
-+ char **path; /* path to directories cur, new and tmp */
-+ unsigned char *buf; /* temporary buffer */
-+ unsigned long buflen; /* current size of temporary buffer */
-+ time_t scantime; /* last time directory scanned */
-+ } MAILDIRLOCAL;
-+
-+ /* Convenient access to local data */
-+ #define LOCAL ((MAILDIRLOCAL *) stream->local)
-+
+ typedef struct maildir_file_info {
+ char *name; /* name of the file */
+ DirNamesType loc; /* location of this file */
@@ -3059,14 +3167,6 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.h alpine-2.24.maildir/imap/src/
+ time_t ctime; /* last changed time */
+ } MAILDIRFILE;
+
-+ #define MDFILE(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->name)
-+ #define MDLOC(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->loc)
-+ #define MDPOS(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->pos)
-+ #define MDSIZE(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->size)
-+ #define MDATIME(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->atime)
-+ #define MDMTIME(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->mtime)
-+ #define MDCTIME(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->ctime)
-+
+ /* Function prototypes */
+
+ DRIVER *maildir_valid (char *name);
@@ -3162,9 +3262,9 @@ diff -rc alpine-2.24/imap/src/osdep/unix/maildir.h alpine-2.24.maildir/imap/src/
+ void maildir_assign_uid(MAILSTREAM *stream, unsigned long msgno, unsigned long uid);
+ void maildir_uid_renew_tempfile(MAILSTREAM *stream);
+
-diff -rc alpine-2.24/imap/src/osdep/unix/Makefile alpine-2.24.maildir/imap/src/osdep/unix/Makefile
-*** alpine-2.24/imap/src/osdep/unix/Makefile 2020-10-10 00:24:28.196554399 -0600
---- alpine-2.24.maildir/imap/src/osdep/unix/Makefile 2020-10-10 00:26:49.976167588 -0600
+diff -rc alpine-2.26/imap/src/osdep/unix/Makefile alpine-2.26.maildir/imap/src/osdep/unix/Makefile
+*** alpine-2.26/imap/src/osdep/unix/Makefile 2022-06-02 18:14:00.475274788 -0600
+--- alpine-2.26.maildir/imap/src/osdep/unix/Makefile 2022-06-02 18:14:52.255147822 -0600
***************
*** 146,152 ****
# However, mh needs to be before any sysinbox formats (such as mmdf or unix)
@@ -3187,15 +3287,17 @@ diff -rc alpine-2.24/imap/src/osdep/unix/Makefile alpine-2.24.maildir/imap/src/o
BINARIES=osdep.o mail.o misc.o newsrc.o smanager.o utf8.o utf8aux.o siglocal.o \
dummy.o pseudo.o netmsg.o flstring.o fdstring.o \
rfc822.o nntp.o smtp.o imap4r1.o http.o json.o pop3.o \
-! unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o
+! unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o sha.o
CFLAGS=-g
CAT=cat
---- 155,161 ----
+--- 155,163 ----
BINARIES=osdep.o mail.o misc.o newsrc.o smanager.o utf8.o utf8aux.o siglocal.o \
dummy.o pseudo.o netmsg.o flstring.o fdstring.o \
rfc822.o nntp.o smtp.o imap4r1.o http.o json.o pop3.o \
-! unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o maildir.o
+! unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o \
+! maildir.o sha.o
+!
CFLAGS=-g
CAT=cat
@@ -3208,7 +3310,7 @@ diff -rc alpine-2.24/imap/src/osdep/unix/Makefile alpine-2.24.maildir/imap/src/o
SIGTYPE=psx CHECKPW=cyg LOGINPW=cyg CRXTYPE=std \
SPOOLDIR=/var \
ACTIVEFILE=/usr/local/news/lib/active \
---- 292,298 ----
+--- 294,300 ----
cyg: # Cygwin - note that most local file drivers don't work!!
$(BUILD) `$(CAT) SPECIALS` OS=$@ \
@@ -3217,18 +3319,18 @@ diff -rc alpine-2.24/imap/src/osdep/unix/Makefile alpine-2.24.maildir/imap/src/o
SPOOLDIR=/var \
ACTIVEFILE=/usr/local/news/lib/active \
***************
-*** 921,926 ****
---- 921,927 ----
- utf8aux.o: mail.h misc.h osdep.h utf8.h
+*** 922,927 ****
+--- 924,930 ----
json.o: mail.h misc.h osdep.h utf8.h json.h
http.o: mail.h misc.h osdep.h utf8.h http.h json.h
+ sha.o: mail.h misc.h osdep.h sha.h sha-private.h hash.h hmac.c sha1.c sha224-256.c sha384-512.c usha.c
+ maildir.o: mail.h misc.h osdep.h maildir.h dummy.h
# OS-dependent
-diff -rc alpine-2.24/imap/src/osdep/unix/os_cyg.h alpine-2.24.maildir/imap/src/osdep/unix/os_cyg.h
-*** alpine-2.24/imap/src/osdep/unix/os_cyg.h 2020-10-10 00:24:28.192554297 -0600
---- alpine-2.24.maildir/imap/src/osdep/unix/os_cyg.h 2020-10-10 00:26:49.976167588 -0600
+diff -rc alpine-2.26/imap/src/osdep/unix/os_cyg.h alpine-2.26.maildir/imap/src/osdep/unix/os_cyg.h
+*** alpine-2.26/imap/src/osdep/unix/os_cyg.h 2022-06-02 18:14:00.475274788 -0600
+--- alpine-2.26.maildir/imap/src/osdep/unix/os_cyg.h 2022-06-02 18:14:52.255147822 -0600
***************
*** 47,52 ****
--- 47,53 ----
@@ -3239,12 +3341,12 @@ diff -rc alpine-2.24/imap/src/osdep/unix/os_cyg.h alpine-2.24.maildir/imap/src/o
#define geteuid Geteuid
uid_t Geteuid (void);
-diff -rc alpine-2.24/pith/conf.c alpine-2.24.maildir/pith/conf.c
-*** alpine-2.24/pith/conf.c 2020-10-10 00:24:28.204554602 -0600
---- alpine-2.24.maildir/pith/conf.c 2020-10-10 00:26:49.976167588 -0600
+diff -rc alpine-2.26/pith/conf.c alpine-2.26.maildir/pith/conf.c
+*** alpine-2.26/pith/conf.c 2022-06-02 18:14:00.491274749 -0600
+--- alpine-2.26.maildir/pith/conf.c 2022-06-02 18:14:52.259147813 -0600
***************
-*** 453,458 ****
---- 453,461 ----
+*** 451,456 ****
+--- 451,459 ----
CONF_TXT_T cf_text_newsrc_path[] = "Full path and name of NEWSRC file";
@@ -3255,8 +3357,8 @@ diff -rc alpine-2.24/pith/conf.c alpine-2.24.maildir/pith/conf.c
/*----------------------------------------------------------------------
These are the variables that control a number of pine functions. They
***************
-*** 657,662 ****
---- 660,669 ----
+*** 655,660 ****
+--- 658,667 ----
NULL, cf_text_news_active},
{"news-spool-directory", 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0,
NULL, cf_text_news_spooldir},
@@ -3268,8 +3370,8 @@ diff -rc alpine-2.24/pith/conf.c alpine-2.24.maildir/pith/conf.c
NULL, cf_text_upload_cmd},
{"upload-command-prefix", 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0,
***************
-*** 2392,2397 ****
---- 2399,2410 ----
+*** 2396,2401 ****
+--- 2403,2414 ----
mail_parameters(NULL, SET_NEWSSPOOL,
(void *)VAR_NEWS_SPOOL_DIR);
@@ -3283,8 +3385,8 @@ diff -rc alpine-2.24/pith/conf.c alpine-2.24.maildir/pith/conf.c
set_current_val(&vars[V_DEFAULT_SAVE_FOLDER], TRUE, TRUE);
if(!VAR_DEFAULT_SAVE_FOLDER || !VAR_DEFAULT_SAVE_FOLDER[0])
***************
-*** 3030,3035 ****
---- 3043,3052 ----
+*** 3037,3042 ****
+--- 3050,3059 ----
F_SORT_DEFAULT_SAVE_ALPHA, h_config_sort_save_alpha, PREF_FLDR, 0},
{"vertical-folder-list", "Use Vertical Folder List",
F_VERTICAL_FOLDER_LIST, h_config_vertical_list, PREF_FLDR, 0},
@@ -3296,7 +3398,7 @@ diff -rc alpine-2.24/pith/conf.c alpine-2.24.maildir/pith/conf.c
/* Addr book */
{"combined-addrbook-display", "Combined Address Book Display",
***************
-*** 7209,7215 ****
+*** 7217,7223 ****
int just_flip_value, EditWhich ew)
{
char **vp, *p, **lval, ***alval;
@@ -3304,7 +3406,7 @@ diff -rc alpine-2.24/pith/conf.c alpine-2.24.maildir/pith/conf.c
char *err;
long l;
---- 7226,7232 ----
+--- 7234,7240 ----
int just_flip_value, EditWhich ew)
{
char **vp, *p, **lval, ***alval;
@@ -3313,8 +3415,8 @@ diff -rc alpine-2.24/pith/conf.c alpine-2.24.maildir/pith/conf.c
long l;
***************
-*** 7262,7267 ****
---- 7279,7291 ----
+*** 7270,7275 ****
+--- 7287,7299 ----
break;
@@ -3329,8 +3431,8 @@ diff -rc alpine-2.24/pith/conf.c alpine-2.24.maildir/pith/conf.c
case F_DATES_TO_LOCAL :
clear_index_cache(ps->mail_stream, 0);
***************
-*** 8062,8067 ****
---- 8086,8095 ----
+*** 8074,8079 ****
+--- 8098,8107 ----
return(h_config_newmailwidth);
case V_NEWSRC_PATH :
return(h_config_newsrc_path);
@@ -3341,12 +3443,12 @@ diff -rc alpine-2.24/pith/conf.c alpine-2.24.maildir/pith/conf.c
case V_BROWSER :
return(h_config_browser);
case V_HISTORY :
-diff -rc alpine-2.24/pith/conf.h alpine-2.24.maildir/pith/conf.h
-*** alpine-2.24/pith/conf.h 2020-10-10 00:24:28.204554602 -0600
---- alpine-2.24.maildir/pith/conf.h 2020-10-10 00:26:49.976167588 -0600
+diff -rc alpine-2.26/pith/conf.h alpine-2.26.maildir/pith/conf.h
+*** alpine-2.26/pith/conf.h 2022-06-02 18:14:00.491274749 -0600
+--- alpine-2.26.maildir/pith/conf.h 2022-06-02 18:14:52.263147802 -0600
***************
-*** 264,269 ****
---- 264,273 ----
+*** 265,270 ****
+--- 265,274 ----
#define GLO_NEWS_ACTIVE_PATH vars[V_NEWS_ACTIVE_PATH].global_val.p
#define VAR_NEWS_SPOOL_DIR vars[V_NEWS_SPOOL_DIR].current_val.p
#define GLO_NEWS_SPOOL_DIR vars[V_NEWS_SPOOL_DIR].global_val.p
@@ -3357,9 +3459,9 @@ diff -rc alpine-2.24/pith/conf.h alpine-2.24.maildir/pith/conf.h
#define VAR_DISABLE_DRIVERS vars[V_DISABLE_DRIVERS].current_val.l
#define VAR_DISABLE_AUTHS vars[V_DISABLE_AUTHS].current_val.l
#define VAR_REMOTE_ABOOK_METADATA vars[V_REMOTE_ABOOK_METADATA].current_val.p
-diff -rc alpine-2.24/pith/conftype.h alpine-2.24.maildir/pith/conftype.h
-*** alpine-2.24/pith/conftype.h 2020-10-10 00:24:28.204554602 -0600
---- alpine-2.24.maildir/pith/conftype.h 2020-10-10 00:26:49.980167690 -0600
+diff -rc alpine-2.26/pith/conftype.h alpine-2.26.maildir/pith/conftype.h
+*** alpine-2.26/pith/conftype.h 2022-06-02 18:14:00.491274749 -0600
+--- alpine-2.26.maildir/pith/conftype.h 2022-06-02 18:14:52.275147774 -0600
***************
*** 118,123 ****
--- 118,126 ----
@@ -3373,8 +3475,8 @@ diff -rc alpine-2.24/pith/conftype.h alpine-2.24.maildir/pith/conftype.h
, V_UPLOAD_CMD_PREFIX
, V_DOWNLOAD_CMD
***************
-*** 406,411 ****
---- 409,417 ----
+*** 410,415 ****
+--- 413,421 ----
F_PASS_C1_CONTROL_CHARS,
F_SINGLE_FOLDER_LIST,
F_VERTICAL_FOLDER_LIST,
@@ -3384,12 +3486,25 @@ diff -rc alpine-2.24/pith/conftype.h alpine-2.24.maildir/pith/conftype.h
F_TAB_CHK_RECENT,
F_AUTO_REPLY_TO,
F_VERBOSE_POST,
-diff -rc alpine-2.24/pith/init.c alpine-2.24.maildir/pith/init.c
-*** alpine-2.24/pith/init.c 2020-10-10 00:24:28.208554703 -0600
---- alpine-2.24.maildir/pith/init.c 2020-10-10 00:26:49.980167690 -0600
+diff -rc alpine-2.26/pith/headers.h alpine-2.26.maildir/pith/headers.h
+*** alpine-2.26/pith/headers.h 2022-06-02 18:14:00.495274738 -0600
+--- alpine-2.26.maildir/pith/headers.h 2022-06-02 18:14:52.275147774 -0600
***************
-*** 408,413 ****
---- 408,416 ----
+*** 32,37 ****
+--- 32,38 ----
+ #include "../c-client/utf8.h" /* for CHARSET and such*/
+ #include "../c-client/imap4r1.h"
+ #include "../c-client/http.h" /* for http support */
++ #include "../c-client/maildir.h"
+
+ /* include osdep protos and def'ns */
+ #include "osdep/bldpath.h"
+diff -rc alpine-2.26/pith/init.c alpine-2.26.maildir/pith/init.c
+*** alpine-2.26/pith/init.c 2022-06-02 18:14:00.491274749 -0600
+--- alpine-2.26.maildir/pith/init.c 2022-06-02 18:14:52.283147754 -0600
+***************
+*** 404,409 ****
+--- 404,412 ----
&& stricmp(filename, folder_base)){
#else
if(strncmp(filename, folder_base, folder_base_len) == 0
@@ -3399,11 +3514,11 @@ diff -rc alpine-2.24/pith/init.c alpine-2.24.maildir/pith/init.c
&& strcmp(filename, folder_base)){
#endif
#endif
-diff -rc alpine-2.24/pith/pattern.c alpine-2.24.maildir/pith/pattern.c
-*** alpine-2.24/pith/pattern.c 2020-10-10 00:24:28.204554602 -0600
---- alpine-2.24.maildir/pith/pattern.c 2020-10-10 00:26:49.984167792 -0600
+diff -rc alpine-2.26/pith/pattern.c alpine-2.26.maildir/pith/pattern.c
+*** alpine-2.26/pith/pattern.c 2022-06-02 18:14:00.491274749 -0600
+--- alpine-2.26.maildir/pith/pattern.c 2022-06-02 18:14:52.291147734 -0600
***************
-*** 49,55 ****
+*** 46,52 ****
#include "../pith/icache.h"
#include "../pith/ablookup.h"
#include "../pith/keyword.h"
@@ -3411,7 +3526,7 @@ diff -rc alpine-2.24/pith/pattern.c alpine-2.24.maildir/pith/pattern.c
/*
* Internal prototypes
---- 49,57 ----
+--- 46,54 ----
#include "../pith/icache.h"
#include "../pith/ablookup.h"
#include "../pith/keyword.h"
@@ -3489,12 +3604,12 @@ diff -rc alpine-2.24/pith/pattern.c alpine-2.24.maildir/pith/pattern.c
return(buf[0] != '\0');
}
-diff -rc alpine-2.24/pith/pine.hlp alpine-2.24.maildir/pith/pine.hlp
-*** alpine-2.24/pith/pine.hlp 2020-10-10 00:24:28.204554602 -0600
---- alpine-2.24.maildir/pith/pine.hlp 2020-10-10 00:26:49.996168098 -0600
+diff -rc alpine-2.26/pith/pine.hlp alpine-2.26.maildir/pith/pine.hlp
+*** alpine-2.26/pith/pine.hlp 2022-06-02 18:14:00.491274749 -0600
+--- alpine-2.26.maildir/pith/pine.hlp 2022-06-02 18:14:52.299147715 -0600
***************
-*** 23452,23457 ****
---- 23452,23553 ----
+*** 23793,23798 ****
+--- 23793,23894 ----
&lt;End of help on this topic&gt;
</BODY>
</HTML>
@@ -3598,8 +3713,8 @@ diff -rc alpine-2.24/pith/pine.hlp alpine-2.24.maildir/pith/pine.hlp
<HTML>
<HEAD>
***************
-*** 31683,31688 ****
---- 31779,31827 ----
+*** 31999,32004 ****
+--- 32095,32143 ----
<P>
&lt;End of help on this topic&gt;
</BODY>
@@ -3649,12 +3764,12 @@ diff -rc alpine-2.24/pith/pine.hlp alpine-2.24.maildir/pith/pine.hlp
</HTML>
====== h_config_verbose_post =====
<HTML>
-diff -rc alpine-2.24/pith/send.c alpine-2.24.maildir/pith/send.c
-*** alpine-2.24/pith/send.c 2020-10-10 00:24:28.204554602 -0600
---- alpine-2.24.maildir/pith/send.c 2020-10-10 00:26:49.996168098 -0600
+diff -rc alpine-2.26/pith/send.c alpine-2.26.maildir/pith/send.c
+*** alpine-2.26/pith/send.c 2022-06-02 18:14:00.491274749 -0600
+--- alpine-2.26.maildir/pith/send.c 2022-06-02 18:14:52.303147704 -0600
***************
-*** 47,52 ****
---- 47,55 ----
+*** 43,48 ****
+--- 43,51 ----
#include "../c-client/smtp.h"
#include "../c-client/nntp.h"
@@ -3665,8 +3780,8 @@ diff -rc alpine-2.24/pith/send.c alpine-2.24.maildir/pith/send.c
/* this is used in pine_send and pine_simple_send */
***************
-*** 250,255 ****
---- 253,265 ----
+*** 246,251 ****
+--- 249,261 ----
if(exists & FEX_ISFILE){
context_apply(tmp, p_cntxt, mbox, sizeof(tmp));
@@ -3680,9 +3795,9 @@ diff -rc alpine-2.24/pith/send.c alpine-2.24.maildir/pith/send.c
if(!(IS_REMOTE(tmp) || is_absolute_path(tmp))){
/*
* The mbox is relative to the home directory.
-diff -rc alpine-2.24/README.maildir alpine-2.24.maildir/README.maildir
-*** alpine-2.24/README.maildir 2020-10-10 00:26:50.012168504 -0600
---- alpine-2.24.maildir/README.maildir 2020-10-10 00:26:49.996168098 -0600
+diff -rc alpine-2.26/README.maildir alpine-2.26.maildir/README.maildir
+*** alpine-2.26/README.maildir 2022-06-02 18:14:52.327147646 -0600
+--- alpine-2.26.maildir/README.maildir 2022-06-02 18:14:52.303147704 -0600
***************
*** 0 ****
--- 1,149 ----