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

Unified Diff: chromeos/dbus/fake_auth_policy_client.cc

Issue 2653913002: Check username validity in the FakeAuthPolicyClient (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « chrome/browser/resources/chromeos/login/offline_ad_login.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/fake_auth_policy_client.cc
diff --git a/chromeos/dbus/fake_auth_policy_client.cc b/chromeos/dbus/fake_auth_policy_client.cc
index f37f1ea53bc88d6aa576485db9d67fb310e6978b..78f3edcf4cef525e55ee06aa34be27f2e3c1f8b0 100644
--- a/chromeos/dbus/fake_auth_policy_client.cc
+++ b/chromeos/dbus/fake_auth_policy_client.cc
@@ -10,6 +10,7 @@
#include "base/location.h"
#include "base/md5.h"
#include "base/path_service.h"
+#include "base/strings/string_split.h"
#include "base/task_scheduler/post_task.h"
#include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
#include "chromeos/chromeos_paths.h"
@@ -65,6 +66,13 @@ void FakeAuthPolicyClient::JoinAdDomain(const std::string& machine_name,
const std::string& user_principal_name,
int password_fd,
const JoinCallback& callback) {
+ std::vector<std::string> parts = base::SplitString(
+ user_principal_name, "@", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+ if (parts.size() != 2U) {
Thiemo Nagel 2017/01/24 14:17:36 It seems that you'll have to check the sizes of th
achuithb 2017/01/24 19:42:11 Sounds like we need a unit test
Roman Sorokin (ftl) 2017/01/25 11:50:18 Done.
Roman Sorokin (ftl) 2017/01/25 11:50:18 Done.
+ callback.Run(authpolicy::ERROR_PARSE_UPN_FAILED);
+ return;
+ }
+
callback.Run(authpolicy::ERROR_NONE);
}
« no previous file with comments | « chrome/browser/resources/chromeos/login/offline_ad_login.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698