aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStef Walter <stefw@collabora.co.uk>2011-03-18 21:48:55 +0800
committerStef Walter <stefw@collabora.co.uk>2011-03-18 21:53:11 +0800
commitf1975e66ba22bfcfeeb2b1583143693a454aad89 (patch)
tree9c20d46aac44c4e058661aab9d27c3a7bebe60a3
parent3b10103f06517cd7bfbb1576daadaf4855b800a2 (diff)
downloadgsoc2013-empathy-f1975e66ba22bfcfeeb2b1583143693a454aad89.tar
gsoc2013-empathy-f1975e66ba22bfcfeeb2b1583143693a454aad89.tar.gz
gsoc2013-empathy-f1975e66ba22bfcfeeb2b1583143693a454aad89.tar.bz2
gsoc2013-empathy-f1975e66ba22bfcfeeb2b1583143693a454aad89.tar.lz
gsoc2013-empathy-f1975e66ba22bfcfeeb2b1583143693a454aad89.tar.xz
gsoc2013-empathy-f1975e66ba22bfcfeeb2b1583143693a454aad89.tar.zst
gsoc2013-empathy-f1975e66ba22bfcfeeb2b1583143693a454aad89.zip
Style changes from review for ReferenceIdentities code
-rw-r--r--libempathy/empathy-server-tls-handler.c14
-rw-r--r--libempathy/empathy-tls-verifier.c15
-rw-r--r--src/empathy-auth-client.c2
3 files changed, 19 insertions, 12 deletions
diff --git a/libempathy/empathy-server-tls-handler.c b/libempathy/empathy-server-tls-handler.c
index 540bb35fa..95c0b0a9a 100644
--- a/libempathy/empathy-server-tls-handler.c
+++ b/libempathy/empathy-server-tls-handler.c
@@ -105,6 +105,10 @@ tls_handler_init_async (GAsyncInitable *initable,
const gchar *bus_name;
TpDBusDaemon *dbus;
GError *error = NULL;
+ /*
+ * Used when channel doesn't implement ReferenceIdentities. A GStrv
+ * with [0] the hostname, and [1] a NULL terminator.
+ */
gchar *default_identities[2];
EmpathyServerTLSHandler *self = EMPATHY_SERVER_TLS_HANDLER (initable);
EmpathyServerTLSHandlerPriv *priv = GET_PRIV (self);
@@ -128,22 +132,22 @@ tls_handler_init_async (GAsyncInitable *initable,
* If the channel doesn't implement the ReferenceIdentities parameter
* then fallback to the hostname.
*/
- if (!identities)
+ if (identities == NULL)
{
- default_identities[0] = (gchar*)hostname;
+ default_identities[0] = (gchar *) hostname;
default_identities[1] = NULL;
- identities = (const gchar**)default_identities;
+ identities = (const gchar **) default_identities;
}
else
{
#ifdef ENABLE_DEBUG
- gchar *output = g_strjoinv (", ", (gchar**)identities);
+ gchar *output = g_strjoinv (", ", (gchar **) identities);
DEBUG ("Received reference identities: %s", output);
g_free (output);
#endif /* ENABLE_DEBUG */
}
- priv->reference_identities = g_strdupv ((gchar**)identities);
+ priv->reference_identities = g_strdupv ((gchar **) identities);
cert_object_path = tp_asv_get_object_path (properties,
EMP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION ".ServerCertificate");
diff --git a/libempathy/empathy-tls-verifier.c b/libempathy/empathy-tls-verifier.c
index e0fa130bf..47a54333c 100644
--- a/libempathy/empathy-tls-verifier.c
+++ b/libempathy/empathy-tls-verifier.c
@@ -257,7 +257,7 @@ perform_verification (EmpathyTLSVerifier *self,
guint n_list, n_anchors;
guint verify_output;
gint res;
- gchar **i;
+ gint i;
gboolean matched;
EmpathyTLSVerifierPriv *priv = GET_PRIV (self);
@@ -300,13 +300,16 @@ perform_verification (EmpathyTLSVerifier *self,
}
/* now check if the certificate matches one of the reference identities. */
- for (i = priv->reference_identities, matched = FALSE; i && *i; ++i)
+ if (priv->reference_identities != NULL)
{
- const gchar *identity = *i;
- if (gnutls_x509_crt_check_hostname (list[0], identity) == 1)
+ for (i = 0, matched = FALSE; priv->reference_identities[i] != NULL; ++i)
{
- matched = TRUE;
- break;
+ if (gnutls_x509_crt_check_hostname (list[0],
+ priv->reference_identities[i]) == 1)
+ {
+ matched = TRUE;
+ break;
+ }
}
}
diff --git a/src/empathy-auth-client.c b/src/empathy-auth-client.c
index 56c977072..68c4543a8 100644
--- a/src/empathy-auth-client.c
+++ b/src/empathy-auth-client.c
@@ -209,7 +209,7 @@ auth_factory_new_tls_handler_cb (EmpathyAuthFactory *factory,
NULL);
verifier = empathy_tls_verifier_new (certificate, hostname,
- (const gchar**)reference_identities);
+ (const gchar **) reference_identities);
empathy_tls_verifier_verify_async (verifier,
verifier_verify_cb, NULL);