[pan2] reverted cbstruct dtor
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2] reverted cbstruct dtor
- Date: Wed, 2 May 2012 08:14:25 +0000 (UTC)
commit 56a74bc2a6fb7403ac29a9bf119b865607493d10
Author: Heinrich MÃlller <henmull src gnome org>
Date: Wed May 2 10:14:03 2012 +0200
reverted cbstruct dtor
pan/data-impl/groups.cc | 28 ++++++++++++++--------------
pan/data/cert-store.cc | 25 ++++++++++++++-----------
2 files changed, 28 insertions(+), 25 deletions(-)
---
diff --git a/pan/data-impl/groups.cc b/pan/data-impl/groups.cc
index 37892a8..b9ef49c 100644
--- a/pan/data-impl/groups.cc
+++ b/pan/data-impl/groups.cc
@@ -116,7 +116,7 @@ DataImpl :: load_newsrc (const Quark & server,
if (subscribed)
tmp_sub.push_back (group);
- else
+ else
tmp_unsub.push_back (group);
if (!numbers.empty())
@@ -189,8 +189,8 @@ DataImpl :: load_newsrc_files (const DataIO& data_io)
}
// remove duplicates
- s.erase (std::unique(s.begin(), s.end()), s.end());
- u.erase (std::unique(u.begin(), u.end()), u.end());
+ s.erase (std::unique(s.begin(), s.end()), s.end());
+ u.erase (std::unique(u.begin(), u.end()), u.end());
// unsub -= sub
AlphabeticalQuarkOrdering o;
@@ -215,7 +215,7 @@ DataImpl :: save_newsrc_files (DataIO& data_io) const
return;
// overly-complex optimization: both sit->second.groups and _subscribed
- // are both ordered by AlphabeticalQuarkOrdering.
+ // are both ordered by AlphabeticalQuarkOrdering.
// Where N==sit->second.groups.size() and M==_subscribed.size(),
// "bool subscribed = _subscribed.count (group)" is N*log(M),
// but a sorted set comparison is M+N comparisons.
@@ -290,11 +290,11 @@ DataImpl :: load_group_permissions (const DataIO& data_io)
}
std::sort (m.begin(), m.end());
- m.erase (std::unique(m.begin(), m.end()), m.end());
+ m.erase (std::unique(m.begin(), m.end()), m.end());
_moderated.get_container().swap (m);
std::sort (n.begin(), n.end());
- n.erase (std::unique(n.begin(), n.end()), n.end());
+ n.erase (std::unique(n.begin(), n.end()), n.end());
_nopost.get_container().swap (n);
delete in;
@@ -312,7 +312,7 @@ DataImpl :: save_group_permissions (DataIO& data_io) const
tmp_t tmp;
foreach_const (groups_t, _moderated, it) tmp[*it] = 'm';
foreach_const (groups_t, _nopost, it) tmp[*it] = 'n';
-
+
out << "# Permissions: y means posting ok; n means posting not okay; m means moderated.\n"
<< "# Since almost all groups allow posting, Pan assumes that as the default.\n"
<< "# Only moderated or no-posting groups are listed here.\n";
@@ -369,7 +369,7 @@ DataImpl :: load_group_xovers (const DataIO& data_io)
line.trim();
if (line.empty() || *line.str=='#')
continue;
-
+
if (line.pop_token(groupname) && line.pop_token(total) && line.pop_token(unread))
{
ReadGroup& g (_read_groups[groupname]);
@@ -485,7 +485,7 @@ DataImpl :: get_xover_high (const Quark & groupname,
high = rgs->_xover_high;
return high;
}
-
+
void
DataImpl :: set_xover_high (const Quark & group,
const Quark & server,
@@ -520,7 +520,7 @@ DataImpl :: add_groups (const Quark & server,
std::set_union (s->groups.begin(), s->groups.end(),
groups.begin(), groups.end(),
std::back_inserter (tmp), o);
- tmp.erase (std::unique(tmp.begin(), tmp.end()), tmp.end());
+ tmp.erase (std::unique(tmp.begin(), tmp.end()), tmp.end());
s->groups.get_container().swap (tmp);
// make a groups_t of groups we didn't already have,
@@ -534,7 +534,7 @@ DataImpl :: add_groups (const Quark & server,
std::set_union (groups.begin(), groups.end(),
_unsubscribed.begin(), _unsubscribed.end(),
std::back_inserter (tmp), o);
- tmp.erase (std::unique(tmp.begin(), tmp.end()), tmp.end());
+ tmp.erase (std::unique(tmp.begin(), tmp.end()), tmp.end());
_unsubscribed.get_container().swap (tmp);
}
@@ -565,7 +565,7 @@ DataImpl :: add_groups (const Quark & server,
tmp.clear ();
std::set_difference (_nopost.begin(), _nopost.end(), post.begin(), post.end(), inserter (tmp, tmp.begin()));
_nopost.swap (tmp);
- // _nopost += nopost
+ // _nopost += nopost
tmp.clear ();
std::set_union (_nopost.begin(), _nopost.end(), nopost.begin(), nopost.end(), inserter (tmp, tmp.begin()));
_nopost.swap (tmp);
@@ -666,11 +666,11 @@ DataImpl :: server_get_groups (const Quark& servername, quarks_t& addme) const
void
DataImpl :: get_subscribed_groups (std::vector<Quark>& setme) const
{
- setme.assign (_subscribed.begin(), _subscribed.end());
+ setme.assign (_subscribed.begin(), _subscribed.end());
}
void
DataImpl :: get_other_groups (std::vector<Quark>& setme) const
{
- setme.assign (_unsubscribed.begin(), _unsubscribed.end());
+ setme.assign (_unsubscribed.begin(), _unsubscribed.end());
}
diff --git a/pan/data/cert-store.cc b/pan/data/cert-store.cc
index ca20763..677efc8 100644
--- a/pan/data/cert-store.cc
+++ b/pan/data/cert-store.cc
@@ -64,7 +64,6 @@ namespace pan
const Quark server;
Data& data;
SaveCBStruct(CertStore& store, const Quark& s, Data& d) : cs(store), server(s), data(d) {}
- ~SaveCBStruct() { delete server; }
};
gboolean
@@ -137,20 +136,24 @@ namespace pan
if (gnutls_certificate_type_get (session) != GNUTLS_CRT_X509)
{
g_warning ("The certificate is not a X509 certificate!\n");
- goto _fail;
+ fail = true;
+ fatal = true;
}
if (gnutls_x509_crt_init (&cert) < 0)
{
g_warning ("Error in initialization\n");
- goto _fail;
+ fail = true;
+ goto _fatal;
}
+
cert_list = gnutls_certificate_get_peers (session, &cert_list_size);
if (cert_list == NULL)
{
g_warning ("No certificate found!\n");
- goto _fail;
+ fail = true;
+ goto _fatal;
}
/* TODO verify whole chain perhaps?
@@ -158,7 +161,8 @@ namespace pan
if (gnutls_x509_crt_import (cert, &cert_list[0], GNUTLS_X509_FMT_DER) < 0)
{
g_warning ("Error parsing certificate!\n");
- goto _fail;
+ fail = true;
+ goto _fatal;
}
if (!gnutls_x509_crt_check_hostname (cert, mydata->hostname_full.c_str()))
@@ -173,16 +177,15 @@ namespace pan
mydata->cs->add(cert, mydata->host);
else if (fail) goto _fail;
- gnutls_x509_crt_deinit(cert);
-
/* notify gnutls to continue handshake normally */
return 0;
- _fail:
-
- if (cert)
- mydata->cs->verify_failed (cert, mydata->host.c_str(), status);
+ _fatal:
+ gnutls_x509_crt_deinit(cert);
+ return GNUTLS_E_CERTIFICATE_ERROR;
+ _fail:
+ mydata->cs->verify_failed (cert, mydata->host.c_str(), status);
return GNUTLS_E_CERTIFICATE_ERROR;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]