diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook index 26239ea7a3..ef9a68ba8d 100644 --- a/bin/dig/dig.docbook +++ b/bin/dig/dig.docbook @@ -1,6 +1,6 @@ - + @@ -99,9 +99,9 @@ NS query for "." (the root). -It is possible to set per user defaults for dig via +It is possible to set per-user defaults for dig via ${HOME}/.digrc. This file is read and any options in it -are applied before the command line arguements. +are applied before the command line arguments. @@ -204,9 +204,10 @@ When this option is used, there is no need to provide the automatically performs a lookup for a name like 11.12.13.10.in-addr.arpa and sets the query type and class to PTR and IN respectively. By default, IPv6 addresses are -looked up using the IP6.ARPA domain and binary labels as defined in -RFC2874. To use the older RFC1886 method using the IP6.INT domain and -"nibble" labels, specify the (nibble) option. +looked up using nibble format under the IP6.ARPA domain. +To use the older RFC1886 method using the IP6.INT domain +specify the option. Bit string labels (RFC2874) +are now experimental and are not attempted. @@ -319,7 +320,7 @@ requests the server to not perform DNSSEC validation of responses. Display [do not display] the CLASS when printing the record. - + @@ -436,10 +437,10 @@ in a query timeout of 1 second being applied. Sets the number of times to try UDP queries to server to T instead of the default, 3. If T is less than or equal to zero, the number of -retries is silently rounded up to 1. +tries is silently rounded up to 1. - + Sets the number of times to retry UDP queries to server to T instead of the default, 2. Unlike diff --git a/bin/tests/system/dnssec/clean.sh b/bin/tests/system/dnssec/clean.sh index ddcc32b65e..dce2bb79e3 100644 --- a/bin/tests/system/dnssec/clean.sh +++ b/bin/tests/system/dnssec/clean.sh @@ -15,11 +15,12 @@ # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# $Id: clean.sh,v 1.10 2001/01/09 21:42:43 bwelling Exp $ +# $Id: clean.sh,v 1.10.12.1 2003/10/21 05:56:38 marka Exp $ -rm -f */K* */keyset-* */signedkey-* */*.signed */trusted.conf +rm -f */K* */keyset-* */signedkey-* */*.signed */trusted.conf */tmp* rm -f ns1/root.db ns2/example.db ns3/secure.example.db -rm -f ns3/unsecure.example.db ns3/bogus.example.db +rm -f ns3/unsecure.example.db ns3/bogus.example.db ns3/keyless.example.db +rm -f ns3/dynamic.example.db ns3/dynamic.example.db.signed.jnl rm -f dig.out.* rm -f random.data diff --git a/bin/tests/system/xfer/ns2/.cvsignore b/bin/tests/system/xfer/ns2/.cvsignore index 6af68aad15..188dad9ed8 100644 --- a/bin/tests/system/xfer/ns2/.cvsignore +++ b/bin/tests/system/xfer/ns2/.cvsignore @@ -1 +1,4 @@ named.run +example.db +tsigzone.db +example.db.jnl diff --git a/bin/win32/BINDInstall/AccountInfo.cpp b/bin/win32/BINDInstall/AccountInfo.cpp index 52e6482822..21698b335d 100644 --- a/bin/win32/BINDInstall/AccountInfo.cpp +++ b/bin/win32/BINDInstall/AccountInfo.cpp @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: AccountInfo.cpp,v 1.5 2002/08/06 03:35:30 mayer Exp $ */ +/* $Id: AccountInfo.cpp,v 1.5.224.1 2003/10/21 05:56:38 marka Exp $ */ #ifndef UNICODE #define UNICODE diff --git a/bin/win32/BINDInstall/AccountInfo.h b/bin/win32/BINDInstall/AccountInfo.h index fcbab36d0f..af702731e0 100644 --- a/bin/win32/BINDInstall/AccountInfo.h +++ b/bin/win32/BINDInstall/AccountInfo.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: AccountInfo.h,v 1.3 2001/10/05 05:45:50 mayer Exp $ */ +/* $Id: AccountInfo.h,v 1.3.226.1 2003/10/21 05:56:39 marka Exp $ */ #define RTN_OK 0 diff --git a/bin/win32/BINDInstall/BINDInstallDlg.cpp b/bin/win32/BINDInstall/BINDInstallDlg.cpp index e91d8f1dab..cce7319580 100644 --- a/bin/win32/BINDInstall/BINDInstallDlg.cpp +++ b/bin/win32/BINDInstall/BINDInstallDlg.cpp @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: BINDInstallDlg.cpp,v 1.6.2.6.2.2 2003/09/09 03:43:20 marka Exp $ */ +/* $Id: BINDInstallDlg.cpp,v 1.6.2.6.2.3 2003/10/21 05:56:39 marka Exp $ */ /* * Copyright (c) 1999-2000 by Nortel Networks Corporation @@ -59,23 +59,28 @@ #include #include #include +#include #include +#include "AccountInfo.h" #include "versioninfo.h" +#define MAX_GROUPS 100 +#define MAX_PRIVS 50 + #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif -typedef struct _xexception +typedef struct _exception { - _xexception(UINT string, ...); + _exception(UINT string, ...); CString resString; } Exception; -_xexception::_xexception(UINT string, ...) +_exception::_exception(UINT string, ...) { CString format; va_list va; @@ -87,8 +92,7 @@ _xexception::_xexception(UINT string, ...) va_end(va); } -typedef struct _filedata -{ +typedef struct _filedata { enum FileDestinations {TargetDir, BinDir, EtcDir, WinSystem}; enum FileImportance {Trivial, Normal, Critical}; @@ -112,6 +116,7 @@ const FileData installFiles[] = {"mfc70.dll", FileData::WinSystem, FileData::Critical, TRUE}, {"msvcr70.dll", FileData::WinSystem, FileData::Critical, TRUE}, {"bindevt.dll", FileData::WinSystem, FileData::Normal, FALSE}, + {"libbind9.dll", FileData::WinSystem, FileData::Critical, FALSE}, {"libisc.dll", FileData::WinSystem, FileData::Critical, FALSE}, {"libisccfg.dll", FileData::WinSystem, FileData::Critical, FALSE}, {"libisccc.dll", FileData::WinSystem, FileData::Critical, FALSE}, @@ -136,12 +141,12 @@ const FileData installFiles[] = {NULL, -1, -1} }; + ///////////////////////////////////////////////////////////////////////////// // CBINDInstallDlg dialog CBINDInstallDlg::CBINDInstallDlg(CWnd* pParent /*=NULL*/) - : CDialog(CBINDInstallDlg::IDD, pParent) -{ + : CDialog(CBINDInstallDlg::IDD, pParent) { char buf[MAX_PATH]; //{{AFX_DATA_INIT(CBINDInstallDlg) @@ -151,23 +156,36 @@ CBINDInstallDlg::CBINDInstallDlg(CWnd* pParent /*=NULL*/) m_keepFiles = FALSE; m_current = _T(""); m_startOnInstall = FALSE; + m_accountName = _T(""); + m_accountPassword = _T(""); + m_accountName = _T(""); //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); - m_reboot = FALSE; GetSystemDirectory(buf, MAX_PATH); m_winSysDir = buf; m_defaultDir = buf; m_defaultDir += "\\dns"; + m_installed = FALSE; + m_accountExists = FALSE; + m_accountUsed = FALSE; + m_serviceExists = TRUE; + GetCurrentServiceAccountName(); + m_currentAccount = m_accountName; + if (m_accountName == "") { + m_accountName = "named"; + } } -void CBINDInstallDlg::DoDataExchange(CDataExchange* pDX) -{ +void CBINDInstallDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CBINDInstallDlg) DDX_Text(pDX, IDC_TARGETDIR, m_targetDir); DDX_Text(pDX, IDC_VERSION, m_version); + DDX_Text(pDX, IDC_ACCOUNT_NAME, m_accountName); + DDX_Text(pDX, IDC_ACCOUNT_PASSWORD, m_accountPassword); + DDX_Text(pDX, IDC_ACCOUNT_PASSWORD_CONFIRM, m_accountPasswordConfirm); DDX_Check(pDX, IDC_AUTO_START, m_autoStart); DDX_Check(pDX, IDC_KEEP_FILES, m_keepFiles); DDX_Text(pDX, IDC_CURRENT, m_current); @@ -189,8 +207,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CBINDInstallDlg message handlers -BOOL CBINDInstallDlg::OnInitDialog() -{ +BOOL CBINDInstallDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically @@ -208,7 +225,6 @@ BOOL CBINDInstallDlg::OnInitDialog() dirname[index] = '\0'; CString Dirname(dirname); m_currentDir = Dirname; - CVersionInfo bindInst(filename); if(bindInst.IsValid()) @@ -223,12 +239,14 @@ BOOL CBINDInstallDlg::OnInitDialog() m_startOnInstall = CheckBINDService(); /* See if we are installed already */ - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, BIND_SUBKEY, 0, KEY_READ, &hKey) == ERROR_SUCCESS) - { + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, BIND_SUBKEY, 0, KEY_READ, &hKey) + == ERROR_SUCCESS) { + m_installed = TRUE; memset(buf, 0, MAX_PATH); // Get the install directory - if(RegQueryValueEx(hKey, "InstallDir", NULL, NULL, (LPBYTE)buf, &dwBufLen) == ERROR_SUCCESS) - if(strcmp(buf, "")) + if (RegQueryValueEx(hKey, "InstallDir", NULL, NULL, (LPBYTE)buf, + &dwBufLen) == ERROR_SUCCESS) + if (strcmp(buf, "")) m_defaultDir = buf; RegCloseKey(hKey); @@ -241,17 +259,17 @@ BOOL CBINDInstallDlg::OnInitDialog() UpdateData(FALSE); - return(TRUE); // return(TRUE unless you set the focus to a control + return (TRUE); /* return(TRUE) unless you set the focus to a control */ } -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. +/* + * If you add a minimize button to your dialog, you will need the code below + * to draw the icon. For MFC applications using the document/view model, + * this is automatically done for you by the framework. + */ -void CBINDInstallDlg::OnPaint() -{ - if (IsIconic()) - { +void CBINDInstallDlg::OnPaint() { + if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); @@ -267,26 +285,22 @@ void CBINDInstallDlg::OnPaint() // Draw the icon dc.DrawIcon(x, y, m_hIcon); } - else - { + else { CDialog::OnPaint(); } } // The system calls this to obtain the cursor to display while the user drags // the minimized window. -HCURSOR CBINDInstallDlg::OnQueryDragIcon() -{ +HCURSOR CBINDInstallDlg::OnQueryDragIcon() { return((HCURSOR)m_hIcon); } -void CBINDInstallDlg::OnBrowse() -{ +void CBINDInstallDlg::OnBrowse() { CDirBrowse browse; - if(browse.DoModal() == IDOK) - { + if (browse.DoModal() == IDOK) { //m_targetDir = browse.m_selectedDir; UpdateData(FALSE); } @@ -295,44 +309,40 @@ void CBINDInstallDlg::OnBrowse() /* * User pressed the exit button */ -void CBINDInstallDlg::OnExit() -{ +void CBINDInstallDlg::OnExit() { EndDialog(0); } /* * User pressed the uninstall button. Make it go. */ -void CBINDInstallDlg::OnUninstall() -{ +void CBINDInstallDlg::OnUninstall() { UpdateData(); - if(MsgBox(IDS_UNINSTALL, MB_YESNO) == IDYES) - { - if(CheckBINDService()) + if (MsgBox(IDS_UNINSTALL, MB_YESNO) == IDYES) { + if (CheckBINDService()) StopBINDService(); - SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if(!hSCManager) - { + HANDLE hSCManager = OpenSCManager(NULL, NULL, + SC_MANAGER_ALL_ACCESS); + if (!hSCManager) { MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage()); return; } - SC_HANDLE hService = OpenService(hSCManager, BIND_SERVICE_NAME, SERVICE_ALL_ACCESS); - if(!hService && GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST) - { + HANDLE hService = OpenService(hSCManager, BIND_SERVICE_NAME, + SERVICE_ALL_ACCESS); + if (!hService && GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST){ MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage()); return; } SERVICE_STATUS ss; QueryServiceStatus(hService, &ss); - if(ss.dwCurrentState == SERVICE_RUNNING) - { - BOOL rc = ControlService(hService, SERVICE_CONTROL_STOP, &ss); - if(rc == FALSE || ss.dwCurrentState != SERVICE_STOPPED) - { + if (ss.dwCurrentState == SERVICE_RUNNING) { + BOOL rc = ControlService(hService, + SERVICE_CONTROL_STOP, &ss); + if (rc == FALSE || ss.dwCurrentState != SERVICE_STOPPED) { MsgBox(IDS_ERR_STOP_SERVICE, GetErrMessage()); return; } @@ -349,7 +359,7 @@ void CBINDInstallDlg::OnUninstall() UnregisterMessages(TRUE); UnregisterService(TRUE); DeleteFiles(TRUE); - if(m_keepFiles == FALSE) + if (m_keepFiles == FALSE) RemoveDirs(TRUE); else GetDlgItem(IDC_CREATE_DIR)->SetWindowText("Not Removed"); @@ -370,39 +380,64 @@ void CBINDInstallDlg::OnUninstall() /* * User pressed the install button. Make it go. */ -void CBINDInstallDlg::OnInstall() -{ +void CBINDInstallDlg::OnInstall() { BOOL success = FALSE; - if(CheckBINDService()) + if (CheckBINDService()) StopBINDService(); InstallTags(); UpdateData(); - // Directories + /* Check that the Passwords entered match */ + if (m_accountPassword != m_accountPasswordConfirm) { + MsgBox(IDS_ERR_PASSWORD); + return; + } + + /* Check the entered account name */ + if (ValidateServiceAccount() == FALSE) + return; + + + /* For Registration we need to know if account was changed */ + if(m_accountName != m_currentAccount) + m_accountUsed = FALSE; + + /* Directories */ m_etcDir = m_targetDir + "\\etc"; m_binDir = m_targetDir + "\\bin"; - if(m_defaultDir != m_targetDir) - { - if(GetFileAttributes(m_targetDir) != 0xFFFFFFFF) + if (m_defaultDir != m_targetDir) { + if (GetFileAttributes(m_targetDir) != 0xFFFFFFFF) { - int install = MsgBox(IDS_DIREXIST, MB_YESNO | MB_ICONQUESTION, m_targetDir); - if(install == IDNO) + int install = MsgBox(IDS_DIREXIST, + MB_YESNO | MB_ICONQUESTION, m_targetDir); + if (install == IDNO) return; } - else - { - int createDir = MsgBox(IDS_CREATEDIR, MB_YESNO | MB_ICONQUESTION, m_targetDir); - if(createDir == IDNO) + else { + int createDir = MsgBox(IDS_CREATEDIR, + MB_YESNO | MB_ICONQUESTION, m_targetDir); + if (createDir == IDNO) return; } } - try - { + if (m_accountExists == FALSE) { + success = CreateServiceAccount(m_accountName.GetBuffer(30), + m_accountPassword.GetBuffer(30)); + if (success == FALSE) { + MsgBox(IDS_CREATEACCOUNT_FAILED); + return; + } + m_accountExists = TRUE; + } + + ProgramGroup(); + + try { CreateDirs(); CopyFiles(); RegisterService(); @@ -412,41 +447,45 @@ void CBINDInstallDlg::OnInstall() /* Create a new key for named */ SetCurrent(IDS_CREATE_KEY); - if(RegCreateKey(HKEY_LOCAL_MACHINE, BIND_SUBKEY, &hKey) == ERROR_SUCCESS) - { + if (RegCreateKey(HKEY_LOCAL_MACHINE, BIND_SUBKEY, + &hKey) == ERROR_SUCCESS) { // Get the install directory - RegSetValueEx(hKey, "InstallDir", 0, REG_SZ, (LPBYTE)(LPCTSTR)m_targetDir, m_targetDir.GetLength()); + RegSetValueEx(hKey, "InstallDir", 0, REG_SZ, + (LPBYTE)(LPCTSTR)m_targetDir, + m_targetDir.GetLength()); RegCloseKey(hKey); } SetCurrent(IDS_ADD_REMOVE); - if(RegCreateKey(HKEY_LOCAL_MACHINE, BIND_UNINSTALL_SUBKEY, &hKey) == ERROR_SUCCESS) - { + if (RegCreateKey(HKEY_LOCAL_MACHINE, BIND_UNINSTALL_SUBKEY, + &hKey) == ERROR_SUCCESS) { char winDir[MAX_PATH]; CString buf(BIND_DISPLAY_NAME); GetWindowsDirectory(winDir, MAX_PATH); - RegSetValueEx(hKey, "DisplayName", 0, REG_SZ, (LPBYTE)(LPCTSTR)buf, buf.GetLength()); + RegSetValueEx(hKey, "DisplayName", 0, REG_SZ, + (LPBYTE)(LPCTSTR)buf, buf.GetLength()); buf.Format("%s\\BINDInstall.exe", winDir); - RegSetValueEx(hKey, "UninstallString", 0, REG_SZ, (LPBYTE)(LPCTSTR)buf, buf.GetLength()); + RegSetValueEx(hKey, "UninstallString", 0, REG_SZ, + (LPBYTE)(LPCTSTR)buf, buf.GetLength()); RegCloseKey(hKey); } - if(m_startOnInstall && !m_reboot) + ProgramGroup(); + + if (m_startOnInstall) StartBINDService(); } - catch(Exception e) - { + catch(Exception e) { MessageBox(e.resString); SetCurrent(IDS_CLEANUP); FailedInstall(); MsgBox(IDS_FAIL); return; } - catch(DWORD dw) - { + catch(DWORD dw) { CString msg; msg.Format("A fatal error occured\n(%s)", GetErrMessage(dw)); MessageBox(msg); @@ -458,94 +497,88 @@ void CBINDInstallDlg::OnInstall() SetCurrent(IDS_INSTALL_DONE); MsgBox(IDS_SUCCESS); - if(m_reboot) - { - if(MsgBox(IDS_REBOOT, MB_YESNO) == IDYES) - { - InitiateSystemShutdown(NULL, NULL, 0, TRUE, TRUE); - } - } } /* * Methods to do the work */ -void CBINDInstallDlg::CreateDirs() -{ +void CBINDInstallDlg::CreateDirs() { /* s'OK if the directories already exist */ SetCurrent(IDS_CREATE_DIR, m_targetDir); - if(!CreateDirectory(m_targetDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) + if (!CreateDirectory(m_targetDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) throw(Exception(IDS_ERR_CREATE_DIR, m_targetDir, GetErrMessage())); SetCurrent(IDS_CREATE_DIR, m_etcDir); - if(!CreateDirectory(m_etcDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) + if (!CreateDirectory(m_etcDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) throw(Exception(IDS_ERR_CREATE_DIR, m_etcDir, GetErrMessage())); SetCurrent(IDS_CREATE_DIR, m_binDir); - if(!CreateDirectory(m_binDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) + if (!CreateDirectory(m_binDir, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) throw(Exception(IDS_ERR_CREATE_DIR, m_binDir, GetErrMessage())); SetItemStatus(IDC_CREATE_DIR); } -void CBINDInstallDlg::RemoveDirs(BOOL uninstall) -{ - if(!m_keepFiles) - { +void CBINDInstallDlg::RemoveDirs(BOOL uninstall) { + if (!m_keepFiles) { SetCurrent(IDS_REMOVE_DIR, m_binDir); // Check for existence then remove if present - if(GetFileAttributes(m_binDir) != 0xFFFFFFFF) + if (GetFileAttributes(m_binDir) != 0xFFFFFFFF) RemoveDirectory(m_binDir); SetCurrent(IDS_REMOVE_DIR, m_etcDir); - if(GetFileAttributes(m_etcDir) != 0xFFFFFFFF) + if (GetFileAttributes(m_etcDir) != 0xFFFFFFFF) RemoveDirectory(m_etcDir); SetCurrent(IDS_REMOVE_DIR, m_targetDir); - if(GetFileAttributes(m_targetDir) != 0xFFFFFFFF) + if (GetFileAttributes(m_targetDir) != 0xFFFFFFFF) RemoveDirectory(m_targetDir); } - if(uninstall) + if (uninstall) SetItemStatus(IDC_CREATE_DIR, TRUE); } -void CBINDInstallDlg::CopyFiles() -{ +void CBINDInstallDlg::CopyFiles() { CString destFile; - for(int i = 0; installFiles[i].filename; i++) - { + for (int i = 0; installFiles[i].filename; i++) { SetCurrent(IDS_COPY_FILE, installFiles[i].filename); - destFile = DestDir(installFiles[i].destination) + "\\" + installFiles[i].filename; + destFile = DestDir(installFiles[i].destination) + "\\" + + installFiles[i].filename; CString filespec = m_currentDir + "\\" + installFiles[i].filename; - CVersionInfo bindFile(destFile); /* This file doesn't have to exist */ + CVersionInfo bindFile(destFile); CVersionInfo origFile(filespec); - if(!origFile.IsValid() && installFiles[i].checkVer) - { - if(MsgBox(IDS_FILE_BAD, MB_YESNO, installFiles[i].filename) == IDNO) - throw(Exception(IDS_ERR_COPY_FILE, installFiles[i].filename, GetErrMessage())); + if (!origFile.IsValid() && installFiles[i].checkVer) { + if (MsgBox(IDS_FILE_BAD, MB_YESNO, + installFiles[i].filename) == IDNO) + throw(Exception(IDS_ERR_COPY_FILE, + installFiles[i].filename, + GetErrMessage())); } - try - { -/* Ignore Version checking. We need to make sure that all files get copied regardless - of whether or not they are earlier or later versions since we cannot guarantee - that we have either backward or forward compatibility between versions. -*/ + try { +/* + * Ignore Version checking. We need to make sure that all files get copied regardless + * of whether or not they are earlier or later versions since we cannot guarantee + * that we have either backward or forward compatibility between versions. + */ 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) + 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) { SetItemStatus(IDC_COPY_FILE, FALSE); - throw(Exception(IDS_ERR_COPY_FILE, installFiles[i].filename, GetErrMessage())); + throw(Exception(IDS_ERR_COPY_FILE, + installFiles[i].filename, + GetErrMessage())); } } } @@ -554,25 +587,23 @@ void CBINDInstallDlg::CopyFiles() SetItemStatus(IDC_COPY_FILE); } -void CBINDInstallDlg::DeleteFiles(BOOL uninstall) -{ +void CBINDInstallDlg::DeleteFiles(BOOL uninstall) { CString destFile; - for(int i = 0; installFiles[i].filename; i++) - { - if(installFiles[i].checkVer) + for (int i = 0; installFiles[i].filename; i++) { + if (installFiles[i].checkVer) continue; - destFile = DestDir(installFiles[i].destination) + "\\" + installFiles[i].filename; + destFile = DestDir(installFiles[i].destination) + "\\" + + installFiles[i].filename; - if(uninstall) + if (uninstall) SetCurrent(IDS_DELETE_FILE, installFiles[i].filename); DeleteFile(destFile); } - if(!m_keepFiles) - { + if (!m_keepFiles) { WIN32_FIND_DATA findData; CString file = m_etcDir + "\\*.*"; BOOL rc; @@ -581,10 +612,9 @@ void CBINDInstallDlg::DeleteFiles(BOOL uninstall) hFile = FindFirstFile(file, &findData); rc = hFile != INVALID_HANDLE_VALUE; - while(rc == TRUE) - { - if(strcmp(findData.cFileName, ".") && strcmp(findData.cFileName, "..")) - { + while (rc == TRUE) { + if (strcmp(findData.cFileName, ".") && + strcmp(findData.cFileName, "..")) { file = m_etcDir + "\\" + findData.cFileName; SetCurrent(IDS_DELETE_FILE, file); DeleteFile(file); @@ -594,23 +624,127 @@ void CBINDInstallDlg::DeleteFiles(BOOL uninstall) FindClose(hFile); } - if(uninstall) + if (uninstall) SetItemStatus(IDC_COPY_FILE, TRUE); } +/* + * Get the service account name out of the registry, if any + */ +void +CBINDInstallDlg::GetCurrentServiceAccountName() { + HKEY hKey; + BOOL keyFound = FALSE; + char accountName[MAX_PATH]; + DWORD nameLen = MAX_PATH; + CString Tmp; + m_accountUsed = FALSE; -void CBINDInstallDlg::RegisterService() -{ - SC_HANDLE hSCManager; - SC_HANDLE hService; + memset(accountName, 0, nameLen); + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, BIND_SERVICE_SUBKEY, 0, KEY_READ, + &hKey) == ERROR_SUCCESS) { + keyFound = TRUE; + } + else { + m_serviceExists = FALSE; + } + + if (keyFound == TRUE) { + /* Get the named service account, if one was specified */ + if (RegQueryValueEx(hKey, "ObjectName", NULL, NULL, + (LPBYTE)accountName, &nameLen) != ERROR_SUCCESS) + keyFound = FALSE; + } + + RegCloseKey(hKey); + if(keyFound == FALSE) + m_accountName = ""; + else { + /* + * LocalSystem is not a regular account and is equivalent + * to no account but with lots of privileges + */ + Tmp = accountName; + if (Tmp == ".\\LocalSystem") + m_accountName = ""; + /* Found account strip any ".\" from it */ + if (Tmp.Left(2) == ".\\") { + m_accountName = Tmp.Mid(2); + m_accountUsed = TRUE; + } + } +} + +BOOL +CBINDInstallDlg::ValidateServiceAccount() { + wchar_t *PrivList[MAX_PRIVS]; + unsigned int PrivCount = 0; + char *Groups[MAX_GROUPS]; + unsigned int totalGroups = 0; + int status; + char *name; + + name = m_accountName.GetBuffer(30); + + status = GetAccountPrivileges(name, PrivList, &PrivCount, + Groups, &totalGroups, MAX_GROUPS); + if (status == RTN_NOACCOUNT) { + m_accountExists = FALSE; + /* We need to do this in case an account was previously used */ + m_accountUsed = FALSE; + return (TRUE); + } + if (status != RTN_OK) { + MsgBox(IDS_ERR_BADACCOUNT); + return (FALSE); + } + + m_accountExists = TRUE; + if (PrivCount > 1) { + if (MsgBox(IDS_ERR_TOOPRIVED, MB_YESNO) == IDYES) + return (FALSE); + else + return (TRUE); + } + + /* See if we have the correct privilege */ + if (wcscmp(PrivList[0], SE_SERVICE_LOGON_PRIV) != 0) { + MsgBox(IDS_ERR_WRONGPRIV, PrivList[0]); + return (FALSE); + } + return (TRUE); +} + +void +CBINDInstallDlg::RegisterService() { + HANDLE hSCManager; + HANDLE hService; + CString StartName = ".\\" + m_accountName; + + /* + * We need to change the service rather than create it + * if the service already exists. Do nothing if we are already + * using that account + */ + if(m_serviceExists == TRUE) { + if(m_accountUsed == FALSE) { + UpdateService(); + SetItemStatus(IDC_REG_SERVICE); + return; + } + else { + SetItemStatus(IDC_REG_SERVICE); + return; + } + } SetCurrent(IDS_OPEN_SCM); hSCManager= OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if(!hSCManager) + if (!hSCManager) throw(Exception(IDS_ERR_OPEN_SCM, GetErrMessage())); DWORD dwStart = SERVICE_DEMAND_START; - if(m_autoStart) + if (m_autoStart) dwStart = SERVICE_AUTO_START; DWORD dwServiceType = SERVICE_WIN32_OWN_PROCESS; @@ -619,55 +753,103 @@ void CBINDInstallDlg::RegisterService() namedLoc.Format("%s\\bin\\named.exe", m_targetDir); SetCurrent(IDS_CREATE_SERVICE); - hService = CreateService(hSCManager, BIND_SERVICE_NAME, BIND_DISPLAY_NAME, SERVICE_ALL_ACCESS, dwServiceType, dwStart, - SERVICE_ERROR_NORMAL, namedLoc, NULL, NULL, NULL, NULL, NULL); + hService = CreateService(hSCManager, BIND_SERVICE_NAME, + BIND_DISPLAY_NAME, SERVICE_ALL_ACCESS, dwServiceType, dwStart, + SERVICE_ERROR_NORMAL, namedLoc, NULL, NULL, NULL, StartName, + m_accountPassword); - if(!hService && GetLastError() != ERROR_SERVICE_EXISTS) + if (!hService && GetLastError() != ERROR_SERVICE_EXISTS) throw(Exception(IDS_ERR_CREATE_SERVICE, GetErrMessage())); - if(hSCManager) - CloseServiceHandle(hSCManager); - - if(hService) + if (hService) CloseServiceHandle(hService); + if (hSCManager) + CloseServiceHandle(hSCManager); + SetItemStatus(IDC_REG_SERVICE); } -void CBINDInstallDlg::UnregisterService(BOOL uninstall) -{ - BOOL rc = FALSE; - SC_HANDLE hSCManager; - SC_HANDLE hService; +void +CBINDInstallDlg::UpdateService() { + HANDLE hSCManager; + HANDLE hService; + CString StartName = ".\\" + m_accountName; - while(1) + SetCurrent(IDS_OPEN_SCM); + hSCManager= OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (!hSCManager) { + MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage()); + return; + } + + DWORD dwStart = SERVICE_DEMAND_START; + if (m_autoStart) + dwStart = SERVICE_AUTO_START; + + DWORD dwServiceType = SERVICE_WIN32_OWN_PROCESS; + + CString namedLoc; + namedLoc.Format("%s\\bin\\named.exe", m_targetDir); + + SetCurrent(IDS_OPEN_SERVICE); + hService = OpenService(hSCManager, BIND_SERVICE_NAME, + SERVICE_CHANGE_CONFIG); + if (!hService) { + MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage()); + if (hSCManager) + CloseServiceHandle(hSCManager); + return; + } + else { + if (ChangeServiceConfig(hService, dwServiceType, dwStart, + SERVICE_ERROR_NORMAL, namedLoc, NULL, NULL, NULL, + StartName, m_accountPassword,BIND_DISPLAY_NAME) + != TRUE) { + DWORD err = GetLastError(); + MsgBox(IDS_ERR_UPDATE_SERVICE, GetErrMessage()); + } + } + + if (hService) + CloseServiceHandle(hService); + + if (hSCManager) + CloseServiceHandle(hSCManager); + + SetItemStatus(IDC_REG_SERVICE); +} + +void CBINDInstallDlg::UnregisterService(BOOL uninstall) { + BOOL rc = FALSE; + HANDLE hSCManager; + HANDLE hService; + + while(1) { SetCurrent(IDS_OPEN_SCM); hSCManager= OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if(!hSCManager && uninstall == TRUE) - { + if (!hSCManager && uninstall == TRUE) { MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage()); break; } SetCurrent(IDS_OPEN_SERVICE); - hService = OpenService(hSCManager, BIND_SERVICE_NAME, STANDARD_RIGHTS_REQUIRED); - if(!hService && uninstall == TRUE) + hService = OpenService(hSCManager, BIND_SERVICE_NAME, + STANDARD_RIGHTS_REQUIRED); + if (!hService && uninstall == TRUE) { - if(GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST) - { + if (GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST) { MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage()); break; } } - else - { + else { SetCurrent(IDS_REMOVE_SERVICE); - if(!DeleteService(hService) && uninstall == TRUE) - { + if (!DeleteService(hService) && uninstall == TRUE) { DWORD err = GetLastError(); - if(err != ERROR_SERVICE_MARKED_FOR_DELETE && err != ERROR_SERVICE_DOES_NOT_EXIST) - { + if (err != ERROR_SERVICE_MARKED_FOR_DELETE && + err != ERROR_SERVICE_DOES_NOT_EXIST) { MsgBox(IDS_ERR_REMOVE_SERVICE, GetErrMessage()); break; } @@ -678,18 +860,17 @@ void CBINDInstallDlg::UnregisterService(BOOL uninstall) break; } - if(hSCManager) - CloseServiceHandle(hSCManager); - - if(hService) + if (hService) CloseServiceHandle(hService); - if(uninstall) + if (hSCManager) + CloseServiceHandle(hSCManager); + + if (uninstall) SetItemStatus(IDC_REG_SERVICE, rc); } -void CBINDInstallDlg::RegisterMessages() -{ +void CBINDInstallDlg::RegisterMessages() { HKEY hKey; DWORD dwData; char pszMsgDLL[MAX_PATH], buf[MAX_PATH]; @@ -699,16 +880,19 @@ void CBINDInstallDlg::RegisterMessages() SetCurrent(IDS_REGISTER_MESSAGES); /* Create a new key for named */ - if(RegCreateKey(HKEY_LOCAL_MACHINE, BIND_MESSAGE_SUBKEY, &hKey) != ERROR_SUCCESS) + if (RegCreateKey(HKEY_LOCAL_MACHINE, BIND_MESSAGE_SUBKEY, &hKey) + != ERROR_SUCCESS) throw(Exception(IDS_ERR_CREATE_KEY, GetErrMessage())); /* Add the Event-ID message-file name to the subkey. */ - if(RegSetValueEx(hKey, "EventMessageFile", 0, REG_EXPAND_SZ, (LPBYTE)pszMsgDLL, strlen(pszMsgDLL) + 1) != ERROR_SUCCESS) + if (RegSetValueEx(hKey, "EventMessageFile", 0, REG_EXPAND_SZ, + (LPBYTE)pszMsgDLL, strlen(pszMsgDLL) + 1) != ERROR_SUCCESS) throw(Exception(IDS_ERR_SET_VALUE, GetErrMessage())); /* Set the supported types flags and addit to the subkey. */ dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; - if(RegSetValueEx(hKey, "TypesSupported", 0, REG_DWORD, (LPBYTE)&dwData, sizeof(DWORD)) != ERROR_SUCCESS) + if (RegSetValueEx(hKey, "TypesSupported", 0, REG_DWORD, + (LPBYTE)&dwData, sizeof(DWORD)) != ERROR_SUCCESS) throw(Exception(IDS_ERR_SET_VALUE, GetErrMessage())); RegCloseKey(hKey); @@ -716,38 +900,36 @@ void CBINDInstallDlg::RegisterMessages() SetItemStatus(IDC_REG_MESSAGE); } -void CBINDInstallDlg::UnregisterMessages(BOOL uninstall) -{ +void CBINDInstallDlg::UnregisterMessages(BOOL uninstall) { BOOL rc = FALSE; HKEY hKey = NULL; - while(1) - { + while(1) { SetCurrent(IDS_UNREGISTER_MESSAGES); /* Open key for Application Event Log */ - if(RegOpenKey(HKEY_LOCAL_MACHINE, EVENTLOG_APP_SUBKEY, &hKey) != ERROR_SUCCESS) + if (RegOpenKey(HKEY_LOCAL_MACHINE, EVENTLOG_APP_SUBKEY, &hKey) + != ERROR_SUCCESS) break; /* Remove named from the list of messages sources */ - if(RegDeleteKey(hKey, BIND_MESSAGE_NAME) != ERROR_SUCCESS) + if (RegDeleteKey(hKey, BIND_MESSAGE_NAME) != ERROR_SUCCESS) break; rc = TRUE; break; } - if(hKey) + if (hKey) RegCloseKey(hKey); - if(uninstall) + if (uninstall) SetItemStatus(IDC_REG_MESSAGE, rc); } /* * Install failed - clean up quietly */ -void CBINDInstallDlg::FailedInstall() -{ +void CBINDInstallDlg::FailedInstall() { UnregisterMessages(FALSE); UnregisterService(FALSE); DeleteFiles(FALSE); @@ -757,8 +939,7 @@ void CBINDInstallDlg::FailedInstall() /* * Set the checklist tags for install */ -void CBINDInstallDlg::InstallTags() -{ +void CBINDInstallDlg::InstallTags() { CString tag; tag.LoadString(IDS_INSTALL_FILE); @@ -781,8 +962,7 @@ void CBINDInstallDlg::InstallTags() /* * Set the checklist tags for uninstall */ -void CBINDInstallDlg::UninstallTags() -{ +void CBINDInstallDlg::UninstallTags() { CString tag; tag.LoadString(IDS_UNINSTALL_FILES); @@ -802,8 +982,7 @@ void CBINDInstallDlg::UninstallTags() GetDlgItem(IDC_REG_MESSAGE)->SetWindowText(""); } -void CBINDInstallDlg::SetItemStatus(UINT nID, BOOL bSuccess) -{ +void CBINDInstallDlg::SetItemStatus(UINT nID, BOOL bSuccess) { GetDlgItem(nID)->SetWindowText(bSuccess == TRUE ? "Done" : "Failed"); } @@ -811,8 +990,7 @@ void CBINDInstallDlg::SetItemStatus(UINT nID, BOOL bSuccess) /* * Set the text in the current operation field - use a string table string */ -void CBINDInstallDlg::SetCurrent(int id, ...) -{ +void CBINDInstallDlg::SetCurrent(int id, ...) { CString format; va_list va; char buf[128]; @@ -831,21 +1009,19 @@ void CBINDInstallDlg::SetCurrent(int id, ...) /* * Stop the BIND service */ -void CBINDInstallDlg::StopBINDService() -{ +void CBINDInstallDlg::StopBINDService() { SERVICE_STATUS svcStatus; SetCurrent(IDS_STOP_SERVICE); - SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if(!hSCManager) - { + HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (!hSCManager) { MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage()); } - SC_HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, SERVICE_ALL_ACCESS); - if(!hBINDSvc) - { + HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, + SERVICE_ALL_ACCESS); + if (!hBINDSvc) { MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage()); } @@ -855,19 +1031,17 @@ void CBINDInstallDlg::StopBINDService() /* * Start the BIND service */ -void CBINDInstallDlg::StartBINDService() -{ +void CBINDInstallDlg::StartBINDService() { SetCurrent(IDS_START_SERVICE); - SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if(!hSCManager) - { + HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (!hSCManager) { MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage()); } - SC_HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, SERVICE_ALL_ACCESS); - if(!hBINDSvc) - { + HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, + SERVICE_ALL_ACCESS); + if (!hBINDSvc) { MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage()); } BOOL rc = StartService(hBINDSvc, 0, NULL); @@ -876,31 +1050,30 @@ void CBINDInstallDlg::StartBINDService() /* * Check to see if the BIND service is running or not */ -BOOL CBINDInstallDlg::CheckBINDService() -{ +BOOL CBINDInstallDlg::CheckBINDService() { SERVICE_STATUS svcStatus; - SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if(hSCManager) - { - SC_HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, SERVICE_ALL_ACCESS); - if(hBINDSvc) - { - BOOL rc = ControlService(hBINDSvc, SERVICE_CONTROL_INTERROGATE, &svcStatus); - if(!rc) + HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (hSCManager) { + HANDLE hBINDSvc = OpenService(hSCManager, BIND_SERVICE_NAME, + SERVICE_ALL_ACCESS); + if (hBINDSvc) { + BOOL rc = ControlService(hBINDSvc, + SERVICE_CONTROL_INTERROGATE, &svcStatus); + if (!rc) DWORD err = GetLastError(); - return(svcStatus.dwCurrentState == SERVICE_RUNNING); + return (svcStatus.dwCurrentState == SERVICE_RUNNING); } } - return(FALSE); + return (FALSE); } /* - * Display message boxes with variable args, using string table strings for the format specifiers + * Display message boxes with variable args, using string table strings + * for the format specifiers */ -int CBINDInstallDlg::MsgBox(int id, ...) -{ +int CBINDInstallDlg::MsgBox(int id, ...) { CString format; va_list va; char buf[BUFSIZ]; @@ -912,11 +1085,10 @@ int CBINDInstallDlg::MsgBox(int id, ...) vsprintf(buf, format, va); va_end(va); - return(MessageBox(buf)); + return (MessageBox(buf)); } -int CBINDInstallDlg::MsgBox(int id, UINT type, ...) -{ +int CBINDInstallDlg::MsgBox(int id, UINT type, ...) { CString format; va_list va; char buf[BUFSIZ]; @@ -934,8 +1106,7 @@ int CBINDInstallDlg::MsgBox(int id, UINT type, ...) /* * Call GetLastError(), retrieve the message associated with the error */ -CString CBINDInstallDlg::GetErrMessage(DWORD err) -{ +CString CBINDInstallDlg::GetErrMessage(DWORD err) { LPVOID msgBuf; static char buf[BUFSIZ]; @@ -950,8 +1121,7 @@ CString CBINDInstallDlg::GetErrMessage(DWORD err) return(buf); } -void CBINDInstallDlg::ProgramGroup(BOOL create) -{ +void CBINDInstallDlg::ProgramGroup(BOOL create) { TCHAR path[MAX_PATH], commonPath[MAX_PATH], fileloc[MAX_PATH], linkpath[MAX_PATH]; HRESULT hres; IShellLink *psl = NULL; @@ -959,18 +1129,15 @@ void CBINDInstallDlg::ProgramGroup(BOOL create) ITEMIDLIST *itemList = NULL; HRESULT hr = SHGetMalloc(&pMalloc); - if(hr != NOERROR) - { + if (hr != NOERROR) { MessageBox("Could not get a handle to Shell memory object"); return; } hr = SHGetSpecialFolderLocation(m_hWnd, CSIDL_COMMON_PROGRAMS, &itemList); - if(hr != NOERROR) - { + if (hr != NOERROR) { MessageBox("Could not get a handle to the Common Programs folder"); - if(itemList) - { + if (itemList) { pMalloc->Free(itemList); } return; @@ -979,8 +1146,7 @@ void CBINDInstallDlg::ProgramGroup(BOOL create) hr = SHGetPathFromIDList(itemList, commonPath); pMalloc->Free(itemList); - if(create) - { + if (create) { sprintf(path, "%s\\ISC", commonPath); CreateDirectory(path, NULL); @@ -989,8 +1155,7 @@ void CBINDInstallDlg::ProgramGroup(BOOL create) hres = CoInitialize(NULL); - if (SUCCEEDED(hres)) - { + if (SUCCEEDED(hres)) { // Get a pointer to the IShellLink interface. hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID *)&psl); if (SUCCEEDED(hres)) @@ -1003,8 +1168,7 @@ void CBINDInstallDlg::ProgramGroup(BOOL create) psl->SetDescription("BIND Control Panel"); hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf); - if (SUCCEEDED(hres)) - { + if (SUCCEEDED(hres)) { WCHAR wsz[MAX_PATH]; MultiByteToWideChar(CP_ACP, 0, linkpath, -1, wsz, MAX_PATH); @@ -1012,8 +1176,7 @@ void CBINDInstallDlg::ProgramGroup(BOOL create) ppf->Release(); } - if(GetFileAttributes("readme.txt") != -1) - { + if (GetFileAttributes("readme.txt") != -1) { sprintf(fileloc, "%s\\Readme.txt", m_targetDir); sprintf(linkpath, "%s\\Readme.lnk", path); @@ -1021,8 +1184,7 @@ void CBINDInstallDlg::ProgramGroup(BOOL create) psl->SetDescription("BIND Readme"); hres = psl->QueryInterface(IID_IPersistFile, (void **)&ppf); - if (SUCCEEDED(hres)) - { + if (SUCCEEDED(hres)) { WCHAR wsz[MAX_PATH]; MultiByteToWideChar(CP_ACP, 0, linkpath, -1, wsz, MAX_PATH); @@ -1035,8 +1197,7 @@ void CBINDInstallDlg::ProgramGroup(BOOL create) CoUninitialize(); } } - else - { + else { TCHAR filename[MAX_PATH]; WIN32_FIND_DATA fd; @@ -1044,16 +1205,13 @@ void CBINDInstallDlg::ProgramGroup(BOOL create) sprintf(filename, "%s\\*.*", path); HANDLE hFind = FindFirstFile(filename, &fd); - if(hFind != INVALID_HANDLE_VALUE) - { - do - { - if(strcmp(fd.cFileName, ".") && strcmp(fd.cFileName, "..")) - { + if (hFind != INVALID_HANDLE_VALUE) { + do { + if (strcmp(fd.cFileName, ".") && strcmp(fd.cFileName, "..")) { sprintf(filename, "%s\\%s", path, fd.cFileName); DeleteFile(filename); } - } while(FindNextFile(hFind, &fd)); + } while (FindNextFile(hFind, &fd)); FindClose(hFind); } RemoveDirectory(path); @@ -1062,10 +1220,8 @@ void CBINDInstallDlg::ProgramGroup(BOOL create) } } -CString CBINDInstallDlg::DestDir(int destination) -{ - switch(destination) - { +CString CBINDInstallDlg::DestDir(int destination) { + switch(destination) { case FileData::TargetDir: return m_targetDir; case FileData::BinDir: diff --git a/bin/win32/BINDInstall/BINDInstallDlg.h b/bin/win32/BINDInstall/BINDInstallDlg.h index d75de61786..6993fb410a 100644 --- a/bin/win32/BINDInstall/BINDInstallDlg.h +++ b/bin/win32/BINDInstall/BINDInstallDlg.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: BINDInstallDlg.h,v 1.3 2001/07/31 00:03:14 gson Exp $ */ +/* $Id: BINDInstallDlg.h,v 1.3.12.1 2003/10/21 05:56:39 marka Exp $ */ /* * Copyright (c) 1999-2000 by Nortel Networks Corporation @@ -72,6 +72,7 @@ protected: void DeleteFiles(BOOL uninstall); void RegisterService(); + void UpdateService(); void UnregisterService(BOOL uninstall); void RegisterMessages(); @@ -80,6 +81,8 @@ protected: void FailedInstall(); void SetItemStatus(UINT nID, BOOL bSuccess = TRUE); + void GetCurrentServiceAccountName(); + BOOL ValidateServiceAccount(); protected: CString DestDir(int destination); int MsgBox(int id, ...); @@ -94,9 +97,16 @@ protected: CString m_etcDir; CString m_binDir; CString m_winSysDir; - BOOL m_reboot; + BOOL m_installed; CString m_currentDir; - + BOOL m_accountExists; + BOOL m_accountUsed; + CString m_currentAccount; + CString m_accountName; + CString m_accountPasswordConfirm; + CString m_accountPassword; + BOOL m_serviceExists; + // Generated message map functions //{{AFX_MSG(CBINDInstallDlg) virtual BOOL OnInitDialog(); diff --git a/bin/win32/BINDInstall/resource.h b/bin/win32/BINDInstall/resource.h index 02f6802d7a..fd142d32d1 100644 --- a/bin/win32/BINDInstall/resource.h +++ b/bin/win32/BINDInstall/resource.h @@ -50,11 +50,19 @@ #define IDS_NO_VERSION 49 #define IDS_EXISTING_NEWER 50 #define IDS_FILE_BAD 51 +#define IDS_ERR_TOOPRIVED 52 +#define IDS_ERR_BADACCOUNT 53 +#define IDS_ERR_WRONGPRIV 54 +#define IDS_CREATEACCOUNT_FAILED 55 +#define IDS_ERR_PASSWORD 56 +#define IDS_ERR_UPDATE_SERVICE 57 #define IDD_BINDINSTALL_DIALOG 102 #define IDR_MAINFRAME 128 #define IDD_BROWSE 129 #define IDI_CHECK 130 #define IDI_X 132 +#define IDC_CURSOR1 142 +#define IDD_DIALOG1 143 #define IDC_TARGETDIR 1001 #define IDC_BROWSE 1002 #define IDC_DIRLIST 1004 @@ -77,14 +85,17 @@ #define IDC_DRIVES 1021 #define IDC_CURRENT 1021 #define IDC_START 1022 +#define IDC_ACCOUNT_NAME 1030 +#define IDC_ACCOUNT_PASSWORD 1031 +#define IDC_ACCOUNT_PASSWORD_CONFIRM 1032 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 142 +#define _APS_NEXT_RESOURCE_VALUE 144 #define _APS_NEXT_COMMAND_VALUE 32771 #define _APS_NEXT_CONTROL_VALUE 1027 -#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_SYMED_VALUE 104 #endif #endif diff --git a/lib/dns/adb.c b/lib/dns/adb.c index caa3d9eb6b..e81e62524e 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: adb.c,v 1.181.2.11.2.11 2003/10/14 03:47:58 marka Exp $ */ +/* $Id: adb.c,v 1.181.2.11.2.12 2003/10/21 05:56:40 marka Exp $ */ /* * Implementation notes @@ -86,7 +86,7 @@ */ #define ADB_CACHE_MINIMUM 10 /* seconds */ #define ADB_CACHE_MAXIMUM 86400 /* seconds (86400 = 24 hours) */ -#define ADB_ENTRY_WINDOW 1800 /* seconds */ +#define ADB_ENTRY_WINDOW 1800 /* seconds */ /* * Wake up every CLEAN_SECONDS and clean CLEAN_BUCKETS buckets, so that all @@ -242,7 +242,7 @@ struct dns_adbentry { unsigned int flags; unsigned int srtt; isc_sockaddr_t sockaddr; - + isc_stdtime_t expires; /* * A nonzero 'expires' field indicates that the entry should @@ -292,7 +292,7 @@ static inline void inc_adb_erefcnt(dns_adb_t *); static inline void inc_entry_refcnt(dns_adb_t *, dns_adbentry_t *, isc_boolean_t); static inline isc_boolean_t dec_entry_refcnt(dns_adb_t *, dns_adbentry_t *, - isc_boolean_t); + isc_boolean_t); static inline void violate_locking_hierarchy(isc_mutex_t *, isc_mutex_t *); static isc_boolean_t clean_namehooks(dns_adb_t *, dns_adbnamehooklist_t *); static void clean_target(dns_adb_t *, dns_name_t *); @@ -1234,7 +1234,7 @@ dec_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) { free_adbentry(adb, &entry); if (result) result =dec_adb_irefcnt(adb); - + return (result); } @@ -3199,7 +3199,7 @@ fetch_callback(isc_task_t *task, isc_event_t *ev) { */ if (dev->result != ISC_R_SUCCESS) { char buf[DNS_NAME_FORMATSIZE]; - + dns_name_format(&name->name, buf, sizeof(buf)); DP(DEF_LEVEL, "adb: fetch of '%s' %s failed: %s", buf, address_type == DNS_ADBFIND_INET ? "A" : "AAAA", @@ -3310,7 +3310,7 @@ fetch_name(dns_adbname_t *adbname, return (result); } -/* +/* * XXXMLG Needs to take a find argument and an address info, no zone or adb, * since these can be extracted from the find itself. */ @@ -3530,11 +3530,11 @@ dns_adb_flushname(dns_adb_t *adb, dns_name_t *name) { static void water(void *arg, int mark) { - dns_adb_t *adb = arg; - isc_boolean_t overmem = ISC_TF(mark == ISC_MEM_HIWATER); + dns_adb_t *adb = arg; + isc_boolean_t overmem = ISC_TF(mark == ISC_MEM_HIWATER); isc_interval_t interval; - - REQUIRE(DNS_ADB_VALID(adb)); + + REQUIRE(DNS_ADB_VALID(adb)); DP(ISC_LOG_DEBUG(1), "adb reached %s water mark", overmem ? "high" : "low"); diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index ec6747c174..8e89bb00ed 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: masterdump.c,v 1.56.2.5.2.4 2003/10/14 03:48:00 marka Exp $ */ +/* $Id: masterdump.c,v 1.56.2.5.2.5 2003/10/21 05:56:40 marka Exp $ */ #include @@ -1049,7 +1049,7 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, dctx->do_date = dns_db_iscache(dctx->db); relative = ((dctx->tctx.style.flags & DNS_STYLEFLAG_REL_OWNER) != 0) ? - ISC_TRUE : ISC_FALSE, + ISC_TRUE : ISC_FALSE; result = dns_db_createiterator(dctx->db, relative, &dctx->dbiter); if (result != ISC_R_SUCCESS) goto cleanup; diff --git a/lib/dns/rdata/generic/key_25.c b/lib/dns/rdata/generic/key_25.c index 7fc7ecda88..17ec9b4eee 100644 --- a/lib/dns/rdata/generic/key_25.c +++ b/lib/dns/rdata/generic/key_25.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: key_25.c,v 1.41.12.2 2003/09/11 00:18:10 marka Exp $ */ +/* $Id: key_25.c,v 1.41.12.3 2003/10/21 05:56:41 marka Exp $ */ /* * Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley. @@ -28,7 +28,7 @@ #include -#define RRTYPE_KEY_ATTRIBUTES (DNS_RDATATYPEATTR_DNSSEC) +#define RRTYPE_KEY_ATTRIBUTES (DNS_RDATATYPEATTR_DNSSEC|DNS_RDATATYPEATTR_ATPARENT) static inline isc_result_t fromtext_key(ARGS_FROMTEXT) { diff --git a/lib/isc/include/isc/hash.h b/lib/isc/include/isc/hash.h index 43080df39c..d83f46f499 100644 --- a/lib/isc/include/isc/hash.h +++ b/lib/isc/include/isc/hash.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: hash.h,v 1.2.2.1 2003/07/25 07:30:43 marka Exp $ */ +/* $Id: hash.h,v 1.2.2.1.2.1 2003/10/21 05:56:41 marka Exp $ */ #ifndef ISC_HASH_H #define ISC_HASH_H 1 @@ -40,8 +40,8 @@ * * Altough the API is generic about the hash keys, it mainly expects * DNS names (and sometimes IPv4/v6 addresses) as inputs. It has an - * upper limit of the input length, and may run slow to calculaate the - * has values for large inputs. + * upper limit of the input length, and may run slow to calculate the + * hash values for large inputs. * * This API is designed to be general so that it can provide multiple * different hash contexts that have different random vectors. However, diff --git a/lib/isc/win32/syslog.c b/lib/isc/win32/syslog.c index f52da8c07e..3bf5ea46cd 100644 --- a/lib/isc/win32/syslog.c +++ b/lib/isc/win32/syslog.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: syslog.c,v 1.3.12.2 2003/10/07 03:28:39 marka Exp $ */ +/* $Id: syslog.c,v 1.3.12.3 2003/10/21 05:56:41 marka Exp $ */ #include @@ -178,4 +178,4 @@ NTReportError(const char *name, const char *str) { BIND_ERR_MSG, NULL, 1, 0, buf, NULL); DeregisterEventSource(hNTAppLog); -} \ No newline at end of file +}