summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-06-22 14:54:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:33 -0500
commit32a3c30627fad859bc7fa218cc40e7b056bac30d (patch)
tree13d5e40e107f645b39f4b90c7e20787dee38c989 /source3/libsmb
parent679727b8df0b64cfe2e04111a41a3e512c1428c5 (diff)
downloadsamba-32a3c30627fad859bc7fa218cc40e7b056bac30d.tar.gz
samba-32a3c30627fad859bc7fa218cc40e7b056bac30d.tar.bz2
samba-32a3c30627fad859bc7fa218cc40e7b056bac30d.zip
r23588: Some more cleanups and error checks in the krb5 renew function.
Guenther (This used to be commit 277e07c8553e2ed20bc95493cdc996be43feb6bd)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clikrb5.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source3/libsmb/clikrb5.c b/source3/libsmb/clikrb5.c
index be6fb1bda8..f452766e32 100644
--- a/source3/libsmb/clikrb5.c
+++ b/source3/libsmb/clikrb5.c
@@ -1151,6 +1151,11 @@ out:
ccache_string = krb5_cc_default_name(context);
}
+ if (!ccache_string) {
+ ret = EINVAL;
+ goto done;
+ }
+
DEBUG(10,("smb_krb5_renew_ticket: using %s as ccache\n", ccache_string));
/* FIXME: we should not fall back to defaults */
@@ -1175,6 +1180,8 @@ out:
{
krb5_creds creds;
+ ZERO_STRUCT(creds);
+
ret = krb5_get_renewed_creds(context, &creds, client, ccache, CONST_DISCARD(char *, service_string));
if (ret) {
DEBUG(10,("smb_krb5_renew_ticket: krb5_get_kdc_cred failed: %s\n", error_message(ret)));
@@ -1202,7 +1209,7 @@ out:
krb5_realm *client_realm;
krb5_creds *creds;
- memset(&creds_in, 0, sizeof(creds_in));
+ ZERO_STRUCT(creds_in);
ret = krb5_copy_principal(context, client, &creds_in.client);
if (ret) {
@@ -1252,7 +1259,7 @@ out:
krb5_free_creds(context, creds);
}
#else
-#error NO_SUITABKE_KRB5_TICKET_RENEW_FUNCTION_AVAILABLE
+#error NO_SUITABLE_KRB5_TICKET_RENEW_FUNCTION_AVAILABLE
#endif
@@ -1260,15 +1267,14 @@ done:
if (client) {
krb5_free_principal(context, client);
}
- if (context) {
- krb5_free_context(context);
- }
if (ccache) {
krb5_cc_close(context, ccache);
}
+ if (context) {
+ krb5_free_context(context);
+ }
return ret;
-
}
krb5_error_code smb_krb5_free_addresses(krb5_context context, smb_krb5_addresses *addr)