• Home
  • Raw
  • Download

Lines Matching refs:name

78 static bool check_mac_perms(const std::string& name, char* sctx, struct ucred* cr) {  in check_mac_perms()  argument
89 if (selabel_lookup(sehandle_prop, &tctx, name.c_str(), 1) != 0) { in check_mac_perms()
95 audit_data.name = name.c_str(); in check_mac_perms()
104 static int check_control_mac_perms(const char *name, char *sctx, struct ucred *cr) in check_control_mac_perms() argument
113 int ret = snprintf(ctl_name, sizeof(ctl_name), "ctl.%s", name); in check_control_mac_perms()
121 static void write_persistent_property(const char *name, const char *value) in write_persistent_property() argument
137 snprintf(path, sizeof(path), "%s/%s", PERSISTENT_PROPERTY_DIR, name); in write_persistent_property()
144 bool is_legal_property_name(const std::string& name) { in is_legal_property_name() argument
145 size_t namelen = name.size(); in is_legal_property_name()
148 if (name[0] == '.') return false; in is_legal_property_name()
149 if (name[namelen - 1] == '.') return false; in is_legal_property_name()
154 if (name[i] == '.') { in is_legal_property_name()
156 if (name[i-1] == '.') return false; in is_legal_property_name()
159 if (name[i] == '_' || name[i] == '-' || name[i] == '@' || name[i] == ':') continue; in is_legal_property_name()
160 if (name[i] >= 'a' && name[i] <= 'z') continue; in is_legal_property_name()
161 if (name[i] >= 'A' && name[i] <= 'Z') continue; in is_legal_property_name()
162 if (name[i] >= '0' && name[i] <= '9') continue; in is_legal_property_name()
169 static uint32_t PropertySetImpl(const std::string& name, const std::string& value) { in PropertySetImpl() argument
172 if (!is_legal_property_name(name)) { in PropertySetImpl()
173 LOG(ERROR) << "property_set(\"" << name << "\", \"" << value << "\") failed: bad name"; in PropertySetImpl()
178 LOG(ERROR) << "property_set(\"" << name << "\", \"" << value << "\") failed: " in PropertySetImpl()
183 prop_info* pi = (prop_info*) __system_property_find(name.c_str()); in PropertySetImpl()
186 if (android::base::StartsWith(name, "ro.")) { in PropertySetImpl()
187 LOG(ERROR) << "property_set(\"" << name << "\", \"" << value << "\") failed: " in PropertySetImpl()
194 int rc = __system_property_add(name.c_str(), name.size(), value.c_str(), valuelen); in PropertySetImpl()
196 LOG(ERROR) << "property_set(\"" << name << "\", \"" << value << "\") failed: " in PropertySetImpl()
204 if (persistent_properties_loaded && android::base::StartsWith(name, "persist.")) { in PropertySetImpl()
205 write_persistent_property(name.c_str(), value.c_str()); in PropertySetImpl()
207 property_changed(name, value); in PropertySetImpl()
216 std::string name; member
235 if (info.func(info.name, info.value) != 0) { in PropertyChildLaunch()
236 LOG(ERROR) << "property_set_async(\"" << info.name << "\", \"" << info.value in PropertyChildLaunch()
251 if (PropertySetImpl(info.name, info.value) != PROP_SUCCESS) { in PropertyChildReap()
252 LOG(ERROR) << "Failed to set async property " << info.name; in PropertyChildReap()
261 static uint32_t PropertySetAsync(const std::string& name, const std::string& value, in PropertySetAsync() argument
264 return PropertySetImpl(name, value); in PropertySetAsync()
269 info.name = name; in PropertySetAsync()
278 static int RestoreconRecursiveAsync(const std::string& name, const std::string& value) { in RestoreconRecursiveAsync() argument
282 uint32_t property_set(const std::string& name, const std::string& value) { in property_set() argument
283 if (name == "selinux.restorecon_recursive") { in property_set()
284 return PropertySetAsync(name, value, RestoreconRecursiveAsync); in property_set()
287 return PropertySetImpl(name, value); in property_set()
411 const std::string& name, in handle_property_set() argument
415 if (!is_legal_property_name(name)) { in handle_property_set()
416 LOG(ERROR) << "sys_prop(" << cmd_name << "): illegal property name \"" << name << "\""; in handle_property_set()
425 if (android::base::StartsWith(name, "ctl.")) { in handle_property_set()
427 handle_control_message(name.c_str() + 4, value.c_str()); in handle_property_set()
432 LOG(ERROR) << "sys_prop(" << cmd_name << "): Unable to " << (name.c_str() + 4) in handle_property_set()
442 if (check_mac_perms(name, source_ctx, &cr)) { in handle_property_set()
443 uint32_t result = property_set(name, value); in handle_property_set()
448 …LOG(ERROR) << "sys_prop(" << cmd_name << "): permission denied uid:" << cr.uid << " name:" << name; in handle_property_set()
503 std::string name; in handle_property_set_fd() local
505 if (!socket.RecvString(&name, &timeout_ms) || in handle_property_set_fd()
512 handle_property_set(socket, name, value, false); in handle_property_set_fd()