Add support for setting and getting kdc offset
authorLove Hörnquist Åstrand <lha@kth.se>
Sun, 22 Mar 2009 17:21:50 +0000 (17:21 +0000)
committerLove Hörnquist Åstrand <lha@kth.se>
Sun, 22 Mar 2009 17:21:50 +0000 (17:21 +0000)
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24910 ec53bebd-3082-4978-b11e-865c3cabbd6b

lib/krb5/acache.c

index 18b460256e7442471ca30340fef867751b7bc647..2dcf603cd04a44346f9832c35bdaf6be9ff11132 100644 (file)
@@ -491,12 +491,21 @@ acc_resolve(krb5_context context, krb5_ccache *id, const char *res)
 
     error = (*a->context->func->open_ccache)(a->context, res, &a->ccache);
     if (error == ccNoError) {
+       cc_time_t offset;
        error = get_cc_name(a);
        if (error != ccNoError) {
            acc_close(context, *id);
            *id = NULL;
            return translate_cc_error(context, error);
        }
+
+       error = (*a->ccache->func->get_kdc_time_offset)(a->ccache,
+                                                       cc_credentials_v5,
+                                                       &offset);
+       if (error == 0) 
+           context->kdc_sec_offset = offset;
+
+       error = 0;
     } else if (error == ccErrCCacheNotFound) {
        a->ccache = NULL;
        a->cache_name = NULL;
@@ -572,6 +581,11 @@ acc_initialize(krb5_context context,
                                                  name);
     }
 
+    if (error == 0 && context->kdc_sec_offset)
+       error = (*a->ccache->func->set_kdc_time_offset)(a->ccache,
+                                                       cc_credentials_v5,
+                                                       context->kdc_sec_offset);
+
     return translate_cc_error(context, error);
 }