Enforce allowing providers to take away flash abilities

The flags for ALLOW_OFFLINE and ALLOW_ONLINE aren't currently used to
block a provider from flashing a file by hand.
This commit is contained in:
Mario Limonciello 2016-05-18 00:35:02 -05:00
parent 3321d7ea09
commit ff94ccde59

View File

@ -561,6 +561,17 @@ fu_main_provider_update_authenticated (FuMainAuthHelper *helper, GError **error)
return FALSE;
}
/* The provider might have taken away update abilities */
if (!fu_device_has_flag (item->device, FU_DEVICE_FLAG_ALLOW_OFFLINE) &&
!fu_device_has_flag (item->device, FU_DEVICE_FLAG_ALLOW_ONLINE)) {
g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_INTERNAL,
"Device %s does not currently allow updates",
fu_device_get_id (helper->device));
return FALSE;
}
/* can we only do this on AC power */
if (fu_device_has_flag (item->device, FU_DEVICE_FLAG_REQUIRE_AC)) {
if (fu_main_on_battery (helper->priv)) {