提交 2868f22f 编写于 作者: N Neil Chen

fix invalid type in OAT.xml and other typos

Signed-off-by: NNeil Chen <jingsi.chen@petalmail.com>
上级 5cde4ec3
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/--> <!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/--> <!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/--> <!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
<filteritem type="filname" name="*.jpg|*.png|*.gif|*.pdf" desc="already checked"/> <filteritem type="filename" name="*.jpg|*.png|*.gif|*.pdf" desc="already checked"/>
<filteritem type="filepath" name="services/test/unittest/test_data/proc/*" desc="启动功能UT测试的资源文件"/> <filteritem type="filepath" name="services/test/unittest/test_data/proc/*" desc="启动功能UT测试的资源文件"/>
</filefilter> </filefilter>
......
...@@ -43,7 +43,7 @@ static void ProcessFifoWrite(const WatcherHandle taskHandle, int fd, uint32_t *e ...@@ -43,7 +43,7 @@ static void ProcessFifoWrite(const WatcherHandle taskHandle, int fd, uint32_t *e
} }
int fifow = *((int *)context); int fifow = *((int *)context);
if (fifow < 0) { if (fifow < 0) {
BEGET_LOGE("[control_fd] invaild fifo write fd"); BEGET_LOGE("[control_fd] invalid fifo write fd");
return; return;
} }
char rbuf[FIFO_BUF_SIZE] = {0}; char rbuf[FIFO_BUF_SIZE] = {0};
......
...@@ -95,7 +95,7 @@ static void CmdOnRecvMessage(const TaskHandle task, const uint8_t *buffer, uint3 ...@@ -95,7 +95,7 @@ static void CmdOnRecvMessage(const TaskHandle task, const uint8_t *buffer, uint3
static int SendMessage(LoopHandle loop, TaskHandle task, const char *message) static int SendMessage(LoopHandle loop, TaskHandle task, const char *message)
{ {
if (message == NULL) { if (message == NULL) {
BEGET_LOGE("[control_fd] Invaild parameter"); BEGET_LOGE("[control_fd] Invalid parameter");
return -1; return -1;
} }
BufferHandle handle = NULL; BufferHandle handle = NULL;
...@@ -135,7 +135,7 @@ static int CmdOnIncommingConntect(const LoopHandle loop, const TaskHandle server ...@@ -135,7 +135,7 @@ static int CmdOnIncommingConntect(const LoopHandle loop, const TaskHandle server
void CmdServiceInit(const char *socketPath, CallbackControlFdProcess func) void CmdServiceInit(const char *socketPath, CallbackControlFdProcess func)
{ {
if ((socketPath == NULL) || (func == NULL)) { if ((socketPath == NULL) || (func == NULL)) {
BEGET_LOGE("[control_fd] Invaild parameter"); BEGET_LOGE("[control_fd] Invalid parameter");
return; return;
} }
LE_StreamServerInfo info = {}; LE_StreamServerInfo info = {};
......
...@@ -55,7 +55,7 @@ int BuildControlMessage(struct msghdr *msghdr, int *fds, int fdCount, bool send ...@@ -55,7 +55,7 @@ int BuildControlMessage(struct msghdr *msghdr, int *fds, int fdCount, bool send
cmsg->cmsg_len = CMSG_LEN(sizeof(int) * fdCount); cmsg->cmsg_len = CMSG_LEN(sizeof(int) * fdCount);
int ret = memcpy_s(CMSG_DATA(cmsg), cmsg->cmsg_len, fds, sizeof(int) * fdCount); int ret = memcpy_s(CMSG_DATA(cmsg), cmsg->cmsg_len, fds, sizeof(int) * fdCount);
if (ret != 0) { if (ret != 0) {
BEGET_LOGE("Controll message is not valid"); BEGET_LOGE("Control message is not valid");
free(msghdr->msg_control); free(msghdr->msg_control);
return -1; return -1;
} }
...@@ -65,7 +65,7 @@ int BuildControlMessage(struct msghdr *msghdr, int *fds, int fdCount, bool send ...@@ -65,7 +65,7 @@ int BuildControlMessage(struct msghdr *msghdr, int *fds, int fdCount, bool send
if (sendUcred) { if (sendUcred) {
if (cmsg == NULL) { if (cmsg == NULL) {
BEGET_LOGE("Controll message is not valid"); BEGET_LOGE("Control message is not valid");
free(msghdr->msg_control); free(msghdr->msg_control);
return -1; return -1;
} }
...@@ -106,7 +106,7 @@ int *ReceiveFds(int sock, struct iovec iovec, size_t *outFdCount, bool nonblock, ...@@ -106,7 +106,7 @@ int *ReceiveFds(int sock, struct iovec iovec, size_t *outFdCount, bool nonblock,
BEGET_ERROR_CHECK(rc >= 0, return NULL, "Failed to get fds from remote, err = %d", errno); BEGET_ERROR_CHECK(rc >= 0, return NULL, "Failed to get fds from remote, err = %d", errno);
if ((msghdr.msg_flags) & MSG_TRUNC) { if ((msghdr.msg_flags) & MSG_TRUNC) {
BEGET_LOGE("Message was trucated when receiving fds"); BEGET_LOGE("Message was truncated when receiving fds");
return NULL; return NULL;
} }
......
...@@ -231,7 +231,7 @@ static int GetSandboxInfo(sandbox_t *sandbox, cJSON *root, const char *itemName) ...@@ -231,7 +231,7 @@ static int GetSandboxInfo(sandbox_t *sandbox, cJSON *root, const char *itemName)
static int ParseSandboxConfig(cJSON *root, sandbox_t *sandbox) static int ParseSandboxConfig(cJSON *root, sandbox_t *sandbox)
{ {
BEGET_ERROR_CHECK(!(root == NULL || sandbox == NULL), return -1, "Invaild parameter."); BEGET_ERROR_CHECK(!(root == NULL || sandbox == NULL), return -1, "Invalid parameter.");
cJSON *sandboxRoot = cJSON_GetObjectItem(root, SANDBOX_ROOT_TAG); cJSON *sandboxRoot = cJSON_GetObjectItem(root, SANDBOX_ROOT_TAG);
BEGET_ERROR_CHECK(sandboxRoot != NULL, return -1, BEGET_ERROR_CHECK(sandboxRoot != NULL, return -1,
......
...@@ -232,7 +232,7 @@ static void AddWatcherCallback(ParamWatcherPtr watcher, napi_ref callbackRef) ...@@ -232,7 +232,7 @@ static void AddWatcherCallback(ParamWatcherPtr watcher, napi_ref callbackRef)
static void DelWatcherCallback(ParamWatcherPtr watcher, uint32_t next) static void DelWatcherCallback(ParamWatcherPtr watcher, uint32_t next)
{ {
PARAM_JS_LOGV("JSApp watcher key %s delete callack %u", watcher->keyPrefix, next); PARAM_JS_LOGV("JSApp watcher key %s delete callback %u", watcher->keyPrefix, next);
std::lock_guard<std::mutex> lock(watcher->mutex); std::lock_guard<std::mutex> lock(watcher->mutex);
watcher->callbackReferences.erase(next); watcher->callbackReferences.erase(next);
} }
...@@ -490,7 +490,7 @@ static napi_value SwithWatchOn(napi_env env, napi_callback_info info) ...@@ -490,7 +490,7 @@ static napi_value SwithWatchOn(napi_env env, napi_callback_info info)
{ {
napi_value callback = nullptr; napi_value callback = nullptr;
ParamWatcherPtr watcher = GetWatcherInfo(env, info, &callback); ParamWatcherPtr watcher = GetWatcherInfo(env, info, &callback);
PARAM_JS_CHECK(watcher != nullptr, return GetNapiValue(env, -1), "Failed to get watcher swith param"); PARAM_JS_CHECK(watcher != nullptr, return GetNapiValue(env, -1), "Failed to get watcher switch param");
if (CheckCallbackEqual(env, callback, watcher)) { if (CheckCallbackEqual(env, callback, watcher)) {
PARAM_JS_LOGE("JSApp watcher repeater switch on %s", watcher->keyPrefix); PARAM_JS_LOGE("JSApp watcher repeater switch on %s", watcher->keyPrefix);
...@@ -553,4 +553,4 @@ napi_value RegisterWatcher(napi_env env, napi_value exports) ...@@ -553,4 +553,4 @@ napi_value RegisterWatcher(napi_env env, napi_value exports)
napi_set_named_property(env, exports, "paramWatcher", result); napi_set_named_property(env, exports, "paramWatcher", result);
napi_create_reference(env, result, 1, &g_paramWatchRef); napi_create_reference(env, result, 1, &g_paramWatchRef);
return exports; return exports;
} }
\ No newline at end of file
...@@ -158,7 +158,7 @@ static void ShowParam(BShellHandle shell, const char *name, const char *value) ...@@ -158,7 +158,7 @@ static void ShowParam(BShellHandle shell, const char *name, const char *value)
ParamAuditData auditData = {}; ParamAuditData auditData = {};
int ret = GetParamSecurityAuditData(name, 0, &auditData); int ret = GetParamSecurityAuditData(name, 0, &auditData);
BSH_CHECK(ret == 0, return, "Failed to get param security for %s", name); BSH_CHECK(ret == 0, return, "Failed to get param security for %s", name);
BShellEnvOutput(shell, "Parameter infomation:\r\n"); BShellEnvOutput(shell, "Parameter information:\r\n");
#ifdef PARAM_SUPPORT_SELINUX #ifdef PARAM_SUPPORT_SELINUX
BShellEnvOutput(shell, "selinux : %s \r\n", auditData.label); BShellEnvOutput(shell, "selinux : %s \r\n", auditData.label);
#endif #endif
......
...@@ -170,10 +170,10 @@ static int main_cmd(BShellHandle shell, int argc, char **argv) ...@@ -170,10 +170,10 @@ static int main_cmd(BShellHandle shell, int argc, char **argv)
processName = optarg; processName = optarg;
break; break;
case '?': case '?':
std::cout << "Invalid arugment\n"; std::cout << "Invalid argument\n";
break; break;
default: default:
std::cout << "Invalid arugment\n"; std::cout << "Invalid argument\n";
break; break;
} }
} }
......
...@@ -720,7 +720,7 @@ const ParamInfo *BShellEnvGetReservedParam(BShellHandle handle, const char *name ...@@ -720,7 +720,7 @@ const ParamInfo *BShellEnvGetReservedParam(BShellHandle handle, const char *name
{ {
BSH_CHECK(handle != NULL, return NULL, "Invalid shell env"); BSH_CHECK(handle != NULL, return NULL, "Invalid shell env");
static ParamInfo reservedParams[] = { static ParamInfo reservedParams[] = {
{PARAM_REVERESD_NAME_CURR_PARAMETER, "current paramater", PARAM_STRING} {PARAM_REVERESD_NAME_CURR_PARAMETER, "current parameter", PARAM_STRING}
}; };
for (size_t i = 0; i < sizeof(reservedParams) / sizeof(reservedParams[0]); i++) { for (size_t i = 0; i < sizeof(reservedParams) / sizeof(reservedParams[0]); i++) {
if (strcmp(name, reservedParams[i].name) == 0) { if (strcmp(name, reservedParams[i].name) == 0) {
...@@ -744,4 +744,4 @@ int32_t BShellEnvDirectExecute(BShellHandle handle, int argc, char *args[]) ...@@ -744,4 +744,4 @@ int32_t BShellEnvDirectExecute(BShellHandle handle, int argc, char *args[])
BShellCmdHelp(handle, argc, args); BShellCmdHelp(handle, argc, args);
} }
return 0; return 0;
} }
\ No newline at end of file
...@@ -72,7 +72,7 @@ int main(int argc, char *args[]) ...@@ -72,7 +72,7 @@ int main(int argc, char *args[])
return 0; return 0;
} }
const ParamInfo *param = BShellEnvGetReservedParam(handle, PARAM_REVERESD_NAME_CURR_PARAMETER); const ParamInfo *param = BShellEnvGetReservedParam(handle, PARAM_REVERESD_NAME_CURR_PARAMETER);
BSH_CHECK(param != NULL && param->type == PARAM_STRING, break, "Failed to get revered param"); BSH_CHECK(param != NULL && param->type == PARAM_STRING, break, "Failed to get reversed param");
BShellEnvSetParam(handle, param->name, param->desc, param->type, (void *)""); BShellEnvSetParam(handle, param->name, param->desc, param->type, (void *)"");
if (argc > 1) { if (argc > 1) {
int ret = SetParamShellPrompt(handle, args[1]); int ret = SetParamShellPrompt(handle, args[1]);
......
...@@ -173,7 +173,7 @@ static void DoSleep(const struct CmdArgs *ctx) ...@@ -173,7 +173,7 @@ static void DoSleep(const struct CmdArgs *ctx)
{ {
errno = 0; errno = 0;
unsigned long sleepTime = strtoul(ctx->argv[0], NULL, DECIMAL_BASE); unsigned long sleepTime = strtoul(ctx->argv[0], NULL, DECIMAL_BASE);
INIT_ERROR_CHECK(errno == 0, return, "cannot covert sleep time in command \" sleep \""); INIT_ERROR_CHECK(errno == 0, return, "cannot convert sleep time in command \" sleep \"");
// Limit sleep time in 5 seconds // Limit sleep time in 5 seconds
const unsigned long sleepTimeLimit = 5; const unsigned long sleepTimeLimit = 5;
...@@ -192,7 +192,7 @@ static void DoWait(const struct CmdArgs *ctx) ...@@ -192,7 +192,7 @@ static void DoWait(const struct CmdArgs *ctx)
errno = 0; errno = 0;
waitSecond = strtoul(ctx->argv[timePos], NULL, DECIMAL_BASE); waitSecond = strtoul(ctx->argv[timePos], NULL, DECIMAL_BASE);
INIT_ERROR_CHECK(errno == 0, INIT_ERROR_CHECK(errno == 0,
return, "cannot covert sleep time in command \" wait \""); return, "cannot convert sleep time in command \" wait \"");
} }
INIT_LOGI("Waiting %s %lu second(s)", ctx->argv[filePos], waitSecond); INIT_LOGI("Waiting %s %lu second(s)", ctx->argv[filePos], waitSecond);
...@@ -548,7 +548,7 @@ static void DoSetrlimit(const struct CmdArgs *ctx) ...@@ -548,7 +548,7 @@ static void DoSetrlimit(const struct CmdArgs *ctx)
} }
} }
if (rcs == -1) { if (rcs == -1) {
INIT_LOGE("DoSetrlimit failed, resouces :%s not support.", ctx->argv[0]); INIT_LOGE("DoSetrlimit failed, resources :%s not support.", ctx->argv[0]);
return; return;
} }
INIT_CHECK_ONLY_ELOG(setrlimit(rcs, &limit) == 0, "DoSetrlimit failed : %d", errno); INIT_CHECK_ONLY_ELOG(setrlimit(rcs, &limit) == 0, "DoSetrlimit failed : %d", errno);
......
...@@ -106,13 +106,13 @@ static int SetPerms(const Service *service) ...@@ -106,13 +106,13 @@ static int SetPerms(const Service *service)
} }
INIT_ERROR_CHECK(capset(&capHeader, capData) == 0, return SERVICE_FAILURE, INIT_ERROR_CHECK(capset(&capHeader, capData) == 0, return SERVICE_FAILURE,
"capset faild for service: %s, error: %d", service->name, errno); "capset failed for service: %s, error: %d", service->name, errno);
for (unsigned int i = 0; i < service->servPerm.capsCnt; ++i) { for (unsigned int i = 0; i < service->servPerm.capsCnt; ++i) {
if (service->servPerm.caps[i] == FULL_CAP) { if (service->servPerm.caps[i] == FULL_CAP) {
return SetAllAmbientCapability(); return SetAllAmbientCapability();
} }
INIT_ERROR_CHECK(SetAmbientCapability(service->servPerm.caps[i]) == 0, return SERVICE_FAILURE, INIT_ERROR_CHECK(SetAmbientCapability(service->servPerm.caps[i]) == 0, return SERVICE_FAILURE,
"SetAmbientCapability faild for service: %s", service->name); "SetAmbientCapability failed for service: %s", service->name);
} }
return SERVICE_SUCCESS; return SERVICE_SUCCESS;
} }
...@@ -267,7 +267,7 @@ static void ClearEnvironment(Service *service) ...@@ -267,7 +267,7 @@ static void ClearEnvironment(Service *service)
static int InitServicePropertys(Service *service) static int InitServicePropertys(Service *service)
{ {
INIT_ERROR_CHECK(service != NULL, return -1, "Invaild parameter."); INIT_ERROR_CHECK(service != NULL, return -1, "Invalid parameter.");
SetServiceEnterSandbox(service->pathArgs.argv[0], service->attribute); SetServiceEnterSandbox(service->pathArgs.argv[0], service->attribute);
INIT_CHECK_ONLY_ELOG(SetAccessToken(service) == SERVICE_SUCCESS, "access token failed %s", service->name); INIT_CHECK_ONLY_ELOG(SetAccessToken(service) == SERVICE_SUCCESS, "access token failed %s", service->name);
// deal start job // deal start job
...@@ -427,7 +427,7 @@ static void CheckServiceSocket(Service *service) ...@@ -427,7 +427,7 @@ static void CheckServiceSocket(Service *service)
ServiceSocket *tmpSock = service->socketCfg; ServiceSocket *tmpSock = service->socketCfg;
while (tmpSock != NULL) { while (tmpSock != NULL) {
if (tmpSock->sockFd <= 0) { if (tmpSock->sockFd <= 0) {
INIT_LOGE("Invaid socket %s for service", service->name); INIT_LOGE("Invalid socket %s for service", service->name);
tmpSock = tmpSock->next; tmpSock = tmpSock->next;
} }
SocketAddWatcher(&tmpSock->watcher, service, tmpSock->sockFd); SocketAddWatcher(&tmpSock->watcher, service, tmpSock->sockFd);
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
# include "init_selinux_param.h" # include "init_selinux_param.h"
#endif // WITH_SELINUX #endif // WITH_SELINUX
// All serivce processes that init will fork+exec. // All service processes that init will fork+exec.
static ServiceSpace g_serviceSpace = { 0 }; static ServiceSpace g_serviceSpace = { 0 };
static const int CRITICAL_DEFAULT_CRASH_TIME = 20; static const int CRITICAL_DEFAULT_CRASH_TIME = 20;
// maximum number of crashes within time CRITICAL_DEFAULT_CRASH_TIME for one service // maximum number of crashes within time CRITICAL_DEFAULT_CRASH_TIME for one service
...@@ -1042,7 +1042,7 @@ void StartAllServices(int startMode) ...@@ -1042,7 +1042,7 @@ void StartAllServices(int startMode)
} }
node = GetNextGroupNode(NODE_TYPE_SERVICES, node); node = GetNextGroupNode(NODE_TYPE_SERVICES, node);
} }
INIT_LOGI("StartAllServices %d finsh", startMode); INIT_LOGI("StartAllServices %d finish", startMode);
} }
void LoadAccessTokenId(void) void LoadAccessTokenId(void)
......
...@@ -52,7 +52,7 @@ static int SetSocketAddr(ServiceSocket *sockopt, sockaddr_union *addr) ...@@ -52,7 +52,7 @@ static int SetSocketAddr(ServiceSocket *sockopt, sockaddr_union *addr)
if (sockopt->family == AF_NETLINK) { if (sockopt->family == AF_NETLINK) {
#ifndef __LITEOS_A__ #ifndef __LITEOS_A__
if (memset_s(&(addr->addrnl), sizeof(addr->addrnl), 0, sizeof(addr->addrnl)) != EOK) { if (memset_s(&(addr->addrnl), sizeof(addr->addrnl), 0, sizeof(addr->addrnl)) != EOK) {
INIT_LOGE("Faild to clear socket address"); INIT_LOGE("Failed to clear socket address");
return -1; return -1;
} }
addr->addrnl.nl_family = AF_NETLINK; addr->addrnl.nl_family = AF_NETLINK;
......
...@@ -116,7 +116,7 @@ static void SendFdsInfo(int sock, Service *service) ...@@ -116,7 +116,7 @@ static void SendFdsInfo(int sock, Service *service)
}; };
if (BuildControlMessage(&msghdr, service->fds, service->fdCount, false) < 0) { if (BuildControlMessage(&msghdr, service->fds, service->fdCount, false) < 0) {
SendErrorInfo(sock, "Faild to build send message", service->name); SendErrorInfo(sock, "Failed to build send message", service->name);
} else { } else {
if (TEMP_FAILURE_RETRY(sendmsg(sock, &msghdr, MSG_NOSIGNAL)) < 0) { if (TEMP_FAILURE_RETRY(sendmsg(sock, &msghdr, MSG_NOSIGNAL)) < 0) {
INIT_LOGE("Failed to send fd info to service \' %s \', err = %d", service->name, errno); INIT_LOGE("Failed to send fd info to service \' %s \', err = %d", service->name, errno);
...@@ -220,7 +220,7 @@ static void HandlerFdHolder(int sock) ...@@ -220,7 +220,7 @@ static void HandlerFdHolder(int sock)
// In this case, ignore fds, just close them if fd passed to init // In this case, ignore fds, just close them if fd passed to init
HandlerGetFds(sock, service); HandlerGetFds(sock, service);
} else { } else {
INIT_LOGE("Unexpect action: %s", action); INIT_LOGE("Unexpected action: %s", action);
} }
FreeFds(fds); FreeFds(fds);
CloseFds(fds, fdCount); CloseFds(fds, fdCount);
......
...@@ -74,7 +74,7 @@ static int FdHolderSockInit(void) ...@@ -74,7 +74,7 @@ static int FdHolderSockInit(void)
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;
if (strncpy_s(addr.sun_path, sizeof(addr.sun_path), if (strncpy_s(addr.sun_path, sizeof(addr.sun_path),
INIT_HOLDER_SOCKET_PATH, strlen(INIT_HOLDER_SOCKET_PATH)) != 0) { INIT_HOLDER_SOCKET_PATH, strlen(INIT_HOLDER_SOCKET_PATH)) != 0) {
INIT_LOGE("Faild to copy fd hoder socket path"); INIT_LOGE("Failed to copy fd hoder socket path");
close(sock); close(sock);
return -1; return -1;
} }
...@@ -193,7 +193,7 @@ static void StartInitSecondStage(void) ...@@ -193,7 +193,7 @@ static void StartInitSecondStage(void)
// If mount required partitions failure. // If mount required partitions failure.
// There is no necessary to continue. // There is no necessary to continue.
// Just abort // Just abort
INIT_LOGE("Mount requried partitions failed; please check fstab file"); INIT_LOGE("Mount required partitions failed; please check fstab file");
// Execute sh for debugging // Execute sh for debugging
execv("/bin/sh", NULL); execv("/bin/sh", NULL);
abort(); abort();
......
...@@ -377,7 +377,7 @@ static void DoTimerStart(const struct CmdArgs *ctx) ...@@ -377,7 +377,7 @@ static void DoTimerStart(const struct CmdArgs *ctx)
} }
if (count != expectedCount) { if (count != expectedCount) {
INIT_LOGE("Call timer_start with unexpect arguments %s", arg); INIT_LOGE("Call timer_start with unexpected arguments %s", arg);
FreeStringVector(splitArgs, count); FreeStringVector(splitArgs, count);
return; return;
} }
...@@ -515,7 +515,7 @@ static void DoMkSandbox(const struct CmdArgs *ctx) ...@@ -515,7 +515,7 @@ static void DoMkSandbox(const struct CmdArgs *ctx)
const char *sandbox = ctx->argv[0]; const char *sandbox = ctx->argv[0];
if (sandbox == NULL) { if (sandbox == NULL) {
INIT_LOGE("Invaild sandbox name."); INIT_LOGE("Invalid sandbox name.");
return; return;
} }
InitDefaultNamespace(); InitDefaultNamespace();
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
static void ProcessSandboxControlFd(uint16_t type, const char *serviceCmd) static void ProcessSandboxControlFd(uint16_t type, const char *serviceCmd)
{ {
if ((type != ACTION_SANDBOX) || (serviceCmd == NULL)) { if ((type != ACTION_SANDBOX) || (serviceCmd == NULL)) {
INIT_LOGE("Invaild parameter"); INIT_LOGE("Invalid parameter");
return; return;
} }
Service *service = GetServiceByName(serviceCmd); Service *service = GetServiceByName(serviceCmd);
......
...@@ -118,7 +118,7 @@ static int LoadParamLabels(const char *fileName) ...@@ -118,7 +118,7 @@ static int LoadParamLabels(const char *fileName)
buff[buffSize - 1] = '\0'; buff[buffSize - 1] = '\0';
int ret = SpliteString(buff, NULL, 0, LoadOneParam_, NULL); int ret = SpliteString(buff, NULL, 0, LoadOneParam_, NULL);
if (ret != 0) { if (ret != 0) {
PARAM_LOGE("Failed to splite string %s fileName %s", buff, fileName); PARAM_LOGE("Failed to split string %s fileName %s", buff, fileName);
continue; continue;
} }
infoCount++; infoCount++;
...@@ -298,4 +298,4 @@ INIT_LOCAL_API void LoadGroupUser(void) ...@@ -298,4 +298,4 @@ INIT_LOCAL_API void LoadGroupUser(void)
} }
PARAM_LOGV("LoadGroupUser getgrent fail errnor %d ", errno); PARAM_LOGV("LoadGroupUser getgrent fail errnor %d ", errno);
endgrent(); endgrent();
} }
\ No newline at end of file
...@@ -142,7 +142,7 @@ static int SystemSetParam(const char *name, const char *value, const ParamSecuri ...@@ -142,7 +142,7 @@ static int SystemSetParam(const char *name, const char *value, const ParamSecuri
PARAM_LOGV("SystemWriteParam name %s value: %s", name, value); PARAM_LOGV("SystemWriteParam name %s value: %s", name, value);
int ctrlService = 0; int ctrlService = 0;
int ret = CheckParameterSet(name, value, srcLabel, &ctrlService); int ret = CheckParameterSet(name, value, srcLabel, &ctrlService);
PARAM_CHECK(ret == 0, return ret, "Forbit to set parameter %s", name); PARAM_CHECK(ret == 0, return ret, "Forbid to set parameter %s", name);
if (ctrlService & PARAM_CTRL_SERVICE) { // ctrl param if (ctrlService & PARAM_CTRL_SERVICE) { // ctrl param
PostParamTrigger(EVENT_TRIGGER_PARAM, name, value); PostParamTrigger(EVENT_TRIGGER_PARAM, name, value);
...@@ -431,4 +431,4 @@ ParamService *GetParamService() ...@@ -431,4 +431,4 @@ ParamService *GetParamService()
{ {
return &g_paramService; return &g_paramService;
} }
#endif #endif
\ No newline at end of file
...@@ -78,7 +78,7 @@ int SystemSetParameter(const char *name, const char *value) ...@@ -78,7 +78,7 @@ int SystemSetParameter(const char *name, const char *value)
InitParamClient(); InitParamClient();
int ctrlService = 0; int ctrlService = 0;
int ret = CheckParameterSet(name, value, GetParamSecurityLabel(), &ctrlService); int ret = CheckParameterSet(name, value, GetParamSecurityLabel(), &ctrlService);
PARAM_CHECK(ret == 0, return ret, "Forbit to set parameter %s", name); PARAM_CHECK(ret == 0, return ret, "Forbid to set parameter %s", name);
PARAM_LOGV("SystemSetParameter name %s value: %s ctrlService %d", name, value, ctrlService); PARAM_LOGV("SystemSetParameter name %s value: %s ctrlService %d", name, value, ctrlService);
if ((ctrlService & PARAM_CTRL_SERVICE) != PARAM_CTRL_SERVICE) { // ctrl param if ((ctrlService & PARAM_CTRL_SERVICE) != PARAM_CTRL_SERVICE) { // ctrl param
uint32_t dataIndex = 0; uint32_t dataIndex = 0;
...@@ -152,4 +152,4 @@ int SystemFindParameter(const char *name, ParamHandle *handle) ...@@ -152,4 +152,4 @@ int SystemFindParameter(const char *name, ParamHandle *handle)
PARAM_CHECK(ret == 0, return ret, "Forbid to access parameter %s", name); PARAM_CHECK(ret == 0, return ret, "Forbid to access parameter %s", name);
} }
return ret; return ret;
} }
\ No newline at end of file
...@@ -63,7 +63,7 @@ static int LoadPersistParam(void) ...@@ -63,7 +63,7 @@ static int LoadPersistParam(void)
uint32_t currLen = 0; uint32_t currLen = 0;
while (currLen < fileSize) { while (currLen < fileSize) {
if (buffer[currLen] == '\n') { // splite line if (buffer[currLen] == '\n') { // split line
buffer[currLen] = '\0'; buffer[currLen] = '\0';
int ret = SpliteString(buffer, NULL, 0, LoadOnePersistParam_, NULL); int ret = SpliteString(buffer, NULL, 0, LoadOnePersistParam_, NULL);
PARAM_CHECK(ret == 0, continue, "Failed to set param %d %s", ret, buffer); PARAM_CHECK(ret == 0, continue, "Failed to set param %d %s", ret, buffer);
...@@ -160,4 +160,4 @@ int RegisterPersistParamOps(PersistParamOps *ops) ...@@ -160,4 +160,4 @@ int RegisterPersistParamOps(PersistParamOps *ops)
ops->batchSave = BatchSavePersistParam; ops->batchSave = BatchSavePersistParam;
ops->batchSaveEnd = BatchSavePersistParamEnd; ops->batchSaveEnd = BatchSavePersistParamEnd;
return 0; return 0;
} }
\ No newline at end of file
...@@ -48,7 +48,7 @@ int SystemWriteParam(const char *name, const char *value) ...@@ -48,7 +48,7 @@ int SystemWriteParam(const char *name, const char *value)
{ {
int ctrlService = 0; int ctrlService = 0;
int ret = CheckParameterSet(name, value, GetParamSecurityLabel(), &ctrlService); int ret = CheckParameterSet(name, value, GetParamSecurityLabel(), &ctrlService);
PARAM_CHECK(ret == 0, return ret, "Forbit to set parameter %s", name); PARAM_CHECK(ret == 0, return ret, "Forbid to set parameter %s", name);
PARAM_LOGV("SystemWriteParam name %s value: %s ctrlService %d", name, value, ctrlService); PARAM_LOGV("SystemWriteParam name %s value: %s ctrlService %d", name, value, ctrlService);
if ((ctrlService & PARAM_CTRL_SERVICE) != PARAM_CTRL_SERVICE) { // ctrl param if ((ctrlService & PARAM_CTRL_SERVICE) != PARAM_CTRL_SERVICE) { // ctrl param
uint32_t dataIndex = 0; uint32_t dataIndex = 0;
......
...@@ -23,7 +23,7 @@ static int LoadSecurityLabel(const char *fileName) ...@@ -23,7 +23,7 @@ static int LoadSecurityLabel(const char *fileName)
ParamWorkSpace *paramSpace = GetParamWorkSpace(); ParamWorkSpace *paramSpace = GetParamWorkSpace();
PARAM_CHECK(paramSpace != NULL, return -1, "Invalid paramSpace"); PARAM_CHECK(paramSpace != NULL, return -1, "Invalid paramSpace");
PARAM_WORKSPACE_CHECK(paramSpace, return -1, "Invalid space"); PARAM_WORKSPACE_CHECK(paramSpace, return -1, "Invalid space");
PARAM_CHECK(fileName != NULL, return -1, "Invalid fielname for load"); PARAM_CHECK(fileName != NULL, return -1, "Invalid filename for load");
#if !(defined __LITEOS_A__ || defined __LITEOS_M__) #if !(defined __LITEOS_A__ || defined __LITEOS_M__)
// load security label // load security label
ParamSecurityOps *ops = GetParamSecurityOps(PARAM_SECURITY_DAC); ParamSecurityOps *ops = GetParamSecurityOps(PARAM_SECURITY_DAC);
......
...@@ -220,7 +220,7 @@ char **SplitStringExt(char *buffer, const char *del, int *returnCount, int maxIt ...@@ -220,7 +220,7 @@ char **SplitStringExt(char *buffer, const char *del, int *returnCount, int maxIt
{ {
INIT_CHECK_RETURN_VALUE((maxItemCount >= 0) && (buffer != NULL) && (del != NULL) && (returnCount != NULL), NULL); INIT_CHECK_RETURN_VALUE((maxItemCount >= 0) && (buffer != NULL) && (del != NULL) && (returnCount != NULL), NULL);
// Why is this number? // Why is this number?
// Now we use this function to split a string with a given delimeter // Now we use this function to split a string with a given delimiter
// We do not know how many sub-strings out there after splitting. // We do not know how many sub-strings out there after splitting.
// 50 is just a guess value. // 50 is just a guess value.
const int defaultItemCounts = 50; const int defaultItemCounts = 50;
...@@ -512,4 +512,4 @@ uint32_t GetRandom() ...@@ -512,4 +512,4 @@ uint32_t GetRandom()
} }
close(fd); close(fd);
return ulSeed; return ulSeed;
} }
\ No newline at end of file
...@@ -144,7 +144,7 @@ ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc comparePr ...@@ -144,7 +144,7 @@ ListNode *ListFind(const ListNode *head, void *data, ListTraversalProc comparePr
* @param head list head, make sure head is valid pointer. * @param head list head, make sure head is valid pointer.
* @param cookie optional traversing data. * @param cookie optional traversing data.
* @param traversalProc comparing function, return 0 if matched. * @param traversalProc comparing function, return 0 if matched.
* @param flags optinal traversing flags: * @param flags optional traversing flags:
* TRAVERSE_REVERSE_ORDER: traversing from last node to first node; * TRAVERSE_REVERSE_ORDER: traversing from last node to first node;
* default behaviour is from first node to last node * default behaviour is from first node to last node
* TRAVERSE_STOP_WHEN_ERROR: stop traversing if traversalProc return non-zero * TRAVERSE_STOP_WHEN_ERROR: stop traversing if traversalProc return non-zero
......
...@@ -50,7 +50,7 @@ int main(int argc, char *argv[]) ...@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
}; };
int parameterNum = 2; int parameterNum = 2;
if ((argc != parameterNum) || (argv[1] == nullptr)) { if ((argc != parameterNum) || (argv[1] == nullptr)) {
cout << "Invaild parameter" << endl; cout << "Invalid parameter" << endl;
} }
const string name = argv[1]; const string name = argv[1];
int abilityId = 0; int abilityId = 0;
...@@ -59,7 +59,7 @@ int main(int argc, char *argv[]) ...@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
cout << "sa service name " << item->first << "ability id " << item->second << endl; cout << "sa service name " << item->first << "ability id " << item->second << endl;
abilityId = item->second; abilityId = item->second;
} else { } else {
cout << "Invaild sa service name" << endl; cout << "Invalid sa service name" << endl;
return 0; return 0;
} }
......
...@@ -194,9 +194,9 @@ HWTEST_F(SandboxUnitTest, TestEnterErrorSandbox, TestSize.Level1) { ...@@ -194,9 +194,9 @@ HWTEST_F(SandboxUnitTest, TestEnterErrorSandbox, TestSize.Level1) {
HWTEST_F(SandboxUnitTest, TestCreateErrorSandbox1, TestSize.Level1) { HWTEST_F(SandboxUnitTest, TestCreateErrorSandbox1, TestSize.Level1) {
const char *pname = nullptr; const char *pname = nullptr;
std::cout << "test destory nullptr" << std::endl; std::cout << "test destroy nullptr" << std::endl;
DestroySandbox(pname); DestroySandbox(pname);
std::cout << "test destory xapp" << std::endl; std::cout << "test destroy xapp" << std::endl;
DestroySandbox("xapp"); DestroySandbox("xapp");
std::cout << "test enter xapp" << std::endl; std::cout << "test enter xapp" << std::endl;
int ret1 = EnterSandbox("xapp"); int ret1 = EnterSandbox("xapp");
......
...@@ -45,7 +45,7 @@ const gid_t TEST_FILE_GID = 999; ...@@ -45,7 +45,7 @@ const gid_t TEST_FILE_GID = 999;
const mode_t TEST_FILE_MODE = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; const mode_t TEST_FILE_MODE = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
#endif #endif
// init.cfg releated // init.cfg related
const std::string CFG_FILE = "/etc/init.cfg"; const std::string CFG_FILE = "/etc/init.cfg";
const std::string SERVICE_ARR_NAME_IN_JSON = "services"; const std::string SERVICE_ARR_NAME_IN_JSON = "services";
const std::string JOBS_ARR_NAME_IN_JSON = "jobs"; const std::string JOBS_ARR_NAME_IN_JSON = "jobs";
...@@ -62,7 +62,7 @@ const int TEST_MAX_PATH_ARGS_CNT = 20; // max path and args count ...@@ -62,7 +62,7 @@ const int TEST_MAX_PATH_ARGS_CNT = 20; // max path and args count
const int TEST_MAX_ONE_ARG_LEN = 64; // max length of one param/path const int TEST_MAX_ONE_ARG_LEN = 64; // max length of one param/path
const int CAT_BUF_SIZE = 512; // standard Cat buffer size from vfs_shell_cmd const int CAT_BUF_SIZE = 512; // standard Cat buffer size from vfs_shell_cmd
// job test releated // job test related
const std::string PRE_INIT_DIR = ROOT_DIR + "preInitDir/"; const std::string PRE_INIT_DIR = ROOT_DIR + "preInitDir/";
const std::string INIT_DIR = PRE_INIT_DIR + "initDir"; const std::string INIT_DIR = PRE_INIT_DIR + "initDir";
const std::string POST_INIT_DIR = INIT_DIR + "postInitDir"; const std::string POST_INIT_DIR = INIT_DIR + "postInitDir";
......
...@@ -63,7 +63,7 @@ static const char *forbitWriteParamName[] = { ...@@ -63,7 +63,7 @@ static const char *forbitWriteParamName[] = {
static int TestSetParamCheck(const char *paraName, struct ucred *uc) static int TestSetParamCheck(const char *paraName, struct ucred *uc)
{ {
// forbit to read ohos.servicectrl. // forbid to read ohos.servicectrl.
for (size_t i = 0; i < ARRAY_LENGTH(forbitWriteParamName); i++) { for (size_t i = 0; i < ARRAY_LENGTH(forbitWriteParamName); i++) {
if (strncmp(paraName, forbitWriteParamName[i], strlen(forbitWriteParamName[i])) == 0) { if (strncmp(paraName, forbitWriteParamName[i], strlen(forbitWriteParamName[i])) == 0) {
return 1; return 1;
...@@ -91,7 +91,7 @@ static const char *forbitReadParamName[] = { ...@@ -91,7 +91,7 @@ static const char *forbitReadParamName[] = {
}; };
static int TestReadParamCheck(const char *paraName) static int TestReadParamCheck(const char *paraName)
{ {
// forbit to read ohos.servicectrl. // forbid to read ohos.servicectrl.
for (size_t i = 0; i < ARRAY_LENGTH(forbitReadParamName); i++) { for (size_t i = 0; i < ARRAY_LENGTH(forbitReadParamName); i++) {
if (strncmp(paraName, forbitReadParamName[i], strlen(forbitReadParamName[i])) == 0) { if (strncmp(paraName, forbitReadParamName[i], strlen(forbitReadParamName[i])) == 0) {
return 1; return 1;
...@@ -415,4 +415,4 @@ static __attribute__((constructor(101))) void ParamTestStubInit(void) ...@@ -415,4 +415,4 @@ static __attribute__((constructor(101))) void ParamTestStubInit(void)
#if __cplusplus #if __cplusplus
} }
#endif #endif
#endif #endif
\ No newline at end of file
...@@ -447,7 +447,7 @@ public: ...@@ -447,7 +447,7 @@ public:
int TestServiceCtrl(const char *serviceName, int mode) int TestServiceCtrl(const char *serviceName, int mode)
{ {
// service forbit // service forbid
ParamAuditData auditData = {}; ParamAuditData auditData = {};
auditData.name = "ohos.servicectrl."; auditData.name = "ohos.servicectrl.";
auditData.dacData.gid = 202; // 202 test dac gid auditData.dacData.gid = 202; // 202 test dac gid
...@@ -459,7 +459,7 @@ public: ...@@ -459,7 +459,7 @@ public:
int TestPowerCtrl(const char *reboot, int mode) int TestPowerCtrl(const char *reboot, int mode)
{ {
// service forbit // service forbid
ParamAuditData auditData = {}; ParamAuditData auditData = {};
auditData.name = "ohos.servicectrl."; auditData.name = "ohos.servicectrl.";
auditData.dacData.gid = 202; // 202 test dac gid auditData.dacData.gid = 202; // 202 test dac gid
...@@ -573,4 +573,4 @@ HWTEST_F(ParamServiceUnitTest, TestPowerCtrl, TestSize.Level0) ...@@ -573,4 +573,4 @@ HWTEST_F(ParamServiceUnitTest, TestPowerCtrl, TestSize.Level0)
ret = test.TestPowerCtrl("reboot", 0772); ret = test.TestPowerCtrl("reboot", 0772);
EXPECT_EQ(ret, 0); EXPECT_EQ(ret, 0);
} }
} // namespace init_ut } // namespace init_ut
\ No newline at end of file
...@@ -62,7 +62,7 @@ HWTEST_F(SysparaUnitTest, parameterTest001_1, TestSize.Level0) ...@@ -62,7 +62,7 @@ HWTEST_F(SysparaUnitTest, parameterTest001_1, TestSize.Level0)
printf("SDK api version =%d\n", GetSdkApiVersion()); printf("SDK api version =%d\n", GetSdkApiVersion());
printf("Incremental version = %s\n", GetIncrementalVersion()); printf("Incremental version = %s\n", GetIncrementalVersion());
printf("formal id =%s\n", GetVersionId()); printf("formal id =%s\n", GetVersionId());
printf("build tyep =%s\n", GetBuildType()); printf("build type =%s\n", GetBuildType());
printf("build user =%s\n", GetBuildUser()); printf("build user =%s\n", GetBuildUser());
printf("Build host = %s\n", GetBuildHost()); printf("Build host = %s\n", GetBuildHost());
printf("build time =%s\n", GetBuildTime()); printf("build time =%s\n", GetBuildTime());
......
...@@ -25,10 +25,10 @@ const.allow.mock.location root:root:0777 ...@@ -25,10 +25,10 @@ const.allow.mock.location root:root:0777
const.debuggable root:root:0777 const.debuggable root:root:0777
persist.sys.usb.config root:root:0777 persist.sys.usb.config root:root:0777
# default forbit other user to start service # default forbid other user to start service
ohos.servicectrl. root:root:0777 ohos.servicectrl. root:root:0777
test.permission. root:root:0770 test.permission. root:root:0770
test.permission.read. root:root:0774 test.permission.read. root:root:0774
test.permission.write. root:root:0772 test.permission.write. root:root:0772
test.permission.watcher. root:root:0771 test.permission.watcher. root:root:0771
\ No newline at end of file
...@@ -25,5 +25,5 @@ const.allow.mock.location root:root:0777 ...@@ -25,5 +25,5 @@ const.allow.mock.location root:root:0777
const.debuggable root:root:0777 const.debuggable root:root:0777
persist.sys.usb.config root:root:0777 persist.sys.usb.config root:root:0777
# default forbit other user to start service # default forbid other user to start service
ohos.servicectrl. root:root:0777 ohos.servicectrl. root:root:0777
\ No newline at end of file
...@@ -36,7 +36,7 @@ function hdc_push_cmd() { ...@@ -36,7 +36,7 @@ function hdc_push_cmd() {
if [ $# -ne 2 ];then if [ $# -ne 2 ];then
return; return;
fi fi
echo "Pushing resouces to device" echo "Pushing resources to device"
hdc file send $@ hdc file send $@
sleep 0.2 sleep 0.2
} }
......
...@@ -169,7 +169,7 @@ static void HandleRequiredDynamicDeviceNodes(const struct Uevent *uevent) ...@@ -169,7 +169,7 @@ static void HandleRequiredDynamicDeviceNodes(const struct Uevent *uevent)
static void HandleUeventRequired(const struct Uevent *uevent, char **devices, int num) static void HandleUeventRequired(const struct Uevent *uevent, char **devices, int num)
{ {
const char *deviceName; const char *deviceName;
INIT_ERROR_CHECK(devices != NULL && num > 0, return, "Fault paramters"); INIT_ERROR_CHECK(devices != NULL && num > 0, return, "Fault parameters");
if (uevent->action == ACTION_ADD) { if (uevent->action == ACTION_ADD) {
ChangeSysAttributePermissions(uevent->syspath); ChangeSysAttributePermissions(uevent->syspath);
} }
...@@ -332,7 +332,7 @@ static void Trigger(const char *path, int sockFd, char **devices, int num) ...@@ -332,7 +332,7 @@ static void Trigger(const char *path, int sockFd, char **devices, int num)
} }
char ueventBuffer[PATH_MAX]; char ueventBuffer[PATH_MAX];
if (snprintf_s(ueventBuffer, PATH_MAX, PATH_MAX - 1, "%s/%s", path, "uevent") == -1) { if (snprintf_s(ueventBuffer, PATH_MAX, PATH_MAX - 1, "%s/%s", path, "uevent") == -1) {
INIT_LOGW("Cannnot build uevent path under %s", path); INIT_LOGW("Cannot build uevent path under %s", path);
continue; continue;
} }
DoTrigger(ueventBuffer, sockFd, devices, num); DoTrigger(ueventBuffer, sockFd, devices, num);
......
...@@ -307,7 +307,7 @@ static char **GetBlockDeviceSymbolLinks(const struct Uevent *uevent) ...@@ -307,7 +307,7 @@ static char **GetBlockDeviceSymbolLinks(const struct Uevent *uevent)
return NULL; return NULL;
} }
// Reverse walk through sysPath, and check subystem file under each directory. // Reverse walk through sysPath, and check subsystem file under each directory.
char *parent = dirname(sysPath); char *parent = dirname(sysPath);
while (parent != NULL && !STRINGEQUAL(parent, "/") && !STRINGEQUAL(parent, ".")) { while (parent != NULL && !STRINGEQUAL(parent, "/") && !STRINGEQUAL(parent, ".")) {
char subsystem[SYSPATH_SIZE]; char subsystem[SYSPATH_SIZE];
......
...@@ -155,7 +155,7 @@ static int ParseFirmwareConfig(char *p) ...@@ -155,7 +155,7 @@ static int ParseFirmwareConfig(char *p)
// Sanity checks // Sanity checks
struct stat st = {}; struct stat st = {};
INIT_ERROR_CHECK(stat(p, &st) == 0, return -1, "Invalid firware file: %s, err = %d", p, errno); INIT_ERROR_CHECK(stat(p, &st) == 0, return -1, "Invalid firmware file: %s, err = %d", p, errno);
INIT_ERROR_CHECK(S_ISDIR(st.st_mode), return -1, "Expect directory in firmware config"); INIT_ERROR_CHECK(S_ISDIR(st.st_mode), return -1, "Expect directory in firmware config");
struct FirmwareUdevConf *config = calloc(1, sizeof(struct FirmwareUdevConf)); struct FirmwareUdevConf *config = calloc(1, sizeof(struct FirmwareUdevConf));
INIT_CHECK(config != NULL, errno = ENOMEM; INIT_CHECK(config != NULL, errno = ENOMEM;
......
...@@ -39,7 +39,7 @@ int UeventdSocketInit(void) ...@@ -39,7 +39,7 @@ int UeventdSocketInit(void)
int on = 1; int on = 1;
if (memset_s(&addr, sizeof(addr), 0, sizeof(addr)) != EOK) { if (memset_s(&addr, sizeof(addr), 0, sizeof(addr)) != EOK) {
INIT_LOGE("Faild to clear socket address"); INIT_LOGE("Failed to clear socket address");
return -1; return -1;
} }
addr.nl_family = AF_NETLINK; addr.nl_family = AF_NETLINK;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册