smbd: validate oplock types even for internal and stat opens
[nivanova/samba-autobuild/.git] / wscript_configure_system_mitkrb5
index 0f7e404..a62d00b 100644 (file)
@@ -37,9 +37,15 @@ if conf.env.KRB5_CONFIG:
         conf.define('USING_SYSTEM_KRB5', 1)
         del conf.env.HEIMDAL_KRB5_CONFIG
         kversion = conf.cmd_and_log("%(path)s --version" % dict(path=conf.env.KRB5_CONFIG), dict()).strip()
-        kversion_split = map(int, kversion.split(" ")[-1].split("."))
-        if kversion_split < [1, 9]:
+        kversion_split = kversion.split(' ')[-1].split('.')
+        # drop '-prerelease' suffix
+        if kversion_split[-1].find('-') > 0:
+            last_digit = kversion_split[-1].split('-')[0]
+            kversion_split[-1] = last_digit
+        kversion_check = map(int, kversion_split)
+        if kversion_check < [1, 9]:
             Logs.error('ERROR: MIT krb5 build requires at least 1.9.0. %s is found and cannot be used' % (kversion))
+            Logs.error('ERROR: You may try to build with embedded Heimdal Kerebros by not specifying --with-system-mitkrb5')
             sys.exit(1)
         else:
             Logs.info('%s is detected, MIT krb5 build can proceed' % (kversion))
@@ -60,8 +66,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 +103,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''',
@@ -147,7 +154,7 @@ conf.CHECK_CODE('''
        }''',
     'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_SIZE_T_ARG',
     headers='krb5.h', lib='krb5 k5crypto',
-    addmain=False, cflags='-Werror',
+    addmain=False, cflags=conf.env['WERROR_CFLAGS'],
     msg="Checking whether krb5_enctype_to_string takes size_t argument")
 
 conf.CHECK_CODE('''
@@ -160,7 +167,7 @@ conf.CHECK_CODE('''
        }''',
     'HAVE_KRB5_ENCTYPE_TO_STRING_WITH_KRB5_CONTEXT_ARG',
     headers='krb5.h stdlib.h', lib='krb5',
-    addmain=False, cflags='-Werror',
+    addmain=False, cflags=conf.env['WERROR_CFLAGS'],
     msg="Checking whether krb5_enctype_to_string takes krb5_context argument")
 conf.CHECK_CODE('''
        int main(void) {
@@ -240,3 +247,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")