aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Move to new isolation test runner.android-o-mr1-iot-release-smart-display-r3android-o-mr1-iot-release-1.0.5oreo-mr1-1.2-iot-releasemaster-cuttlefish-testing-releaseChristopher Ferris2018-09-111-1/+1
| | | | | Test: Ran tests. Change-Id: Ia325d252caa1529abc51715855f7a5f81ea04f10
* Merge remote-tracking branch 'aosp/upstream-master' into aosp/master.android-o-mr1-iot-release-1.0.4Sen Jiang2018-08-1089-1033/+3256
|\ | | | | | | | | | | | | | | | | | | Merge Chromium ToT to AOSP: git fetch aosp upstream-master git merge -X patience aosp/upstream-master Bug: 112326236 Test: libbrillo_test Change-Id: I35fbbddad556b051ce12b9cdd95bb2afef3cf6af
| * libbrillo: policy: Modify UpdateStaging policy due to change in designAdolfo Victoria2018-08-035-155/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify the DeviceUpdateStagingSchedule policy code to account for the changes to use JSON strings. Add JSONToListValue to remove repeated logic between new JSON based policies. BUG=chromium:858621 TEST=cros_workon_make libbrillo --test CQ-DEPEND=CL:1158225 Change-Id: I01f73980c5309d77bfe04861255d6665cb7e2e11 Reviewed-on: https://chromium-review.googlesource.com/1142480 Commit-Ready: Lutz Justen <ljusten@chromium.org> Tested-by: Lutz Justen <ljusten@chromium.org> Tested-by: Adolfo Higueros <adokar@google.com> Reviewed-by: Dan Erat <derat@chromium.org>
| * move manifest* from imageloader to libbrilloXiaochu Liu2018-08-014-0/+291
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We move them to libbrillo so it could be shared by imageloader&dlcservice. BUG=chromium:866203 TEST=unittest Change-Id: Id6e1f898d69c5cb1d4d291147482248ee3578f03 Reviewed-on: https://chromium-review.googlesource.com/1147249 Commit-Ready: Xiaochu Liu <xiaochu@chromium.org> Tested-by: Xiaochu Liu <xiaochu@chromium.org> Reviewed-by: Xiaochu Liu <xiaochu@chromium.org>
| * libbrillo: Add new policy (DeviceUpdateStagingSchedule) for staging updates.May Lippert2018-07-205-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new device policy that will allow administrators to specify a schedule for rolling out updates to an organizational unit. BUG=chromium:858621 TEST=Used YAPS as DM server, verified that the new policy is parsed correctly. CQ-DEPEND=CL:1119162 Change-Id: I72852ddf86e6c7e432aea38a33c6fb3be4c7f315 Reviewed-on: https://chromium-review.googlesource.com/1123683 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: May Lippert <maybelle@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: policy: Add new update time restrictions policyAdolfo Victoria2018-07-186-1/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new device policy from chrome_device_policy.proto: DeviceAutoUpdateTimeRestrictions BUG=chromium:852860 TEST=libpolicy unit tests CQ-DEPEND=CL:1136538 Change-Id: Iaef8791f683af00668dcd4041282758cc26b8fbf Reviewed-on: https://chromium-review.googlesource.com/1101707 Commit-Ready: Adolfo Higueros <adokar@google.com> Tested-by: Adolfo Higueros <adokar@google.com> Reviewed-by: Dan Erat <derat@chromium.org>
| * Add SecureBlob::HexStringToSecureBlob.Jorge Lucangeli Obes2018-06-283-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Polymorphic usage of SecureBlob is problematic (see crbug.com/728047). In some cases we're unnecessarily passing plain Blobs into functions that take SecureBlobs because we don't have code to create a SecureBlob from a hex string, so we use base::HexStringToBytes to create a Blob instead. This CL does attempt to use HexStringToBytes and then zero out the memory. As long as we still have polymorphic usage of SecureBlobs, this is not a big deal. Once we decouple SecureBlob from Blob, we can improve this implementation. BUG=chromium:728047 TEST=New unit tests. Change-Id: Iad94cbd8f574dd35730cb2d68b6ae39798b03ef6 Reviewed-on: https://chromium-review.googlesource.com/1114919 Commit-Ready: Jorge Lucangeli Obes <jorgelo@chromium.org> Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org> Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
| * SecureBlob: Improve unit tests.Jorge Lucangeli Obes2018-06-211-27/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When SecureBlob stops inheriting from Blob we'll want to make sure that functionality continues to work. BUG=chromium:728047 TEST=New unit tests pass. Change-Id: I23bbbc37287046ad48ad3b234d752fba934d8d9e Reviewed-on: https://chromium-review.googlesource.com/1110150 Commit-Ready: Jorge Lucangeli Obes <jorgelo@chromium.org> Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: Blob combining utilityMaksim Ivanov2018-06-073-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a function that concatenates given Blob's. This provides analogous functionality of SecureBlob::Combine() to Blob. BUG=chromium:728047 TEST=new unit test (BlobTest.CombineBlobs) Change-Id: I33218bd81a49a265d021e7afdcf438b7fc70921d Reviewed-on: https://chromium-review.googlesource.com/1089338 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Maksim Ivanov <emaxx@chromium.org> Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
| * libbrillo: Blob to/from std::string conversionsMaksim Ivanov2018-06-053-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add routines that allow dumping Blob contents into an std::string, and, vice versa, constructing Blob from such a string. These helpers should simplify writing code that works with Blob's, and consequently help transitioning away from SecureBlob (as the latter provides the same capabilities). BUG=chromium:728047 TEST=new unit test (BlobTest.StringConversions) Change-Id: I18223a99899216fe07cbf948bef86dce86777f69 Reviewed-on: https://chromium-review.googlesource.com/1076629 Commit-Ready: Maksim Ivanov <emaxx@chromium.org> Tested-by: Maksim Ivanov <emaxx@chromium.org> Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
| * dbus: Fix Properties.Set handler to also emit PropertiesChangedSonny Sasaka2018-06-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a D-Bus property value is changed, it should emit PropertiesChanged signal. BUG=chromium:840517 TEST=None Change-Id: I414a62b04f4fb1383152375e1efae434c114e2be Reviewed-on: https://chromium-review.googlesource.com/1049169 Commit-Ready: Sonny Sasaka <sonnysasaka@chromium.org> Tested-by: Sonny Sasaka <sonnysasaka@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
| * libbrillo: Set RollbackAllowedMilestones enterprise default to 0Marton Hunyady2018-05-313-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changing the default value of RollbackAllowedMilestones policy from 4 to 0 for enterprises (already 0 for consumer devices). Until the kernel and firmware key versions can be set properly from Omaha, we don't freeze key rolls by default, only if it's explicitly specified using enterprise policy. BUG=chromium:847226 TEST='cros_run_unit_tests --board=caroline --packages libbrillo' Change-Id: I4451a4e31f475a8b7557fea4f44dc35afe95ef0b Reviewed-on: https://chromium-review.googlesource.com/1078811 Commit-Ready: Marton Hunyady <hunyadym@chromium.org> Tested-by: Marton Hunyady <hunyadym@chromium.org> Reviewed-by: Mattias Nissler <mnissler@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: Add SecureBlob constructor from BlobMaksim Ivanov2018-05-313-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an explicit constructor that allows to convert Blob into SecureBlob. This should be useful during the transition period while moving away from SecureBlob - if some code has mixed use of Blob's and SecureBlob's, then the new constructor will allow to avoid typing long iterator-based conversions. BUG=chromium:728047 TEST=new unit test (SecureBlobTest.BlobConstructorTest) Change-Id: Icad5f0817174f9ec671580dce402a7c361113b6a Reviewed-on: https://chromium-review.googlesource.com/1076631 Commit-Ready: Maksim Ivanov <emaxx@chromium.org> Tested-by: Maksim Ivanov <emaxx@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org> Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
| * libbrillo: avoid double-binding callbacks and operator()Eric Caruso2018-05-183-54/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The second bind is a no-op since it doesn't provide any extra arguments, so it's just an unnecessary allocation. Also, it looks like new versions of base::Bind don't like functor objects, so instead of packaging the callback's environment as part of an enclosing object we should just bind in the bits we need as arguments. BUG=b:37434548 TEST=unit tests Change-Id: I4bed9857655958f300bc99fa9508f2e940fc4a9a Reviewed-on: https://chromium-review.googlesource.com/1064880 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
| * libbrillo: Delete GlibMessageLoop.Daniel Erat2018-05-025-361/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class is no longer used. BUG=chromium:361635 TEST=built with FEATURES=test, both with and without dbus USE flag Change-Id: I6f96848ba1d137c62396ab2a32b35152ef79040c Reviewed-on: https://chromium-review.googlesource.com/1026843 Commit-Ready: Dan Erat <derat@chromium.org> Tested-by: Dan Erat <derat@chromium.org> Reviewed-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Alex Deymo <deymo@google.com>
| * libbrillo: Add a way to construct FileDescriptor without duping FDRyo Hashimoto2018-04-251-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add FileDescriptor(base::ScopedFD&&) and operator=(base::ScopedFD&&) to create FileDescriptor without calling dup(). Also add release() to take the ownership of the FD without calling dup(). BUG=None TEST=build Change-Id: Id96c3dc76e180bf11b674ad08d7d19f75f854c98 Reviewed-on: https://chromium-review.googlesource.com/1025332 Commit-Ready: Ryo Hashimoto <hashimoto@chromium.org> Tested-by: Ryo Hashimoto <hashimoto@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: Set default values for RollbackAllowedMilestones policy.Marton Hunyady2018-04-199-102/+304
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RollbackAllowedMilestones policy values must be between 0 and 4. Default for enterprise devices is 4, for consumer devices the value is always 0. Because DevicePolicy is not available for consumer devices, this CL adds IsConsumerDevice to PolicyProvider, so update_engine can check whether it should use the consumer 0 or not set anything if the policy is not yet loaded. Not setting anything in the case when the device is still in OOBE is important because setting a smaller value can permanently disable rollback to an older version. BUG=chromium:813036 TEST='cros_run_unit_tests --board=cyan --packages libbrillo' Change-Id: I228b12ddf3ba05f3230d111ac05d74c0330999c4 Reviewed-on: https://chromium-review.googlesource.com/1013461 Commit-Ready: Marton Hunyady <hunyadym@chromium.org> Tested-by: Marton Hunyady <hunyadym@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: Fix DCHECK in PolicyProvider::GetDevicePolicyMarton Hunyady2018-04-181-3/+2
| | | | | | | | | | | | | | | | | | | | | | BUG=None TEST='cros_run_unit_tests --board=cyan --packages libbrillo' Change-Id: Id5f30575268a3e9851fcfdfbab9ae7c887877a8c Reviewed-on: https://chromium-review.googlesource.com/1013485 Commit-Ready: Marton Hunyady <hunyadym@chromium.org> Tested-by: Marton Hunyady <hunyadym@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: use bound arguments rather than capture-by-refEric Caruso2018-04-1114-211/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In future libchrome we will have the ability to bind lambdas but it's considered unacceptable to bind lambdas that carry an environment. To prepare for this, explicitly state the environment as bound bare pointers to local variables. BUG=b:37434548 TEST=unit tests Change-Id: Id6cd318077de9b5ad253731a107d2cb418323de6 Reviewed-on: https://chromium-review.googlesource.com/1003892 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
| * libbrillo: use task runners instead of message loopsEric Caruso2018-04-112-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PostTask, PostDelayedTask, and DeleteSoon methods on message loops are gone in the new libchrome, so use the task runner API instead. BUG=b:37434548 TEST=emerge Change-Id: I5a5de39e8a496fb1bed9f0f8c82f06d19a436125 Reviewed-on: https://chromium-review.googlesource.com/1003593 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: remove unused headerEric Caruso2018-04-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This header is gone in future libchromes and we removed all of the references to dbus::FileDescriptor in previous CLs. BUG=b:37434548 TEST=emerge Change-Id: I0034a1fea6c07ce2a3f95702f363d528662e8225 Reviewed-on: https://chromium-review.googlesource.com/1003595 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: use DCHECK_IS_ON() rather than DEBUG_MODEEric Caruso2018-04-101-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The DEBUG_MODE symbol is gone in the new libchrome. BUG=b:37434548 TEST=emerge Change-Id: Ic31ca0eb9f9ee78ead1d66ec8f08edbd994e6b3a Reviewed-on: https://chromium-review.googlesource.com/1003517 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: remove all uses of dbus::FileDescriptorEric Caruso2018-04-065-120/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't support this anymore and we have to remove it for the libchrome uprev anyway. dbus::FileDescriptor is now dead. CQ-DEPEND=CL:1000494 BUG=b:37434548 TEST=unit tests, build_packages Change-Id: I1ca743a2b6f2875eb97c6c95faf4b2717a21e9d1 Reviewed-on: https://chromium-review.googlesource.com/1000725 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: dup and scope file descriptorEric Caruso2018-04-033-5/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | brillo::dbus_utils::FileDescriptor may be used to pass FDs back out of adaptor code into D-Bus bindings, in which case the adaptor code does not pass ownership of the FDs to the D-Bus bindings but the D-Bus FD will probably outlive the lifetime of the FD in the adaptor code. To deal with this, we use brillo::dbus_utils::FileDescriptor as a wrapper around a ScopedFD which dups file descriptors that are put in. This means adaptor code can pass FDs without having to give up ownership or manually try to mitigate leaks later, and does not have to deal with e.g. duping into a ScopedFD at all callsites. BUG=b:37434548 TEST=unit tests, use in permission_broker/session_manager/etc Change-Id: Ic3f139d4af817bb0bbe975cec3855e44a09bcda9 Reviewed-on: https://chromium-review.googlesource.com/987197 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: Resets property update callback on UnregisterPropertySonny Sasaka2018-03-243-0/+12
| | | | | | | | | | | | | | | | | | | | | | BUG=chromium:812468 TEST=Unit test added Change-Id: I797852ffc456894d845b388feff1de56b922e49b Reviewed-on: https://chromium-review.googlesource.com/974907 Commit-Ready: Sonny Sasaka <sonnysasaka@chromium.org> Tested-by: Sonny Sasaka <sonnysasaka@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
| * libbrillo: add default constructor for FileDescriptorEric Caruso2018-03-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to default-construct the struct so a pointer to one can be passed to D-Bus callers as an out-argument. BUG=chromium:821633 TEST=compile new bindings with permission_broker Change-Id: I1c94d66c24d493a8e35c23724c316cb17bd22fa2 Reviewed-on: https://chromium-review.googlesource.com/976870 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: policy: Add new rollback device policies.Marton Hunyady2018-03-196-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add two new device policies from the chrome_device_policy.proto: - rollback_to_target_version - rollback_allowed_milestones BUG=chromium:813036 TEST='FEATURES=test emerge-cyan protofiles libbrillo' and 'cros_run_unit_tests --board=cyan --packages libbrillo' CQ-DEPEND=CL:960382 Change-Id: Ie408ed993fe02f904c511a35837804ac9ff518f9 Reviewed-on: https://chromium-review.googlesource.com/923971 Commit-Ready: Marton Hunyady <hunyadym@chromium.org> Tested-by: Marton Hunyady <hunyadym@chromium.org> Reviewed-by: Pavol Marko <pmarko@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
| * libbrillo: use base::Value instead of StringValueEric Caruso2018-03-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | StringValue is type aliased to base::Value now, so we should move to explicit base::Value to avoid breaking when we uprev libchrome. BUG=b:37434548 TEST=unit tests Change-Id: I77b4354ff63d71186c74deb5a5b0bc925a577653 Reviewed-on: https://chromium-review.googlesource.com/953648 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: Expose DBusObject of ExportedObjectManager.Sonny Sasaka2018-03-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ExportedObjectManager subscribes to signals on interface org.freedesktop.DBus.ObjectManager. In D-Bus forwarding case, it may receive expected signals from the forwarded service about InterfacesAdded and InterfacesRemoved but it would be logged as unexpected method calls and pollute the logs. There needs to be a way to freely attach method handlers to the expected methods so we can handle them instead of unnecessarily polluting the logs. BUG=chromium:812468 TEST=Tested with Bluetooth daemon D-Bus forwarding Change-Id: Ifb26a2d7ce800fde4311b18efe36ab5110f0dae4 Reviewed-on: https://chromium-review.googlesource.com/958325 Commit-Ready: Sonny Sasaka <sonnysasaka@chromium.org> Tested-by: Sonny Sasaka <sonnysasaka@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
| * libbrillo: provide Daemon method to do init on message loopEric Caruso2018-03-132-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In OnInit the message loop may not be instantiated yet, so if some initialization has to happen asynchronously it might have any task runner to post tasks to. Allow subclasses of Daemon to provide a method implementation with initialization that must take place when the message loop has started and is the current message loop. BUG=b:74250103 TEST=with modemfwd Change-Id: I4c9a35934681a24730b01b60e9bca5e853e104ef Reviewed-on: https://chromium-review.googlesource.com/959524 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: Support adding/removing interfaces and their properties.Sonny Sasaka2018-03-096-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | D-Bus specification allows interfaces to be added or removed even after an object is exported. This CL adds the support to libbrillo's D-Bus library to do this. This is needed by the new Bluetooth daemon which is going to impersonate BlueZ's ObjectManager and BlueZ may add/remove interfaces of an object dynamically. BUG=chromium:812468 TEST=Tested with Bluetooth daemon Change-Id: Ia72735bfd28082cf6c43d1e774beb912fa60ec2d Reviewed-on: https://chromium-review.googlesource.com/956745 Commit-Ready: Sonny Sasaka <sonnysasaka@chromium.org> Tested-by: Sonny Sasaka <sonnysasaka@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
| * libbrillo: add new FD D-Bus bindingsEric Caruso2018-03-096-10/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add serialization and deserialization for the FD types used by the new libchrome D-Bus bindings, and plumb those through the method invoker as well. CQ-DEPEND=CL:956622 BUG=b:37434548 TEST=unit tests Change-Id: Ice58ecd307da253cd073be83c7805e68fb9c6edf Reviewed-on: https://chromium-review.googlesource.com/956623 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
| * libbrillo: use std::make_unique in Value constructionEric Caruso2018-03-051-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | You can return std::unique_ptr<Derived> when the return value is declared as std::unique_ptr<Base> if Derived <: Base, so there is no reason not to use std::make_unique here. Also, since libchrome inlined FundamentalValue into Value, we can explicitly use those constructors instead. BUG=b:37434548 TEST=emerge Change-Id: Ia30bcec79c7b618d0051bf7c054858684327685f Reviewed-on: https://chromium-review.googlesource.com/949663 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: Bitwise operator templates for enumsAaron Wood2018-03-024-0/+370
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an enum is used to define bitwise flags that are meant to be combined (FLAG_ONE | FLAG_TWO), the resultant value needs to be cast back to the enum type in order to be stored in a variable of the same type as the enum (as the result is a value of underlying_type of the enum). This adds a macro that allows templated bitwise operators to be defined so that the enumerators can be used more cleanly in code, while preserving type-safety. BUG=b:37434548 BUG=chromium:815356 TEST=unittests (cherry picked from commit 1d20c7da0b8833ffda7dfff2066205ea1af7e771) Change-Id: I35b2a5b99fe87d63f1d0a0c01fba03e7b2f9a58b Reviewed-on: https://chromium-review.googlesource.com/941982 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
| * libbrillo: Support custom D-Bus property handlersSonny Sasaka2018-03-022-13/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL is to allow clients of DBusObject to implement their own custom property method handlers (GetAll/Get/Set). Possible use cases include: * handling Set method call to be forwarded to another D-Bus service * handling Set method call to trigger some operation other than setting the property value itself. * handling Get method call to return a value which is a function of other properties' values. BUG=chromium:812468 TEST=Tested with Bluetooth daemon that forwards Set method call. Change-Id: I8294dc46885b2105adceb9c144f4d603185e49ff Reviewed-on: https://chromium-review.googlesource.com/939263 Commit-Ready: Sonny Sasaka <sonnysasaka@chromium.org> Tested-by: Sonny Sasaka <sonnysasaka@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
| * libbrillo: add self to OWNERSEric Caruso2018-03-011-1/+1
| | | | | | | | | | | | | | BUG=None TEST=None Change-Id: Ic3d325a5747afdf0f88ea4da399b910dbf60c35e
| * libbrillo: use ScopedTempDir::GetPathEric Caruso2018-02-088-38/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream versions of libchrome have gotten rid of ScopedTempDir's inline path method because they wanted to introduce a DCHECK that helps make sure people create the temp directory before using it. To avoid introducing a header dependency on the logging header they took this method out of the header so it wouldn't be inlined. BUG=b:37434548 TEST=unit tests Change-Id: Ic83227a7ddbbad32a1df1f9554d29470c1a2dd42 Reviewed-on: https://chromium-review.googlesource.com/905784 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: add location to FileDescriptorWatcher constructorEric Caruso2018-02-082-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The constructor for this upstream takes a Location object. We've added this as a transparent wrapper around the current nullary constructor so we can move to the new API without changing the client code. BUG=b:37434548 TEST=unit tests Change-Id: I3889a74e8561a9e5c77a05bc938745cac2d01661 Reviewed-on: https://chromium-review.googlesource.com/905510 Commit-Ready: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: Disable asan on SecureMemset.Manoj Gupta2018-02-024-7/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SecureMemset is used to overwrite beyond string size() but not beyond capacity(). As this behavior is intentional, disable it from asan analysis. Also provide a new asan.h header file to hold all asan specific definitions. BUG=chromium:808243 TEST=libbrillo/cryptohome unit tests pass with asan. Change-Id: Idfabe15614299312be35beb64eae10e5acb07e1b Reviewed-on: https://chromium-review.googlesource.com/898605 Commit-Ready: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
| * libpolicy: Add getter for ChromeDeviceSettingsProtoLutz Justen2018-02-024-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a getter for ChromeDeviceSettingsProto in DevicePolicyImpl. This prevents a lot of boilerplate code when used by classes that deal with device policy, anyway, like authpolicyd. Also adds a way to disable validation to be used for authpolicyd unit tests. BUG=chromium:801704 TEST=cros_run_unit_tests --board=amd64-generic --packages libbrillo Change-Id: Ide9e8f87c9798c6d482e9d88bb7e2f909b1ff02e Reviewed-on: https://chromium-review.googlesource.com/893180 Commit-Ready: Lutz Justen <ljusten@chromium.org> Tested-by: Lutz Justen <ljusten@chromium.org> Reviewed-by: Lutz Justen <ljusten@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: Disable ResizeTest when asan is used.Manoj Gupta2018-01-261-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ResizeTest intentationally does an oob access in vector. Asan complains about this so just disable the test when asan is used. BUG=chromium:806013 TEST=libbrillo unit tests pass with asan. Change-Id: I6abc2ffa30f8ffc6ecb64d89c7857f584d0ec9af Reviewed-on: https://chromium-review.googlesource.com/889659 Commit-Ready: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
| * Make session_manager use proper synchronization primitives.Denis Kuznetsov2017-12-183-15/+324
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Moved a bunch of file utils from cryptohome::Platform to libbrillo/file_utils. BUG=chromium:557833 TEST=cros_workon_make cryptohome --test TEST=cros_workon_make libbrillo --test Change-Id: Ia5ee99a790ea010fc2cd0cac37bb100c81b3ca8c Reviewed-on: https://chromium-review.googlesource.com/822614 Commit-Ready: Denis Kuznetsov <antrim@chromium.org> Tested-by: Denis Kuznetsov <antrim@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: policy: Increase resilience for policy readIgor2017-12-1414-132/+462
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The policy files will be stored with indexes as suffix to improve resilience to disk corruptions. This change makes it possible to read the policy data from new files and validate them. Design doc: https://docs.google.com/document/d/1RdUKb-deQCBiyc6Dpdf4RDBEPV-feb5WHu7uzY1YozQ/edit#heading=h.h0q5njx6l4xf BUG=chromium:764337 TEST=Manual CQ-DEPEND=CL:681939, CL:819250, CL:819353, CL:819412 Change-Id: I10f31d307925c6ccef3cfd0887a71b7c774139e2 Reviewed-on: https://chromium-review.googlesource.com/674935 Commit-Ready: Igor <igorcov@chromium.org> Tested-by: Igor <igorcov@chromium.org> Reviewed-by: Maksim Ivanov <emaxx@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: Log CleanupRaju Konduru2017-10-131-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 1)Print curl request log only for failure case 2)Removed excess log BUG=b:65480079 TEST=cros_workon_make --test --board=gale libbrillo Change-Id: I7e9ef0fb43cb97506043d1c1e2b324facc132a85 Reviewed-on: https://chromium-review.googlesource.com/716437 Commit-Ready: jr.shashidhar jr.shashidhar <jr.shashidhar@globaledgesoftware.corp-partner.google.com> Tested-by: jr.shashidhar jr.shashidhar <jr.shashidhar@globaledgesoftware.corp-partner.google.com> Reviewed-by: Julan Hsu <julanhsu@google.com>
| * libbrillo: migrate from base::MakeUnique to std::make_uniqueBen Chan2017-10-065-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | base::MakeUnique is being deprecated as we can now use std::make_unique when compiling code in the C++14 mode. BUG=chromium:769107 TEST=Run unit tests. Change-Id: Ia3eb683524064888a1c4a29d3ba3e5124c3c9331 Reviewed-on: https://chromium-review.googlesource.com/703881 Commit-Ready: Ben Chan <benchan@chromium.org> Tested-by: Ben Chan <benchan@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
| * Added getting proxy config from Chrome and default proxy transportJeffrey Kardatzke2017-09-287-0/+420
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds methods for getting the proxy settings from Chrome in either a synchronous or asynchronous way. It also then adds a method to http_transport for creating a Transport based off the proxy settings rather than having to call into the curl specific methods. BUG=None TEST=Unit tests pass Change-Id: I4f3df09740e4f3a78563fbb1987928bd794fd3c5 Reviewed-on: https://chromium-review.googlesource.com/687830 Commit-Ready: Jeffrey Kardatzke <jkardatzke@google.com> Tested-by: Jeffrey Kardatzke <jkardatzke@google.com> Reviewed-by: Dan Erat <derat@chromium.org>
| * libbrillo: allow redirecting process inputStephen Barber2017-09-224-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a RedirectInput method to Process that allows redirecting stdin to read from a file. BUG=chromium:767088 TEST=unittests Change-Id: Id3d440048792a9c89e1ffb3b59ba26f888191678 Reviewed-on: https://chromium-review.googlesource.com/673355 Commit-Ready: Stephen Barber <smbarber@chromium.org> Tested-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
| * libbrillo: Steer people away from GLib.Daniel Erat2017-08-253-0/+11
| | | | | | | | | | | | | | | | | | | | Add a brillo/glib/README.md file and some comments warning people away from dbus-glib and GLib. BUG=none TEST=none Change-Id: Iee63ae626fbd630be4d224be47a3d6401ba63902
| * Remove inclusion of brillo/daemons/daemon.h in process_reaper.*Ben Chan2017-08-242-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL removes the unnecesary inclusion of brillo/daemons/daemon.h in process_reaper.*, which don't use anything from daemons/daemons.h. BUG=None TEST=Remote trybot runs. Change-Id: I424df0a2b5895d6a9d33be295a46eed018254bd9 Reviewed-on: https://chromium-review.googlesource.com/631616 Commit-Ready: Ben Chan <benchan@chromium.org> Tested-by: Ben Chan <benchan@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
| * syslog: new option to log in interactive sessionsMike Frysinger2017-08-172-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Developers often want to run programs that log to stderr when they run them by hand, but use syslog when run as a daemon. Add a new flag that turns on stderr logging only when stdin is a tty. BUG=None TEST=unittests pass Change-Id: I8086a4613099c873800188415b97cc7b241ab847 Reviewed-on: https://chromium-review.googlesource.com/616449 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>