upload android base code part6
This commit is contained in:
parent
421e214c7d
commit
4e516ec6ed
35396 changed files with 9188716 additions and 0 deletions
31
android/system/hwservicemanager/AccessControl.h
Normal file
31
android/system/hwservicemanager/AccessControl.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include <string>
|
||||
|
||||
#include <selinux/android.h>
|
||||
#include <selinux/avc.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
class AccessControl {
|
||||
public:
|
||||
AccessControl();
|
||||
|
||||
using Context = std::unique_ptr<char, decltype(&freecon)>;
|
||||
Context getContext(pid_t sourcePid);
|
||||
|
||||
bool canAdd(const std::string& fqName, const Context &context, pid_t pid);
|
||||
bool canGet(const std::string& fqName, pid_t pid);
|
||||
bool canList(pid_t pid);
|
||||
|
||||
private:
|
||||
|
||||
bool checkPermission(const Context &context, pid_t sourceAuditPid, const char *targetContext, const char *perm, const char *interface);
|
||||
bool checkPermission(const Context &context, pid_t sourcePid, const char *perm, const char *interface);
|
||||
|
||||
static int auditCallback(void *data, security_class_t cls, char *buf, size_t len);
|
||||
|
||||
char* mSeContext;
|
||||
struct selabel_handle* mSeHandle;
|
||||
union selinux_callback mSeCallbacks;
|
||||
};
|
||||
|
||||
} // namespace android
|
Loading…
Add table
Add a link
Reference in a new issue