- update the sidebar/compressed patches to work with this snapshot.

- new LIB_DEPENDS/REVISION.
- switch to a newer snapshot pulled from the repo, rolling in the
upstream patches.

requested by edd@. thanks to jasper@, landry@, pea@ for testing.
This commit is contained in:
sthen 2010-09-08 09:57:28 +00:00
parent 30af92fea6
commit 1e1a4b8dc8
16 changed files with 67 additions and 549 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile.inc,v 1.32 2009/06/20 10:20:09 sthen Exp $
# $OpenBSD: Makefile.inc,v 1.33 2010/09/08 09:57:28 sthen Exp $
CATEGORIES= mail
@ -77,7 +77,8 @@ RUN_DEPENDS+= ::mail/mixmaster
.if ${FLAVOR:L:Midn}
CONFIGURE_ARGS+= --with-idn
LIB_DEPENDS+= idn.>=16::devel/libidn
LIB_DEPENDS+= ::devel/libidn
WANTLIB+= idn.>=16
.else
CONFIGURE_ARGS+= --without-idn
.endif

View File

@ -1,35 +1,39 @@
# $OpenBSD: Makefile,v 1.59 2010/08/09 09:54:14 dcoppa Exp $
# $OpenBSD: Makefile,v 1.60 2010/09/08 09:57:28 sthen Exp $
COMMENT= tty-based e-mail client, development version
VERSION= 1.5.20
DISTNAME= mutt-${VERSION}
REVISION= 3
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=mutt/} \
${MASTER_SITES_MUTT:=devel/}
DISTNAME= mutt-5302767aa6aa
DISTFILES= ${DISTNAME}.tar.bz2
PKGNAME= mutt-${VERSION}.20100824
# ${MASTER_SITE_SOURCEFORGE:=mutt/} ${MASTER_SITES_MUTT:=devel/}
MASTER_SITES= http://spacehopper.org/mirrors/
WANTLIB= z
WANTLIB= qdbm.>=14 z
FLAVORS= idn sasl sidebar
FLAVOR?=
# should be 2.63
AUTOCONF_VERSION= 2.62
AUTOCONF_VERSION= 2.64
CONFIGURE_ARGS= --enable-hcache \
--enable-smtp \
--without-gdbm
LIB_DEPENDS= qdbm.>=14::databases/qdbm
LIB_DEPENDS= ::databases/qdbm
BUILD_DEPENDS+= ::textproc/docbook \
::textproc/docbook-xsl \
::textproc/libxslt
.if ${FLAVOR:L:Msasl}
CONFIGURE_ARGS+= --with-sasl=${LOCALBASE}
LIB_DEPENDS+= sasl2::security/cyrus-sasl2
LIB_DEPENDS+= ::security/cyrus-sasl2
WANTLIB+= sasl2
.endif
MUTTRCDIR= doc/
DIST_COMPRESSED=compressed-1.5.20.diff.gz:2
DIST_SIDEBAR= sidebar-1.5.20.diff0.gz:2
DIST_COMPRESSED=compressed-5302767aa6aa.gz:2
DIST_SIDEBAR= sidebar-5302767aa6aa.gz:2
.if ${FLAVOR:L:Msidebar}
PATCHFILES+= ${DIST_SIDEBAR}
@ -38,4 +42,15 @@ PATCH_DIST_STRIP= -p1
SUPDISTFILES+= ${DIST_SIDEBAR}
.endif
## following needed for hg snapshots
AUTOMAKE_VERSION= 1.9
CONFIGURE_STYLE= gnu
BUILD_DEPENDS+= ${MODGNU_AUTOCONF_DEPENDS} \
${MODGNU_AUTOMAKE_DEPENDS}
post-patch:
cd ${WRKSRC}; \
AUTOCONF_VERSION=${AUTOCONF_VERSION} \
AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \
autoreconf --install
.include <bsd.port.mk>

View File

