summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-10-15 13:44:44 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-10-17 13:17:26 +0200
commit4a25e68cd863318f18b2ca78cf6efa7a1921d33a (patch)
tree8a97a7b25fb742844685d10d145dd8fe866a7e34 /src
parent13734b9723e221cbb535306b89fc3e77fc2010de (diff)
downloadsssd-4a25e68cd863318f18b2ca78cf6efa7a1921d33a.tar.gz
sssd-4a25e68cd863318f18b2ca78cf6efa7a1921d33a.tar.bz2
sssd-4a25e68cd863318f18b2ca78cf6efa7a1921d33a.zip
heimdal: Add wrapper for krb5_get_time_offsets
Using krb5_get_kdc_sec_offset from heimdal.
Diffstat (limited to 'src')
-rw-r--r--src/external/krb5.m41
-rw-r--r--src/providers/ldap/ldap_child.c7
-rw-r--r--src/util/sss_krb5.c22
-rw-r--r--src/util/sss_krb5.h4
4 files changed, 28 insertions, 6 deletions
diff --git a/src/external/krb5.m4 b/src/external/krb5.m4
index ff4924f3..7cad5cb9 100644
--- a/src/external/krb5.m4
+++ b/src/external/krb5.m4
@@ -60,6 +60,7 @@ AC_CHECK_FUNCS([krb5_get_init_creds_opt_alloc krb5_get_error_message \
krb5_kt_free_entry \
krb5_princ_realm \
krb5_get_time_offsets \
+ krb5_get_kdc_sec_offset \
krb5_principal_get_realm \
krb5_cc_cache_match \
krb5_timestamp_to_sfstring \
diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c
index 19c838da..465ea676 100644
--- a/src/providers/ldap/ldap_child.c
+++ b/src/providers/ldap/ldap_child.c
@@ -343,8 +343,7 @@ static krb5_error_code ldap_child_get_tgt_sync(TALLOC_CTX *memctx,
}
DEBUG(SSSDBG_TRACE_INTERNAL, ("credentials stored\n"));
-#ifdef HAVE_KRB5_GET_TIME_OFFSETS
- krberr = krb5_get_time_offsets(context, &kdc_time_offset,
+ krberr = sss_krb5_get_time_offsets(context, &kdc_time_offset,
&kdc_time_offset_usec);
if (krberr) {
DEBUG(SSSDBG_OP_FAILURE, ("Failed to get KDC time offset: %s\n",
@@ -356,10 +355,6 @@ static krb5_error_code ldap_child_get_tgt_sync(TALLOC_CTX *memctx,
}
}
DEBUG(SSSDBG_TRACE_INTERNAL, ("Got KDC time offset\n"));
-#else
- /* If we don't have this function, just assume no offset */
- kdc_time_offset = 0;
-#endif
krberr = 0;
*ccname_out = ccname;
diff --git a/src/util/sss_krb5.c b/src/util/sss_krb5.c
index c9b16107..6382c1aa 100644
--- a/src/util/sss_krb5.c
+++ b/src/util/sss_krb5.c
@@ -1098,3 +1098,25 @@ sss_krb5_unparse_name_ext(krb5_context ctx,
return kerr;
}
+
+krb5_error_code KRB5_CALLCONV
+sss_krb5_get_time_offsets(krb5_context ctx,
+ krb5_timestamp *seconds,
+ int32_t *microseconds)
+{
+#if defined(HAVE_KRB5_GET_TIME_OFFSETS)
+ return krb5_get_time_offsets(ctx, seconds, microseconds);
+#elif defined(HAVE_KRB5_GET_KDC_SEC_OFFSET)
+ int32_t _seconds;
+ krb5_error_code ret;
+
+ ret = krb5_get_kdc_sec_offset(ctx, &_seconds, microseconds);
+ *seconds = _seconds;
+ return ret;
+#else
+ (void) ctx;
+ *seconds = 0;
+ *microseconds = 0;
+ return 0;
+#endif
+}
diff --git a/src/util/sss_krb5.h b/src/util/sss_krb5.h
index c8f2d4d7..2ddcca97 100644
--- a/src/util/sss_krb5.h
+++ b/src/util/sss_krb5.h
@@ -192,4 +192,8 @@ sss_krb5_unparse_name_ext(krb5_context ctx,
krb5_const_principal principal,
char **name,
unsigned int *len);
+krb5_error_code KRB5_CALLCONV
+sss_krb5_get_time_offsets(krb5_context ctx,
+ krb5_timestamp *seconds,
+ int32_t *microseconds);
#endif /* __SSS_KRB5_H__ */