[gnome-online-accounts/gnome-3-14] identity: Make verify_identity have one exit path
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/gnome-3-14] identity: Make verify_identity have one exit path
- Date: Mon, 10 Nov 2014 20:40:11 +0000 (UTC)
commit a0e6f016935e35eca6f5c2f2bc1fcc16c83a90b4
Author: Ray Strode <rstrode redhat com>
Date: Tue Oct 28 16:45:06 2014 -0400
identity: Make verify_identity have one exit path
This makes the control flow easier to follow and lays the way
for a follow up change.
https://bugzilla.gnome.org/show_bug.cgi?id=739593
src/goaidentity/goakerberosidentity.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/goaidentity/goakerberosidentity.c b/src/goaidentity/goakerberosidentity.c
index 4c3d1aa..67c74b4 100644
--- a/src/goaidentity/goakerberosidentity.c
+++ b/src/goaidentity/goakerberosidentity.c
@@ -569,16 +569,16 @@ static VerificationLevel
verify_identity (GoaKerberosIdentity *self,
GError **error)
{
- krb5_principal principal;
+ krb5_principal principal = NULL;
krb5_cc_cursor cursor;
krb5_creds credentials;
krb5_error_code error_code;
- VerificationLevel verification_level;
+ VerificationLevel verification_level = VERIFICATION_LEVEL_UNVERIFIED;
set_expiration_time (self, 0);
if (self->priv->credentials_cache == NULL)
- return VERIFICATION_LEVEL_UNVERIFIED;
+ goto out;
error_code = krb5_cc_get_principal (self->priv->kerberos_context,
self->priv->credentials_cache,
@@ -587,7 +587,7 @@ verify_identity (GoaKerberosIdentity *self,
if (error_code != 0)
{
if (error_code == KRB5_CC_END || error_code == KRB5_FCC_NOFILE)
- return VERIFICATION_LEVEL_UNVERIFIED;
+ goto out;
set_error_from_krb5_error_code (self,
error,
@@ -595,7 +595,8 @@ verify_identity (GoaKerberosIdentity *self,
error_code,
_("Could not find identity in "
"credential cache: %k"));
- return VERIFICATION_LEVEL_ERROR;
+ verification_level = VERIFICATION_LEVEL_ERROR;
+ goto out;
}
error_code = krb5_cc_start_seq_get (self->priv->kerberos_context,
@@ -669,7 +670,8 @@ verify_identity (GoaKerberosIdentity *self,
goto out;
}
out:
- krb5_free_principal (self->priv->kerberos_context, principal);
+ if (principal != NULL)
+ krb5_free_principal (self->priv->kerberos_context, principal);
return verification_level;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]