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

Unified Diff: net/base/auth.cc

Issue 8340026: Use AuthCredentials throughout the network stack instead of username/password. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: mac compile fix Created 9 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: net/base/auth.cc
diff --git a/net/base/auth.cc b/net/base/auth.cc
index 104400f6afb5729cf13f73dd65162c6bd42702e9..b132a0c44a471ed903d7115550f99349d2155a5b 100644
--- a/net/base/auth.cc
+++ b/net/base/auth.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "net/base/auth.h"
+#include "net/base/zap.h"
namespace net {
@@ -28,7 +29,29 @@ AuthData::~AuthData() {
AuthCredentials::AuthCredentials() {
}
+AuthCredentials::AuthCredentials(const string16& username,
+ const string16& password)
+ : username_(username),
+ password_(password) {
+}
+
AuthCredentials::~AuthCredentials() {
+ // Wipe our copy of the password from memory, to reduce the chance of being
+ // written to the paging file on disk.
+ ZapString(&password_);
+}
+
+bool AuthCredentials::Equals(const AuthCredentials& other) const {
+ return username_ == other.username_ && password_ == other.password_;
+}
+
+bool AuthCredentials::Empty() const {
+ return username_.empty() && password_.empty();
+}
+
+void AuthCredentials::Set(const string16& username, const string16& password) {
+ username_ = username;
+ password_ = password;
asanka 2011/10/27 20:01:20 Zap password_ before assignment? Also consider as
cbentzel 2011/10/28 02:18:40 As we discussed, I'll change behavior in another C
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698