+4200. [cleanup] win32: update BINDinstall to be BIND release
+ independent. [RT #38915]
+
4199. [protocol] Add support for NINFO, RKEY, TA.
[RT #40545] [RT #40547] [RT #40563]
#include "AccountInfo.h"
#include "versioninfo.h"
+#include <fstream>
+#include <iostream>
+#include <string>
+#include <vector>
+
#include <config.h>
+#undef open
+
#define MAX_GROUPS 100
#define MAX_PRIVS 50
enum FileDestinations {TargetDir, BinDir, EtcDir, WinSystem};
enum FileImportance {Trivial, Normal, Critical};
- char *filename;
+ char filename[128];
int destination;
int importance;
BOOL checkVer;
BOOL withTools;
} FileData;
+#if no_longer_used
+
const FileData installFiles[] =
{
#ifdef BINARIES_INSTALL
{NULL, -1, -1}
};
+#else
+
+typedef std::vector<FileData> FileDatas;
+FileDatas installFiles;
+BOOL forwin64 = FALSE;
+BOOL runvcredist = FALSE;
+
+#endif
+
/////////////////////////////////////////////////////////////////////////////
// CBINDInstallDlg dialog
CBINDInstallDlg::CBINDInstallDlg(CWnd* pParent /*=NULL*/)
: CDialog(CBINDInstallDlg::IDD, pParent) {
char winsys[MAX_PATH];
- char progfiles[MAX_PATH];
//{{AFX_DATA_INIT(CBINDInstallDlg)
m_targetDir = _T("");
GetSystemDirectory(winsys, MAX_PATH);
m_winSysDir = winsys;
-#ifndef _WIN64
- SHGetFolderPath(NULL, CSIDL_FLAG_CREATE|CSIDL_PROGRAM_FILESX86,
- NULL, SHGFP_TYPE_CURRENT, progfiles);
-#else
- SHGetFolderPath(NULL, CSIDL_FLAG_CREATE|CSIDL_PROGRAM_FILES,
- NULL, SHGFP_TYPE_CURRENT, progfiles);
-#endif
+ m_defaultDir = "notyetknown";
- m_defaultDir = progfiles;
- m_defaultDir += "\\ISC BIND 9";
m_installed = FALSE;
m_accountExists = FALSE;
m_accountUsed = FALSE;
CString Dirname(dirname);
m_currentDir = Dirname;
+ ReadInstallFlags();
+ char progfiles[MAX_PATH];
+ int id_program_files;
+ if (forwin64)
+ id_program_files = CSIDL_PROGRAM_FILES;
+ else
+ id_program_files = CSIDL_PROGRAM_FILESX86;
+ SHGetFolderPath(NULL, CSIDL_FLAG_CREATE|id_program_files,
+ NULL, SHGFP_TYPE_CURRENT, progfiles);
+
+ m_defaultDir = progfiles;
+ m_defaultDir += "\\ISC BIND 9";
+
CVersionInfo bindInst(filename);
if(bindInst.IsValid())
m_version.Format(IDS_VERSION, bindInst.GetFileVersionString());
UninstallTags();
UnregisterMessages(TRUE);
UnregisterService(TRUE);
+ ReadInstallFileList();
DeleteFiles(TRUE);
if (m_keepFiles == FALSE)
RemoveDirs(TRUE);
* User pressed the install button. Make it go.
*/
void CBINDInstallDlg::OnInstall() {
-#if _MSC_VER >= 1400
- char Vcredist_x86[MAX_PATH];
-#endif
BOOL success = FALSE;
int oldlen;
ProgramGroup(FALSE);
-#if _MSC_VER >= 1400
/*
* Install Visual Studio libraries. As per:
* http://blogs.msdn.com/astebner/archive/2006/08/23/715755.aspx
* Enclose full path to Vcredist_x86.exe in quotes as
* m_currentDir may contain spaces.
*/
-#ifndef _WIN64
- sprintf(Vcredist_x86, "\"%s\\Vcredist_x86.exe\"",
- (LPCTSTR) m_currentDir);
-#else
- sprintf(Vcredist_x86, "\"%s\\Vcredist_x64.exe\"",
- (LPCTSTR) m_currentDir);
-#endif
- system(Vcredist_x86);
-#endif
+ if (runvcredist) {
+ char Vcredist_x86[MAX_PATH];
+ if (forwin64)
+ sprintf(Vcredist_x86, "\"%s\\Vcredist_x64.exe\"",
+ (LPCTSTR) m_currentDir);
+ else
+ sprintf(Vcredist_x86, "\"%s\\Vcredist_x86.exe\"",
+ (LPCTSTR) m_currentDir);
+ system(Vcredist_x86);
+ }
try {
CreateDirs();
+ ReadInstallFileList();
CopyFiles();
if (!m_toolsOnly)
RegisterService();
SetItemStatus(IDC_CREATE_DIR, TRUE);
}
+// InstallFlags: runvcredist and forwin64 options
+void CBINDInstallDlg::ReadInstallFlags() {
+ std::ifstream ff(m_currentDir + "\\InstallFlags");
+ if (!ff) {
+ throw(Exception(IDS_FILE_BAD, "InstallFlags", "can't open"));
+ }
+ while (!ff.eof()) {
+ std::string line;
+ getline(ff, line);
+ if (line.compare("runvcredist") == 0)
+ runvcredist = TRUE;
+ else if (line.compare("forwin64") == 0)
+ forwin64 = TRUE;
+ }
+}
+
+// InstallFiles: {filename-divt}*
+// destination: TBEW
+// importance: TNC
+// checkVer and withTools: TF (boolean)
+void CBINDInstallDlg::ReadInstallFileList() {
+ std::ifstream fl(m_currentDir + "\\InstallFiles");
+ if (!fl) {
+ throw(Exception(IDS_FILE_BAD, "InstallFiles", "can't open"));
+ }
+ while (!fl.eof()) {
+ std::string line;
+ getline(fl, line);
+ if (line.empty())
+ continue;
+ if (line[0] == '#')
+ continue;
+ // zip -l adds spurious \r: remove trailing space chars
+ size_t finish = line.find_last_not_of(" \t\r\n\t\v");
+ if ((finish != std::string::npos) &&
+ (finish + 1 != line.size())) {
+ line.erase(finish + 1);
+ }
+ size_t flags = line.find_last_of('-');
+ if ((flags == std::string::npos) ||
+ (flags + 5 != line.size()))
+ goto bad;
+ std::string file = line.substr(0, flags);
+ if (file.empty() || (file.size() > 127))
+ goto bad;
+ FileData entry;
+ memmove(entry.filename, file.c_str(), file.size() + 1);
+ switch (line[flags + 1]) {
+ case 'T':
+ entry.destination = FileData::TargetDir;
+ break;
+ case 'B':
+ entry.destination = FileData::BinDir;
+ break;
+ case 'E':
+ entry.destination = FileData::EtcDir;
+ break;
+ case 'W':
+ entry.destination = FileData::WinSystem;
+ break;
+ default:
+ goto bad;
+ }
+ switch (line[flags + 2]) {
+ case 'T':
+ entry.importance = FileData::Trivial;
+ break;
+ case 'N':
+ entry.importance = FileData::Normal;
+ break;
+ case 'C':
+ entry.importance = FileData::Critical;
+ break;
+ default:
+ goto bad;
+ }
+ switch (line[flags + 3]) {
+ case 'T':
+ entry.checkVer = TRUE;
+ break;
+ case 'F':
+ entry.checkVer = FALSE;
+ break;
+ default:
+ goto bad;
+ }
+ switch (line[flags + 4]) {
+ case 'T':
+ entry.withTools = TRUE;
+ break;
+ case 'F':
+ entry.withTools = FALSE;
+ break;
+ default:
+ goto bad;
+ }
+ installFiles.push_back(entry);
+ }
+ return;
+
+bad:
+ throw(Exception(IDS_FILE_BAD, "InstallFiles", "syntax error"));
+}
+
void CBINDInstallDlg::CopyFiles() {
CString destFile;
- for (int i = 0; installFiles[i].filename; i++) {
- if (m_toolsOnly && !installFiles[i].withTools)
+ for (FileDatas::iterator fd = installFiles.begin();
+ fd != installFiles.end(); ++fd) {
+ if (m_toolsOnly && !fd->withTools)
continue;
- SetCurrent(IDS_COPY_FILE, installFiles[i].filename);
+ SetCurrent(IDS_COPY_FILE, fd->filename);
- destFile = DestDir(installFiles[i].destination) + "\\" +
- installFiles[i].filename;
- CString filespec = m_currentDir + "\\" + installFiles[i].filename;
+ destFile = DestDir(fd->destination) + "\\" + fd->filename;
+ CString filespec = m_currentDir + "\\" + fd->filename;
CVersionInfo bindFile(destFile);
CVersionInfo origFile(filespec);
- if (!origFile.IsValid() && installFiles[i].checkVer) {
+ if (!origFile.IsValid() && fd->checkVer) {
if (MsgBox(IDS_FILE_BAD, MB_YESNO,
- installFiles[i].filename) == IDNO)
+ fd->filename) == IDNO)
throw(Exception(IDS_ERR_COPY_FILE,
- installFiles[i].filename,
- GetErrMessage()));
+ fd->filename,
+ GetErrMessage()));
}
try {
bindFile.CopyFileNoVersion(origFile);
}
catch(...) {
- if (installFiles[i].importance != FileData::Trivial) {
- if (installFiles[i].importance ==
- FileData::Critical ||
- MsgBox(IDS_ERR_NONCRIT_FILE, MB_YESNO,
- installFiles[i].filename,
- GetErrMessage()) == IDNO)
+ if (fd->importance != FileData::Trivial) {
+ if (fd->importance == FileData::Critical ||
+ MsgBox(IDS_ERR_NONCRIT_FILE, MB_YESNO,
+ fd->filename,
+ GetErrMessage()) == IDNO)
{
SetItemStatus(IDC_COPY_FILE, FALSE);
throw(Exception(IDS_ERR_COPY_FILE,
- installFiles[i].filename,
- GetErrMessage()));
+ fd->filename,
+ GetErrMessage()));
}
}
}
void CBINDInstallDlg::DeleteFiles(BOOL uninstall) {
CString destFile;
- for (int i = 0; installFiles[i].filename; i++) {
- if (installFiles[i].checkVer)
+ for (FileDatas::iterator fd = installFiles.begin();
+ fd != installFiles.end(); ++fd) {
+ if (fd->checkVer)
continue;
- destFile = DestDir(installFiles[i].destination) + "\\" +
- installFiles[i].filename;
+ destFile = DestDir(fd->destination) + "\\" + fd->filename;
if (uninstall)
- SetCurrent(IDS_DELETE_FILE, installFiles[i].filename);
+ SetCurrent(IDS_DELETE_FILE, fd->filename);
DeleteFile(destFile);
}
void CreateDirs();
void RemoveDirs(BOOL uninstall);
+ void ReadInstallFlags();
+ void ReadInstallFileList();
+
void CopyFiles();
void DeleteFiles(BOOL uninstall);
</listitem>
</itemizedlist>
</sect2>
+ <sect2 id="relnotes_port">
+ <title>Porting Changes</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ The Microsoft Windows install tool
+ <command>BINDInstall.exe</command> which requires a
+ non-free version of Visual Studio to be built, now uses two
+ files (lists of flags and files) created by the Configure
+ perl script with all the needed information which were
+ previously compiled in the binary. Read
+ <filename>win32utils/build.txt</filename> for more details.
+ [RT #38915]
+ </para>
+ </listitem>
+ </itemizedlist>
+ </sect2>
<sect2 id="relnotes_bugs">
<title>Bug Fixes</title>
<itemizedlist>
copy /Y @VCREDIST_PATH@ ..\Build\Debug\
+echo Copying install files (flags and file list).
+
+copy InstallFlags ..\Build\Debug\
+copy InstallFiles ..\Build\Debug\
+
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
copy /Y @VCREDIST_PATH@ ..\Build\Release\
+echo Copying install files (flags and file list).
+
+copy InstallFlags ..\Build\Release\
+copy InstallFiles ..\Build\Release\
+
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
close SOUT;
}
+# Build install files
+
+sub makeinstallfile {
+ open FOUT, ">InstallFlags" || die "cannot open InstallFlags: $!\n";
+ print FOUT "# Flags for BINDInstall\n";
+ if ($msc_ver >= 1400) {
+ print FOUT "runvcredist\n";
+ }
+ if ($want_x64 eq "yes") {
+ print FOUT "forwin64\n";
+ }
+ close FOUT;
+
+ open LOUT, ">InstallFiles" || die "cannot open InstallFiles: $!\n";
+ print LOUT "# File list for BINDInstall\n";
+ if ($msc_ver < 1400) {
+ if ($msc_ver >= 1310) {
+ print LOUT "mfc71.dll-WCTT\n";
+ print LOUT "msvcr71.dll-WCTT\n";
+ } elsif (($msc_ver > 1200) && ($msc_ver < 1310)) {
+ print LOUT "mfc70.dll-WCTT\n";
+ print LOUT "msvcr70.dll-WCTT\n";
+ }
+ }
+ print LOUT "bindevt.dll-BNFT\n";
+ print LOUT "libbind9.dll-BCFT\n";
+ print LOUT "libisc.dll-BCFT\n";
+ print LOUT "libisccfg.dll-BCFT\n";
+ print LOUT "libisccc.dll-BCFT\n";
+ print LOUT "libdns.dll-BCFT\n";
+ print LOUT "liblwres.dll-BCFT\n";
+ print LOUT "libirs.dll-BCFT\n";
+ if ($use_openssl eq "yes") {
+ print LOUT "libeay32.dll-BCFT\n";
+ }
+ if ($use_libxml2 eq "yes") {
+ print LOUT "libxml2.dll-BCFT\n";
+ }
+ if ($use_gssapi eq "yes") {
+ if ($want_x64 eq "yes") {
+ print LOUT "gssapi64.dll-BCFT\n";
+ print LOUT "krb5_64.dll-BCFT\n";
+ } else {
+ print LOUT "gssapi32.dll-BCFT\n";
+ print LOUT "krb5_32.dll-BCFT\n";
+ }
+ }
+ if ($use_geoip eq "yes") {
+ print LOUT "libgeoip.dll-BCFT\n";
+ }
+ if ($use_idn eq "yes") {
+ print LOUT "idnkit.dll-BCFT\n";
+ print LOUT "iconv.dll-BCFT\n";
+ }
+ print LOUT "named.exe-BCFF\n";
+ print LOUT "nsupdate.exe-BNFT\n";
+ print LOUT "BINDInstall.exe-BNFT\n";
+ print LOUT "InstallFlags-BNFT\n";
+ print LOUT "InstallFiles-BNFT\n";
+ print LOUT "rndc.exe-BNFF\n";
+ print LOUT "dig.exe-BNFT\n";
+ print LOUT "host.exe-BNFT\n";
+ print LOUT "nslookup.exe-BNFT\n";
+ print LOUT "delv.exe-BNFT\n";
+ print LOUT "arpaname.exe-BNFT\n";
+ print LOUT "nsec3hash.exe-BNFF\n";
+ print LOUT "genrandom.exe-BNFF\n";
+ print LOUT "rndc-confgen.exe-BNFF\n";
+ print LOUT "ddns-confgen.exe-BNFF\n";
+ print LOUT "tsig-keygen.exe-BNFF\n";
+ print LOUT "dnssec-keygen.exe-BNFF\n";
+ print LOUT "dnssec-signzone.exe-BNFF\n";
+ print LOUT "dnssec-dsfromkey.exe-BNFF\n";
+ print LOUT "dnssec-importkey.exe-BNFF\n";
+ print LOUT "dnssec-keyfromlabel.exe-BNFF\n";
+ print LOUT "dnssec-revoke.exe-BNFF\n";
+ print LOUT "dnssec-settime.exe-BNFF\n";
+ print LOUT "dnssec-verify.exe-BNFF\n";
+ print LOUT "named-checkconf.exe-BNFF\n";
+ print LOUT "named-checkzone.exe-BNFF\n";
+ print LOUT "named-compilezone.exe-BNFF\n";
+ print LOUT "named-journalprint.exe-BNFF\n";
+ print LOUT "named-rrchecker.exe-BNFF\n";
+ print LOUT "isc-hmax-fixup.exe-BNFF\n";
+ if ($use_pkcs11 eq "yes") {
+ print LOUT "pkcs11-destroy.exe-BNFF\n";
+ print LOUT "pkcs11-keygen.exe-BNFF\n";
+ print LOUT "pkcs11-list.exe-BNFF\n";
+ print LOUT "pkcs11-tokens.exe-BNFF\n";
+ }
+ if ($use_python eq "yes") {
+ print LOUT "dnssec-checkds.py-BNFF\n";
+ print LOUT "dnssec-coverage.py-BNFF\n";
+ }
+ print LOUT "readme1st.txt-BTFT\n";
+ close LOUT;
+}
+
# Status
if ($verbose) {
makesrcid();
+ makeinstallfile();
+
print "Configured.\n";
} else {
print "add win32 or x64 to commit configuration to build files\n";
-Copyright (C) 2013, 2014 Internet Systems Consortium, Inc. ("ISC")
+Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
See COPYRIGHT in the source root or http://isc.org/copyright.html for terms.
- BIND 9.10 for Win32 Source Build Instructions. 02-Feb-2014
+ BIND 9.10 for Win32 Source Build Instructions. 17-Apr-2015
Building BIND 9.10 on Windows has the following prerequisites:
Download and untar the OpenSSL sources from http://www.openssl.org/.
Extract them at in the same directory in which you extracted the BIND 9
- source: If BIND 9 is in \build\bind-9.10.0, for instance, OpenSSL should
- be in \build\openssl-1.0.1g (subject to version number changes).
+ source: If BIND 9 is in \build\bind-9.10.2, for instance, OpenSSL should
+ be in \build\openssl-1.0.2a (subject to version number changes).
Note: Building OpenSSL requires that you install Perl as it uses it
during its build process. The following commands work as of
- openssl-1.0.1g, but you should check the OpenSSL distribution to see
+ openssl-1.0.2a, but you should check the OpenSSL distribution to see
if the build instructions in the INSTALL.W32 (or INSTALL.W64) file
have changed, in particular for the assembler options:
32-bit builds:
(In an x86 Visual Studio Command Prompt window)
- cd openssl-1.0.1g
+ cd openssl-1.0.2a
perl Configure --prefix=c:\openssl enable-static-engine VC-WIN32
ms\do_ms
nmake /f ms\ntdll.mak
64-bit builds:
(In an x64 Visual Studio Command Prompt window)
- cd openssl-1.0.1g
+ cd openssl-1.0.2a
perl Configure --prefix=c:\openssl64 enable-static-engine VC-WIN64A
ms\do_win64a
nmake /f ms\ntdll.mak
If you wish to use OpenSSL-based PKCS#11 to control a cryptographic
hardware service module, please see "PKCS#11 (Cryptoki) support" in
chapter 4 of the BIND 9 Administrator Reference Guide. You will need to
- apply the patch in bind9\bin\pkcs11\openssl-1.0.1g-patch (this can be
+ apply the patch in bind9\bin\pkcs11\openssl-1.0.2a-patch (this can be
done using the Cygwin 'patch' utility) and add --pk11-libname and
--pk11-flavor to the Configure command above.
+ If you don't have the required assembler (nasm), just add 'no-asm'
+ to the configure arguments.
+
Step 2: Download and build LibXML2
LibXML2 is required to use the statistics channel. If you wish to
Download and untar the libxml2 sources from ftp://xmlsoft.org/libxml2.
Extract them in the same directory in which you extracted the BIND 9
- source: If BIND 9 is in \build\bind-9.10.0, for instance, libxml2 should
- be in \build\libxml2-2.9.1 (subject to version number changes).
+ source: If BIND 9 is in \build\bind-9.10.2, for instance, libxml2 should
+ be in \build\libxml2-2.9.2 (subject to version number changes).
Now build libxml2, and copy the resulting files into the include and lib
directories:
- cd libxml2-2.9.1\win32
+ cd libxml2-2.9.2\win32
cscript configure.js compiler=msvc vcmanifest=yes static=yes \
debug=no iconv=no
nmake /f Makefile.msvc libxml
+ Note some recent distributions show 2 bugs: some files are extracted
+ with no writable rights, cscript tries to open the configure.in file
+ (in the libxml2-2.9.2 directory) when the correct file is configure.ac
+ so raises a 'not found' error.
+
Step 3: Download and build GeoIP
Geographic ("geoip") ACLs require libGeoIP. If you wish to build BIND 9
http://gpsim.sourceforge.net/gpsimWin32/gpsimWin32.html#readline_lib
+ Note: Windows command (cmd.exe) provides an integrated line edition
+ feature so it is not recommended to configure bind with readline.
+
Step 5: Make the redistributable runtime object available
Check that the Microsoft redistributable object (vcredist_x86.exe or
vcredist_x64.exe) is available to the build. The file may be placed
in the directory in which the BIND 9 source was extracted (for
- instance, if BIND 9 is in \build\bind-9.10.0, the redistributable
+ instance, if BIND 9 is in \build\bind-9.10.2, the redistributable
may be placed in \build\vcredist_x86.exe). Or, the path to the file
can be specified via the VCREDIST_PATH environment variable, or via
the "with-vcredist=PATH" option to the configuration script (see
From the command prompt, cd to the win32utils directory under
the BIND 9 root:
- cd bind-9.10.0\win32utils
+ cd bind-9.10.2\win32utils
In this directory, you can prepare the Windows build by running:
Visual Studio. The other BIND 9 libraries and applications do not have
this dependency.
+ The very last version of BINDInstall uses two files created by
+ the Configure perl script:
+ - InstallFlags: 32/64 bit build, and/or should the redistributable
+ object be run.
+ - InstallFiles: the list of files to install with for each files
+ 4 flags (destination, importance, check version and part of tools).
+ The idea is to be able to use any BINDInstall.exe binary so
+ a non-free version of Visual Studio is no longer required.
+
Please report bugs, whether in the process of building the application
or in BIND 9 itself, to bind9-bugs@isc.org.
copy /Y @VCREDIST_PATH@ ..\..\Build\Release\
copy /Y @VCREDIST_PATH@ ..\..\Build\Debug\
+echo Copying install files (flags and file list).
+
+copy ..\InstallFlags ..\..\Build\Release\
+copy ..\InstallFlags ..\..\Build\Debug\
+copy ..\InstallFiles ..\..\Build\Release\
+copy ..\InstallFiles ..\..\Build\Debug\
+
@IF TESTS
cd ..\..\bin\tests\dst
copy "Kdh.+002+18602.key.in" "Kdh.+002+18602.key"