Accepting request 45318 from GNOME:Factory

Copy from GNOME:Factory/libesmtp based on submit request 45318 from user vuntz

OBS-URL: https://build.opensuse.org/request/show/45318
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libesmtp?expand=0&rev=9
This commit is contained in:
OBS User autobuild 2010-08-13 00:33:25 +00:00 committed by Git OBS Bridge
parent 1c41633f0b
commit c0d174396d
6 changed files with 34 additions and 271 deletions

View File

@ -1,67 +0,0 @@
From: Bernhard Walle <bwalle@suse.de>
Subject: [PATCH] Allow multiple Cc and Bcc header calls
This patch modifies the library so that smtp_set_header() can be called
multiple times. One header will be generated with a comma-separated list
of values.
That's the behaviour as described in the API documentation at
http://www.stafford.uklinux.net/libesmtp/api.html.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
---
headers.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/headers.c
+++ b/headers.c
@@ -273,7 +273,7 @@ set_from (struct rfc2822_header *header,
return 1;
}
-/* Print header-name ": " mailbox "\r\n"
+/* Print header-name ": " mailbox "\r\n"
or header-name ": \"" phrase "\" <" mailbox ">\r\n" */
static void
print_from (smtp_message_t message, struct rfc2822_header *header)
@@ -340,7 +340,7 @@ set_sender (struct rfc2822_header *heade
/* TODO: do nothing if the mailbox is NULL. Check this doesn't fool
the protocol engine into thinking it has seen end of file. */
-/* Print header-name ": " mailbox "\r\n"
+/* Print header-name ": " mailbox "\r\n"
or header-name ": \"" phrase "\" <" mailbox ">\r\n"
*/
static void
@@ -414,7 +414,7 @@ set_cc (struct rfc2822_header *header, v
return 1;
}
-/* Print header-name ": " mailbox "\r\n"
+/* Print header-name ": " mailbox "\r\n"
or header-name ": \"" phrase "\" <" mailbox ">\r\n"
ad nauseum. */
static void
@@ -508,9 +508,9 @@ static const struct header_actions heade
set_sender, print_sender, destroy_mbox_list, },
{ "To", OPTIONAL,
set_to, print_to, destroy_mbox_list, },
- { "Cc", OPTIONAL,
+ { "Cc", OPTIONAL | LISTVALUE,
set_cc, print_cc, destroy_mbox_list, },
- { "Bcc", OPTIONAL,
+ { "Bcc", OPTIONAL | LISTVALUE,
set_cc, print_cc, destroy_mbox_list, },
{ "Reply-To", OPTIONAL,
set_cc, print_cc, destroy_mbox_list, },
@@ -760,7 +760,7 @@ missing_header (smtp_message_t message,
if (print == NULL)
print = print_string;
-
+
cat_reset (&message->hdr_buffer, 0);
(*print) (message, message->current_header);
return cat_buffer (&message->hdr_buffer, len);

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:407ec85a4c3ce2c4045608d28c36a8e19f1cfbad02bf3de784f6b6fa83d15a56
size 351917

3
libesmtp-1.0.6.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d0a61a5c52d99fa7ce7d00ed0a07e341dbda67101dbed1ab0cdae3f37db4eb0b
size 365506

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Tue Aug 10 14:37:42 CEST 2010 - dimstar@opensuse.org
- Update to version 1.0.6:
+ Each component matched by match-domain() is either a single
'*' which matches anything or a case-insensitive comparison
with a string of alphanumeric characters or a '-'.
- Changes from version 1.0.5:
+ The Gmail server reports enhanced status codes but then fails
to provide them in some cases. The parser is now tolerant of
this but warns the application using a new event flag
SMTP_EV_SYNTAXWARNING that it is progressing despite the syntax
error.
+ Fixed bug where To, Cc, Bcc etc. accepted only single values
instead of a list.
+ Fix reversed comparison on the return value of gettimeofday().
- Drop upstream fixed patches libesmtp-1.0.4-multiple-cc.patch and
libestmp-commonname.diff.
- Cleaned spec file using spec-cleaner.
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Apr 28 08:16:43 UTC 2010 - freitag@novell.com Wed Apr 28 08:16:43 UTC 2010 - freitag@novell.com

View File

@ -1,5 +1,5 @@
# #
# spec file for package libesmtp (Version 1.0.4) # spec file for package libesmtp (Version 1.0.6)
# #
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
@ -15,24 +15,22 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
# norootforbuild
Name: libesmtp Name: libesmtp
BuildRequires: openssl-devel Version: 1.0.6
Url: http://www.stafford.uklinux.net/libesmtp/ Release: 1
License: GPLv2+ ; LGPLv2.1+ License: GPLv2+ ; LGPLv2.1+
Group: Development/Libraries/C and C++
Summary: A Library for Posting Electronic Mail Summary: A Library for Posting Electronic Mail
Version: 1.0.4 Url: http://www.stafford.uklinux.net/libesmtp/
Release: 171 Group: Development/Libraries/C and C++
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: %{name}-%{version}.tar.bz2 Source0: %{name}-%{version}.tar.bz2
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/Packaging/Patches
Patch0: libesmtp-removedecls.diff Patch0: libesmtp-removedecls.diff
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/Packaging/Patches
Patch1: libesmtp-1.0.4-bloat.patch Patch1: libesmtp-1.0.4-bloat.patch
Patch2: libesmtp-1.0.4-multiple-cc.patch BuildRequires: openssl-devel
# PATCH-FIX-UPSTREAM libestmp-commonname.diff bnc#585393 freitag@novell.com -- Stricter checking on CommonName BuildRoot: %{_tmppath}/%{name}-%{version}-build
Patch3: libestmp-commonname.diff
%description %description
libESMTP is a library to manage posting (or submission of) electronic libESMTP is a library to manage posting (or submission of) electronic
@ -41,12 +39,6 @@ Exim. It may be used as part of a Mail User Agent (MUA) or another
program that must be able to post electronic mail but where mail program that must be able to post electronic mail but where mail
functionality is not that program's primary purpose. functionality is not that program's primary purpose.
Authors:
--------
Brian Stafford <brian@stafford.uklinux.net>
%package devel %package devel
License: GPLv2+ ; LGPLv2.1+ License: GPLv2+ ; LGPLv2.1+
Summary: A Library for Posting Electronic Mail Summary: A Library for Posting Electronic Mail
@ -60,28 +52,19 @@ Exim. It may be used as part of a Mail User Agent (MUA) or another
program that must be able to post electronic mail but where mail program that must be able to post electronic mail but where mail
functionality is not that program's primary purpose. functionality is not that program's primary purpose.
Authors:
--------
Brian Stafford <brian@stafford.uklinux.net>
%prep %prep
%setup -q %setup -q
%patch0 %patch0
%patch1 %patch1
%patch2 -p1
%patch3
%build %build
autoreconf -fi
%configure --disable-static --with-pic \ %configure --disable-static --with-pic \
--enable-ntlm \ --enable-ntlm \
--enable-etrn --enable-etrn
%{__make} %{?jobs:-j%jobs} %{__make} %{?_smp_mflags}
%install %install
make DESTDIR=%{buildroot} install %makeinstall
#uses dlsym not ltdl ..useless files #uses dlsym not ltdl ..useless files
rm -rf %{buildroot}%{_libdir}/esmtp-plugins/*a rm -rf %{buildroot}%{_libdir}/esmtp-plugins/*a
rm -rf %{buildroot}%{_libdir}/*a rm -rf %{buildroot}%{_libdir}/*a

View File

@ -1,173 +0,0 @@
--- smtp-tls.c.orig 2005-12-15 18:59:49.000000000 +0000
+++ smtp-tls.c 2010-03-17 01:15:06.000000000 +0000
@@ -439,15 +439,32 @@
match_component (const char *dom, const char *edom,
const char *ref, const char *eref)
{
- while (dom < edom && ref < eref)
+ /* If ref is the single character '*' then accept this as a wildcard
+ matching any valid domainname component, i.e. characters from the
+ range A-Z, a-z, 0-9, - or _
+ NB this is more restrictive than RFC 2818 which allows multiple
+ wildcard characters in the component pattern */
+ if (eref == ref + 1 && *ref == '*')
+ while (dom < edom)
+ {
+ if (!(isalnum (*dom) || *dom == '-' /*|| *dom == '_'*/))
+ return 0;
+ dom++;
+ }
+ else
{
- /* Accept a final '*' in the reference as a wildcard */
- if (*ref == '*' && ref + 1 == eref)
- break;
- /* compare the domain name case insensitive */
- if (!(*dom == *ref || tolower (*dom) == tolower (*ref)))
- return 0;
- ref++, dom++;
+ while (dom < edom && ref < eref)
+ {
+ /* check for valid domainname character */
+ if (!(isalnum (*dom) || *dom == '-' /*|| *dom == '_'*/))
+ return 0;
+ /* compare the domain name case-insensitively */
+ if (!(*dom == *ref || tolower (*dom) == tolower (*ref)))
+ return 0;
+ ref++, dom++;
+ }
+ if (dom < edom || ref < eref)
+ return 0;
}
return 1;
}
@@ -541,65 +560,83 @@
}
else
{
- int i, j, extcount;
+ char buf[256] = { 0 };
+ STACK_OF(GENERAL_NAME) *altnames;
+ int hasaltname = 0;
- extcount = X509_get_ext_count (cert);
- for (i = 0; i < extcount; i++)
+ altnames = X509_get_ext_d2i (cert, NID_subject_alt_name, NULL, NULL);
+ if (altnames != NULL)
{
- const char *extstr;
- X509_EXTENSION *ext = X509_get_ext (cert, i);
+ int i;
- extstr = OBJ_nid2sn (OBJ_obj2nid (X509_EXTENSION_get_object (ext)));
- if (strcmp (extstr, "subjectAltName") == 0)
+ for (i = 0; i < sk_GENERAL_NAME_num (altnames); ++i)
{
- unsigned char *data;
- STACK_OF(CONF_VALUE) *val;
- CONF_VALUE *nval;
- X509V3_EXT_METHOD *meth;
- void *ext_str = NULL;
- int stack_len;
-
- meth = X509V3_EXT_get (ext);
- if (meth == NULL)
- break;
- data = ext->value->data;
-#if (OPENSSL_VERSION_NUMBER > 0x00907000L)
- if (meth->it)
- ext_str = ASN1_item_d2i (NULL, &data, ext->value->length,
- ASN1_ITEM_ptr (meth->it));
- else
-#endif
- ext_str = meth->d2i (NULL, &data, ext->value->length);
- val = meth->i2v (meth, ext_str, NULL);
- stack_len = sk_CONF_VALUE_num (val);
- for (j = 0; j < stack_len; j++)
+ GENERAL_NAME *name = sk_GENERAL_NAME_value (altnames, i);
+
+ if (name->type == GEN_DNS)
{
- nval = sk_CONF_VALUE_value (val, j);
- if (strcmp (nval->name, "DNS") == 0
- && match_domain (session->host, nval->value))
+ const char *ia5str = (const char *) name->d.ia5->data;
+ int ia5len = name->d.ia5->length;
+
+ hasaltname = 1;
+ if (strlen (ia5str) == ia5len
+ && match_domain (session->host, ia5str))
+ ok = 1;
+ else
{
- ok = 1;
- break;
+ buf[0] = '\0';
+ strncat (buf, ia5str, sizeof buf - 1);
}
}
+ // TODO: handle GEN_IPADD
}
- if (ok)
- break;
+ sk_GENERAL_NAME_pop_free (altnames, GENERAL_NAME_free);
}
- if (!ok)
+
+ if (!hasaltname)
{
- /* Matching by subjectAltName failed, try commonName */
- X509_NAME_get_text_by_NID (X509_get_subject_name (cert),
- NID_commonName, buf, sizeof buf);
- if (!match_domain (session->host, buf) != 0)
+ X509_NAME *subj = X509_get_subject_name (cert);
+
+ if (subj != NULL)
{
- if (session->event_cb != NULL)
- (*session->event_cb) (session, SMTP_EV_WRONG_PEER_CERTIFICATE,
- session->event_cb_arg, &ok, buf, ssl);
+ ASN1_STRING *cn;
+ int idx, i = -1;
+
+ do
+ {
+ idx = i;
+ i = X509_NAME_get_index_by_NID (subj, NID_commonName, i);
+ }
+ while (i >= 0);
+
+ if (idx >= 0
+ && (cn = X509_NAME_ENTRY_get_data (
+ X509_NAME_get_entry (subj, idx)
+ )) != NULL)
+ {
+ unsigned char *str = NULL;
+ int len = ASN1_STRING_to_UTF8 (&str, cn);
+
+ if (str != NULL)
+ {
+ if (strlen ((char *) str) == len
+ && match_domain (session->host, (char *) str))
+ ok = 1;
+ else
+ {
+ buf[0] = '\0';
+ strncat (buf, (char *) str, sizeof buf - 1);
+ }
+ OPENSSL_free (str);
+ }
+ }
}
- else
- ok = 1;
}
+
+ if (!ok && session->event_cb != NULL)
+ (*session->event_cb) (session, SMTP_EV_WRONG_PEER_CERTIFICATE,
+ session->event_cb_arg, &ok, buf, ssl);
+
X509_free (cert);
}
return ok;