@ -1,15 +1,15 @@
MD5 (mutt/compressed-1.5.20.diff.gz) = 4xSjIY/dvydz3LExkxoN4g==
MD5 (mutt/mutt-1.5.20.tar.gz) = AnzdmVkgPeDDxkFJp+41HA==
MD5 (mutt/sidebar-1.5.20.diff0.gz) = /GBOsZNTStNwOZclkPL7yQ==
RMD160 (mutt/compressed-1.5.20.diff.gz) = RgaMsDPxgKJTawFQzzm9En/Z1bI=
RMD160 (mutt/mutt-1.5.20.tar.gz) = 31gveTZLn9cKAAHnahGdj3gnXrs=
RMD160 (mutt/sidebar-1.5.20.diff0.gz) = 1GVwvf0b2yMH8Edo76jESgkWeU8=
SHA1 (mutt/compressed-1.5.20.diff.gz) = KhlFfvfP1GA6azseUzAebFHjsnc=
SHA1 (mutt/mutt-1.5.20.tar.gz) = 0r7Hozdx8SjKSbFyOwa20kijXTE=
SHA1 (mutt/sidebar-1.5.20.diff0.gz) = 7vx2QU9/5+XJcj/iJGstYesw4iI=
SHA256 (mutt/compressed-1.5.20.diff.gz) = 6WGic/h6jKRGWGgc+tdTwkxlAjajcZksWvk9elzjpo8=
SHA256 (mutt/mutt-1.5.20.tar.gz) = lXn8B510/1yJIj/wnfQC705Qi6jKklxJ50qgnAKpp5Y=
SHA256 (mutt/sidebar-1.5.20.diff0.gz) = ZRXjDdhHiLRxTsLggPa3PcN3tbP3BGrQi+VZqvKTDd8=
SIZE (mutt/compressed-1.5.20.diff.gz) = 368893
SIZE (mutt/mutt-1.5.20.tar.gz) = 3635047
SIZE (mutt/sidebar-1.5.20.diff0.gz) = 538817
MD5 (mutt/compressed-5302767aa6aa.gz) = 2Z9fL+jDFfd0SBxUO5vCFQ==
MD5 (mutt/mutt-5302767aa6aa.tar.bz2) = 0Z4GykfllslEjtbhwaG3Zg==
MD5 (mutt/sidebar-5302767aa6aa.gz) = f5h+PEGkJ4ATX3T2V5xFfw==
RMD160 (mutt/compressed-5302767aa6aa.gz) = idHgV+jNI+DfOsviOinP9eefjBw=
RMD160 (mutt/mutt-5302767aa6aa.tar.bz2) = LBBum+UPk+8M+za9tzMLzHryRuA=
RMD160 (mutt/sidebar-5302767aa6aa.gz) = xP2BhsvKPa0w3iU7ZzucRcuavyY=
SHA1 (mutt/compressed-5302767aa6aa.gz) = 4cbAMQZX23U3Whon6LNDouxHy9U=
SHA1 (mutt/mutt-5302767aa6aa.tar.bz2) = 4owE5tEwWg0vwx2JnRscEjzjJJ4=
SHA1 (mutt/sidebar-5302767aa6aa.gz) = P4fajiCSE6I/Io9IrFVL7uFa3Ao=
SHA256 (mutt/compressed-5302767aa6aa.gz) = wip+TwZMzA3Gu1WF5ZBR96hKvz6qfd5JalqB9bn/uB0=
SHA256 (mutt/mutt-5302767aa6aa.tar.bz2) = R18zPYPn7J4dPzWH9ZAR9pWmHcLgv5JrasvhqAsvpsI=
SHA256 (mutt/sidebar-5302767aa6aa.gz) = TJdd4RHwJfmiM5hHKGKNmLEGCvpIVIvNBumPXN1Juh8=
SIZE (mutt/compressed-5302767aa6aa.gz) = 6315
SIZE (mutt/mutt-5302767aa6aa.tar.bz2) = 1534906
SIZE (mutt/sidebar-5302767aa6aa.gz) = 11762

View File

