Lines Matching refs:cr
126 const ucred* cr; member
133 if (!d || !d->name || !d->cr) { in PropertyAuditCallback()
138 snprintf(buf, len, "property=%s pid=%d uid=%d gid=%d", d->name, d->cr->pid, d->cr->uid, in PropertyAuditCallback()
139 d->cr->gid); in PropertyAuditCallback()
161 ucred cr = {.pid = 0, .uid = 0, .gid = 0}; in CanReadProperty() local
162 audit_data.cr = &cr; in CanReadProperty()
169 const char* source_context, const ucred& cr) { in CheckMacPerms() argument
177 audit_data.cr = &cr; in CheckMacPerms()
463 const std::string& source_context, const ucred& cr) { in CheckControlPropertyPerms() argument
477 … if (CheckMacPerms(control_string_legacy, target_context_legacy, source_context.c_str(), cr)) { in CheckControlPropertyPerms()
488 return CheckMacPerms(control_string_full, target_context_full, source_context.c_str(), cr); in CheckControlPropertyPerms()
493 const std::string& source_context, const ucred& cr, std::string* error) { in CheckPermissions() argument
500 if (!CheckControlPropertyPerms(name, value, source_context, cr)) { in CheckPermissions()
513 if (!CheckMacPerms(name, target_context, source_context.c_str(), cr)) { in CheckPermissions()
530 const std::string& source_context, const ucred& cr, in HandlePropertySet() argument
532 if (auto ret = CheckPermissions(name, value, source_context, cr, error); ret != PROP_SUCCESS) { in HandlePropertySet()
537 return {SendControlMessage(name.c_str() + 4, value, cr.pid, socket, error)}; in HandlePropertySet()
543 std::string cmdline_path = StringPrintf("proc/%d/cmdline", cr.pid); in HandlePropertySet()
551 LOG(INFO) << "Received sys.powerctl='" << value << "' from pid: " << cr.pid in HandlePropertySet()
563 if (name == kRestoreconProperty && cr.pid != 1 && !value.empty()) { in HandlePropertySet()
575 const std::string& source_context, const ucred& cr, in HandlePropertySetNoSocket() argument
577 auto ret = HandlePropertySet(name, value, source_context, cr, nullptr, error); in HandlePropertySetNoSocket()
590 ucred cr; in handle_property_set_fd() local
591 socklen_t cr_size = sizeof(cr); in handle_property_set_fd()
592 if (getsockopt(s, SOL_SOCKET, SO_PEERCRED, &cr, &cr_size) < 0) { in handle_property_set_fd()
598 SocketConnection socket(s, cr); in handle_property_set_fd()
628 const auto& cr = socket.cred(); in handle_property_set_fd() local
630 auto result = HandlePropertySetNoSocket(prop_name, prop_value, source_context, cr, &error); in handle_property_set_fd()
632 LOG(ERROR) << "Unable to set property '" << prop_name << "' from uid:" << cr.uid in handle_property_set_fd()
633 << " gid:" << cr.gid << " pid:" << cr.pid << ": " << error; in handle_property_set_fd()
657 const auto& cr = socket.cred(); in handle_property_set_fd() local
659 auto result = HandlePropertySet(name, value, source_context, cr, &socket, &error); in handle_property_set_fd()
665 LOG(ERROR) << "Unable to set property '" << name << "' from uid:" << cr.uid in handle_property_set_fd()
666 << " gid:" << cr.gid << " pid:" << cr.pid << ": " << error; in handle_property_set_fd()
680 ucred cr = {.pid = 1, .uid = 0, .gid = 0}; in InitPropertySet() local
682 auto result = HandlePropertySetNoSocket(name, value, kInitContext, cr, &error); in InitPropertySet()
781 ucred cr = {.pid = 1, .uid = 0, .gid = 0}; in LoadProperties() local
783 if (CheckPermissions(key, value, context, cr, &error) == PROP_SUCCESS) { in LoadProperties()