[Pkg-wmaker-commits] [wmbiff] 60/84: bugfix to allow imap mailbox filenames to contain spaces, test that it works; also, prepare 0.4.8
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:02:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to tag wmbiff_0_4_10
in repository wmbiff.
commit de5e6b9c647635a479e9929e1807886fa4506bc5
Author: bluehal <bluehal>
Date: Wed Sep 18 23:43:49 2002 +0000
bugfix to allow imap mailbox filenames to contain spaces, test that it works; also, prepare 0.4.8
---
ChangeLog | 18 +++++++++++--
NEWS | 10 +++++++-
configure.ac | 4 +--
wmbiff/Client.h | 6 ++---
wmbiff/Imap4Client.c | 24 +++++++++++++-----
wmbiff/Makefile.am | 2 +-
wmbiff/maildirClient.c | 13 +++++-----
wmbiff/test_wmbiff.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++-
wmbiff/wmbiffrc.5.in | 7 ++++--
9 files changed, 128 insertions(+), 24 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e3f7407..5ef613b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,14 +6,28 @@ The latest changelog entry is in a different format, because it's inserted by
CVS on commit.
$Log: ChangeLog,v $
- Revision 1.39 2002/08/16 07:55:03 bluehal
- handle new gnutls/gnutls.h convention, release 0.4.7
+ Revision 1.40 2002/09/18 23:43:49 bluehal
+ bugfix to allow imap mailbox filenames to contain spaces, test that it works; also, prepare 0.4.8
Revision 1.1 2002/04/07 05:08:23 bluehal
use automake / autoconf; after checkout run ./FromCVS.sh
+2002-09-14 Saturday 18:51 UTC -- Dwayne C. Litzenberger <dlitz at dlitz.net>
+
+ * wmbiff/: Client.h, maildirClient.c, wmbiffrc.5.in: *
+ maildirClient: Added support for quick checking of writable
+ network-mounted maildirs where directory caching normally causes
+ unwanted delays.
+
+2002-08-16 Friday 07:55 UTC -- Neil Spring <nspring at cs.washington.edu>
+
+ * ChangeLog, NEWS, configure.ac, autoconf/libgnutls.m4,
+ wmbiff/Imap4Client.c, wmbiff/gnutls-common.c,
+ wmbiff/gnutls-common.h, wmbiff/tlsComm.c: handle new
+ gnutls/gnutls.h convention, release 0.4.7
+
2002-08-06 Tuesday 08:05 UTC -- Neil Spring <nspring at cs.washington.edu>
* FromCVS.sh: seek out and use athe underrated automake 1.6.
diff --git a/NEWS b/NEWS
index 71dfb47..4811664 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,13 @@
Release Notes
~~~~~~~~~~~~~
+Release 0.4.8 - Sept 18, 2002
+ * GNUTLS v0.5.1-0.5.6, gcrypt v1.1.8 required.
+ * Allow spaces in IMAP mailbox paths. The new syntax is:
+ server/"mail box with spaces" where the old is server/mailbox.
+ See wmbiffrc(5) for details.
+ * Avoid filesystem caching for network mounted maildirs.
+ See wmbiffrc(5) for details. (Dwayne C. Litzenberger)
+
Release 0.4.7 - August 16, 2002
* GNUTLS v0.5.1, gcrypt v1.1.8 required. (no other changes)
@@ -348,4 +356,4 @@ Release 0.1 - Wed, 17 Nov 1999 00:00:00 +0000
* Initial release by Gennady Belyakov <gb at ccat.elect.ru>.
-$Id: NEWS,v 1.28 2002/08/16 07:55:03 bluehal Exp $
+$Id: NEWS,v 1.29 2002/09/18 23:43:49 bluehal Exp $
diff --git a/configure.ac b/configure.ac
index 3585fdc..0a6d844 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,9 +7,9 @@ dnl and configure:
dnl installation prefix
dnl version
-AC_INIT(wmbiff, 0.4.7, wmbiff-devel at lists.sourceforge.net)
+AC_INIT(wmbiff, 0.4.8, wmbiff-devel at lists.sourceforge.net)
AC_CONFIG_AUX_DIR(autoconf)
-AM_INIT_AUTOMAKE(wmbiff, 0.4.7)
+AM_INIT_AUTOMAKE(wmbiff, 0.4.8)
dnl AUTOHEADER="$AUTOHEADER -l \\\\\\\$\(srcdir)/autoconf"
AM_CONFIG_HEADER(config.h)
dnl make sure autoheader finds version, implicitly defined above.
diff --git a/wmbiff/Client.h b/wmbiff/Client.h
index cf95230..7e1356b 100644
--- a/wmbiff/Client.h
+++ b/wmbiff/Client.h
@@ -1,11 +1,11 @@
-/* $Id: Client.h,v 1.27 2002/09/14 18:51:46 dwonis Exp $ */
+/* $Id: Client.h,v 1.28 2002/09/18 23:43:49 bluehal Exp $ */
/* Author : Scott Holden ( scotth at thezone.net )
Modified : Yong-iL Joh ( tolkien at mizi.com )
Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
*
* Email Checker Pop3/Imap4/Licq/Gicu/mbox/maildir/finger
*
- * Last Updated : $Date: 2002/09/14 18:51:46 $
+ * Last Updated : $Date: 2002/09/18 23:43:49 $
*
*/
@@ -51,7 +51,7 @@ typedef struct _mbox_t {
off_t size_new;
time_t mtime_cur;
off_t size_cur;
- unsigned int dircache_flush:1; /* hack to flush directory caches */
+ unsigned int dircache_flush:1; /* hack to flush directory caches */
} maildir;
struct {
char password[32];
diff --git a/wmbiff/Imap4Client.c b/wmbiff/Imap4Client.c
index c2797cc..b0d23ca 100644
--- a/wmbiff/Imap4Client.c
+++ b/wmbiff/Imap4Client.c
@@ -289,8 +289,12 @@ int imap_checkmail( /*@notnull@ */ Pop3 pc)
tlscomm_printf(scs, "a003 STATUS %s (MESSAGES UNSEEN)\r\n", pc->path);
if (tlscomm_expect(scs, "* STATUS", buf, 127) != 0) {
/* a valid response? */
- (void) sscanf(buf, "* STATUS %*s (MESSAGES %d UNSEEN %d)",
- &(pc->TotalMsgs), &(pc->UnreadMsgs));
+ // doesn't support spaces: (void) sscanf(buf, "* STATUS %*s (MESSAGES %d UNSEEN %d)",
+ const char *msg;
+ msg = strstr(buf, "(MESSAGES");
+ if (msg != NULL)
+ (void) sscanf(msg, "(MESSAGES %d UNSEEN %d)",
+ &(pc->TotalMsgs), &(pc->UnreadMsgs));
} else {
/* something went wrong. bail. */
tlscomm_close(unbind(scs));
@@ -305,8 +309,8 @@ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
struct re_registers regs;
int i, matchedchars;
const char *regexes[] = {
- ".*imaps?:([^: ]{1,32}):([^@]{0,32})@([^/: ]+)(/[^: ]+)?(:[0-9]+)? *",
- ".*imaps?:([^: ]{1,32}) ([^ ]{1,32}) ([^/: ]+)(/[^: ]+)?( [0-9]+)? *",
+ ".*imaps?:([^: ]{1,32}):([^@]{0,32})@([^/: ]+)(/(\"[^\"]+\")|([^: ]+))?(:[0-9]+)? *",
+ ".*imaps?:([^: ]{1,32}) ([^ ]{1,32}) ([^/: ]+)(/(\"[^\"]+\")|([^: ]+))?( [0-9]+)? *",
NULL
};
@@ -345,6 +349,13 @@ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
matchedchars);
return -1;
}
+#ifdef why_wont_you_parse
+ for (i = 0; i < 8; i++) {
+ char buf[255];
+ copy_substring(buf, regs.start[i], regs.end[i], str);
+ IMAP_DM(pc, DEBUG_INFO, "%d: %s\n", i, buf);
+ }
+#endif
/* copy matches where they belong */
copy_substring(PCU.userName, regs.start[1], regs.end[1], str);
@@ -356,8 +367,9 @@ int imap4Create( /*@notnull@ */ Pop3 pc, const char *const str)
copy_substring(pc->path, regs.start[4] + 1, regs.end[4], str);
else
strcpy(pc->path, "INBOX");
- if (regs.start[5] != -1)
- PCU.serverPort = atoi(str + regs.start[5] + 1);
+
+ if (regs.start[7] != -1)
+ PCU.serverPort = atoi(str + regs.start[7] + 1);
else
PCU.serverPort = (PCU.dossl != 0) ? 993 : 143;
diff --git a/wmbiff/Makefile.am b/wmbiff/Makefile.am
index bb15a9b..aa23a6c 100644
--- a/wmbiff/Makefile.am
+++ b/wmbiff/Makefile.am
@@ -8,7 +8,7 @@ EXTRA_wmbiff_SOURCES = gnutls-common.c gnutls-common.h
wmbiff_LDADD = -L../wmgeneral -lwmgeneral @LIBGCRYPT_LIBS@ @GNUTLS_COMMON_O@
wmbiff_DEPENDENCIES = ../wmgeneral/libwmgeneral.a Makefile @GNUTLS_COMMON_O@
test_wmbiff_SOURCES = ShellClient.c charutil.c charutil.h Client.h \
- test_wmbiff.c passwordMgr.c
+ test_wmbiff.c passwordMgr.c Imap4Client.c
man_MANS = wmbiff.1 wmbiffrc.5
skindir = $(datadir)/wmbiff/skins
skin_DATA = wmbiff-master-led.xpm wmbiff-master-contrast.xpm
diff --git a/wmbiff/maildirClient.c b/wmbiff/maildirClient.c
index 7e197fa..65c3a37 100644
--- a/wmbiff/maildirClient.c
+++ b/wmbiff/maildirClient.c
@@ -1,11 +1,11 @@
-/* $Id: maildirClient.c,v 1.9 2002/09/14 18:51:46 dwonis Exp $ */
+/* $Id: maildirClient.c,v 1.10 2002/09/18 23:43:49 bluehal Exp $ */
/* Author : Yong-iL Joh ( tolkien at mizi.com )
Modified : Jorge Garc�a ( Jorge.Garcia at uv.es )
Modified : Dwayne C. Litzenberger ( dlitz at dlitz.net )
*
* Maildir checker.
*
- * Last Updated : $Date: 2002/09/14 18:51:46 $
+ * Last Updated : $Date: 2002/09/18 23:43:49 $
*
*/
@@ -69,12 +69,13 @@ int maildirCheckHistory(Pop3 pc)
strcat(path_newtmp, ".wmbiff.dircache_flush.XXXXXX");
if (pc->u.maildir.dircache_flush) {
- /* hack to clear directory cache for network-mounted maildirs*/
+ /* hack to clear directory cache for network-mounted maildirs */
if (fn = mktemp(path_newtmp)) {
unlink(fn);
} else {
- DM(pc, DEBUG_ERROR, "Can't create dircache flush file '%s': %s\n",
- path_newtmp, strerror(errno));
+ DM(pc, DEBUG_ERROR,
+ "Can't create dircache flush file '%s': %s\n", path_newtmp,
+ strerror(errno));
}
}
@@ -147,7 +148,7 @@ int maildirCreate(Pop3 pc, const char *str)
pc->u.maildir.dircache_flush = 0;
/* special flags */
- if (*(str + 8) == ':') { /* path is of the format maildir::flags:path */
+ if (*(str + 8) == ':') { /* path is of the format maildir::flags:path */
c = ' ';
for (i = 1; c != ':' && c != '\0'; i++) {
c = *(str + 8 + i);
diff --git a/wmbiff/test_wmbiff.c b/wmbiff/test_wmbiff.c
index 48b0462..07f3d56 100644
--- a/wmbiff/test_wmbiff.c
+++ b/wmbiff/test_wmbiff.c
@@ -136,10 +136,76 @@ int test_passwordMgr(void) {
return(0);
}
+#define CKSTRING(x,shouldbe) if(strcmp(x,shouldbe)) { \
+printf("Failed: expected '" #shouldbe "' but got '%s'\n", x); \
+ return 1; }
+#define CKINT(x,shouldbe) if(x != shouldbe) { \
+printf("Failed: expected '" #shouldbe "' but got '%d'\n", x); \
+ return 1; }
+int test_imap4creator(void) {
+ mbox_t m;
+
+ if(imap4Create(&m, "imaps:foo:@bar/mybox")) {
+ return 1;
+ }
+ CKSTRING(m.path, "mybox");
+ CKSTRING(m.u.pop_imap.serverName, "bar");
+ CKINT(m.u.pop_imap.serverPort, 993);
+
+ if(imap4Create(&m, "imaps:foo:@bar/\"mybox\"")) {
+ return 1;
+ }
+ CKSTRING(m.path, "\"mybox\"");
+ CKSTRING(m.u.pop_imap.serverName, "bar");
+ CKINT(m.u.pop_imap.serverPort, 993);
+
+ if(imap4Create(&m, "imaps:foo:@bar/\"space box\"")) {
+ return 1;
+ }
+ CKSTRING(m.path, "\"space box\"");
+ CKSTRING(m.u.pop_imap.serverName, "bar");
+ CKINT(m.u.pop_imap.serverPort, 993);
+
+ if(imap4Create(&m, "imaps:user pass bar/\"space box\"")) {
+ return 1;
+ }
+ CKSTRING(m.path, "\"space box\"");
+ CKSTRING(m.u.pop_imap.serverName, "bar");
+ CKINT(m.u.pop_imap.serverPort, 993);
+
+ if(imap4Create(&m, "imaps:user pass bar/\"space box\" 12")) {
+ return 1;
+ }
+ CKSTRING(m.path, "\"space box\"");
+ CKSTRING(m.u.pop_imap.serverName, "bar");
+ CKINT(m.u.pop_imap.serverPort, 12);
+
+ if(imap4Create(&m, "imaps:foo:@bar/\"mybox\":12")) {
+ return 1;
+ }
+ CKSTRING(m.path, "\"mybox\"");
+ CKSTRING(m.u.pop_imap.serverName, "bar");
+ CKINT(m.u.pop_imap.serverPort, 12);
+
+
+ return 0;
+}
+
+void initialize_blacklist(void) { }
+void tlscomm_printf(int x __attribute__((unused)), const char *f __attribute__((unused)), ...) { }
+void tlscomm_expect(void) { }
+void tlscomm_close() { }
+int tlscomm_is_blacklisted(const char *x __attribute__((unused))) { return 1; }
+void initialize_gnutls(void) { }
+int sock_connect(const char *n __attribute__((unused)),
+ int p __attribute__((unused))) { return 1; } /* stdout */
+void initialize_unencrypted(void) { }
+
int main(int argc __attribute__((unused)),
char *argv[] __attribute__((unused))) {
if( test_backtickExpand() ||
- test_passwordMgr() ) {
+ test_passwordMgr() ||
+ test_imap4creator()) {
printf("SOME TESTS FAILED!\n");
exit(EXIT_FAILURE);
} else {
diff --git a/wmbiff/wmbiffrc.5.in b/wmbiff/wmbiffrc.5.in
index 1b47f8b..27ca15d 100644
--- a/wmbiff/wmbiffrc.5.in
+++ b/wmbiff/wmbiffrc.5.in
@@ -1,5 +1,5 @@
.\" Hey, Emacs! This is an -*- nroff -*- source file.
-.\" $Id: wmbiffrc.5.in,v 1.5 2002/09/14 18:51:46 dwonis Exp $
+.\" $Id: wmbiffrc.5.in,v 1.6 2002/09/18 23:43:49 bluehal Exp $
.\"
.\" wmbiff.1 and wmbiffrc.5 are copyright 1999-2002 by
.\" Jordi Mallach <jordi at debian.org>
@@ -100,7 +100,7 @@ accepts user, optional password, host and optional path to
mailbox and port number. See Authentication below for a
description of the auth field. The password may be left
empty: see askpass above for information on password
-prompting.
+prompting. The mailbox field may be quoted, e.g., server/"Mail/Eggs and Spam"
.RS
imap:user:passwd at server[/mailbox][:port] [auth]
.RE
@@ -110,6 +110,9 @@ imap:user:@server[/mailbox][:port] [auth]
.RS
imap:user passwd server[/mailbox][ port] [auth]
.RE
+.RS
+imap:user:passwd at server[/"mail box"][:port] [auth]
+.RE
.TP
.I imaps
These are IMAP4 boxes wrapped in a TLS (SSL)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git
More information about the Pkg-wmaker-commits
mailing list