From 7ed710b6b50f5269a0fbf86e05bc3773d15abba0 Mon Sep 17 00:00:00 2001 From: liusn Date: Thu, 4 Nov 2021 09:35:47 +0800 Subject: [PATCH 1/2] change LICENSE.txt to LICENSE in BUILD.gn, and modify sepolicy/policy.31 Signed-off-by: liusn --- BUILD.gn | 16 ++++++++-------- sepolicy/policy.31 | 23 ++++++++++++++++++++--- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index ed1a53e54..6df987cf5 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -52,7 +52,7 @@ ohos_shared_library("libload_policy") { "system", "ramdisk", ] - license_file = "$SELINUX_ROOT_DIR/LICENSE.txt" + license_file = "$SELINUX_ROOT_DIR/LICENSE" part_name = "selinux" subsystem_name = "security" } @@ -87,7 +87,7 @@ ohos_shared_library("librestorecon") { "system", "ramdisk", ] - license_file = "$SELINUX_ROOT_DIR/LICENSE.txt" + license_file = "$SELINUX_ROOT_DIR/LICENSE" part_name = "selinux" subsystem_name = "security" } @@ -107,7 +107,7 @@ ohos_executable("load_policy") { "-DUSE_PCRE2", "-w", ] - license_file = "$SELINUX_ROOT_DIR/LICENSE.txt" + license_file = "$SELINUX_ROOT_DIR/LICENSE" part_name = "selinux" subsystem_name = "security" } @@ -127,7 +127,7 @@ ohos_executable("restorecon") { "-DUSE_PCRE2", "-w", ] - license_file = "$SELINUX_ROOT_DIR/LICENSE.txt" + license_file = "$SELINUX_ROOT_DIR/LICENSE" part_name = "selinux" subsystem_name = "security" } @@ -145,7 +145,7 @@ ohos_executable("selinux_test") { "$THIRD_PARTY_PCRE2_DIR:libpcre2", "$THIRD_PARTY_SELINUX_DIR:libselinux", ] - license_file = "$SELINUX_ROOT_DIR/LICENSE.txt" + license_file = "$SELINUX_ROOT_DIR/LICENSE" part_name = "selinux" subsystem_name = "security" } @@ -162,21 +162,21 @@ action("build_policy") { ohos_prebuilt_etc("build_sepolicy") { deps = [ ":build_policy" ] source = "$SELINUX_ROOT_DIR/sepolicy/policy.31" - license_file = "$SELINUX_ROOT_DIR/LICENSE.txt" + license_file = "$SELINUX_ROOT_DIR/LICENSE" part_name = "selinux" relative_install_dir = "selinux/targeted/policy/" } ohos_prebuilt_etc("config") { source = "$SELINUX_ROOT_DIR/config/config" - license_file = "$SELINUX_ROOT_DIR/LICENSE.txt" + license_file = "$SELINUX_ROOT_DIR/LICENSE" part_name = "selinux" relative_install_dir = "selinux/" } ohos_prebuilt_etc("file_contexts") { source = "$SELINUX_ROOT_DIR/sepolicy/file_contexts" - license_file = "$SELINUX_ROOT_DIR/LICENSE.txt" + license_file = "$SELINUX_ROOT_DIR/LICENSE" part_name = "selinux" # FIXME 此处不应该改变 file_contexts 的约定路径! diff --git a/sepolicy/policy.31 b/sepolicy/policy.31 index f723ccd0b..f49e1c892 100644 --- a/sepolicy/policy.31 +++ b/sepolicy/policy.31 @@ -1,4 +1,21 @@ -! DO NOT DELETE THIS FILE ! - -This needed by ohos_prebuilt_etc("precompiled_sepolicy") in ..//BUILD.gn +#!/usr/bin/env bash +# +# Copyright (c) 2021 北京万里红科技有限公司 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# ! DO NOT DELETE THIS FILE ! +# +# This needed by ohos_prebuilt_etc("precompiled_sepolicy") in ..//BUILD.gn -- Gitee From 5447e9d67b53317243b1e104f19c849d2531dc27 Mon Sep 17 00:00:00 2001 From: liusn Date: Thu, 4 Nov 2021 09:36:09 +0800 Subject: [PATCH 2/2] change selinux_opt to selinux_opts in interfaces/policycoreutils/src/restorecon.c Signed-off-by: liusn --- interfaces/policycoreutils/src/restorecon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/policycoreutils/src/restorecon.c b/interfaces/policycoreutils/src/restorecon.c index c11754efa..f21344464 100644 --- a/interfaces/policycoreutils/src/restorecon.c +++ b/interfaces/policycoreutils/src/restorecon.c @@ -38,7 +38,7 @@ static int restore_init(restore_opts_t * opts) if (!(opts->hnd = selabel_open(SELABEL_CTX_FILE, selinux_opts, sizeof(selinux_opts) / - sizeof(selinux_opt)))) { + sizeof(selinux_opts)))) { return -1; } -- Gitee