• Home
  • Raw
  • Download

Lines Matching refs:name

73 static int check_mac_perms(const char *name, char *sctx, struct ucred *cr)  in check_mac_perms()  argument
85 if (selabel_lookup(sehandle_prop, &tctx, name, 1) != 0) in check_mac_perms()
88 audit_data.name = name; in check_mac_perms()
99 static int check_control_mac_perms(const char *name, char *sctx, struct ucred *cr) in check_control_mac_perms() argument
108 int ret = snprintf(ctl_name, sizeof(ctl_name), "ctl.%s", name); in check_control_mac_perms()
116 std::string property_get(const char* name) { in property_get() argument
118 __system_property_get(name, value); in property_get()
122 static void write_persistent_property(const char *name, const char *value) in write_persistent_property() argument
138 snprintf(path, sizeof(path), "%s/%s", PERSISTENT_PROPERTY_DIR, name); in write_persistent_property()
145 static bool is_legal_property_name(const char* name, size_t namelen) in is_legal_property_name() argument
150 if (name[0] == '.') return false; in is_legal_property_name()
151 if (name[namelen - 1] == '.') return false; in is_legal_property_name()
156 if (name[i] == '.') { in is_legal_property_name()
158 if (name[i-1] == '.') return false; in is_legal_property_name()
161 if (name[i] == '_' || name[i] == '-') continue; in is_legal_property_name()
162 if (name[i] >= 'a' && name[i] <= 'z') continue; in is_legal_property_name()
163 if (name[i] >= 'A' && name[i] <= 'Z') continue; in is_legal_property_name()
164 if (name[i] >= '0' && name[i] <= '9') continue; in is_legal_property_name()
171 static int property_set_impl(const char* name, const char* value) { in property_set_impl() argument
172 size_t namelen = strlen(name); in property_set_impl()
175 if (!is_legal_property_name(name, namelen)) return -1; in property_set_impl()
178 if (strcmp("selinux.reload_policy", name) == 0 && strcmp("1", value) == 0) { in property_set_impl()
182 } else if (strcmp("selinux.restorecon_recursive", name) == 0 && valuelen > 0) { in property_set_impl()
188 prop_info* pi = (prop_info*) __system_property_find(name); in property_set_impl()
192 if(!strncmp(name, "ro.", 3)) return -1; in property_set_impl()
196 int rc = __system_property_add(name, namelen, value, valuelen); in property_set_impl()
202 if (strncmp("net.", name, strlen("net.")) == 0) { in property_set_impl()
203 if (strcmp("net.change", name) == 0) { in property_set_impl()
211 property_set("net.change", name); in property_set_impl()
213 strncmp("persist.", name, strlen("persist.")) == 0) { in property_set_impl()
218 write_persistent_property(name, value); in property_set_impl()
220 property_changed(name, value); in property_set_impl()
224 int property_set(const char* name, const char* value) { in property_set() argument
225 int rc = property_set_impl(name, value); in property_set()
227 ERROR("property_set(\"%s\", \"%s\") failed\n", name, value); in property_set()
281 msg.name[PROP_NAME_MAX-1] = 0; in handle_property_set_fd()
284 if (!is_legal_property_name(msg.name, strlen(msg.name))) { in handle_property_set_fd()
285 ERROR("sys_prop: illegal property name. Got: \"%s\"\n", msg.name); in handle_property_set_fd()
292 if(memcmp(msg.name,"ctl.",4) == 0) { in handle_property_set_fd()
297 handle_control_message((char*) msg.name + 4, (char*) msg.value); in handle_property_set_fd()
300 msg.name + 4, msg.value, cr.uid, cr.gid, cr.pid); in handle_property_set_fd()
303 if (check_mac_perms(msg.name, source_ctx, &cr)) { in handle_property_set_fd()
304 property_set((char*) msg.name, (char*) msg.value); in handle_property_set_fd()
307 cr.uid, msg.name); in handle_property_set_fd()