Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: chrome/browser/password_manager/password_manager_util_win.cc

Issue 772413004: Revive PasswordManager.OsPasswordStatus histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: blank lines Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/password_manager/chrome_password_manager_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <LM.h> 7 #include <LM.h>
8 #include <wincred.h> 8 #include <wincred.h>
9 9
10 // SECURITY_WIN32 must be defined in order to get 10 // SECURITY_WIN32 must be defined in order to get
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 WCHAR username[CREDUI_MAX_USERNAME_LENGTH+1] = {}; 122 WCHAR username[CREDUI_MAX_USERNAME_LENGTH+1] = {};
123 OsPasswordStatus retVal = PASSWORD_STATUS_UNKNOWN; 123 OsPasswordStatus retVal = PASSWORD_STATUS_UNKNOWN;
124 124
125 if (GetUserNameEx(NameUserPrincipal, username, &username_length)) { 125 if (GetUserNameEx(NameUserPrincipal, username, &username_length)) {
126 // If we are on a domain, it is almost certain that the password is not 126 // If we are on a domain, it is almost certain that the password is not
127 // blank, but we do not actively check any further than this to avoid any 127 // blank, but we do not actively check any further than this to avoid any
128 // failed login attempts hitting the domain controller. 128 // failed login attempts hitting the domain controller.
129 retVal = PASSWORD_STATUS_WIN_DOMAIN; 129 retVal = PASSWORD_STATUS_WIN_DOMAIN;
130 } else { 130 } else {
131 username_length = CREDUI_MAX_USERNAME_LENGTH; 131 username_length = CREDUI_MAX_USERNAME_LENGTH;
132 if (GetUserName(username, &username_length)) { 132 // CheckBlankPassword() isn't safe to call on before Windows 7.
133 // http://crbug.com/345916
134 if (base::win::GetVersion() >= base::win::VERSION_WIN7 &&
135 GetUserName(username, &username_length)) {
133 retVal = CheckBlankPassword(username) ? PASSWORD_STATUS_BLANK : 136 retVal = CheckBlankPassword(username) ? PASSWORD_STATUS_BLANK :
134 PASSWORD_STATUS_NONBLANK; 137 PASSWORD_STATUS_NONBLANK;
135 } 138 }
136 } 139 }
137 140
138 return retVal; 141 return retVal;
139 } 142 }
140 143
141 bool AuthenticateUser(gfx::NativeWindow window) { 144 bool AuthenticateUser(gfx::NativeWindow window) {
142 bool retval = false; 145 bool retval = false;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 238 }
236 } 239 }
237 SecureZeroMemory(password, sizeof(password)); 240 SecureZeroMemory(password, sizeof(password));
238 } 241 }
239 } while (credErr == NO_ERROR && 242 } while (credErr == NO_ERROR &&
240 (retval == false && tries < kMaxPasswordRetries)); 243 (retval == false && tries < kMaxPasswordRetries));
241 return retval; 244 return retval;
242 } 245 }
243 246
244 } // namespace password_manager_util 247 } // namespace password_manager_util
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/chrome_password_manager_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698