${PROJECT_SOURCE_DIR}/src/common/timeout.cpp
${PROJECT_SOURCE_DIR}/src/common/temp_test_user.cpp
${PROJECT_SOURCE_DIR}/src/common/cynara_helpers_creds.cpp
+ ${PROJECT_SOURCE_DIR}/src/common/label_generator.cpp
)
#system and local includes
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#include <label_generator.h>
+
+// Common implementation details
+std::string generateProcessLabel(const std::string &appId, const std::string &pkgId, bool isHybrid)
+{
+ std::string label = "User::Pkg::" + pkgId;
+ if (isHybrid) {
+ label += "::App::" + appId;
+ }
+ return label;
+}
+
+std::string generatePathRWLabel(const std::string &pkgId)
+{
+ return "User::Pkg::" + pkgId;
+}
+
+std::string generatePathROLabel(const std::string &pkgId)
+{
+ return generatePathRWLabel(pkgId) + "::RO";
+}
+
+std::string generatePathSharedROLabel(const std::string &pkgId)
+{
+ return generatePathRWLabel(pkgId) + "::SharedRO";
+}
+
+std::string generatePathTrustedLabel(int64_t authorId)
+{
+ return "User::Author::" + std::to_string(authorId);
+}
+
+std::string getPublicPathLabel()
+{
+ return "User::Home";
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#include <string>
+#include <sys/types.h>
+
+std::string generateProcessLabel(const std::string &appId, const std::string &pkgId, bool isHybrid = false);
+std::string generatePathRWLabel(const std::string &pkgId);
+std::string generatePathROLabel(const std::string &pkgId);
+std::string generatePathSharedROLabel(const std::string &pkgId);
+std::string generatePathTrustedLabel(int64_t authorId);
+std::string getPublicPathLabel();
#include <security-manager-types.h>
#include <dpl/test/test_runner.h>
-#include <sm_commons.h>
#include <tzplatform.h>
+#include <label_generator.h>
#include "app_install_helper.h"
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <tests_common.h>
#include <policy_configuration.h>
#include "tzplatform.h"
+#include <label_generator.h>
using namespace SecurityManagerTest;
-// Common implementation details
-
-std::string generateProcessLabel(const std::string &appId, const std::string &pkgId, bool isHybrid)
-{
- std::string label = "User::Pkg::" + pkgId;
- if (isHybrid) {
- label += "::App::" + appId;
- }
- return label;
-}
-
-std::string generatePathRWLabel(const std::string &pkgId)
-{
- return "User::Pkg::" + pkgId;
-}
-
-std::string generatePathROLabel(const std::string &pkgId)
-{
- return generatePathRWLabel(pkgId) + "::RO";
-}
-
-std::string generatePathSharedROLabel(const std::string &pkgId)
-{
- return generatePathRWLabel(pkgId) + "::SharedRO";
-}
-
-std::string generatePathTrustedLabel(int64_t authorId)
-{
- return "User::Author::" + std::to_string(authorId);
-}
-
-std::string getPublicPathLabel()
-{
- return "User::Home";
-}
-
// Common DB/nftw checks
// nftw doesn't allow passing user data to functions. Work around by using global variable
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
const int FTW_MAX_FDS = 16;
-std::string generateProcessLabel(const std::string &appId, const std::string &pkgId, bool isHybrid = false);
-std::string generatePathRWLabel(const std::string &pkgId);
-std::string generatePathROLabel(const std::string &pkgId);
-std::string generatePathSharedROLabel(const std::string &pkgId);
-std::string generatePathTrustedLabel(int64_t authorId);
-std::string getPublicPathLabel();
-
typedef std::vector<std::string> privileges_t;
int nftw_remove_labels(const char *fpath, const struct stat* /*sb*/,
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <app_install_helper.h>
#include <cynara_test_admin.h>
#include <dpl/test/test_runner.h>
+#include <label_generator.h>
#include <message_pipe.h>
#include <policy_configuration.h>
#include <scoped_installer.h>
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <access_provider.h>
#include <cynara_helpers_creds.h>
#include <dpl/test/test_runner.h>
+#include <label_generator.h>
#include <memory.h>
#include <passwd_access.h>
#include <sm_api.h>
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <app_install_helper.h>
#include <dpl/test/test_runner.h>
+#include <label_generator.h>
#include <memory.h>
#include <message_pipe.h>
#include <scoped_installer.h>
static void testSetLabelForSelf(const std::string &appName, const std::string &pkgName,
bool expected_success)
{
+ //FIXME : replace this with SM API
std::string label = generateProcessLabel(appName, pkgName);
int result = smack_set_label_for_self(label.c_str());
if (expected_success)
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <app_install_helper.h>
#include <dpl/test/test_runner.h>
+#include <label_generator.h>
#include <scoped_installer.h>
#include <sm_api.h>
#include <sm_commons.h>