Merge "Allow setting read-only properties with value length > 92 characters"
This commit is contained in:
commit
96e8042e41
1 changed files with 5 additions and 4 deletions
|
|
@ -57,6 +57,7 @@
|
||||||
#include "persistent_properties.h"
|
#include "persistent_properties.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
using android::base::StartsWith;
|
||||||
using android::base::StringPrintf;
|
using android::base::StringPrintf;
|
||||||
using android::base::Timer;
|
using android::base::Timer;
|
||||||
|
|
||||||
|
|
@ -153,7 +154,7 @@ static uint32_t PropertySetImpl(const std::string& name, const std::string& valu
|
||||||
return PROP_ERROR_INVALID_NAME;
|
return PROP_ERROR_INVALID_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valuelen >= PROP_VALUE_MAX) {
|
if (valuelen >= PROP_VALUE_MAX && !StartsWith(name, "ro.")) {
|
||||||
LOG(ERROR) << "property_set(\"" << name << "\", \"" << value << "\") failed: "
|
LOG(ERROR) << "property_set(\"" << name << "\", \"" << value << "\") failed: "
|
||||||
<< "value too long";
|
<< "value too long";
|
||||||
return PROP_ERROR_INVALID_VALUE;
|
return PROP_ERROR_INVALID_VALUE;
|
||||||
|
|
@ -162,7 +163,7 @@ static uint32_t PropertySetImpl(const std::string& name, const std::string& valu
|
||||||
prop_info* pi = (prop_info*) __system_property_find(name.c_str());
|
prop_info* pi = (prop_info*) __system_property_find(name.c_str());
|
||||||
if (pi != nullptr) {
|
if (pi != nullptr) {
|
||||||
// ro.* properties are actually "write-once".
|
// ro.* properties are actually "write-once".
|
||||||
if (android::base::StartsWith(name, "ro.")) {
|
if (StartsWith(name, "ro.")) {
|
||||||
LOG(ERROR) << "property_set(\"" << name << "\", \"" << value << "\") failed: "
|
LOG(ERROR) << "property_set(\"" << name << "\", \"" << value << "\") failed: "
|
||||||
<< "property already set";
|
<< "property already set";
|
||||||
return PROP_ERROR_READ_ONLY_PROPERTY;
|
return PROP_ERROR_READ_ONLY_PROPERTY;
|
||||||
|
|
@ -180,7 +181,7 @@ static uint32_t PropertySetImpl(const std::string& name, const std::string& valu
|
||||||
|
|
||||||
// Don't write properties to disk until after we have read all default
|
// Don't write properties to disk until after we have read all default
|
||||||
// properties to prevent them from being overwritten by default values.
|
// properties to prevent them from being overwritten by default values.
|
||||||
if (persistent_properties_loaded && android::base::StartsWith(name, "persist.")) {
|
if (persistent_properties_loaded && StartsWith(name, "persist.")) {
|
||||||
WritePersistentProperty(name, value);
|
WritePersistentProperty(name, value);
|
||||||
}
|
}
|
||||||
property_changed(name, value);
|
property_changed(name, value);
|
||||||
|
|
@ -401,7 +402,7 @@ static void handle_property_set(SocketConnection& socket,
|
||||||
char* source_ctx = nullptr;
|
char* source_ctx = nullptr;
|
||||||
getpeercon(socket.socket(), &source_ctx);
|
getpeercon(socket.socket(), &source_ctx);
|
||||||
|
|
||||||
if (android::base::StartsWith(name, "ctl.")) {
|
if (StartsWith(name, "ctl.")) {
|
||||||
if (check_control_mac_perms(value.c_str(), source_ctx, &cr)) {
|
if (check_control_mac_perms(value.c_str(), source_ctx, &cr)) {
|
||||||
handle_control_message(name.c_str() + 4, value.c_str());
|
handle_control_message(name.c_str() + 4, value.c_str());
|
||||||
if (!legacy_protocol) {
|
if (!legacy_protocol) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue