summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/krb5/get_cred.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/heimdal/lib/krb5/get_cred.c')
-rw-r--r--source4/heimdal/lib/krb5/get_cred.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/source4/heimdal/lib/krb5/get_cred.c b/source4/heimdal/lib/krb5/get_cred.c
index e921cf0593..3d76391fa8 100644
--- a/source4/heimdal/lib/krb5/get_cred.c
+++ b/source4/heimdal/lib/krb5/get_cred.c
@@ -3,6 +3,8 @@
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
+ * Portions Copyright (c) 2009 Apple Inc. All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -31,7 +33,7 @@
* SUCH DAMAGE.
*/
-#include <krb5_locl.h>
+#include "krb5_locl.h"
#include <assert.h>
/*
@@ -606,7 +608,7 @@ get_cred_kdc_address(krb5_context context,
return ret;
}
-krb5_error_code KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_kdc_cred(krb5_context context,
krb5_ccache id,
krb5_kdc_flags flags,
@@ -1037,6 +1039,13 @@ _krb5_get_cred_kdc_any(krb5_context context,
krb5_creds ***ret_tgts)
{
krb5_error_code ret;
+ krb5_deltat offset;
+
+ ret = krb5_cc_get_kdc_offset(context, ccache, &offset);
+ if (ret) {
+ context->kdc_sec_offset = offset;
+ context->kdc_usec_offset = 0;
+ }
ret = get_cred_kdc_referral(context,
flags,
@@ -1059,7 +1068,7 @@ _krb5_get_cred_kdc_any(krb5_context context,
}
-krb5_error_code KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_credentials_with_flags(krb5_context context,
krb5_flags options,
krb5_kdc_flags flags,
@@ -1145,7 +1154,7 @@ krb5_get_credentials_with_flags(krb5_context context,
return ret;
}
-krb5_error_code KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_credentials(krb5_context context,
krb5_flags options,
krb5_ccache ccache,
@@ -1166,7 +1175,7 @@ struct krb5_get_creds_opt_data {
};
-krb5_error_code KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_creds_opt_alloc(krb5_context context, krb5_get_creds_opt *opt)
{
*opt = calloc(1, sizeof(**opt));
@@ -1178,7 +1187,7 @@ krb5_get_creds_opt_alloc(krb5_context context, krb5_get_creds_opt *opt)
return 0;
}
-void KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_get_creds_opt_free(krb5_context context, krb5_get_creds_opt opt)
{
if (opt->self)
@@ -1191,7 +1200,7 @@ krb5_get_creds_opt_free(krb5_context context, krb5_get_creds_opt opt)
free(opt);
}
-void KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_get_creds_opt_set_options(krb5_context context,
krb5_get_creds_opt opt,
krb5_flags options)
@@ -1199,7 +1208,7 @@ krb5_get_creds_opt_set_options(krb5_context context,
opt->options = options;
}
-void KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_get_creds_opt_add_options(krb5_context context,
krb5_get_creds_opt opt,
krb5_flags options)
@@ -1207,7 +1216,7 @@ krb5_get_creds_opt_add_options(krb5_context context,
opt->options |= options;
}
-void KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
krb5_get_creds_opt_set_enctype(krb5_context context,
krb5_get_creds_opt opt,
krb5_enctype enctype)
@@ -1215,7 +1224,7 @@ krb5_get_creds_opt_set_enctype(krb5_context context,
opt->enctype = enctype;
}
-krb5_error_code KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_creds_opt_set_impersonate(krb5_context context,
krb5_get_creds_opt opt,
krb5_const_principal self)
@@ -1225,7 +1234,7 @@ krb5_get_creds_opt_set_impersonate(krb5_context context,
return krb5_copy_principal(context, self, &opt->self);
}
-krb5_error_code KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_creds_opt_set_ticket(krb5_context context,
krb5_get_creds_opt opt,
const Ticket *ticket)
@@ -1258,7 +1267,7 @@ krb5_get_creds_opt_set_ticket(krb5_context context,
-krb5_error_code KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_creds(krb5_context context,
krb5_get_creds_opt opt,
krb5_ccache ccache,
@@ -1325,14 +1334,14 @@ krb5_get_creds(krb5_context context,
if(options & KRB5_GC_EXPIRED_OK) {
*out_creds = res_creds;
krb5_free_principal(context, in_creds.client);
- return 0;
+ goto out;
}
krb5_timeofday(context, &timeret);
if(res_creds->times.endtime > timeret) {
*out_creds = res_creds;
krb5_free_principal(context, in_creds.client);
- return 0;
+ goto out;
}
if(options & KRB5_GC_CACHED)
krb5_cc_remove_cred(context, ccache, 0, res_creds);
@@ -1340,12 +1349,13 @@ krb5_get_creds(krb5_context context,
} else if(ret != KRB5_CC_END) {
free(res_creds);
krb5_free_principal(context, in_creds.client);
- return ret;
+ goto out;
}
free(res_creds);
if(options & KRB5_GC_CACHED) {
krb5_free_principal(context, in_creds.client);
- return not_found(context, in_creds.server, KRB5_CC_NOTFOUND);
+ ret = not_found(context, in_creds.server, KRB5_CC_NOTFOUND);
+ goto out;
}
if(options & KRB5_GC_USER_USER) {
flags.b.enc_tkt_in_skey = 1;
@@ -1374,6 +1384,10 @@ krb5_get_creds(krb5_context context,
free(tgts);
if(ret == 0 && (options & KRB5_GC_NO_STORE) == 0)
krb5_cc_store_cred(context, ccache, *out_creds);
+
+ out:
+ _krb5_debug(context, 5, "krb5_get_creds: ret = %d", ret);
+
return ret;
}
@@ -1381,7 +1395,7 @@ krb5_get_creds(krb5_context context,
*
*/
-krb5_error_code KRB5_LIB_FUNCTION
+KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_get_renewed_creds(krb5_context context,
krb5_creds *creds,
krb5_const_principal client,