[glib-networking/tls-database] gnutls: Better precondition checks in GTlsDatabase methods.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/tls-database] gnutls: Better precondition checks in GTlsDatabase methods.
- Date: Tue, 28 Dec 2010 16:53:38 +0000 (UTC)
commit 447b8c06e3efc86f66d963db6b4023e4826ded80
Author: Stef Walter <stefw collabora co uk>
Date: Tue Dec 28 10:53:11 2010 -0600
gnutls: Better precondition checks in GTlsDatabase methods.
tls/gnutls/gtlsdatabase-gnutls.c | 13 ++++++-------
tls/gnutls/gtlsfiledatabase-gnutls.c | 6 ------
tls/gnutls/gtlspkcs11database-gnutls.c | 6 ------
3 files changed, 6 insertions(+), 19 deletions(-)
---
diff --git a/tls/gnutls/gtlsdatabase-gnutls.c b/tls/gnutls/gtlsdatabase-gnutls.c
index 6c3a642..1483338 100644
--- a/tls/gnutls/gtlsdatabase-gnutls.c
+++ b/tls/gnutls/gtlsdatabase-gnutls.c
@@ -215,14 +215,8 @@ g_tls_database_gnutls_verify_chain (GTlsDatabase *database,
guint certs_length, anchors_length;
gint status, gerr;
- g_return_val_if_fail (G_IS_TLS_DATABASE_GNUTLS (database),
- G_TLS_CERTIFICATE_GENERIC_ERROR);
g_return_val_if_fail (G_IS_TLS_CERTIFICATE_GNUTLS (chain),
G_TLS_CERTIFICATE_GENERIC_ERROR);
- g_return_val_if_fail (purpose, G_TLS_CERTIFICATE_GENERIC_ERROR);
- g_return_val_if_fail (!identity || G_IS_SOCKET_CONNECTABLE (identity),
- G_TLS_CERTIFICATE_GENERIC_ERROR);
- g_return_val_if_fail (!error || !*error, G_TLS_CERTIFICATE_GENERIC_ERROR);
self = G_TLS_DATABASE_GNUTLS (database);
anchor = NULL;
@@ -299,7 +293,12 @@ g_tls_database_gnutls_lookup_assertion (GTlsDatabaseGnutls *self,
GCancellable *cancellable,
GError **error)
{
- g_return_val_if_fail (G_IS_TLS_DATABASE (self), FALSE);
+ g_return_val_if_fail (G_IS_TLS_DATABASE_GNUTLS (self), FALSE);
+ g_return_val_if_fail (G_IS_TLS_CERTIFICATE_GNUTLS (certificate), FALSE);
+ g_return_val_if_fail (purpose, FALSE);
+ g_return_val_if_fail (!identity || G_IS_SOCKET_CONNECTABLE (identity), FALSE);
+ g_return_val_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable), FALSE);
+ g_return_val_if_fail (!error || !*error, FALSE);
g_return_val_if_fail (G_TLS_DATABASE_GNUTLS_GET_CLASS (self)->lookup_assertion, FALSE);
return G_TLS_DATABASE_GNUTLS_GET_CLASS (self)->lookup_assertion (self,
certificate,
diff --git a/tls/gnutls/gtlsfiledatabase-gnutls.c b/tls/gnutls/gtlsfiledatabase-gnutls.c
index 34cfe31..b2250a8 100644
--- a/tls/gnutls/gtlsfiledatabase-gnutls.c
+++ b/tls/gnutls/gtlsfiledatabase-gnutls.c
@@ -224,11 +224,6 @@ g_tls_file_database_gnutls_lookup_assertion (GTlsDatabaseGnutls *databa
GByteArray *der = NULL;
gboolean contains;
- g_return_val_if_fail (G_IS_TLS_CERTIFICATE_GNUTLS (certificate), FALSE);
- g_return_val_if_fail (purpose, FALSE);
- g_return_val_if_fail (!identity || G_IS_SOCKET_CONNECTABLE (identity), FALSE);
- g_return_val_if_fail (!error || !*error, FALSE);
-
/* We only have anchored certificate assertions here */
if (assertion != G_TLS_DATABASE_GNUTLS_ANCHORED_CERTIFICATE)
return FALSE;
@@ -265,7 +260,6 @@ g_tls_file_database_gnutls_lookup_issuer (GTlsDatabase *database,
gnutls_x509_crt_t cert;
int gerr;
- g_return_val_if_fail (!error || !*error, NULL);
g_return_val_if_fail (G_IS_TLS_CERTIFICATE_GNUTLS (certificate), NULL);
/* Dig out the issuer of this certificate */
diff --git a/tls/gnutls/gtlspkcs11database-gnutls.c b/tls/gnutls/gtlspkcs11database-gnutls.c
index 72b71ad..3c8061b 100644
--- a/tls/gnutls/gtlspkcs11database-gnutls.c
+++ b/tls/gnutls/gtlspkcs11database-gnutls.c
@@ -364,11 +364,6 @@ g_tls_pkcs11_database_gnutls_lookup_assertion (GTlsDatabaseGnutls *data
GPkcs11Array *match;
const gchar *peer;
- g_return_val_if_fail (G_IS_TLS_CERTIFICATE_GNUTLS (certificate), FALSE);
- g_return_val_if_fail (purpose, FALSE);
- g_return_val_if_fail (!identity || G_IS_SOCKET_CONNECTABLE (identity), FALSE);
- g_return_val_if_fail (!error || !*error, FALSE);
-
ready = FALSE;
found = FALSE;
match = g_pkcs11_array_new ();
@@ -422,7 +417,6 @@ g_tls_pkcs11_database_gnutls_lookup_issuer (GTlsDatabase *database,
gnutls_datum_t dn;
int gerr;
- g_return_val_if_fail (!error || !*error, NULL);
g_return_val_if_fail (G_IS_TLS_CERTIFICATE_GNUTLS (certificate), NULL);
/* Dig out the issuer of this certificate */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]