
This is the second of two commits in a series that must be picked together. This series of two commits moves parts of lib/krb5/ infrastructure functionality to lib/base/, leaving behind wrappers. Some parts of libkrb5 are entirely generic or easily made so, and could be useful in various parts of Heimdal that are not specific to the krb5 API, such as: - lib/gssapi/ (especially since the integration of NegoEx) - lib/hx509/ - bx509d (which should really move out of kdc/) For the above we need to move these bits of lib/krb5/: - lib/krb5/config_file.c (all of it, leaving forwardings behind) - lib/krb5/config_reg.c (all of it) - lib/krb5/plugin.c (all of it, leaving forwardings behind) - lib/krb5/log.c (all of it, ditto) - lib/krb5/heim_err.et (all of it) And because of those two, these too must also move: - lib/krb5/expand_path.c (all of it, leaving forwardings behind) - lib/krb5/warn.c (just the warning functions, ditto) The changes to the moved files are mostly quite straightforward and are best reviewed with --word-diff=color. We're also creating a heim_context and a heim API to go with it. But it's as thin as possible, with as little state as necessary to enable this move. Functions for dealing with error messages use callbacks. Moving plugin.c does have one knock-on effect on all users of the old krb5 plugin API (which remains), which is that a global search and replace of struct krb5_plugin_data to struct heim_plugin_data was needed, though the layout and size of that structure doesn't change, so the ABI doesn't either. As well, we now build lib/vers/ and lib/com_err/ before lib/base/ so as to be able to move lib/krb5/heim_err.et to lib/base/ so that we can make use of HEIM_ERR_* in lib/base/, specifically in the files that moved. Once this is all done we'll be able to use config files and plugins in lib/hx509/, we'll be able to move bx509d out of kdc/, and so on. Most if not all of the new functions in lib/base/ are Heimdal-private, thus calling conventions for them are not declared. Status: - builds and passes CIs (Travis, Appveyor) - ran make check-valgrind and no new leaks or other memory errors - ready for review HOW TO REVIEW: $ # Review file moves: $ git log --stat -n1 HEAD^ $ $ # Review changes to moved files using --word-diff=color $ git log -p -b -w --word-diff=color HEAD^..HEAD \ lib/base/config_file.c \ lib/base/config_reg.c \ lib/base/expand_path.c \ lib/base/warn.c \ lib/krb5/config_file.c \ lib/krb5/config_reg.c \ lib/krb5/expand_path.c \ lib/krb5/warn.c $ $ # Review the whole thing, possibly adding -b and/or -w, and $ # maybe --word-diff=color: $ git log -p origin/master..HEAD $ git log -p -b -w origin/master..HEAD $ git log -p -b -w --word-diff=color origin/master..HEAD TBD (future commits): - make lib/gssapi use the new heimbase functions - move kx509/bx509d common code to lib/hx509/ or other approp. location - move bx509d out of kdc/
Building Heimdal for Windows
- Introduction
Heimdal can be built and run on Windows XP or later. Older OSs may work, but have not been tested.
- Prerequisites
-
Microsoft Visual C++ Compiler: Heimdal has been tested with Microsoft Visual C/C++ compiler version 15.x. This corresponds to Microsoft Visual Studio version 2008. The compiler and tools that are included with Microsoft Windows SDK versions 6.1 and later can also be used for building Heimdal. If you have a recent Windows SDK, then you already have a compatible compiler.
-
Microsoft Windows SDK: Heimdal has been tested with Microsoft Windows SDK version 6.1 and 7.0.
-
Microsoft HTML Help Compiler: Needed for building documentation.
-
Perl: A recent version of Perl. Tested with ActiveState ActivePerl.
-
Python: Tested with Python 2.5 and 2.6.
-
WiX: The Windows Installer XML toolkit (WiX) Version 3.x is used to build the installers.
-
Cygwin: The Heimdal build system requires a number of additional tools:
awk
,yacc
,lex
,cmp
,sed
,makeinfo
,sh
(Required for running tests). These can be found in the Cygwin distribution. MinGW or GnuWin32 may also be used instead of Cygwin. However, a recent build ofmakeinfo
is required for building the documentation. Cygwin makeinfo 4.7 is known to work. -
Certificate for code-signing: The Heimdal build produces a number of Assemblies that should be signed if they are to be installed via Windows Installer. In addition, all executable binaries produced by the build including installers can be signed and timestamped if a code-signing certificate is available. As of 1 January 2016 Windows 7 and above require the use of sha256 signatures. The signtool.exe provided with Windows SDK 8.1 or later must be used.
- Setting up the build environment
-
Start with a Windows SDK or Visual Studio build environment. The target platform, OS and build type (debug / release) is determined by the build environment.
E.g.: If you are using the Windows SDK, you can use the
SetEnv.Cmd
script to set up a build environment targetting 64-bit Windows XP or later with:SetEnv.Cmd /xp /x64 /Debug
The build will produce debug binaries. If you specify
SetEnv.Cmd /xp /x64 /Release
the build will produce release binaries.
-
Add any directories to
PATH
as necessary for tools required by the build to be found. The build scripts will check for build tools at the start of the build and will indicate which ones are missing. In general, adding Perl, Python, WiX, HTML Help Compiler and Cygwin binary directories to the path should be sufficient. -
Set up environment variables for code signing. This can be done in one of two ways. By specifying options for
signtool
or by specifying the code-signing command directly. To usesigntool
, defineSIGNTOOL_C
and optionally,SIGNTOOL_O
andSIGNTOOL_T
.-
SIGNTOOL_C
: Certificate selection and private key selection options forsigntool
.E.g.:
set SIGNTOOL_C=/f c:\mycerts\codesign.pfx
set SIGNTOOL_C=/n "Certificate Subject Name" /a
-
SIGNTOOL_O
: Signing parameter options forsigntool
. Optional.E.g.:
set SIGNTOOL_O=/du http://example.com/myheimdal
-
SIGNTOOL_T
: SHA1 Timestamp URL forsigntool
. If not specified, defaults tohttp://timestamp.digicert.com
. -
SIGNTOOL_T_SHA256
: SHA256 Timestamp URL forsigntool
. If not specified, defaults tohttp://timestamp.digicert.com
. -
CODESIGN
: SHA1 Code signer command. This environment variable, if defined, overrides theSIGNTOOL_*
variables. It should be defined to be a command that takes one parameter: the binary to be signed. -
CODESIGN_SHA256
: SHA256 Code signer command. This environment variable, if defined, applies a second SHA256 signature to the parameter. It should be defined to be a command that takes one parameter: the binary to be signed.E.g.:
set CODESIGN=c:\scripts\mycodesigner.cmd
set CODESIGN_SHA256=c:\scripts\mycodesigner256.cmd
-
-
Define the code sign public key token. This is contained in the environment variable
CODESIGN_PKT
and is needed to build the Heimdal assemblies. If you are not using a code-sign certificate, set this to0000000000000000
.You can use the
pktextract
tool to determine the public key token corresponding to your code signing certificate as follows (assuming your code signing certificate is inc:\mycerts\codesign.cer
:pktextract c:\mycerts\codesign.cer
The above command will output the certificate name, key size and the public key token. Set the
CODESIGN_PKT
variable to thepublicKeyToken
value (excluding quotes).E.g.:
set CODESIGN_PKT=abcdef0123456789
- Running the build
Change the current directory to the root of the Heimdal source tree and run:
nmake /f NTMakefile
This should build the binaries, assemblies and the installers.
The build can also be invoked from any subdirectory that contains an
NTMakefile
using the same command. Keep in mind that there are
inter-dependencies between directories and therefore it is recommended
that a full build be invoked from the root of the source tree.
Tests can be invoked, after a full build, by executing:
nmake /f NTMakefile test
The build tree can be cleaned with:
nmake /f NTMakefile clean
It is recommended that both AMD64 and X86 builds take place on the same machine. This permits a multi-platform installer package to be built. First build for X86 and then build AMD64
nmake /f NTMakefile MULTIPLATFORM_INSTALLER=1
The build must be executed under cmd.exe.