diff options
author | Martin Kosek <mkosek@redhat.com> | 2011-11-08 17:59:45 +0100 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2011-11-23 00:30:41 -0500 |
commit | 216505d2a066fd0afb8228b7f05089a7f7d5ab19 (patch) | |
tree | 4d94a74b4b32182534019b7d14b410d41181f11a /ipa-client/ipa-getkeytab.c | |
parent | d24dda2fe3e188b4904deb184cc098d979e7f611 (diff) | |
download | freeipa-216505d2a066fd0afb8228b7f05089a7f7d5ab19.tar.gz freeipa-216505d2a066fd0afb8228b7f05089a7f7d5ab19.tar.xz freeipa-216505d2a066fd0afb8228b7f05089a7f7d5ab19.zip |
Fix coverity issues in client CLI tools
This patch fixes 2 coverity issues:
* ipa-client/config.c: CID 11090: Resource leak
* ipa-client/ipa-getkeytab.c: CID 11018: Unchecked return value
https://fedorahosted.org/freeipa/ticket/2035
Diffstat (limited to 'ipa-client/ipa-getkeytab.c')
-rw-r--r-- | ipa-client/ipa-getkeytab.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ipa-client/ipa-getkeytab.c b/ipa-client/ipa-getkeytab.c index 5a521d041..28ef5b5a5 100644 --- a/ipa-client/ipa-getkeytab.c +++ b/ipa-client/ipa-getkeytab.c @@ -82,14 +82,24 @@ static int ldap_sasl_interact(LDAP *ld, unsigned flags, void *priv_data, void *s krberr = krb5_init_context(&krbctx); if (krberr) { - fprintf(stderr, _("Kerberos context initialization failed\n")); + fprintf(stderr, _("Kerberos context initialization failed: %s (%d)\n"), + error_message(krberr), krberr); in->result = NULL; in->len = 0; ret = LDAP_LOCAL_ERROR; break; } - krb5_unparse_name(krbctx, princ, &outname); + krberr = krb5_unparse_name(krbctx, princ, &outname); + + if (krberr) { + fprintf(stderr, _("Unable to parse principal: %s (%d)\n"), + error_message(krberr), krberr); + in->result = NULL; + in->len = 0; + ret = LDAP_LOCAL_ERROR; + break; + } in->result = outname; in->len = strlen(outname); |