Skip to content

Commit a3ee0ce

Browse files
jsutton24abartlet
authored andcommitted
wscript: Correctly determine dependencies for system Heimdal build
Previously, the call to CHECK_BUNDLED_SYSTEM() in check_system_heimdal_lib() could have us pick up MIT Kerberos headers when we should only be using system Heimdal headers. Now, we just perform an explicit check for the functions we require, which should avoid any use of the MIT libraries. We also remove some library checks for Heimdal components that we don't use directly, restricting the checks to only the functions we need. Finally, we no longer need to recurse into third_party/heimdal_build when performing a system Heimdal build. Signed-off-by: Joseph Sutton <[email protected]> Reviewed-by: Andrew Bartlett <[email protected]>
1 parent 77bb72d commit a3ee0ce

File tree

2 files changed

+12
-37
lines changed

2 files changed

+12
-37
lines changed

wscript_build_system_heimdal

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
from waflib import Logs
22

33
Logs.info("\tSelected system Heimdal build")
4-
bld.RECURSE('third_party/heimdal_build')
4+
5+
# Alias subsystem to allow common kerberos code that will
6+
# otherwise link against MIT's gssapi_krb5 and k5crypto
7+
#
8+
# Note: that we also need this if we use system heimdal libraries
9+
bld.SAMBA_SUBSYSTEM('gssapi_krb5', '', deps='gssapi')
10+
bld.SAMBA_SUBSYSTEM('k5crypto', '', deps='krb5')

wscript_configure_system_heimdal

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,20 @@ if krb5_config:
2424
finally:
2525
f.close()
2626

27-
def check_system_heimdal_lib(name, functions='', headers='', onlyif=None):
27+
def check_system_heimdal_lib(name, functions='', headers=''):
2828
# Only use system library if the user requested the bundled one not be
2929
# used.
3030
if conf.LIB_MAY_BE_BUNDLED(name):
3131
return False
3232
setattr(conf.env, "CPPPATH_%s" % name.upper(), heimdal_includedirs)
3333
setattr(conf.env, "LIBPATH_%s" % name.upper(), heimdal_libdirs)
34-
if not conf.CHECK_BUNDLED_SYSTEM(name, checkfunctions=functions, headers=headers,
35-
onlyif=onlyif):
36-
return False
37-
conf.define('USING_SYSTEM_%s' % name.upper(), 1)
38-
return True
39-
40-
def check_system_heimdal_binary(name):
41-
if conf.LIB_MAY_BE_BUNDLED(name):
42-
return False
43-
if not conf.find_program(name, var=name.upper()):
34+
if not conf.CHECK_FUNCS_IN(functions, name, headers=headers, empty_decl=False, set_target=True):
4435
return False
4536
conf.define('USING_SYSTEM_%s' % name.upper(), 1)
4637
return True
4738

4839
check_system_heimdal_lib("com_err", "com_right_r com_err", "com_err.h")
4940

50-
if check_system_heimdal_lib("roken", "rk_socket_set_reuseaddr", "roken.h"):
51-
conf.env.CPPPATH_ROKEN_HOSTCC = conf.env.CPPPATH_ROKEN
52-
conf.env.LIBPATH_ROKEN_HOSTCC = conf.env.LIBPATH_ROKEN
53-
conf.env.LIB_ROKEN_HOSTCC = "roken"
54-
conf.SET_TARGET_TYPE("ROKEN_HOSTCC", 'SYSLIB')
55-
5641
# Make sure HAVE_CONFIG_H is unset, as the system Heimdal headers use it
5742
# and include config.h if it is set, resulting in failure (since config.h
5843
# doesn't yet exist)
@@ -62,33 +47,17 @@ conf.undefine("HAVE_CONFIG_H")
6247
while "HAVE_CONFIG_H=1" in conf.env.DEFINES:
6348
conf.env.DEFINES.remove("HAVE_CONFIG_H=1")
6449
try:
65-
check_system_heimdal_lib("wind", "wind_stringprep", "wind.h", onlyif="roken")
66-
check_system_heimdal_lib("hx509", "hx509_bitstring_print", "hx509.h", onlyif="roken wind")
67-
check_system_heimdal_lib("asn1", "initialize_asn1_error_table", "asn1_err.h", onlyif="roken com_err")
68-
check_system_heimdal_lib("heimbase", "heim_cmp", "heimbase.h", onlyif="roken")
69-
check_system_heimdal_lib("hcrypto", "MD4_Init", "hcrypto/md4.h",
70-
onlyif="asn1 roken com_err")
71-
if check_system_heimdal_lib("krb5", "krb5_anyaddr", "krb5.h",
72-
onlyif="roken wind asn1 hx509 hcrypto com_err heimbase"):
50+
check_system_heimdal_lib("asn1", "decode_Ticket", "krb5_asn1.h")
51+
if check_system_heimdal_lib("krb5", "krb5_anyaddr", "krb5.h"):
7352
conf.CHECK_FUNCS_IN('krb5_free_unparsed_name', 'krb5', headers="krb5.h")
74-
check_system_heimdal_lib("gssapi", "gss_oid_to_name", "gssapi.h",
75-
onlyif="hcrypto asn1 roken krb5 com_err wind")
76-
check_system_heimdal_lib("heimntlm", "heim_ntlm_ntlmv2_key", "heimntlm.h",
77-
onlyif="roken hcrypto krb5")
78-
check_system_heimdal_lib("hdb", "hdb_db_dir", "krb5.h hdb.h",
79-
onlyif="roken krb5 hcrypto com_err wind")
80-
check_system_heimdal_lib("kdc", "kdc_log", "kdc.h",
81-
onlyif="roken krb5 hdb asn1 heimntlm hcrypto com_err wind heimbase")
53+
check_system_heimdal_lib("gssapi", "gss_oid_to_name", "gssapi.h")
8254
finally:
8355
conf.env.DEFINES = DEFINES
8456

8557
# With the proper checks in place we should be able to build against the system libtommath.
8658
#if conf.CHECK_BUNDLED_SYSTEM('tommath', checkfunctions='mp_init', headers='tommath.h'):
8759
# conf.define('USING_SYSTEM_TOMMATH', 1)
8860

89-
check_system_heimdal_binary("compile_et")
90-
check_system_heimdal_binary("asn1_compile")
91-
9261
conf.env.KRB5_VENDOR = 'heimdal'
9362
conf.define('USING_SYSTEM_KRB5', 1)
9463
conf.define('USING_SYSTEM_HEIMDAL', 1)

0 commit comments

Comments
 (0)