Accepting request 176932 from server:mail

- Enable mutt to parse e.g. PGP markers with CRLF

OBS-URL: https://build.opensuse.org/request/show/176932
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mutt?expand=0&rev=54
This commit is contained in:
Stephan Kulow 2013-06-05 11:31:13 +00:00 committed by Git OBS Bridge
commit 984ec1962b
3 changed files with 151 additions and 2 deletions

View File

@ -0,0 +1,138 @@
--- crypt-gpgme.c
+++ crypt-gpgme.c 2013-05-29 09:31:53.141939173 +0000
@@ -2003,12 +2003,12 @@ static int pgp_check_traditional_one_bod
{
if (!mutt_strncmp ("-----BEGIN PGP ", buf, 15))
{
- if (!mutt_strcmp ("MESSAGE-----\n", buf + 15))
+ if (!mutt_strxcmp ("MESSAGE-----\n", buf + 15))
{
enc = 1;
break;
}
- else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15))
+ else if (!mutt_strxcmp ("SIGNED MESSAGE-----\n", buf + 15))
{
sgn = 1;
break;
@@ -2196,14 +2196,14 @@ int pgp_gpgme_application_handler (BODY
clearsign = 0;
start_pos = last_pos;
- if (!mutt_strcmp ("MESSAGE-----\n", buf + 15))
+ if (!mutt_strxcmp ("MESSAGE-----\n", buf + 15))
needpass = 1;
- else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15))
+ else if (!mutt_strxcmp ("SIGNED MESSAGE-----\n", buf + 15))
{
clearsign = 1;
needpass = 0;
}
- else if (!mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15))
+ else if (!mutt_strxcmp ("PUBLIC KEY BLOCK-----\n", buf + 15))
{
needpass = 0;
pgp_keyblock = 1;
--- lib.c
+++ lib.c 2013-05-29 09:31:53.325439198 +0000
@@ -875,6 +875,18 @@ int mutt_strcmp(const char *a, const cha
return strcmp(NONULL(a), NONULL(b));
}
+int mutt_strxcmp(const char *a, const char *b)
+{
+ size_t xa, xb;
+ xa = strcspn(NONULL(a), "\r\n");
+ xb = strcspn(NONULL(b), "\r\n");
+ if (xb != xa)
+ return -1;
+ if (!xa)
+ return 0;
+ return strncmp(NONULL(a), NONULL(b), xa);
+}
+
int mutt_strcasecmp(const char *a, const char *b)
{
return strcasecmp(NONULL(a), NONULL(b));
--- lib.h
+++ lib.h 2013-05-29 09:25:21.805439324 +0000
@@ -179,6 +179,7 @@ int mutt_copy_bytes (FILE *, FILE *, siz
int mutt_rx_sanitize_string (char *, size_t, const char *);
int mutt_strcasecmp (const char *, const char *);
int mutt_strcmp (const char *, const char *);
+int mutt_strxcmp (const char *, const char *);
int mutt_strncasecmp (const char *, const char *, size_t);
int mutt_strncmp (const char *, const char *, size_t);
int mutt_strcoll (const char *, const char *);
--- pager.c
+++ pager.c 2013-05-29 09:31:53.433440090 +0000
@@ -771,7 +771,7 @@ resolve_types (char *buf, char *raw, str
else if (check_attachment_marker ((char *) raw) == 0)
lineInfo[n].type = MT_COLOR_ATTACHMENT;
#endif
- else if (mutt_strcmp ("-- \n", buf) == 0 || mutt_strcmp ("-- \r\n", buf) == 0)
+ else if (mutt_strxcmp ("-- \n", buf) == 0)
{
i = n + 1;
--- pgp.c
+++ pgp.c 2013-05-29 09:31:53.461439587 +0000
@@ -287,14 +287,14 @@ int pgp_application_pgp_handler (BODY *m
clearsign = 0;
start_pos = last_pos;
- if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0)
+ if (mutt_strxcmp ("MESSAGE-----\n", buf + 15) == 0)
needpass = 1;
- else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
+ else if (mutt_strxcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
{
clearsign = 1;
needpass = 0;
}
- else if (!mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15))
+ else if (!mutt_strxcmp ("PUBLIC KEY BLOCK-----\n", buf + 15))
{
needpass = 0;
pgp_keyblock = 1;
@@ -327,10 +327,10 @@ int pgp_application_pgp_handler (BODY *m
fputs (buf, tmpfp);
- if ((needpass && mutt_strcmp ("-----END PGP MESSAGE-----\n", buf) == 0) ||
+ if ((needpass && mutt_strxcmp ("-----END PGP MESSAGE-----\n", buf) == 0) ||
(!needpass
- && (mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf) == 0
- || mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",buf) == 0)))
+ && (mutt_strxcmp ("-----END PGP SIGNATURE-----\n", buf) == 0
+ || mutt_strxcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",buf) == 0)))
break;
/* remember optional Charset: armor header as defined by RfC4880 */
if (mutt_strncmp ("Charset: ", buf, 9) == 0)
@@ -552,11 +552,11 @@ static int pgp_check_traditional_one_bod
{
if (mutt_strncmp ("-----BEGIN PGP ", buf, 15) == 0)
{
- if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0)
+ if (mutt_strxcmp ("MESSAGE-----\n", buf + 15) == 0)
enc = 1;
- else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
+ else if (mutt_strxcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
sgn = 1;
- else if (mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
+ else if (mutt_strxcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
key = 1;
}
}
@@ -1065,9 +1065,9 @@ BODY *pgp_sign_message (BODY *a)
*/
while (fgets (buffer, sizeof (buffer) - 1, pgpout) != NULL)
{
- if (mutt_strcmp ("-----BEGIN PGP MESSAGE-----\n", buffer) == 0)
+ if (mutt_strxcmp ("-----BEGIN PGP MESSAGE-----\n", buffer) == 0)
fputs ("-----BEGIN PGP SIGNATURE-----\n", fp);
- else if (mutt_strcmp("-----END PGP MESSAGE-----\n", buffer) == 0)
+ else if (mutt_strxcmp("-----END PGP MESSAGE-----\n", buffer) == 0)
fputs ("-----END PGP SIGNATURE-----\n", fp);
else
fputs (buffer, fp);

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed May 29 10:26:45 UTC 2013 - werner@suse.de
- Enable mutt to parse e.g. PGP markers with CRLF
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Apr 18 12:54:39 UTC 2013 - werner@suse.de Thu Apr 18 12:54:39 UTC 2013 - werner@suse.de

View File

@ -17,7 +17,7 @@
Name: mutt Name: mutt
#!BuildIgnore: sendmail #!BuildIgnore: sendmail
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: cyrus-sasl-devel BuildRequires: cyrus-sasl-devel
@ -30,13 +30,14 @@ BuildRequires: ispell
BuildRequires: krb5-devel BuildRequires: krb5-devel
BuildRequires: libcom_err BuildRequires: libcom_err
BuildRequires: libgcrypt BuildRequires: libgcrypt
BuildRequires: libgnutls-devel
BuildRequires: libgpg-error-devel BuildRequires: libgpg-error-devel
BuildRequires: libidn-devel BuildRequires: libidn-devel
BuildRequires: libopenssl-devel
BuildRequires: libxml2 BuildRequires: libxml2
BuildRequires: libxslt BuildRequires: libxslt
BuildRequires: lynx BuildRequires: lynx
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
BuildRequires: openssl-devel
BuildRequires: postfix BuildRequires: postfix
BuildRequires: sgml-skel BuildRequires: sgml-skel
BuildRequires: update-desktop-files BuildRequires: update-desktop-files
@ -94,6 +95,8 @@ Patch13: automake-1.12.patch
Patch14: nion.sidebar-color.diff Patch14: nion.sidebar-color.diff
# PATCH-FIX-OPENSUSE: bnc#813498 - mutt crashes in fgetwc in text_enriched_handler # PATCH-FIX-OPENSUSE: bnc#813498 - mutt crashes in fgetwc in text_enriched_handler
Patch15: widechar.sidebar.dif Patch15: widechar.sidebar.dif
# PATCH-FIX-OPENSUSE: Be able to read signed/encrypted messsages even with CRLF
Patch16: mutt-1.5.21-cariage-return.path
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%global _sysconfdir %{_sysconfdir} %global _sysconfdir %{_sysconfdir}
@ -125,6 +128,7 @@ done
%patch13 -p1 -b .automake-1.12 %patch13 -p1 -b .automake-1.12
%patch14 -p1 -b .sidebar.color %patch14 -p1 -b .sidebar.color
%patch15 -p0 -b .widechar.sidebar %patch15 -p0 -b .widechar.sidebar
%patch16 -p0 -b .crlf
cp doc/Muttrc Muttrc.SuSE cp doc/Muttrc Muttrc.SuSE
cp %{S:2} . cp %{S:2} .
@ -189,6 +193,8 @@ chmod 755 $KRB5CFGPATH
--with-ssl=%{_prefix} \ --with-ssl=%{_prefix} \
--with-sasl=%{_prefix} \ --with-sasl=%{_prefix} \
--with-gss=%{_prefix} \ --with-gss=%{_prefix} \
--with-gnutls=%{_prefix} \
--with-curses=%{_prefix} \
--with-regex \ --with-regex \
--enable-smtp \ --enable-smtp \
--enable-hcache \ --enable-hcache \