(_kadm5_c_get_cred_cache): handle ccache case better in case no client

name was passed in. Coverity, NetBSD CID#919


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17029 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-04-10 07:55:22 +00:00
parent 86ee0aa773
commit 5d676c4509

View File

@@ -314,8 +314,13 @@ _kadm5_c_get_cred_cache(krb5_context context,
id = NULL;
}
}
} else if(ccache != NULL)
} else if(ccache != NULL) {
id = ccache;
ret = krb5_cc_get_principal(context, id, &client);
if(ret)
return ret;
}
if(id && (default_client == NULL ||
krb5_principal_compare(context, client, default_client))) {
@@ -332,7 +337,7 @@ _kadm5_c_get_cred_cache(krb5_context context,
return -1;
}
/* get creds via AS request */
if(id)
if(id && (id != ccache))
krb5_cc_close(context, id);
if (client != default_client)
krb5_free_principal(context, default_client);