4 from waflib
import Context
5 from samba_utils
import SET_TARGET_TYPE
6 from samba_autoconf
import CURRENT_CFLAGS
7 from samba_utils
import LOAD_ENVIRONMENT
, TO_LIST
9 def heimdal_path(p
, absolute
=False):
10 hpath
= os
.path
.join("../heimdal", p
)
13 return os
.path
.normpath(os
.path
.join(bld
.path
.abspath(), hpath
))
15 def heimdal_paths(ps
):
16 return [heimdal_path(p
) for p
in TO_LIST(ps
)]
18 # waf build tool for building .et files with compile_et
19 def HEIMDAL_ASN1(name
, source
,
24 '''Build a ASN1 file using the asn1 compiler.
25 This will produce 2 output files'''
26 source
= heimdal_path(source
)
27 bname
= os
.path
.basename(source
)[0:-5];
28 dname
= os
.path
.dirname(source
)
29 asn1name
= "%s_asn1" % bname
32 option_file
= heimdal_path(option_file
)
34 if not SET_TARGET_TYPE(bld
, name
, 'ASN1'):
37 # for ASN1 compilation, I always put it in build_source, as it doesn't make
39 bld
.set_group('build_source')
41 out_files
= heimdal_paths([
42 "%s/asn1_%s_asn1.x" % (directory
, bname
),
43 "%s/%s_asn1.hx" % (directory
, bname
),
44 "%s/%s_asn1-priv.hx" % (directory
, bname
),
47 # the ${TGT[0].parent.abspath(env)} expression gives us the parent directory of
48 # the first target in the build directory
49 # SRC[0].abspath(env) gives the absolute path to the source directory for the first
50 # source file. Note that in the case of a option_file, we have more than
52 cd_rule
= 'cd "${TGT[0].parent.abspath(env)}" &&'
53 env
= LOAD_ENVIRONMENT()
54 if env
.ADDRESS_SANITIZER
:
55 # If address sanitizer is enabled, we need to suppress leak checking
57 no_leak_check
= " ASAN_OPTIONS=detect_leaks=0"
61 asn1_rule
= cd_rule
+ no_leak_check
+ ' "${ASN1_COMPILE}" ${OPTION_FILE} ${ASN1OPTIONS} --one-code-file "${SRC[0].abspath(env)}" ${ASN1NAME}'
63 source
= TO_LIST(source
)
65 if option_file
is not None:
66 source
.append(option_file
)
69 if not bld
.CONFIG_SET('USING_SYSTEM_ASN1_COMPILE'):
72 t
= bld(rule
=asn1_rule
,
75 update_outputs
= True,
82 t
.env
.ASN1NAME
= asn1name
83 t
.env
.ASN1OPTIONS
= options
84 t
.env
.BLDBIN
= os
.path
.normpath(os
.path
.join(bld
.srcnode
.abspath(bld
.env
), '..'))
85 if option_file
is not None:
86 t
.env
.OPTION_FILE
= "--option-file='%s'" % \
87 os
.path
.normpath(os
.path
.join(bld
.path
.abspath(), option_file
))
89 cfile
= out_files
[0][0:-2] + '.c'
90 hfile
= out_files
[1][0:-3] + '.h'
91 hpriv
= out_files
[2][0:-3] + '.h'
93 # now generate a .c file from the .x file
94 t
= bld(rule
='''( echo '#include "config.h"' && cat ${SRC} ) > ${TGT}''',
95 source
= out_files
[0],
101 depends_on
= name
+ '_ASN1',
104 # and generate a .h file from the .hx file
105 t
= bld(rule
='cp ${SRC} ${TGT}',
106 source
= out_files
[1],
111 depends_on
= name
+ '_ASN1',
114 # and generate a .h file from the .hx file
115 t
= bld(rule
='cp ${SRC} ${TGT}',
116 source
= out_files
[2],
121 depends_on
= name
+ '_ASN1',
122 name
= name
+ '_PRIV_H')
124 bld
.set_group('main')
126 includes
= TO_LIST(includes
)
127 includes
.append(os
.path
.dirname(out_files
[0]))
129 t
= bld(features
= 'c',
132 samba_cflags
= CURRENT_CFLAGS(bld
, name
, ''),
134 samba_deps
= TO_LIST('roken replace'),
135 samba_includes
= includes
,
136 local_include
= True)
139 def HEIMDAL_ERRTABLE(name
, source
):
140 '''Build a heimdal errtable from a .et file'''
142 source
= heimdal_path(source
)
144 bname
= source
[0:-3]; # strip off the .et suffix
146 if not SET_TARGET_TYPE(bld
, name
, 'ET'):
149 bld
.set_group('hostcc_build_source')
152 out_files
.append('%s.c' % bname
)
153 out_files
.append('%s.h' % bname
)
155 sources
= [source
, 'et_compile_wrapper.sh']
158 if not bld
.CONFIG_SET('USING_SYSTEM_COMPILE_ET'):
161 t
= bld(rule
='"${SRC[1].abspath(env)}" "${TGT[0].parent.abspath(env)}" "${COMPILE_ET}" "${SRC[0].abspath(env)}" ${TGT[0].bldpath(env)}',
164 update_outputs
= True,
171 def HEIMDAL_AUTOPROTO(header
, source
, options
=None, group
='prototypes'):
172 '''rule for heimdal prototype generation'''
173 header
= heimdal_path(header
)
176 options
='-q -P comment -o'
177 SET_TARGET_TYPE(bld
, header
, 'PROTOTYPE')
178 source
= heimdal_paths(source
)
179 t
= bld(rule
='${PERL} "${HEIMDAL}/cf/make-proto.pl" ${OPTIONS} "${TGT[0].abspath(env)}" ${SRC}',
185 t
.env
.HEIMDAL
= os
.path
.join(bld
.srcnode
.abspath(), 'source4/heimdal')
186 t
.env
.OPTIONS
= options
189 def HEIMDAL_AUTOPROTO_PRIVATE(header
, source
):
190 '''rule for private heimdal prototype generation'''
191 HEIMDAL_AUTOPROTO(header
, source
, options
='-q -P comment -p')
194 def HEIMDAL_GENERATOR(name
, rule
, source
='', target
='',
196 '''A generic source generator target'''
198 if not SET_TARGET_TYPE(bld
, name
, 'GENERATOR'):
206 shell
=isinstance(rule
, str),
211 samba_type
='GENERATOR',
215 def HEIMDAL_LIBRARY(libname
, source
, deps
, vnum
, version_script
, includes
='', cflags
=[]):
216 '''define a Heimdal library'''
218 obj_target
= libname
+ '.objlist'
220 # first create a target for building the object files for this library
221 # by separating in this way, we avoid recompiling the C files
222 # separately for the install library and the build library
223 HEIMDAL_SUBSYSTEM(obj_target
,
230 if not SET_TARGET_TYPE(bld
, libname
, "LIBRARY"):
233 # the library itself will depend on that object target
235 deps
.append(obj_target
)
239 # FIXME: When building upstream heimdal, we should not be adding this
243 bundled_name
= libname
+ '-samba4'
245 bundled_name
= libname
246 version
= "%s_%s" % (Context
.g_module
.APPNAME
, Context
.g_module
.VERSION
)
248 features
= 'c cshlib symlink_lib install_lib'
250 bld
.set_group('main')
254 target
= bundled_name
,
256 samba_includes
= includes
,
262 private_library
= bundled_build
,
263 version_script
= heimdal_path(version_script
, absolute
=True),
266 def HEIMDAL_CFLAGS(use_hostcc
=False, extra_cflags
=[]):
269 if bld
.env
.allow_heimdal_warnings
:
270 cflags_unpicky
+= bld
.env
.HEIMDAL_UNPICKY_WNO_STRICT_OVERFLOW_CFLAGS
271 cflags_unpicky
+= bld
.env
.HEIMDAL_UNPICKY_WNO_MAYBE_UNINITIALIZED_CFLAGS
272 # old compilers on centos7 or ubuntu1604 need this
274 allow_warnings
= bld
.env
.allow_heimdal_warnings
275 cflags_picky
= bld
.env
.HEIMDAL_NO_ERROR_CFLAGS
276 extra_cflags
=TO_LIST(extra_cflags
)
279 cflags_end
= cflags_picky
+ cflags_unpicky
+ extra_cflags
280 return (cflags
, cflags_end
, allow_warnings
)
282 def HEIMDAL_SUBSYSTEM(modname
, source
,
288 use_global_deps
=True):
289 '''define a Heimdal subsystem'''
291 cflags
, cflags_end
, allow_warnings
= HEIMDAL_CFLAGS(use_hostcc
=use_hostcc
,
293 source
= heimdal_paths(source
)
295 bld
.SAMBA_SUBSYSTEM(modname
,
300 cflags_end
= cflags_end
,
301 allow_warnings
= allow_warnings
,
303 use_hostcc
= use_hostcc
,
304 use_global_deps
= use_global_deps
)
306 def HEIMDAL_BINARY(binname
, source
,
311 use_global_deps
=True,
316 '''define a Samba binary'''
318 cflags
, cflags_end
, allow_warnings
= HEIMDAL_CFLAGS(use_hostcc
=use_hostcc
)
319 source
= heimdal_paths(source
)
321 obj_target
= binname
+ '.heimdal.objlist'
323 HEIMDAL_SUBSYSTEM(obj_target
,
329 use_hostcc
= use_hostcc
,
330 use_global_deps
= use_global_deps
)
332 bld
.SAMBA_BINARY(binname
,
337 cflags_end
= cflags_end
,
338 allow_warnings
= allow_warnings
,
340 use_hostcc
= use_hostcc
,
341 use_global_deps
= use_global_deps
,
346 if not bld
.CONFIG_SET('USING_SYSTEM_ROKEN'):
348 if not bld
.CONFIG_SET('HAVE_IFADDRS_H'):
350 name
="HEIMDAL_IFADDRS_H",
351 rule
="rm -f ${TGT} && ln ${SRC} ${TGT}",
352 source
= 'ifaddrs.hin',
353 target
= 'ifaddrs.h',
356 if not bld
.CONFIG_SET('HAVE_ERR_H'):
358 group
='hostcc_base_build_source',
359 name
="HEIMDAL_ERR_H",
360 rule
="rm -f ${TGT} && ln ${SRC} ${TGT}",
361 source
= '../heimdal/lib/roken/err.hin',
362 target
= '../heimdal/lib/roken/err.h',
365 ROKEN_COMMON_SOURCE
= '''
374 lib/roken/get_window_size.c
375 lib/roken/getdtablesize.c
379 lib/roken/net_write.c
380 lib/roken/parse_time.c
381 lib/roken/parse_units.c
384 lib/roken/strsep_copy.c
390 lib/roken/simple_exec.c
391 lib/roken/strcollect.c
396 ../heimdal_build/replace.c
399 ROKEN_HOSTCC_SOURCE
= ROKEN_COMMON_SOURCE
401 ROKEN_SOURCE
= ROKEN_COMMON_SOURCE
+ '''
404 lib/roken/roken_gethostby.c
407 HEIMDAL_LIBRARY('roken',
409 includes
='../heimdal/lib/roken ../heimdal/include ../heimdal_build/include',
410 deps
='resolv util replace',
412 version_script
='lib/roken/version-script.map',
415 HEIMDAL_SUBSYSTEM('ROKEN_HOSTCC',
418 use_global_deps
=False,
419 includes
='../heimdal/lib/roken ../heimdal/include ../heimdal_build/include',
420 group
='hostcc_base_build_main',
421 deps
='LIBREPLACE_HOSTCC',
424 if not bld
.CONFIG_SET("USING_SYSTEM_KDC"):
425 HEIMDAL_ASN1('HEIMDAL_KX509_ASN1',
426 'lib/asn1/kx509.asn1',
429 HEIMDAL_ASN1('HEIMDAL_DIGEST_ASN1',
430 'lib/asn1/digest.asn1',
434 KDC_SOURCE
='kdc/default_config.c kdc/kerberos5.c kdc/krb5tgs.c kdc/pkinit.c kdc/log.c kdc/misc.c kdc/digest.c kdc/process.c kdc/windc.c kdc/kx509.c'
436 HEIMDAL_LIBRARY('kdc', source
=KDC_SOURCE
,
437 includes
='../heimdal/kdc',
438 deps
='roken krb5 hdb asn1 HEIMDAL_DIGEST_ASN1 HEIMDAL_KX509_ASN1 heimntlm hcrypto com_err wind heimbase',
440 version_script
='kdc/version-script.map')
441 HEIMDAL_AUTOPROTO('kdc/kdc-protos.h', KDC_SOURCE
)
442 HEIMDAL_AUTOPROTO_PRIVATE('kdc/kdc-private.h', KDC_SOURCE
)
444 if not bld
.CONFIG_SET("USING_SYSTEM_HEIMNTLM"):
445 HEIMDAL_ERRTABLE('HEIMNTLM_ET',
446 'lib/ntlm/ntlm_err.et')
448 HEIMNTLM_SOURCE
= 'lib/ntlm/ntlm.c'
449 HEIMDAL_LIBRARY('heimntlm',
450 source
=HEIMNTLM_SOURCE
,
451 includes
='../heimdal/lib/ntlm',
452 deps
='roken hcrypto krb5',
454 version_script
='lib/ntlm/version-script.map',
456 HEIMDAL_AUTOPROTO('lib/ntlm/heimntlm-protos.h', HEIMNTLM_SOURCE
)
458 if not bld
.CONFIG_SET("USING_SYSTEM_HDB"):
459 HEIMDAL_ASN1('HEIMDAL_HDB_ASN1', 'lib/hdb/hdb.asn1',
460 directory
='lib/asn1',
461 options
="--sequence=HDB-Ext-KeySet --sequence=Keys",
462 includes
='../heimdal/lib/asn1')
464 HDB_KEYS_SOURCE
= 'lib/hdb/keys.c'
466 HEIMDAL_SUBSYSTEM('HEIMDAL_HDB_KEYS',
468 includes
='../heimdal/lib/hdb',
469 deps
='roken hcrypto krb5 HEIMDAL_HDB_ASN1',
472 HEIMDAL_ERRTABLE('HEIMDAL_HDB_ERR_ET', 'lib/hdb/hdb_err.et')
474 HDB_SOURCE
= '''lib/hdb/db.c lib/hdb/dbinfo.c lib/hdb/hdb.c
475 lib/hdb/ext.c lib/hdb/keytab.c lib/hdb/hdb-keytab.c
476 lib/hdb/mkey.c lib/hdb/ndbm.c lib/hdb/hdb_err.c
477 ../heimdal_build/hdb-glue.c'''
479 HEIMDAL_LIBRARY('hdb',
480 version_script
='lib/hdb/version-script.map',
482 includes
='../heimdal/lib/hdb',
483 deps
='krb5 HEIMDAL_HDB_KEYS roken hcrypto com_err HEIMDAL_HDB_ASN1 wind',
486 HEIMDAL_AUTOPROTO('lib/hdb/hdb-protos.h', HDB_SOURCE
+ " " + HDB_KEYS_SOURCE
)
487 HEIMDAL_AUTOPROTO_PRIVATE('lib/hdb/hdb-private.h', HDB_SOURCE
+ " " + HDB_KEYS_SOURCE
)
490 if not bld
.CONFIG_SET("USING_SYSTEM_GSSAPI"):
491 HEIMDAL_ERRTABLE('HEIMDAL_GKRB5_ERR_ET', 'lib/gssapi/krb5/gkrb5_err.et')
493 HEIMDAL_ASN1('HEIMDAL_GSSAPI_ASN1',
494 'lib/gssapi/mech/gssapi.asn1',
495 includes
='../heimdal/lib/asn1',
496 directory
='lib/gssapi'
499 HEIMDAL_ASN1('HEIMDAL_SPNEGO_ASN1',
500 source
='lib/gssapi/spnego/spnego.asn1',
501 options
='--sequence=MechTypeList',
502 includes
='../heimdal/lib/asn1',
503 directory
='lib/gssapi'
506 HEIMDAL_GSSAPI_SPNEGO_SOURCE
= '''
507 lib/gssapi/spnego/init_sec_context.c
508 lib/gssapi/spnego/external.c
509 lib/gssapi/spnego/compat.c
510 lib/gssapi/spnego/context_stubs.c
511 lib/gssapi/spnego/cred_stubs.c
512 lib/gssapi/spnego/accept_sec_context.c
515 HEIMDAL_AUTOPROTO_PRIVATE('lib/gssapi/spnego/spnego-private.h',
516 HEIMDAL_GSSAPI_SPNEGO_SOURCE
)
518 HEIMDAL_GSSAPI_KRB5_SOURCE
= '''
519 lib/gssapi/krb5/copy_ccache.c
520 lib/gssapi/krb5/delete_sec_context.c
521 lib/gssapi/krb5/init_sec_context.c
522 lib/gssapi/krb5/context_time.c
523 lib/gssapi/krb5/init.c
524 lib/gssapi/krb5/address_to_krb5addr.c
525 lib/gssapi/krb5/get_mic.c
526 lib/gssapi/krb5/inquire_context.c
527 lib/gssapi/krb5/add_cred.c
528 lib/gssapi/krb5/inquire_cred.c
529 lib/gssapi/krb5/inquire_cred_by_oid.c
530 lib/gssapi/krb5/inquire_cred_by_mech.c
531 lib/gssapi/krb5/inquire_mechs_for_name.c
532 lib/gssapi/krb5/inquire_names_for_mech.c
533 lib/gssapi/krb5/indicate_mechs.c
534 lib/gssapi/krb5/inquire_sec_context_by_oid.c
535 lib/gssapi/krb5/export_sec_context.c
536 lib/gssapi/krb5/import_sec_context.c
537 lib/gssapi/krb5/duplicate_name.c
538 lib/gssapi/krb5/import_name.c
539 lib/gssapi/krb5/compare_name.c
540 lib/gssapi/krb5/export_name.c
541 lib/gssapi/krb5/canonicalize_name.c
542 lib/gssapi/krb5/unwrap.c
543 lib/gssapi/krb5/wrap.c
544 lib/gssapi/krb5/release_name.c
545 lib/gssapi/krb5/cfx.c
546 lib/gssapi/krb5/8003.c
547 lib/gssapi/krb5/arcfour.c
548 lib/gssapi/krb5/encapsulate.c
549 lib/gssapi/krb5/display_name.c
550 lib/gssapi/krb5/sequence.c
551 lib/gssapi/krb5/display_status.c
552 lib/gssapi/krb5/release_buffer.c
553 lib/gssapi/krb5/external.c
554 lib/gssapi/krb5/compat.c
555 lib/gssapi/krb5/creds.c
556 lib/gssapi/krb5/acquire_cred.c
557 lib/gssapi/krb5/release_cred.c
558 lib/gssapi/krb5/store_cred.c
559 lib/gssapi/krb5/set_cred_option.c
560 lib/gssapi/krb5/decapsulate.c
561 lib/gssapi/krb5/verify_mic.c
562 lib/gssapi/krb5/accept_sec_context.c
563 lib/gssapi/krb5/set_sec_context_option.c
564 lib/gssapi/krb5/process_context_token.c
565 lib/gssapi/krb5/prf.c
566 lib/gssapi/krb5/aeap.c
567 lib/gssapi/krb5/pname_to_uid.c
568 lib/gssapi/krb5/authorize_localname.c
571 HEIMDAL_AUTOPROTO_PRIVATE('lib/gssapi/krb5/gsskrb5-private.h',
572 HEIMDAL_GSSAPI_KRB5_SOURCE
)
574 HEIMDAL_LIBRARY('gssapi',
575 HEIMDAL_GSSAPI_SPNEGO_SOURCE
+ HEIMDAL_GSSAPI_KRB5_SOURCE
+ '''
576 lib/gssapi/mech/context.c lib/gssapi/mech/gss_krb5.c lib/gssapi/mech/gss_mech_switch.c
577 lib/gssapi/mech/gss_process_context_token.c lib/gssapi/mech/gss_buffer_set.c
578 lib/gssapi/mech/gss_aeap.c lib/gssapi/mech/gss_add_cred.c lib/gssapi/mech/gss_cred.c
579 lib/gssapi/mech/gss_add_oid_set_member.c lib/gssapi/mech/gss_compare_name.c lib/gssapi/mech/gss_release_oid_set.c
580 lib/gssapi/mech/gss_create_empty_oid_set.c lib/gssapi/mech/gss_decapsulate_token.c lib/gssapi/mech/gss_inquire_cred_by_oid.c
581 lib/gssapi/mech/gss_canonicalize_name.c lib/gssapi/mech/gss_inquire_sec_context_by_oid.c lib/gssapi/mech/gss_inquire_names_for_mech.c
582 lib/gssapi/mech/gss_inquire_mechs_for_name.c lib/gssapi/mech/gss_wrap_size_limit.c lib/gssapi/mech/gss_names.c
583 lib/gssapi/mech/gss_verify.c lib/gssapi/mech/gss_display_name.c
584 lib/gssapi/mech/gss_duplicate_oid.c lib/gssapi/mech/gss_display_status.c lib/gssapi/mech/gss_release_buffer.c
585 lib/gssapi/mech/gss_release_oid.c lib/gssapi/mech/gss_test_oid_set_member.c
586 lib/gssapi/mech/gss_release_cred.c
587 lib/gssapi/mech/gss_set_sec_context_option.c lib/gssapi/mech/gss_export_name.c lib/gssapi/mech/gss_seal.c
588 lib/gssapi/mech/gss_acquire_cred.c lib/gssapi/mech/gss_unseal.c lib/gssapi/mech/gss_verify_mic.c
589 lib/gssapi/mech/gss_accept_sec_context.c lib/gssapi/mech/gss_inquire_cred_by_mech.c lib/gssapi/mech/gss_indicate_mechs.c
590 lib/gssapi/mech/gss_delete_sec_context.c lib/gssapi/mech/gss_sign.c lib/gssapi/mech/gss_utils.c
591 lib/gssapi/mech/gss_init_sec_context.c lib/gssapi/mech/gss_oid_equal.c lib/gssapi/mech/gss_oid.c
592 lib/gssapi/mech/gss_oid_to_str.c lib/gssapi/mech/gss_mo.c
593 lib/gssapi/mech/gss_context_time.c lib/gssapi/mech/gss_encapsulate_token.c lib/gssapi/mech/gss_get_mic.c
594 lib/gssapi/mech/gss_import_sec_context.c lib/gssapi/mech/gss_inquire_cred.c lib/gssapi/mech/gss_wrap.c
595 lib/gssapi/mech/gss_import_name.c lib/gssapi/mech/gss_duplicate_name.c lib/gssapi/mech/gss_unwrap.c
596 lib/gssapi/mech/gss_export_sec_context.c lib/gssapi/mech/gss_inquire_context.c lib/gssapi/mech/gss_release_name.c
597 lib/gssapi/mech/gss_set_cred_option.c lib/gssapi/mech/gss_pseudo_random.c ../heimdal_build/gssapi-glue.c''',
598 includes
='../heimdal/lib/gssapi ../heimdal/lib/gssapi/gssapi ../heimdal/lib/gssapi/spnego ../heimdal/lib/gssapi/krb5 ../heimdal/lib/gssapi/mech',
599 deps
='hcrypto asn1 HEIMDAL_SPNEGO_ASN1 HEIMDAL_GSSAPI_ASN1 roken krb5 com_err wind heimbase',
601 version_script
='lib/gssapi/version-script.map',
604 if not bld
.CONFIG_SET("USING_SYSTEM_KRB5"):
605 # expand_path.c needs some of the install paths
606 HEIMDAL_SUBSYSTEM('HEIMDAL_CONFIG',
607 'lib/krb5/expand_path.c lib/krb5/plugin.c lib/krb5/context.c',
608 includes
='../heimdal/lib/krb5 ../heimdal/lib/asn1 ../heimdal/include',
609 cflags
=bld
.dynconfig_cflags('LIBDIR BINDIR LIBEXECDIR SBINDIR'),
610 deps
='hcrypto heimbase wind hx509 com_err'
613 HEIMDAL_ERRTABLE('HEIMDAL_KRB5_ERR_ET', 'lib/krb5/krb5_err.et')
615 HEIMDAL_ERRTABLE('HEIMDAL_KRB_ERR_ET', 'lib/krb5/krb_err.et')
617 HEIMDAL_ERRTABLE('HEIMDAL_K524_ERR_ET', 'lib/krb5/k524_err.et')
619 HEIMDAL_ERRTABLE('HEIMDAL_HEIM_ERR_ET', 'lib/krb5/heim_err.et')
621 KRB5_SOURCE
= [os
.path
.join('lib/krb5/', x
) for x
in TO_LIST(
622 '''acache.c add_et_list.c
623 addr_families.c appdefault.c
624 asn1_glue.c auth_context.c
625 build_ap_req.c build_auth.c cache.c
626 changepw.c codec.c config_file.c
627 constants.c convert_creds.c
628 copy_host_realm.c crc.c creds.c
629 crypto.c crypto-aes.c crypto-algs.c
630 crypto-arcfour.c crypto-des3.c crypto-des.c
631 crypto-des-common.c crypto-evp.c
632 crypto-null.c crypto-pk.c crypto-rand.c
633 data.c eai_to_heim_errno.c
634 error_string.c expand_hostname.c
635 fcache.c free.c free_host_realm.c
636 generate_seq_number.c generate_subkey.c
637 get_addrs.c get_cred.c
638 get_default_principal.c
639 get_default_realm.c get_for_creds.c
640 get_host_realm.c get_in_tkt.c
641 get_port.c init_creds.c init_creds_pw.c
642 kcm.c keyblock.c keytab.c keytab_any.c
643 keytab_file.c keytab_memory.c
644 keytab_keyfile.c krbhst.c log.c
645 mcache.c misc.c mk_error.c mk_priv.c
646 mk_rep.c mk_req.c mk_req_ext.c
647 mit_glue.c n-fold.c padata.c pkinit.c
648 principal.c prog_setup.c pac.c
649 pcache.c prompter_posix.c rd_cred.c rd_error.c
650 rd_priv.c rd_rep.c rd_req.c replay.c
651 salt.c salt-aes.c salt-arcfour.c salt-des3.c salt-des.c
652 send_to_kdc.c set_default_realm.c
653 store.c store-int.c store_emem.c store_fd.c
654 store_mem.c ticket.c time.c transited.c
655 version.c warn.c krb5_err.c
656 aname_to_localname.c kuserok.c
657 heim_err.c k524_err.c krb_err.c''')] + ["../heimdal_build/krb5-glue.c"]
659 HEIMDAL_LIBRARY('krb5', KRB5_SOURCE
,
660 version_script
='lib/krb5/version-script.map',
661 includes
='../heimdal/lib/krb5 ../heimdal/lib/asn1 ../heimdal/include',
662 deps
='roken wind asn1 hx509 hcrypto com_err HEIMDAL_CONFIG heimbase execinfo samba_intl',
665 KRB5_PROTO_SOURCE
= KRB5_SOURCE
+ ['lib/krb5/expand_path.c', 'lib/krb5/plugin.c', 'lib/krb5/context.c']
667 HEIMDAL_AUTOPROTO_PRIVATE('lib/krb5/krb5-private.h', KRB5_PROTO_SOURCE
)
668 HEIMDAL_AUTOPROTO('lib/krb5/krb5-protos.h', KRB5_PROTO_SOURCE
,
669 options
='-E KRB5_LIB -q -P comment -o')
671 if not bld
.CONFIG_SET("USING_SYSTEM_ASN1"):
672 HEIMDAL_HEIM_ASN1_DER_SOURCE
= '''
676 lib/asn1/der_format.c
677 lib/asn1/der_length.c
682 HEIMDAL_AUTOPROTO('lib/asn1/der-protos.h',
683 HEIMDAL_HEIM_ASN1_DER_SOURCE
,
684 group
='hostcc_build_source',
685 options
="-q -P comment -o")
688 HEIMDAL_AUTOPROTO('lib/asn1/der-private.h',
689 HEIMDAL_HEIM_ASN1_DER_SOURCE
,
690 group
='hostcc_build_source',
691 options
="-q -P comment -p")
693 HEIMDAL_ERRTABLE('HEIMDAL_ASN1_ERR_ET', 'lib/asn1/asn1_err.et')
695 heimdal_heim_asn1_cflags
= ''
696 if bld
.CONFIG_SET('HAVE_WNO_FORMAT_TRUNCATION'):
697 heimdal_heim_asn1_cflags
= '-Wno-format-truncation'
699 HEIMDAL_SUBSYSTEM('HEIMDAL_HEIM_ASN1',
700 HEIMDAL_HEIM_ASN1_DER_SOURCE
+ 'lib/asn1/extra.c lib/asn1/timegm.c lib/asn1/asn1_err.c',
701 includes
='../heimdal/lib/asn1',
702 cflags
=heimdal_heim_asn1_cflags
,
706 HEIMDAL_ASN1('HEIMDAL_RFC2459_ASN1',
707 'lib/asn1/rfc2459.asn1',
708 option_file
='lib/asn1/rfc2459.opt',
712 HEIMDAL_ASN1('HEIMDAL_KRB5_ASN1',
713 'lib/asn1/krb5.asn1',
714 option_file
='lib/asn1/krb5.opt',
718 HEIMDAL_ASN1('HEIMDAL_PKINIT_ASN1',
719 'lib/asn1/pkinit.asn1',
723 HEIMDAL_ASN1('HEIMDAL_CMS_ASN1',
725 option_file
='lib/asn1/cms.opt',
729 HEIMDAL_LIBRARY('asn1',
730 version_script
='lib/asn1/version-script.map',
731 deps
="HEIMDAL_HEIM_ASN1 HEIMDAL_RFC2459_ASN1 HEIMDAL_KRB5_ASN1 HEIMDAL_PKINIT_ASN1 HEIMDAL_CMS_ASN1",
735 if not bld
.CONFIG_SET('USING_SYSTEM_HCRYPTO'):
736 if not bld
.CONFIG_SET("USING_SYSTEM_TOMMATH"):
737 HEIMDAL_SUBSYSTEM('tommath',
738 'lib/hcrypto/libtommath/bncore.c lib/hcrypto/libtommath/bn_mp_init.c lib/hcrypto/libtommath/bn_mp_clear.c lib/hcrypto/libtommath/bn_mp_exch.c lib/hcrypto/libtommath/bn_mp_grow.c lib/hcrypto/libtommath/bn_mp_shrink.c lib/hcrypto/libtommath/bn_mp_clamp.c lib/hcrypto/libtommath/bn_mp_zero.c lib/hcrypto/libtommath/bn_mp_zero_multi.c lib/hcrypto/libtommath/bn_mp_set.c lib/hcrypto/libtommath/bn_mp_set_int.c lib/hcrypto/libtommath/bn_mp_init_size.c lib/hcrypto/libtommath/bn_mp_copy.c lib/hcrypto/libtommath/bn_mp_init_copy.c lib/hcrypto/libtommath/bn_mp_abs.c lib/hcrypto/libtommath/bn_mp_neg.c lib/hcrypto/libtommath/bn_mp_cmp_mag.c lib/hcrypto/libtommath/bn_mp_cmp.c lib/hcrypto/libtommath/bn_mp_cmp_d.c lib/hcrypto/libtommath/bn_mp_rshd.c lib/hcrypto/libtommath/bn_mp_lshd.c lib/hcrypto/libtommath/bn_mp_mod_2d.c lib/hcrypto/libtommath/bn_mp_div_2d.c lib/hcrypto/libtommath/bn_mp_mul_2d.c lib/hcrypto/libtommath/bn_mp_div_2.c lib/hcrypto/libtommath/bn_mp_mul_2.c lib/hcrypto/libtommath/bn_s_mp_add.c lib/hcrypto/libtommath/bn_s_mp_sub.c lib/hcrypto/libtommath/bn_fast_s_mp_mul_digs.c lib/hcrypto/libtommath/bn_s_mp_mul_digs.c lib/hcrypto/libtommath/bn_fast_s_mp_mul_high_digs.c lib/hcrypto/libtommath/bn_s_mp_mul_high_digs.c lib/hcrypto/libtommath/bn_fast_s_mp_sqr.c lib/hcrypto/libtommath/bn_s_mp_sqr.c lib/hcrypto/libtommath/bn_mp_add.c lib/hcrypto/libtommath/bn_mp_sub.c lib/hcrypto/libtommath/bn_mp_karatsuba_mul.c lib/hcrypto/libtommath/bn_mp_mul.c lib/hcrypto/libtommath/bn_mp_karatsuba_sqr.c lib/hcrypto/libtommath/bn_mp_sqr.c lib/hcrypto/libtommath/bn_mp_div.c lib/hcrypto/libtommath/bn_mp_mod.c lib/hcrypto/libtommath/bn_mp_add_d.c lib/hcrypto/libtommath/bn_mp_sub_d.c lib/hcrypto/libtommath/bn_mp_mul_d.c lib/hcrypto/libtommath/bn_mp_div_d.c lib/hcrypto/libtommath/bn_mp_mod_d.c lib/hcrypto/libtommath/bn_mp_expt_d.c lib/hcrypto/libtommath/bn_mp_addmod.c lib/hcrypto/libtommath/bn_mp_submod.c lib/hcrypto/libtommath/bn_mp_mulmod.c lib/hcrypto/libtommath/bn_mp_sqrmod.c lib/hcrypto/libtommath/bn_mp_gcd.c lib/hcrypto/libtommath/bn_mp_lcm.c lib/hcrypto/libtommath/bn_fast_mp_invmod.c lib/hcrypto/libtommath/bn_mp_invmod.c lib/hcrypto/libtommath/bn_mp_reduce.c lib/hcrypto/libtommath/bn_mp_montgomery_setup.c lib/hcrypto/libtommath/bn_fast_mp_montgomery_reduce.c lib/hcrypto/libtommath/bn_mp_montgomery_reduce.c lib/hcrypto/libtommath/bn_mp_exptmod_fast.c lib/hcrypto/libtommath/bn_mp_exptmod.c lib/hcrypto/libtommath/bn_mp_2expt.c lib/hcrypto/libtommath/bn_mp_n_root.c lib/hcrypto/libtommath/bn_mp_jacobi.c lib/hcrypto/libtommath/bn_reverse.c lib/hcrypto/libtommath/bn_mp_count_bits.c lib/hcrypto/libtommath/bn_mp_read_unsigned_bin.c lib/hcrypto/libtommath/bn_mp_read_signed_bin.c lib/hcrypto/libtommath/bn_mp_to_unsigned_bin.c lib/hcrypto/libtommath/bn_mp_to_signed_bin.c lib/hcrypto/libtommath/bn_mp_unsigned_bin_size.c lib/hcrypto/libtommath/bn_mp_signed_bin_size.c lib/hcrypto/libtommath/bn_mp_xor.c lib/hcrypto/libtommath/bn_mp_and.c lib/hcrypto/libtommath/bn_mp_or.c lib/hcrypto/libtommath/bn_mp_rand.c lib/hcrypto/libtommath/bn_mp_montgomery_calc_normalization.c lib/hcrypto/libtommath/bn_mp_prime_is_divisible.c lib/hcrypto/libtommath/bn_prime_tab.c lib/hcrypto/libtommath/bn_mp_prime_fermat.c lib/hcrypto/libtommath/bn_mp_prime_miller_rabin.c lib/hcrypto/libtommath/bn_mp_prime_is_prime.c lib/hcrypto/libtommath/bn_mp_prime_next_prime.c lib/hcrypto/libtommath/bn_mp_find_prime.c lib/hcrypto/libtommath/bn_mp_isprime.c lib/hcrypto/libtommath/bn_mp_dr_reduce.c lib/hcrypto/libtommath/bn_mp_dr_is_modulus.c lib/hcrypto/libtommath/bn_mp_dr_setup.c lib/hcrypto/libtommath/bn_mp_reduce_setup.c lib/hcrypto/libtommath/bn_mp_toom_mul.c lib/hcrypto/libtommath/bn_mp_toom_sqr.c lib/hcrypto/libtommath/bn_mp_div_3.c lib/hcrypto/libtommath/bn_s_mp_exptmod.c lib/hcrypto/libtommath/bn_mp_reduce_2k.c lib/hcrypto/libtommath/bn_mp_reduce_is_2k.c lib/hcrypto/libtommath/bn_mp_reduce_2k_setup.c lib/hcrypto/libtommath/bn_mp_reduce_2k_l.c lib/hcrypto/libtommath/bn_mp_reduce_is_2k_l.c lib/hcrypto/libtommath/bn_mp_reduce_2k_setup_l.c lib/hcrypto/libtommath/bn_mp_radix_smap.c lib/hcrypto/libtommath/bn_mp_read_radix.c lib/hcrypto/libtommath/bn_mp_toradix.c lib/hcrypto/libtommath/bn_mp_radix_size.c lib/hcrypto/libtommath/bn_mp_fread.c lib/hcrypto/libtommath/bn_mp_fwrite.c lib/hcrypto/libtommath/bn_mp_cnt_lsb.c lib/hcrypto/libtommath/bn_error.c lib/hcrypto/libtommath/bn_mp_init_multi.c lib/hcrypto/libtommath/bn_mp_clear_multi.c lib/hcrypto/libtommath/bn_mp_exteuclid.c lib/hcrypto/libtommath/bn_mp_toradix_n.c lib/hcrypto/libtommath/bn_mp_prime_random_ex.c lib/hcrypto/libtommath/bn_mp_get_int.c lib/hcrypto/libtommath/bn_mp_sqrt.c lib/hcrypto/libtommath/bn_mp_is_square.c lib/hcrypto/libtommath/bn_mp_init_set.c lib/hcrypto/libtommath/bn_mp_init_set_int.c lib/hcrypto/libtommath/bn_mp_invmod_slow.c lib/hcrypto/libtommath/bn_mp_prime_rabin_miller_trials.c lib/hcrypto/libtommath/bn_mp_to_signed_bin_n.c lib/hcrypto/libtommath/bn_mp_to_unsigned_bin_n.c',
739 includes
='../heimdal/lib/hcrypto/libtommath'
742 HEIMDAL_LIBRARY('hcrypto',
743 'lib/hcrypto/aes.c lib/hcrypto/bn.c lib/hcrypto/dh.c lib/hcrypto/dh-ltm.c lib/hcrypto/des.c lib/hcrypto/dsa.c lib/hcrypto/engine.c lib/hcrypto/md2.c lib/hcrypto/md4.c lib/hcrypto/md5.c lib/hcrypto/rsa.c lib/hcrypto/rsa-ltm.c lib/hcrypto/rc2.c lib/hcrypto/rc4.c lib/hcrypto/rijndael-alg-fst.c lib/hcrypto/rnd_keys.c lib/hcrypto/sha.c lib/hcrypto/sha256.c lib/hcrypto/sha512.c lib/hcrypto/ui.c lib/hcrypto/evp.c lib/hcrypto/evp-hcrypto.c lib/hcrypto/pkcs5.c lib/hcrypto/pkcs12.c lib/hcrypto/rand.c lib/hcrypto/rand-egd.c lib/hcrypto/rand-unix.c lib/hcrypto/rand-fortuna.c lib/hcrypto/rand-timer.c lib/hcrypto/hmac.c lib/hcrypto/camellia.c lib/hcrypto/camellia-ntt.c lib/hcrypto/common.c lib/hcrypto/validate.c',
744 includes
='../heimdal/lib/hcrypto ../heimdal/lib ../heimdal/include',
745 deps
='roken asn1 tommath replace',
746 version_script
='lib/hcrypto/version-script.map',
750 if not bld
.CONFIG_SET('USING_SYSTEM_HEIMBASE'):
751 HEIMDAL_LIBRARY('heimbase',
752 'base/array.c base/bool.c base/dict.c base/heimbase.c base/string.c base/number.c base/null.c',
753 includes
='../heimdal/base ../heimdal/include',
754 deps
='roken replace',
755 version_script
='base/version-script.map',
760 if not bld
.CONFIG_SET("USING_SYSTEM_HX509"):
761 HEIMDAL_ASN1('HEIMDAL_OCSP_ASN1',
762 'lib/hx509/ocsp.asn1',
763 options
='--preserve-binary=OCSPTBSRequest --preserve-binary=OCSPResponseData',
764 includes
='../heimdal/lib/asn1',
765 directory
='lib/hx509'
768 HEIMDAL_ASN1('HEIMDAL_PKCS8_ASN1',
769 'lib/asn1/pkcs8.asn1',
774 HEIMDAL_ASN1('HEIMDAL_PKCS9_ASN1',
775 'lib/asn1/pkcs9.asn1',
780 HEIMDAL_ASN1('HEIMDAL_PKCS12_ASN1',
781 'lib/asn1/pkcs12.asn1',
785 HEIMDAL_ASN1('HEIMDAL_PKCS10_ASN1',
786 'lib/hx509/pkcs10.asn1',
787 options
='--preserve-binary=CertificationRequestInfo',
788 includes
='../heimdal/lib/asn1',
789 directory
='lib/hx509'
792 HEIMDAL_ERRTABLE('HEIMDAL_HX509_ERR_ET',
793 'lib/hx509/hx509_err.et')
795 HEIMDAL_HX509_OBJH_SOURCE
= '''
799 lib/hx509/collector.c
807 lib/hx509/ks_keychain.c
819 lib/hx509/hx509_err.c
822 HEIMDAL_AUTOPROTO('lib/hx509/hx509-protos.h',
823 HEIMDAL_HX509_OBJH_SOURCE
,
824 options
="-R '^(_|^C)' -E HX509_LIB -q -P comment -o")
826 HEIMDAL_AUTOPROTO('lib/hx509/hx509-private.h',
827 HEIMDAL_HX509_OBJH_SOURCE
,
828 options
="-q -P comment -p")
830 HEIMDAL_LIBRARY('hx509',
831 'lib/hx509/ca.c lib/hx509/cert.c lib/hx509/cms.c lib/hx509/collector.c lib/hx509/crypto.c lib/hx509/error.c lib/hx509/env.c lib/hx509/file.c lib/hx509/keyset.c lib/hx509/ks_dir.c lib/hx509/ks_file.c lib/hx509/ks_keychain.c lib/hx509/ks_mem.c lib/hx509/ks_null.c lib/hx509/ks_p11.c lib/hx509/ks_p12.c lib/hx509/lock.c lib/hx509/name.c lib/hx509/peer.c lib/hx509/print.c lib/hx509/req.c lib/hx509/revoke.c lib/hx509/sel.c lib/hx509/hx509_err.c lib/hx509/sel-lex.l lib/hx509/sel-gram.y',
832 includes
='../heimdal/lib/hx509',
833 deps
='roken com_err asn1 hcrypto asn1 HEIMDAL_OCSP_ASN1 HEIMDAL_PKCS8_ASN1 HEIMDAL_PKCS9_ASN1 HEIMDAL_PKCS12_ASN1 HEIMDAL_PKCS10_ASN1 wind',
835 version_script
='lib/hx509/version-script.map',
838 if not bld
.CONFIG_SET('USING_SYSTEM_WIND'):
839 HEIMDAL_ERRTABLE('WIND_ERR_ET',
840 'lib/wind/wind_err.et')
843 name
="HEIMDAL_ERRORLIST",
844 rule
="${PYTHON} '${SRC[0].abspath()}' '${SRC[1].abspath()}' '${SRC[1].parent.abspath(env)}'",
845 source
= '../heimdal/lib/wind/gen-errorlist.py ../heimdal/lib/wind/rfc3454.txt ../heimdal/lib/wind/stringprep.py',
846 target
= '../heimdal/lib/wind/errorlist_table.c ../heimdal/lib/wind/errorlist_table.h'
851 name
= 'HEIMDAL_NORMALIZE_TABLE',
852 rule
="${PYTHON} '${SRC[0].abspath()}' '${SRC[1].abspath()}' '${SRC[2].abspath()}' '${SRC[1].parent.abspath(env)}'",
853 source
= '../heimdal/lib/wind/gen-normalize.py ../heimdal/lib/wind/UnicodeData.txt ../heimdal/lib/wind/CompositionExclusions-3.2.0.txt',
854 target
= '../heimdal/lib/wind/normalize_table.h ../heimdal/lib/wind/normalize_table.c'
858 name
= 'HEIMDAL_COMBINING_TABLE',
859 rule
="${PYTHON} '${SRC[0].abspath()}' '${SRC[1].abspath()}' '${SRC[1].parent.abspath(env)}'",
860 source
= '../heimdal/lib/wind/gen-combining.py ../heimdal/lib/wind/UnicodeData.txt',
861 target
= '../heimdal/lib/wind/combining_table.h ../heimdal/lib/wind/combining_table.c'
865 name
= 'HEIMDAL_BIDI_TABLE',
866 rule
="${PYTHON} '${SRC[0].abspath()}' '${SRC[1].abspath()}' '${SRC[1].parent.abspath(env)}'",
867 source
= '../heimdal/lib/wind/gen-bidi.py ../heimdal/lib/wind/rfc3454.txt',
868 target
= '../heimdal/lib/wind/bidi_table.h ../heimdal/lib/wind/bidi_table.c'
873 name
= 'HEIMDAL_MAP_TABLE',
874 rule
="${PYTHON} '${SRC[0].abspath()}' '${SRC[2].abspath()}' '${SRC[2].parent.abspath(env)}'",
875 source
= '../heimdal/lib/wind/gen-map.py ../heimdal/lib/wind/stringprep.py ../heimdal/lib/wind/rfc3454.txt',
876 target
= '../heimdal/lib/wind/map_table.h ../heimdal/lib/wind/map_table.c'
879 HEIMDAL_LIBRARY('wind',
880 'lib/wind/wind_err.c lib/wind/stringprep.c lib/wind/errorlist.c lib/wind/errorlist_table.c lib/wind/normalize.c lib/wind/normalize_table.c lib/wind/combining.c lib/wind/combining_table.c lib/wind/utf8.c lib/wind/bidi.c lib/wind/bidi_table.c lib/wind/ldap.c lib/wind/map.c lib/wind/map_table.c',
881 includes
='../heimdal/lib/wind',
882 deps
='roken com_err',
884 version_script
='lib/wind/version-script.map',
887 if not bld
.CONFIG_SET('USING_SYSTEM_COM_ERR'):
888 HEIMDAL_LIBRARY('com_err',
889 'lib/com_err/com_err.c lib/com_err/error.c',
890 includes
='../heimdal/lib/com_err',
891 deps
='roken samba_intl',
893 version_script
='lib/com_err/version-script.map',
896 HEIMDAL_SUBSYSTEM('HEIMDAL_VERS_HOSTCC',
897 'lib/vers/print_version.c ../heimdal_build/version.c',
898 group
='hostcc_base_build_main',
899 deps
='LIBREPLACE_HOSTCC ROKEN_HOSTCC',
900 use_global_deps
=False,
903 HEIMDAL_SUBSYSTEM('HEIMDAL_VERS',
904 'lib/vers/print_version.c ../heimdal_build/version.c',
905 deps
='roken replace')
908 if not bld
.CONFIG_SET('USING_SYSTEM_ASN1_COMPILE'):
909 # here is the asn1 compiler build rule
910 HEIMDAL_BINARY('asn1_compile',
911 'lib/asn1/gen.c lib/asn1/gen_copy.c '
912 'lib/asn1/gen_decode.c lib/asn1/gen_encode.c lib/asn1/gen_free.c '
913 'lib/asn1/gen_glue.c lib/asn1/gen_length.c lib/asn1/gen_seq.c '
914 'lib/asn1/gen_template.c lib/asn1/hash.c lib/asn1/symbol.c '
915 'lib/asn1/asn1parse.y lib/asn1/lex.l lib/asn1/main.c',
917 use_global_deps
=False,
918 includes
='../heimdal/lib/asn1',
919 group
='hostcc_build_main',
920 deps
='ROKEN_HOSTCC LIBREPLACE_HOSTCC HEIMDAL_VERS_HOSTCC',
923 bld
.env
['ASN1_COMPILE'] = os
.path
.join(bld
.bldnode
.parent
.abspath(), 'asn1_compile')
926 if not bld
.CONFIG_SET('USING_SYSTEM_COMPILE_ET'):
927 HEIMDAL_BINARY('compile_et',
928 'lib/com_err/parse.y lib/com_err/lex.l lib/com_err/compile_et.c',
930 use_global_deps
=False,
931 includes
='../heimdal/lib/com_err',
932 group
='hostcc_base_build_main',
933 deps
='ROKEN_HOSTCC LIBREPLACE_HOSTCC HEIMDAL_VERS_HOSTCC',
936 bld
.env
['COMPILE_ET'] = os
.path
.join(bld
.bldnode
.parent
.abspath(), 'compile_et')
938 HEIMDAL_BINARY('samba4kinit',
940 deps
='krb5 heimntlm roken HEIMDAL_VERS hcrypto',
944 HEIMDAL_BINARY('samba4kgetcred',
946 deps
='krb5 heimntlm roken HEIMDAL_VERS hcrypto asn1',
950 HEIMDAL_BINARY('samba4kpasswd',
952 deps
='krb5 heimntlm roken HEIMDAL_VERS hcrypto',
956 # Alias subsystem to allow common kerberos code that will
957 # otherwise link against MIT's gssapi_krb5 and k5crypto
959 # Note: that we also need this if we use system heimdal libraries
960 HEIMDAL_SUBSYSTEM('gssapi_krb5', '', deps
='gssapi')
961 HEIMDAL_SUBSYSTEM('k5crypto', '', deps
='krb5')