waf: check for krb5_create_checksum and krb5_creds.flags for some Heimdal versions
authorAlexander Bokovoy <ab@samba.org>
Thu, 31 May 2012 09:44:50 +0000 (12:44 +0300)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 1 Jun 2012 09:23:21 +0000 (11:23 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Fri Jun  1 11:23:21 CEST 2012 on sn-devel-104

lib/krb5_wrap/krb5_samba.c
source3/configure.in
source4/heimdal_build/wscript_configure
wscript_configure_system_mitkrb5

index 572d39ebf5ab7cfc0afa469510ad3ccee1cc6675..dc90f19075f5e6ba51effed59b67167ceeba158b 100644 (file)
@@ -2162,7 +2162,11 @@ krb5_error_code smb_krb5_cc_get_lifetime(krb5_context context,
        }
 
        while ((kerr = krb5_cc_next_cred(context, id, &cursor, &cred)) == 0) {
+#ifndef HAVE_FLAGS_IN_KRB5_CREDS
                if (cred.ticket_flags & TKT_FLG_INITIAL) {
+#else
+               if (cred.flags.b.initial) {
+#endif
                        if (now < cred.times.endtime) {
                                *t = (time_t) (cred.times.endtime - now);
                        }
index ea89fa2fe73657f1521fcda446ecd17a00957edd..06b51dba6e389d6ccdf6e03138110a141fccdbe3 100644 (file)
@@ -3596,6 +3596,7 @@ if test x"$with_ads_support" != x"no"; then
   AC_CHECK_FUNC_EXT(krb5_cc_get_lifetime, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_cc_retrieve_cred, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_free_checksum_contents, $KRB5_LIBS)
+  AC_CHECK_FUNC_EXT(krb5_create_checksum, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(krb5_c_make_checksum, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(gss_krb5_import_cred, $KRB5_LIBS)
   AC_CHECK_FUNC_EXT(gss_get_name_attribute, $KRB5_LIBS)
@@ -4006,6 +4007,17 @@ if test x"$with_ads_support" != x"no"; then
 
   AC_HAVE_DECL(KRB5_PDU_NONE,[#include <krb5.h>])
 
+  AC_CACHE_CHECK([for flags in krb5_creds],
+                samba_cv_HAVE_FLAGS_IN_KRB5_CREDS,[
+    AC_TRY_COMPILE([#include <krb5.h>],
+      [krb5_creds creds; creds.flags.b.initial = 0;],
+      samba_cv_HAVE_FLAGS_IN_KRB5_CREDS=yes,
+      samba_cv_HAVE_FLAGS_IN_KRB5_CREDS=no)])
+
+  if test x"$samba_cv_HAVE_FLAGS_IN_KRB5_CREDS" = x"yes"; then
+    AC_DEFINE(HAVE_FLAGS_IN_KRB5_CREDS,1,
+               [Whether the krb5_creds struct has a flags property])
+  fi
   #
   #
   # Now the decisions whether we can support krb5
index e8dab6800a9aab61405c470fd50e63aa8c210daa..ea854f2e88e78473c5eb6a7c65deb048b8966dc5 100755 (executable)
@@ -156,6 +156,7 @@ conf.define('HAVE_ENCTYPE_AES128_CTS_HMAC_SHA1_96', 1)
 conf.define('HAVE_ENCTYPE_AES256_CTS_HMAC_SHA1_96', 1)
 conf.define('HAVE_KRB5_PRINCIPAL_GET_NUM_COMP', 1)
 conf.define('HAVE_GSSAPI_GSSAPI_SPNEGO_H', 1)
+conf.define('HAVE_FLAGS_IN_KRB5_CREDS', 1)
 
 heimdal_includedirs = []
 heimdal_libdirs = []
index 0f7e404c1a4331161fadc234db78d0c7ed50cf04..1ad6d207db6d70cc2aa0293d5b51800bdd3b5eb0 100644 (file)
@@ -60,8 +60,9 @@ if conf.CHECK_FUNCS_IN('gss_display_status', 'gssapi gssapi_krb5'):
     have_gssapi=True
 
 if not have_gssapi:
-    Logs.error("ERROR: WAF build with MIT Krb5 requires working GSSAPI implementation")
-    sys.exit(1)
+    if conf.env.KRB5_CONFIG and conf.env.KRB5_CONFIG != 'heimdal':
+        Logs.error("ERROR: WAF build with MIT Krb5 requires working GSSAPI implementation")
+        sys.exit(1)
 
 conf.CHECK_FUNCS_IN('''
        gss_wrap_iov
@@ -96,7 +97,7 @@ conf.CHECK_FUNCS('''
        krb5_get_init_creds_keyblock krb5_get_init_creds_keytab
        krb5_make_principal krb5_build_principal_alloc_va
        krb5_cc_get_lifetime krb5_cc_retrieve_cred
-       krb5_free_checksum_contents krb5_c_make_checksum''',
+       krb5_free_checksum_contents krb5_c_make_checksum krb5_create_checksum''',
      lib='krb5 k5crypto')
 conf.CHECK_DECLS('''krb5_get_credentials_for_user
                     krb5_auth_con_set_req_cksumtype''',
@@ -240,3 +241,11 @@ conf.CHECK_CODE('''#define KRB5_DEPRECATED 1
    'HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER', addmain=False,
     link=False,
     msg="Checking for KRB5_DEPRECATED define taking an identifier")
+
+conf.CHECK_CODE('''
+       krb5_creds creds;
+       creds.flags.b.initial = 0;
+       ''',
+    'HAVE_FLAGS_IN_KRB5_CREDS',
+    headers='krb5.h', lib='krb5', execute=False,
+    msg="Checking whether krb5_creds have flags property")