OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // windows.h must be first otherwise Win8 SDK breaks. | 5 // windows.h must be first otherwise Win8 SDK breaks. |
6 #include <windows.h> | 6 #include <windows.h> |
7 #include <wincred.h> | 7 #include <wincred.h> |
8 #include <LM.h> | 8 #include <LM.h> |
9 | 9 |
10 // SECURITY_WIN32 must be defined in order to get | 10 // SECURITY_WIN32 must be defined in order to get |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 return retVal; | 149 return retVal; |
150 } | 150 } |
151 | 151 |
152 bool AuthenticateUser(gfx::NativeWindow window) { | 152 bool AuthenticateUser(gfx::NativeWindow window) { |
153 bool retval = false; | 153 bool retval = false; |
154 CREDUI_INFO cui = {}; | 154 CREDUI_INFO cui = {}; |
155 WCHAR username[CREDUI_MAX_USERNAME_LENGTH+1] = {}; | 155 WCHAR username[CREDUI_MAX_USERNAME_LENGTH+1] = {}; |
156 WCHAR displayname[CREDUI_MAX_USERNAME_LENGTH+1] = {}; | 156 WCHAR displayname[CREDUI_MAX_USERNAME_LENGTH+1] = {}; |
157 WCHAR password[CREDUI_MAX_PASSWORD_LENGTH+1] = {}; | 157 WCHAR password[CREDUI_MAX_PASSWORD_LENGTH+1] = {}; |
158 DWORD username_length = CREDUI_MAX_USERNAME_LENGTH; | 158 DWORD username_length = CREDUI_MAX_USERNAME_LENGTH; |
159 std::wstring product_name = | 159 base::string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
160 base::UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 160 base::string16 password_prompt = |
161 std::wstring password_prompt = | 161 l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_AUTHENTICATION_PROMPT); |
162 base::UTF16ToWide(l10n_util::GetStringUTF16( | |
163 IDS_PASSWORDS_PAGE_AUTHENTICATION_PROMPT)); | |
164 HANDLE handle = INVALID_HANDLE_VALUE; | 162 HANDLE handle = INVALID_HANDLE_VALUE; |
165 int tries = 0; | 163 int tries = 0; |
166 bool use_displayname = false; | 164 bool use_displayname = false; |
167 bool use_principalname = false; | 165 bool use_principalname = false; |
168 DWORD logon_result = 0; | 166 DWORD logon_result = 0; |
169 | 167 |
170 // Disable password manager reauthentication before Windows 7. | 168 // Disable password manager reauthentication before Windows 7. |
171 // This is because of an interaction between LogonUser() and the sandbox. | 169 // This is because of an interaction between LogonUser() and the sandbox. |
172 // http://crbug.com/345916 | 170 // http://crbug.com/345916 |
173 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 171 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 246 } |
249 } | 247 } |
250 SecureZeroMemory(password, sizeof(password)); | 248 SecureZeroMemory(password, sizeof(password)); |
251 } | 249 } |
252 } while (credErr == NO_ERROR && | 250 } while (credErr == NO_ERROR && |
253 (retval == false && tries < kMaxPasswordRetries)); | 251 (retval == false && tries < kMaxPasswordRetries)); |
254 return retval; | 252 return retval; |
255 } | 253 } |
256 | 254 |
257 } // namespace password_manager_util | 255 } // namespace password_manager_util |
OLD | NEW |