* @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
* @version 1.0
*/
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <cstdlib>
#include <string>
#include <fstream>
#include <sys/smack.h>
#include <fcntl.h>
#include <unistd.h>
#include <unordered_map>
+#include <tzplatform_config.h>
const std::string SMACK_USER_APP_PREFIX = "User::Pkg::";
const char *SYSTEM_LABEL = ckmc_owner_id_system;
}
return CKM::Policy();
}
+
+void require_default_user(char *argv[])
+{
+ uid_t expected_uid = tzplatform_getuid(TZ_SYS_DEFAULT_USER);
+ if (expected_uid != geteuid()) {
+ std::string userStr("owner");
+ const char* user = tzplatform_getenv(TZ_SYS_DEFAULT_USER);
+ if (user)
+ userStr = user;
+
+ std::cerr << argv[0] << " should be executed as " << userStr << ". Aborting" << std::endl;
+ exit(-1);
+ }
+}
* See the License for the specific language governing permissions and
* limitations under the License
*/
-#include <unistd.h>
-#include <sys/types.h>
#include <fstream>
#include <iostream>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
-#include <tzplatform_config.h>
-
namespace {
const int USER_APP = 5001;
int main(int argc, char *argv[])
{
- uid_t expected_uid = tzplatform_getuid(TZ_SYS_DEFAULT_USER);
- if (expected_uid != geteuid()) {
- std::string userStr("owner");
- const char* user = tzplatform_getenv(TZ_SYS_DEFAULT_USER);
- if (user)
- userStr = user;
-
- std::cerr << argv[0] << " should be executed as " << userStr << ". Aborting" << std::endl;
- return -1;
- }
+ require_default_user(argv);
int exitCode = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
int main(int argc, char *argv[])
{
+ require_default_user(argv);
+
return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
}