| OLD | NEW |
| 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 #ifndef LOGIN_MANAGER_SESSION_MANAGER_SERVICE_H_ | 5 #ifndef LOGIN_MANAGER_SESSION_MANAGER_SERVICE_H_ |
| 6 #define LOGIN_MANAGER_SESSION_MANAGER_SERVICE_H_ | 6 #define LOGIN_MANAGER_SESSION_MANAGER_SERVICE_H_ |
| 7 | 7 |
| 8 #include <dbus/dbus.h> | 8 #include <dbus/dbus.h> |
| 9 #include <errno.h> | 9 #include <errno.h> |
| 10 #include <glib.h> | 10 #include <glib.h> |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 // ServiceShutdown() so that we can register it as the callback for | 367 // ServiceShutdown() so that we can register it as the callback for |
| 368 // when |source| has data to read. | 368 // when |source| has data to read. |
| 369 static gboolean HandleKill(GIOChannel* source, | 369 static gboolean HandleKill(GIOChannel* source, |
| 370 GIOCondition condition, | 370 GIOCondition condition, |
| 371 gpointer data); | 371 gpointer data); |
| 372 | 372 |
| 373 // So that we can enqueue an event that will exit the main loop. | 373 // So that we can enqueue an event that will exit the main loop. |
| 374 // |data| is a SessionManagerService* | 374 // |data| is a SessionManagerService* |
| 375 static gboolean ServiceShutdown(gpointer data); | 375 static gboolean ServiceShutdown(gpointer data); |
| 376 | 376 |
| 377 // Initializes |error| with |code| and |message|. | |
| 378 static void SetGError(GError** error, | |
| 379 ChromeOSLoginError code, | |
| 380 const char* message); | |
| 381 | |
| 382 // Initializes |error| with |code| and |message|. | |
| 383 static void SetAndSendGError(ChromeOSLoginError code, | |
| 384 DBusGMethodInvocation* context, | |
| 385 const char* message); | |
| 386 | |
| 387 // Setup any necessary signal handlers. | 377 // Setup any necessary signal handlers. |
| 388 void SetupHandlers(); | 378 void SetupHandlers(); |
| 389 | 379 |
| 390 // Returns true if the current user is listed in |store_| as the | 380 // Returns true if the current user is listed in |store_| as the |
| 391 // kDeviceOwner. Returns false if not, or if that cannot be determined. | 381 // kDeviceOwner. Returns false if not, or if that cannot be determined. |
| 392 // |error| is set appropriately on failure. | 382 gboolean CurrentUserIsOwner(); |
| 393 gboolean CurrentUserIsOwner(GError** error); | |
| 394 | 383 |
| 395 // Returns true if the current user has the private half of |pub_key| | 384 // Returns true if the current user has the private half of |pub_key| |
| 396 // in his nssdb. Returns false if not, or if that cannot be determined. | 385 // in his nssdb. Returns false if not, or if that cannot be determined. |
| 397 // |error| is set appropriately on failure. | 386 // |error| is set appropriately on failure. |
| 398 gboolean CurrentUserHasOwnerKey(const std::vector<uint8>& pub_key, | 387 gboolean CurrentUserHasOwnerKey(const std::vector<uint8>& pub_key, |
| 399 GError** error); | 388 GError** error); |
| 400 | 389 |
| 401 // Cache |email_address| in |current_user_| and return true, if the address | 390 // Cache |email_address| in |current_user_| and return true, if the address |
| 402 // passes validation. Otherwise, set |error| appropriately and return false. | 391 // passes validation. Otherwise, set |error| appropriately and return false. |
| 403 gboolean ValidateAndCacheUserEmail(const gchar* email_address, | 392 gboolean ValidateAndCacheUserEmail(const gchar* email_address, |
| 404 GError** error); | 393 GError** error); |
| 405 | 394 |
| 406 // Searches through |child_pids_| for |pid|. Returns index of child if | 395 // Searches through |child_pids_| for |pid|. Returns index of child if |
| 407 // found, -1 if not. | 396 // found, -1 if not. |
| 408 int FindChildByPid(int pid); | 397 int FindChildByPid(int pid); |
| 409 | 398 |
| 410 // Terminate all children, with increasing prejudice. | 399 // Terminate all children, with increasing prejudice. |
| 411 void CleanupChildren(int timeout); | 400 void CleanupChildren(int timeout); |
| 412 | 401 |
| 413 // Assuming the current user has access to the owner private key | 402 // Assuming the current user has access to the owner private key |
| 414 // (read: is the owner), this call whitelists |current_user_|, sets a | 403 // (read: is the owner), this call whitelists |current_user_|, sets a |
| 415 // property indicating |current_user_| is the owner, and schedules both | 404 // property indicating |current_user_| is the owner, and schedules both |
| 416 // a PersistWhitelist() and a PersistStore(). | 405 // a PersistWhitelist() and a PersistStore(). |
| 417 // Returns false on failure, with |error| set appropriately. | 406 // Returns false on failure, with |error| set appropriately. |
| 407 // |error| can be NULL, should you wish to ignore the particulars. |
| 418 gboolean StoreOwnerProperties(GError** error); | 408 gboolean StoreOwnerProperties(GError** error); |
| 419 | 409 |
| 420 // Signs and stores |name|=|value|, and schedules a PersistStore(). | 410 // Signs and stores |name|=|value|, and schedules a PersistStore(). |
| 421 // Returns false on failure, populating |error| with |err_msg|. | 411 // Returns false on failure, populating |error| with |err_msg|. |
| 422 gboolean SignAndStoreProperty(const std::string& name, | 412 gboolean SignAndStoreProperty(const std::string& name, |
| 423 const std::string& value, | 413 const std::string& value, |
| 424 const std::string& err_msg, | 414 const std::string& err_msg, |
| 425 GError** error); | 415 GError** error); |
| 426 | 416 |
| 427 // Signs and whitelists |email|, and schedules a PersistWhitelist(). | 417 // Signs and whitelists |email|, and schedules a PersistWhitelist(). |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 | 528 |
| 539 bool shutting_down_; | 529 bool shutting_down_; |
| 540 bool shutdown_already_; | 530 bool shutdown_already_; |
| 541 | 531 |
| 542 friend class TestAPI; | 532 friend class TestAPI; |
| 543 DISALLOW_COPY_AND_ASSIGN(SessionManagerService); | 533 DISALLOW_COPY_AND_ASSIGN(SessionManagerService); |
| 544 }; | 534 }; |
| 545 } // namespace login_manager | 535 } // namespace login_manager |
| 546 | 536 |
| 547 #endif // LOGIN_MANAGER_SESSION_MANAGER_SERVICE_H_ | 537 #endif // LOGIN_MANAGER_SESSION_MANAGER_SERVICE_H_ |
| OLD | NEW |