-# Copyright (c) 2013-2015 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2013-2018 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.
PKG_CHECK_MODULES(CKM_TEST_COMMON_DEP
REQUIRED
key-manager
+ libtzplatform-config
)
SET(CKM_TEST_COMMON_SRCS
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2018 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.
* 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 <netdb.h>
#include <dpl/test/test_runner.h>
#include <ckm/ckm-type.h>
#include <ckm/ckm-pkcs12.h>
-#include <fstream>
-
#include <openssl/x509.h>
#include <openssl/x509v3.h>
int main(int argc, char *argv[])
{
+ if (geteuid() != 0)
+ {
+ std::cerr << argv[0] << " should be executed as root. Aborting" << std::endl;
+ return -1;
+ }
return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
}
+/*
+ * Copyright (c) 2016-2018 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 <unistd.h>
+#include <sys/types.h>
+
+#include <fstream>
+#include <iostream>
+#include <string>
+
#include <netdb.h>
#include <dpl/test/test_runner.h>
#include <ckm/ckm-type.h>
#include <ckm/ckm-pkcs12.h>
-#include <fstream>
-
#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;
+ }
+
return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
}
#!/bin/sh
#####################################################################
-# Copyright (c) 2012-2014 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2012-2018 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.
;;
"ckm")
echo "========================================================================="
- echo "KEY MANAGER TESTS"
+ echo "KEY MANAGER UNPRIVILEGED TESTS"
echo
- ckm-tests "${@:2}"
+ ARGS="${@:2}"
+ su - owner -c "ckm-tests $ARGS"
+ echo "========================================================================="
+ echo "KEY MANAGER PRIVILEGED TESTS"
+ echo
+ ckm-tests-on-onlycap.sh $ARGS
;;
"yaca")
echo "========================================================================="