@ -1,49 +0,0 @@
$OpenBSD: patch-browser_c,v 1.6 2009/06/16 09:37:19 sthen Exp $
--- browser.c.orig Thu Jun 11 18:52:54 2009
+++ browser.c Mon Jun 15 21:06:08 2009
@@ -27,6 +27,7 @@
#include "buffy.h"
#include "mapping.h"
#include "sort.h"
+#include "mx.h"
#include "mailbox.h"
#include "browser.h"
#ifdef USE_IMAP
@@ -352,6 +353,21 @@ static void init_state (struct browser_state *state, M
menu->data = state->entry;
}
+static void check_maildir_times (BUFFY *buf, struct stat *st)
+{
+ char buffer[_POSIX_PATH_MAX + SHORT_STRING];
+ struct stat s;
+
+ if(!buf || buf->magic != M_MAILDIR)
+ return;
+
+ snprintf (buffer, sizeof (buffer), "%s/tmp", buf->path);
+ if (lstat (buffer, &s) != 0)
+ return;
+
+ st->st_mtime = s.st_mtime;
+}
+
static int examine_directory (MUTTMENU *menu, struct browser_state *state,
char *d, const char *prefix)
{
@@ -415,6 +431,7 @@ static int examine_directory (MUTTMENU *menu, struct b
tmp = Incoming;
while (tmp && mutt_strcmp (buffer, tmp->path))
tmp = tmp->next;
+ check_maildir_times (tmp, &s);
add_folder (menu, state, de->d_name, &s, (tmp) ? tmp->new : 0);
}
closedir (dp);
@@ -479,6 +496,7 @@ static int examine_mailboxes (MUTTMENU *menu, struct b
strfcpy (buffer, NONULL(tmp->path), sizeof (buffer));
mutt_pretty_mailbox (buffer, sizeof (buffer));
+ check_maildir_times (tmp, &s);
add_folder (menu, state, buffer, &s, tmp->new);
}
while ((tmp = tmp->next));

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-buffy_c,v 1.1 2009/06/19 21:35:37 sthen Exp $
r5914 from upstream; Do not free statically-allocated
buffy buffer. Unbreaks unmailboxes, ticket #3273.
--- buffy.c.orig Fri Jun 19 22:30:51 2009
+++ buffy.c Fri Jun 19 22:30:52 2009
@@ -236,7 +236,6 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, uns
{
if(*tmp)
{
- FREE (&((*tmp)->path));
tmp1=(*tmp)->next;
FREE (tmp); /* __FREE_CHECKED__ */
*tmp=tmp1;

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-configure_ac,v 1.4 2009/06/16 09:37:19 sthen Exp $
--- configure.ac.orig Tue Jun 9 07:50:33 2009
+++ configure.ac Mon Jun 15 21:06:12 2009
@@ -546,7 +546,7 @@ docdir=$mutt_cv_docdir
$OpenBSD: patch-configure_ac,v 1.5 2010/09/08 09:57:28 sthen Exp $
--- configure.ac.orig Wed Aug 25 00:30:49 2010
+++ configure.ac Sat Sep 4 10:33:30 2010
@@ -549,7 +549,7 @@ fi
AC_SUBST(docdir)
if test x$mutt_cv_setgid = xyes; then

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-doc_Makefile_am,v 1.1 2010/09/08 09:57:28 sthen Exp $
--- doc/Makefile.am.orig Sat Sep 4 10:34:22 2010
+++ doc/Makefile.am Sat Sep 4 10:38:22 2010
@@ -161,8 +161,8 @@ update-doc: stamp-doc-xml stamp-doc-chunked stamp-doc-
muttrc.man: makedoc$(EXEEXT) $(top_srcdir)/init.h muttrc.man.head muttrc.man.tail
$(MAKEDOC_CPP) $(top_srcdir)/init.h | ./makedoc$(EXEEXT) -m | \
- cat $(srcdir)/muttrc.man.head - $(srcdir)/muttrc.man.tail\
- > muttrc.man
+ cat $(srcdir)/muttrc.man.head - $(srcdir)/muttrc.man.tail | \
+ /usr/bin/tbl > muttrc.man
EDIT = sed -e 's,@sysconfdir\@,$(sysconfdir),g' \
-e 's,@bindir\@,$(bindir),g' \

View File

@ -1,23 +0,0 @@
$OpenBSD: patch-doc_Makefile_in,v 1.9 2009/06/16 09:37:19 sthen Exp $
--- doc/Makefile.in.orig Tue Jun 9 07:50:43 2009
+++ doc/Makefile.in Mon Jun 15 21:06:12 2009
@@ -517,7 +517,7 @@ uninstall-am: uninstall-local
all: makedoc-all
-makedoc-all: mutt.1 muttrc.man manual.html stamp-doc-rc stamp-doc-chunked manual.txt
+makedoc-all: mutt.1 muttrc.man stamp-doc-rc
install-data-local: makedoc-all instdoc
$(top_srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man1
@@ -627,8 +627,8 @@ update-doc: stamp-doc-xml stamp-doc-chunked stamp-doc-
muttrc.man: makedoc$(EXEEXT) $(top_srcdir)/init.h muttrc.man.head muttrc.man.tail
$(MAKEDOC_CPP) $(top_srcdir)/init.h | ./makedoc$(EXEEXT) -m | \
- cat $(srcdir)/muttrc.man.head - $(srcdir)/muttrc.man.tail\
- > muttrc.man
+ cat $(srcdir)/muttrc.man.head - $(srcdir)/muttrc.man.tail | \
+ /usr/bin/tbl > muttrc.man
mutt.1: $(srcdir)/mutt.man
$(EDIT) $(srcdir)/mutt.man > $@

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-handler_c,v 1.1 2009/06/16 09:37:19 sthen Exp $
unbreak header weeding for message/rfc822 parts, mutt bug #3265
--- handler.c.orig Mon Jun 15 21:08:41 2009
+++ handler.c Mon Jun 15 21:08:57 2009
@@ -1090,7 +1090,7 @@ static int message_handler (BODY *a, STATE *s)
mutt_copy_hdr (s->fpin, s->fpout, off_start, b->parts->offset,
(((s->flags & M_WEED) || ((s->flags & (M_DISPLAY|M_PRINTING)) && option (OPTWEED))) ? (CH_WEED | CH_REORDER) : 0) |
(s->prefix ? CH_PREFIX : 0) | CH_DECODE | CH_FROM |
- (s->flags & M_DISPLAY) ? CH_DISPLAY : 0, s->prefix);
+ ((s->flags & M_DISPLAY) ? CH_DISPLAY : 0), s->prefix);
if (s->prefix)
state_puts (s->prefix, s);

View File

@ -1,53 +0,0 @@
$OpenBSD: patch-hcache_c,v 1.1 2009/07/29 20:26:45 sthen Exp $
uidvalidity is an IMAP-specific uint32; ticket #3296
--- hcache.c.orig Mon Jun 1 17:29:32 2009
+++ hcache.c Wed Jul 29 20:48:32 2009
@@ -85,7 +85,7 @@ static void mutt_hcache_dbt_empty_init(DBT * dbt);
typedef union
{
struct timeval timeval;
- unsigned long uid_validity;
+ unsigned int uidvalidity;
} validate;
static void *
@@ -588,7 +588,7 @@ mutt_hcache_per_folder(const char *path, const char *f
* db_store */
static void *
mutt_hcache_dump(header_cache_t *h, HEADER * header, int *off,
- unsigned long uid_validity)
+ unsigned int uidvalidity)
{
unsigned char *d = NULL;
HEADER nh;
@@ -597,8 +597,8 @@ mutt_hcache_dump(header_cache_t *h, HEADER * header, i
*off = 0;
d = lazy_malloc(sizeof (validate));
- if (uid_validity)
- memcpy(d, &uid_validity, sizeof (unsigned long));
+ if (uidvalidity)
+ memcpy(d, &uidvalidity, sizeof (uidvalidity));
else
{
struct timeval now;
@@ -757,7 +757,7 @@ mutt_hcache_fetch_raw (header_cache_t *h, const char *
int
mutt_hcache_store(header_cache_t *h, const char *filename, HEADER * header,
- unsigned long uid_validity,
+ unsigned int uidvalidity,
size_t(*keylen) (const char *fn))
{
char* data;
@@ -767,7 +767,7 @@ mutt_hcache_store(header_cache_t *h, const char *filen
if (!h)
return -1;
- data = mutt_hcache_dump(h, header, &dlen, uid_validity);
+ data = mutt_hcache_dump(h, header, &dlen, uidvalidity);
ret = mutt_hcache_store_raw (h, filename, data, dlen, keylen);
FREE(&data);

View File

@ -1,17 +0,0 @@
$OpenBSD: patch-hcache_h,v 1.1 2009/07/29 20:26:45 sthen Exp $
uidvalidity is an IMAP-specific uint32; ticket #3296
--- hcache.h.orig Tue Nov 11 19:55:46 2008
+++ hcache.h Wed Jul 29 20:48:32 2009
@@ -33,8 +33,9 @@ HEADER *mutt_hcache_restore(const unsigned char *d, HE
void *mutt_hcache_fetch(header_cache_t *h, const char *filename, size_t (*keylen)(const char *fn));
void *mutt_hcache_fetch_raw (header_cache_t *h, const char *filename,
size_t (*keylen)(const char *fn));
+/* uidvalidity is an IMAP-specific unsigned 32 bit number */
int mutt_hcache_store(header_cache_t *h, const char *filename, HEADER *header,
- unsigned long uid_validity, size_t (*keylen)(const char *fn));
+ unsigned int uidvalidity, size_t (*keylen)(const char *fn));
int mutt_hcache_store_raw (header_cache_t *h, const char* filename, void* data,
size_t dlen, size_t(*keylen) (const char* fn));
int mutt_hcache_delete(header_cache_t *h, const char *filename, size_t (*keylen)(const char *fn));

View File

@ -1,24 +0,0 @@
$OpenBSD: patch-imap_imap_c,v 1.1 2009/06/16 09:37:19 sthen Exp $
fix segfault in imap_synx_mailbox; mutt bug #3226
--- imap/imap.c.orig Mon Jun 15 21:11:05 2009
+++ imap/imap.c Mon Jun 15 21:11:58 2009
@@ -1178,7 +1178,7 @@ int imap_sync_mailbox (CONTEXT* ctx, int expunge, int*
return rc;
/* if we are expunging anyway, we can do deleted messages very quickly... */
- if (expunge && mutt_bit_isset (ctx->rights, M_ACL_DELETE))
+ if (expunge && mutt_bit_isset (idata->ctx->rights, M_ACL_DELETE))
{
if ((rc = imap_exec_msgset (idata, "UID STORE", "+FLAGS.SILENT (\\Deleted)",
M_DELETED, 1, 0)) < 0)
@@ -1293,7 +1293,7 @@ int imap_sync_mailbox (CONTEXT* ctx, int expunge, int*
ctx->changed = 0;
/* We must send an EXPUNGE command if we're not closing. */
- if (expunge && !(ctx->closing) &&
+ if (expunge && !(idata->ctx->closing) &&
mutt_bit_isset(ctx->rights, M_ACL_DELETE))
{
mutt_message _("Expunging messages from server...");

View File

@ -1,46 +0,0 @@
$OpenBSD: patch-imap_util_c,v 1.2 2010/08/09 09:54:15 dcoppa Exp $
add hcache debug, re ticket #3296
fix bug in imap_keepalive() which erroneously free Context when the
IMAP connection is shut down by the server.
--- imap/util.c.orig Wed Jun 10 06:17:20 2009
+++ imap/util.c Mon Aug 9 11:37:57 2010
@@ -129,6 +129,8 @@ HEADER* imap_hcache_get (IMAP_DATA* idata, unsigned in
{
if (*uv == idata->uid_validity)
h = mutt_hcache_restore ((unsigned char*)uv, NULL);
+ else
+ dprint (3, (debugfile, "hcache uidvalidity mismatch: %u", *uv));
FREE (&uv);
}
@@ -731,6 +733,8 @@ void imap_keepalive (void)
{
if (conn->account.type == M_ACCT_TYPE_IMAP)
{
+ int need_free = 0;
+
idata = (IMAP_DATA*) conn->data;
if (idata->state >= IMAP_AUTHENTICATED
@@ -742,9 +746,17 @@ void imap_keepalive (void)
{
ctx = safe_calloc (1, sizeof (CONTEXT));
ctx->data = idata;
+ /* imap_close_mailbox will set ctx->iadata->ctx to NULL, so we can't
+ * rely on the value of iadata->ctx to determine if this placeholder
+ * context needs to be freed.
+ */
+ need_free = 1;
}
+ /* if the imap connection closes during this call, ctx may be invalid
+ * after this point, and thus should not be read.
+ */
imap_check_mailbox (ctx, NULL, 1);
- if (!idata->ctx)
+ if (need_free)
FREE (&ctx);
}
}

View File

@ -1,271 +0,0 @@
$OpenBSD: patch-url_c,v 1.2 2009/06/19 21:28:24 sthen Exp $
don't parse URL port as signed short, but to int and cast to
unsigned short; mutt bug #3264
fixup URL parser, Changeset 5901:6eadedb1f6c0 for url.c:
1) allow / in usernames for IMAP (by %-encoding /, : and
% when pretty-printing urls),
2) for POP/SMTP the trailing / is no longer mandatory,
3) more strict %-decoding to avoid unexpected results
--- url.c.orig Mon Jun 1 17:29:32 2009
+++ url.c Fri Jun 19 21:39:02 2009
@@ -45,28 +45,32 @@ static struct mapping_t UrlMap[] =
{ NULL, U_UNKNOWN }
};
-
-static void url_pct_decode (char *s)
+static int url_pct_decode (char *s)
{
char *d;
if (!s)
- return;
-
+ return -1;
+
for (d = s; *s; s++)
{
- if (*s == '%' && s[1] && s[2] &&
- isxdigit ((unsigned char) s[1]) &&
- isxdigit ((unsigned char) s[2]) &&
- hexval (s[1]) >= 0 && hexval (s[2]) >= 0)
+ if (*s == '%')
{
- *d++ = (hexval (s[1]) << 4) | (hexval (s[2]));
- s += 2;
- }
- else
+ if (s[1] && s[2] &&
+ isxdigit ((unsigned char) s[1]) &&
+ isxdigit ((unsigned char) s[2]) &&
+ hexval (s[1]) >= 0 && hexval (s[2]) >= 0)
+ {
+ *d++ = (hexval (s[1]) << 4) | (hexval (s[2]));
+ s += 2;
+ }
+ else
+ return -1;
+ } else
*d++ = *s;
}
*d ='\0';
+ return 0;
}
url_scheme_t url_check_scheme (const char *s)
@@ -74,12 +78,12 @@ url_scheme_t url_check_scheme (const char *s)
char sbuf[STRING];
char *t;
int i;
-
+
if (!s || !(t = strchr (s, ':')))
return U_UNKNOWN;
if ((t - s) + 1 >= sizeof (sbuf))
return U_UNKNOWN;
-
+
strfcpy (sbuf, s, t - s + 1);
for (t = sbuf; *t; t++)
*t = ascii_tolower (*t);
@@ -98,33 +102,33 @@ int url_parse_file (char *d, const char *src, size_t d
return -1;
else
strfcpy (d, src + 5, dl);
-
- url_pct_decode (d);
- return 0;
+
+ return url_pct_decode (d);
}
/* ciss_parse_userhost: fill in components of ciss with info from src. Note
* these are pointers into src, which is altered with '\0's. Port of 0
* means no port given. */
-static char *ciss_parse_userhost (ciss_url_t *ciss, char *src)
+static int ciss_parse_userhost (ciss_url_t *ciss, char *src)
{
- char *t;
- char *p;
- char *path;
+ char *t, *p;
ciss->user = NULL;
ciss->pass = NULL;
ciss->host = NULL;
ciss->port = 0;
- if (strncmp (src, "//", 2))
- return src;
-
+ if (strncmp (src, "//", 2) != 0)
+ {
+ ciss->path = src;
+ return url_pct_decode (ciss->path);
+ }
+
src += 2;
- if ((path = strchr (src, '/')))
- *path++ = '\0';
-
+ if ((ciss->path = strchr (src, '/')))
+ *ciss->path++ = '\0';
+
if ((t = strrchr (src, '@')))
{
*t = '\0';
@@ -132,27 +136,31 @@ static char *ciss_parse_userhost (ciss_url_t *ciss, ch
{
*p = '\0';
ciss->pass = p + 1;
- url_pct_decode (ciss->pass);
+ if (url_pct_decode (ciss->pass) < 0)
+ return -1;
}
ciss->user = src;
- url_pct_decode (ciss->user);
+ if (url_pct_decode (ciss->user) < 0)
+ return -1;
t++;
}
else
t = src;
-
+
if ((p = strchr (t, ':')))
{
+ int t;
*p++ = '\0';
- if (mutt_atos (p, (short*) &ciss->port) < 0)
- return NULL;
+ if (mutt_atoi (p, &t) < 0 || t < 0 || t > 0xffff)
+ return -1;
+ ciss->port = (unsigned short)t;
}
else
ciss->port = 0;
-
+
ciss->host = t;
- url_pct_decode (ciss->host);
- return path;
+ return url_pct_decode (ciss->host) >= 0 &&
+ (!ciss->path || url_pct_decode (ciss->path) >= 0) ? 0 : -1;
}
/* url_parse_ciss: Fill in ciss_url_t. char* elements are pointers into src,
@@ -166,15 +174,31 @@ int url_parse_ciss (ciss_url_t *ciss, char *src)
tmp = strchr (src, ':') + 1;
- if ((ciss->path = ciss_parse_userhost (ciss, tmp)) == NULL)
- return -1;
- url_pct_decode (ciss->path);
-
- return 0;
+ return ciss_parse_userhost (ciss, tmp);
}
-/* url_ciss_tostring: output the URL string for a given CISS object. */
+static void url_pct_encode (char *dst, size_t l, const char *src)
+{
+ static const char *alph = "0123456789ABCDEF";
+ *dst = 0;
+ l--;
+ while (src && *src && l)
+ {
+ if (strchr ("/:%", *src) && l > 3)
+ {
+ *dst++ = '%';
+ *dst++ = alph[(*src >> 4) & 0xf];
+ *dst++ = alph[*src & 0xf];
+ src++;
+ continue;
+ }
+ *dst++ = *src++;
+ }
+ *dst = 0;
+}
+
+/* url_ciss_tostring: output the URL string for a given CISS object. */
int url_ciss_tostring (ciss_url_t* ciss, char* dest, size_t len, int flags)
{
long l;
@@ -189,12 +213,20 @@ int url_ciss_tostring (ciss_url_t* ciss, char* dest, s
if (!(flags & U_PATH))
safe_strcat (dest, len, "//");
len -= (l = strlen (dest)); dest += l;
-
- if (ciss->user) {
+
+ if (ciss->user)
+ {
+ char u[STRING];
+ url_pct_encode (u, sizeof (u), ciss->user);
+
if (flags & U_DECODE_PASSWD && ciss->pass)
- snprintf (dest, len, "%s:%s@", ciss->user, ciss->pass);
+ {
+ char p[STRING];
+ url_pct_encode (p, sizeof (p), ciss->pass);
+ snprintf (dest, len, "%s:%s@", u, p);
+ }
else
- snprintf (dest, len, "%s@", ciss->user);
+ snprintf (dest, len, "%s@", u);
len -= (l = strlen (dest)); dest += l;
}
@@ -219,24 +251,25 @@ int url_parse_mailto (ENVELOPE *e, char **body, const
char *tag, *value;
char scratch[HUGE_STRING];
- int taglen, rc = 0;
+ int taglen, rc = -1;
LIST *last = NULL;
-
+
if (!(t = strchr (src, ':')))
return -1;
-
+
if ((tmp = safe_strdup (t + 1)) == NULL)
return -1;
if ((headers = strchr (tmp, '?')))
*headers++ = '\0';
- url_pct_decode (tmp);
+ if (url_pct_decode (tmp) < 0)
+ return -1;
e->to = rfc822_parse_adrlist (e->to, tmp);
tag = headers ? strtok_r (headers, "&", &p) : NULL;
-
+
for (; tag; tag = strtok_r (NULL, "&", &p))
{
if ((value = strchr (tag, '=')))
@@ -244,8 +277,10 @@ int url_parse_mailto (ENVELOPE *e, char **body, const
if (!value || !*value)
continue;
- url_pct_decode (tag);
- url_pct_decode (value);
+ if (url_pct_decode (tag) < 0)
+ return -1;
+ if (url_pct_decode (value) < 0)
+ return -1;
if (!ascii_strcasecmp (tag, "body"))
{

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.19 2009/06/16 09:37:19 sthen Exp $
@comment $OpenBSD: PLIST,v 1.20 2010/09/08 09:57:28 sthen Exp $
@pkgpath mail/mutt/snapshot,hcache
bin/flea
@bin bin/mutt
@ -11,6 +11,7 @@ bin/smime_keys
@man man/man1/mutt.1
@man man/man1/mutt_dotlock.1
@man man/man1/muttbug.1
@man man/man1/smime_keys.1
@man man/man5/mbox.5
@man man/man5/mmdf.5
@man man/man5/muttrc.5

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.37 2009/06/16 09:37:19 sthen Exp $
# $OpenBSD: Makefile,v 1.38 2010/09/08 09:57:28 sthen Exp $
COMMENT= tty-based e-mail client
VERSION= 1.4.2.3
DISTNAME= mutt-${VERSION}
PKGNAME= ${DISTNAME}p1
REVISION= 1
MASTER_SITES= ${MASTER_SITES_MUTT}
.include <bsd.port.mk>