summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-06-26 10:19:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:36 -0500
commit75f6a458b5d62f2d07e5f5dc121c72b6f26d0f65 (patch)
tree0121f0e5763d4b9ce7feeb934e0d83a50b849746 /source3
parent2afb72337ad1e9d2d4349043f346a4387c4065c5 (diff)
downloadsamba-75f6a458b5d62f2d07e5f5dc121c72b6f26d0f65.tar.gz
samba-75f6a458b5d62f2d07e5f5dc121c72b6f26d0f65.tar.bz2
samba-75f6a458b5d62f2d07e5f5dc121c72b6f26d0f65.zip
r23609: Removing more redundant codepaths out of smb_krb5_renew_ticket().
Thanks Volker for the pointer hint :) Guenther (This used to be commit eb1ec508ace3a5eeb53cf47be44047bd9228cd19)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/clikrb5.c64
1 files changed, 26 insertions, 38 deletions
diff --git a/source3/libsmb/clikrb5.c b/source3/libsmb/clikrb5.c
index f452766e32..1e322974cc 100644
--- a/source3/libsmb/clikrb5.c
+++ b/source3/libsmb/clikrb5.c
@@ -1140,6 +1140,10 @@ out:
krb5_context context = NULL;
krb5_ccache ccache = NULL;
krb5_principal client = NULL;
+ krb5_creds creds, creds_in, *creds_out = NULL;
+
+ ZERO_STRUCT(creds);
+ ZERO_STRUCT(creds_in);
initialize_krb5_error_table();
ret = krb5_init_context(&context);
@@ -1178,38 +1182,16 @@ out:
#ifdef HAVE_KRB5_GET_RENEWED_CREDS /* MIT */
{
- 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)));
goto done;
}
-
- /* hm, doesn't that create a new one if the old one wasn't there? - Guenther */
- ret = krb5_cc_initialize(context, ccache, client);
- if (ret) {
- goto done;
- }
-
- ret = krb5_cc_store_cred(context, ccache, &creds);
-
- if (expire_time) {
- *expire_time = (time_t) creds.times.endtime;
- }
-
- krb5_free_cred_contents(context, &creds);
}
#elif defined(HAVE_KRB5_GET_KDC_CRED) /* Heimdal */
{
krb5_kdc_flags flags;
- krb5_creds creds_in;
- krb5_realm *client_realm;
- krb5_creds *creds;
-
- ZERO_STRUCT(creds_in);
+ krb5_realm *client_realm = NULL;
ret = krb5_copy_principal(context, client, &creds_in.client);
if (ret) {
@@ -1237,33 +1219,39 @@ out:
flags.i = 0;
flags.b.renewable = flags.b.renew = True;
- ret = krb5_get_kdc_cred(context, ccache, flags, NULL, NULL, &creds_in, &creds);
+ ret = krb5_get_kdc_cred(context, ccache, flags, NULL, NULL, &creds_in, &creds_out);
if (ret) {
DEBUG(10,("smb_krb5_renew_ticket: krb5_get_kdc_cred failed: %s\n", error_message(ret)));
goto done;
}
-
- /* hm, doesn't that create a new one if the old one wasn't there? - Guenther */
- ret = krb5_cc_initialize(context, ccache, creds_in.client);
- if (ret) {
- goto done;
- }
-
- ret = krb5_cc_store_cred(context, ccache, creds);
- if (expire_time) {
- *expire_time = (time_t) creds->times.endtime;
- }
-
- krb5_free_cred_contents(context, &creds_in);
- krb5_free_creds(context, creds);
+ creds = *creds_out;
}
#else
#error NO_SUITABLE_KRB5_TICKET_RENEW_FUNCTION_AVAILABLE
#endif
+ /* hm, doesn't that create a new one if the old one wasn't there? - Guenther */
+ ret = krb5_cc_initialize(context, ccache, client);
+ if (ret) {
+ goto done;
+ }
+
+ ret = krb5_cc_store_cred(context, ccache, &creds);
+
+ if (expire_time) {
+ *expire_time = (time_t) creds.times.endtime;
+ }
done:
+ krb5_free_cred_contents(context, &creds_in);
+
+ if (creds_out) {
+ krb5_free_creds(context, creds_out);
+ } else {
+ krb5_free_cred_contents(context, &creds);
+ }
+
if (client) {
krb5_free_principal(context, client);
}