提交 0507592d 编写于 作者: R renwei

Merge branch 'master' of gitee.com:openharmony/startup_init_lite

Change-Id: I1f2bb81be915b8edcb8ba0db0dae95b0e20297c1
......@@ -26,7 +26,6 @@ extern "C" {
#define PARAM_VALUE_LEN_MAX 96
#define PARAM_NAME_LEN_MAX 96
#define OS_FULL_NAME_LEN 128
#define MAX_VALUE_LEN 128
#define VERSION_ID_MAX_LEN 256
static const char EMPTY_STR[] = { "" };
......
......@@ -29,6 +29,7 @@
namespace OHOS {
namespace system {
static constexpr int MAX_VALUE_LEN = 128;
bool SetParameter(const std::string& key, const std::string& value)
{
int ret = SystemSetParameter(key.c_str(), value.c_str());
......
......@@ -216,8 +216,7 @@ static int SelinuxCheckParamPermission(const ParamSecurityLabel *srcLabel, const
SelinuxSpace *selinuxSpace = &GetParamWorkSpace()->selinuxSpace;
int ret = DAC_RESULT_FORBIDED;
// check
SrcInfo info = { 0 };
struct ucred uc;
SrcInfo info;
info.uc.pid = srcLabel->cred.pid;
info.uc.uid = srcLabel->cred.uid;
info.uc.gid = srcLabel->cred.gid;
......@@ -234,7 +233,8 @@ static int SelinuxCheckParamPermission(const ParamSecurityLabel *srcLabel, const
#endif
}
if (ret != 0) {
PARAM_LOGW("Selinux check name %s pid %d uid %d %d result %d", name, info.uc.pid, info.uc.uid, info.uc.gid, ret);
PARAM_LOGW("Selinux check name %s pid %d uid %d %d result %d", name, info.uc.pid,
info.uc.uid, info.uc.gid, ret);
ret = DAC_RESULT_FORBIDED;
} else {
ret = DAC_RESULT_PERMISSION;
......
......@@ -25,6 +25,9 @@
#else
typedef struct ParamContextsList_ {
} ParamContextsList;
typedef struct SrcInfo {
} SrcInfo;
#endif
#include "beget_ext.h"
......@@ -97,7 +100,7 @@ typedef struct {
} ParamSecurityOps;
typedef int (*RegisterSecurityOpsPtr)(ParamSecurityOps *ops, int isInit);
typedef int (*SelinuxSetParamCheck)(const char *paraName, const char *destContext, int32_t sockFd, struct ucred *uc);
typedef int (*SelinuxSetParamCheck)(const char *paraName, const char *destContext, const SrcInfo *info);
typedef struct SelinuxSpace_ {
void *selinuxHandle;
void (*setSelinuxLogCallback)(void);
......@@ -123,4 +126,4 @@ INIT_LOCAL_API int RegisterSecurityOps(int onlyRead);
}
#endif
#endif
#endif // BASE_STARTUP_PARAM_SECURITY_H
\ No newline at end of file
#endif // BASE_STARTUP_PARAM_SECURITY_H
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册