[gnome-online-accounts/gnome-3-12] identity: Make verify_identity have one exit path
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/gnome-3-12] identity: Make verify_identity have one exit path
- Date: Wed, 12 Nov 2014 14:33:04 +0000 (UTC)
commit 5e947201d78ec8b4334ff4253ef9082cf5266435
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 a5cd1b0..34d0400 100644
--- a/src/goaidentity/goakerberosidentity.c
+++ b/src/goaidentity/goakerberosidentity.c
@@ -571,16 +571,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,
@@ -589,7 +589,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,
@@ -597,7 +597,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,
@@ -671,7 +672,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]