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

Side by Side Diff: session_manager_service.cc

Issue 6820024: [login_manager] Fix race condition that caused ownership to never work (Closed) Base URL: http://git.chromium.org/git/login_manager.git@master
Patch Set: comment update Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « nss_util.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 (c) 2011 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium OS 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 #include "login_manager/session_manager_service.h" 5 #include "login_manager/session_manager_service.h"
6 6
7 #include <dbus/dbus-glib-lowlevel.h> 7 #include <dbus/dbus-glib-lowlevel.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <glib.h> 9 #include <glib.h>
10 #include <grp.h> 10 #include <grp.h>
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 if (VerifyHelper(was_signed, decoded.c_str(), decoded.length()) != SUCCESS) { 1132 if (VerifyHelper(was_signed, decoded.c_str(), decoded.length()) != SUCCESS) {
1133 LOG(ERROR) << "Owner pref signature could not be verified."; 1133 LOG(ERROR) << "Owner pref signature could not be verified.";
1134 return FALSE; 1134 return FALSE;
1135 } 1135 }
1136 return value == current_user_; 1136 return value == current_user_;
1137 } 1137 }
1138 1138
1139 gboolean SessionManagerService::CurrentUserHasOwnerKey( 1139 gboolean SessionManagerService::CurrentUserHasOwnerKey(
1140 const std::vector<uint8>& pub_key, 1140 const std::vector<uint8>& pub_key,
1141 GError** error) { 1141 GError** error) {
1142 if (!nss_->MightHaveKeys())
1143 return FALSE;
1142 if (!nss_->OpenUserDB()) { 1144 if (!nss_->OpenUserDB()) {
1143 const char msg[] = "Could not open the current user's NSS database."; 1145 const char msg[] = "Could not open the current user's NSS database.";
1144 LOG(ERROR) << msg; 1146 LOG(ERROR) << msg;
1145 system_->SetGError(error, CHROMEOS_LOGIN_ERROR_NO_USER_NSSDB, msg); 1147 system_->SetGError(error, CHROMEOS_LOGIN_ERROR_NO_USER_NSSDB, msg);
1146 return FALSE; 1148 return FALSE;
1147 } 1149 }
1148 if (!nss_->GetPrivateKey(pub_key)) { 1150 if (!nss_->GetPrivateKey(pub_key)) {
1149 const char msg[] = "Could not verify that public key belongs to the owner."; 1151 const char msg[] = "Could not verify that public key belongs to the owner.";
1150 LOG(WARNING) << msg; 1152 LOG(WARNING) << msg;
1151 system_->SetGError(error, CHROMEOS_LOGIN_ERROR_ILLEGAL_PUBKEY, msg); 1153 system_->SetGError(error, CHROMEOS_LOGIN_ERROR_ILLEGAL_PUBKEY, msg);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 arg_list.push_back(args[i_arg]); 1354 arg_list.push_back(args[i_arg]);
1353 } 1355 }
1354 } 1356 }
1355 if (arg_list.size()) { 1357 if (arg_list.size()) {
1356 arg_lists.push_back(arg_list); 1358 arg_lists.push_back(arg_list);
1357 } 1359 }
1358 return arg_lists; 1360 return arg_lists;
1359 } 1361 }
1360 1362
1361 } // namespace login_manager 1363 } // namespace login_manager
OLDNEW
« no previous file with comments | « nss_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698