From: Mark Andrews Date: Tue, 11 Oct 2005 22:54:45 +0000 (+0000) Subject: 1926. [bug] The Windows installer did not check for empty X-Git-Tag: v9.2.7b1~91^2~152 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=9547d3e03bb082d73aeabb497b60632ebfdc78a6;p=thirdparty%2Fbind9.git 1926. [bug] The Windows installer did not check for empty passwords. [RT #15483] --- diff --git a/CHANGES b/CHANGES index 26512eca31f..fb007bb8eb7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +1926. [bug] The Windows installer did not check for empty + passwords. [RT #15483] + 1925. [port] All outer level AC_TRY_RUNs need cross compiling defaults. [RT #15469] diff --git a/bin/win32/BINDInstall/BINDInstall.rc b/bin/win32/BINDInstall/BINDInstall.rc index 733591d38a8..8bcb636b2e4 100644 --- a/bin/win32/BINDInstall/BINDInstall.rc +++ b/bin/win32/BINDInstall/BINDInstall.rc @@ -78,7 +78,7 @@ STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW CAPTION "BIND 9 Installer" -FONT 8, "MS Sans Serif" +FONT 8, "MS Sans Serif",0,0,0x1 BEGIN EDITTEXT IDC_TARGETDIR,7,62,196,14,ES_AUTOHSCROLL EDITTEXT IDC_ACCOUNT_NAME,7,94,196,14,ES_AUTOHSCROLL @@ -305,6 +305,8 @@ BEGIN IDS_CREATEACCOUNT_FAILED "Unable to Create Account for the Service." IDS_ERR_PASSWORD "Passwords entered did not match. Please reenter password." IDS_ERR_UPDATE_SERVICE "Error updating service\n(%s)" + IDS_ERR_NULLPASSWORD "Service account password cannot be null" + IDS_ERR_WHITESPACE "Service account password has leading/trailing whitespace" END #endif // English (U.S.) resources diff --git a/bin/win32/BINDInstall/BINDInstallDlg.cpp b/bin/win32/BINDInstall/BINDInstallDlg.cpp index 23f3a0994d7..0b44c2ee15d 100644 --- a/bin/win32/BINDInstall/BINDInstallDlg.cpp +++ b/bin/win32/BINDInstall/BINDInstallDlg.cpp @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: BINDInstallDlg.cpp,v 1.20 2005/09/12 02:16:30 marka Exp $ */ +/* $Id: BINDInstallDlg.cpp,v 1.21 2005/10/11 22:54:45 marka Exp $ */ /* * Copyright (c) 1999-2000 by Nortel Networks Corporation @@ -386,6 +386,7 @@ void CBINDInstallDlg::OnUninstall() { */ void CBINDInstallDlg::OnInstall() { BOOL success = FALSE; + int oldlen; if (CheckBINDService()) StopBINDService(); @@ -394,18 +395,45 @@ void CBINDInstallDlg::OnInstall() { UpdateData(); - /* Check that the Passwords entered match */ + /* + * Check that the Passwords entered match. + */ if (m_accountPassword != m_accountPasswordConfirm) { MsgBox(IDS_ERR_PASSWORD); return; } - /* Check the entered account name */ + /* + * Check that there is not leading / trailing whitespace. + * This is for compatability with the standard password dialog. + * Passwords really should be treated as opaque blobs. + */ + oldlen = m_accountPassword.GetLength(); + m_accountPassword.TrimLeft(); + m_accountPassword.TrimRight(); + if (m_accountPassword.GetLength() != oldlen) { + MsgBox(IDS_ERR_WHITESPACE); + return; + } + + /* + * Check that the Password is not null. + */ + if (m_accountPassword.GetLength() == 0) { + MsgBox(IDS_ERR_NULLPASSWORD); + return; + } + + /* + * Check the entered account name. + */ if (ValidateServiceAccount() == FALSE) return; - /* For Registration we need to know if account was changed */ + /* + * For Registration we need to know if account was changed. + */ if(m_accountName != m_currentAccount) m_accountUsed = FALSE; @@ -463,15 +491,13 @@ void CBINDInstallDlg::OnInstall() { SetCurrent(IDS_ADD_REMOVE); if (RegCreateKey(HKEY_LOCAL_MACHINE, BIND_UNINSTALL_SUBKEY, - &hKey) == ERROR_SUCCESS) { - char winDir[MAX_PATH]; + &hKey) == ERROR_SUCCESS) { CString buf(BIND_DISPLAY_NAME); - GetWindowsDirectory(winDir, MAX_PATH); RegSetValueEx(hKey, "DisplayName", 0, REG_SZ, (LPBYTE)(LPCTSTR)buf, buf.GetLength()); - buf.Format("%s\\BINDInstall.exe", winDir); + buf.Format("%s\\BINDInstall.exe", m_binDir); RegSetValueEx(hKey, "UninstallString", 0, REG_SZ, (LPBYTE)(LPCTSTR)buf, buf.GetLength()); RegCloseKey(hKey); diff --git a/bin/win32/BINDInstall/resource.h b/bin/win32/BINDInstall/resource.h index fd142d32d15..14b50846aa2 100644 --- a/bin/win32/BINDInstall/resource.h +++ b/bin/win32/BINDInstall/resource.h @@ -56,6 +56,8 @@ #define IDS_CREATEACCOUNT_FAILED 55 #define IDS_ERR_PASSWORD 56 #define IDS_ERR_UPDATE_SERVICE 57 +#define IDS_ERR_NULLPASSWORD 58 +#define IDS_ERR_WHITESPACE 59 #define IDD_BINDINSTALL_DIALOG 102 #define IDR_MAINFRAME 128 #define IDD_BROWSE 129 diff --git a/lib/isc/win32/include/isc/thread.h b/lib/isc/win32/include/isc/thread.h index bffbe8c834a..6aac8515746 100644 --- a/lib/isc/win32/include/isc/thread.h +++ b/lib/isc/win32/include/isc/thread.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: thread.h,v 1.19 2005/09/18 07:16:24 marka Exp $ */ +/* $Id: thread.h,v 1.20 2005/10/11 22:54:45 marka Exp $ */ #ifndef ISC_THREAD_H #define ISC_THREAD_H 1 @@ -87,7 +87,7 @@ int isc_thread_key_create(isc_thread_key_t *key, void (*func)(void *)); int -isc_thread_key_destroy(isc_thread_key_t key); +isc_thread_key_delete(isc_thread_key_t key); void * isc_thread_key_getspecific(isc_thread_key);