2 * Copyright (c) 2016-2020 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include <sys/capability.h>
23 #include <sys/types.h>
26 #include <app_install_helper.h>
28 #include <temp_test_user.h>
30 DEFINE_SMARTPTR(cap_free, _cap_struct, CapsSetsUniquePtr);
32 const int FTW_MAX_FDS = 16;
34 int nftw_remove_labels(const char *fpath, const struct stat* /*sb*/,
35 int /*typeflag*/, struct FTW* /*ftwbuf*/);
36 void check_path(const std::string &path, const std::string &label,
37 bool transmute = true, bool execute = false);
39 CapsSetsUniquePtr setCaps(const char *cap_string);
41 void accessTest(const std::string &id, const std::string &testPath, int accessType);
42 void runAccessTest(const std::string &label, uid_t uid, gid_t gid,
43 const std::string &testPath, int accessType);
44 void runAccessTest(const AppInstallHelper &app, const std::string &testPath, int accessType);
45 void runSystemAccessTest(uid_t uid, gid_t gid, const std::string &testPath, int accessType);
47 bool isAskuserDisabled();
48 bool isPrivilegePrivacy(const std::string &priv);
49 int countPrivacyPrivileges(const PrivilegeVector &privs);
50 int countPrivacyPrivileges(const std::vector<std::string> &privs);
52 int setLauncherSecurityAttributes(uid_t uid, gid_t gid);
53 int setLauncherSecurityAttributes(TemporaryTestUser &user);