%attr(644,root,root) %{TZ_SYS_RO_ICONS}/krate/shortcut_icon.png
%attr(644,root,root) %{TZ_SYS_RO_ICONS}/krate/indicator_icon.png
%attr(644,root,root) %{TZ_SYS_RO_ICONS}/krate/notification_sub_icon.png
-#%attr(700,root,root) %dir %{TZ_SYS_ETC}/krate
%attr(755,root,root) %{_libdir}/security/pam_krate.so
%attr(700,root,root) %{_sbindir}/krate-admin-cli
%config /etc/pam.d/*
-DHOME_DIR=%{TZ_SYS_HOME} \
-DSYSTEMD_UNIT_DIR=%{_unitdir} \
-DPAMD_DIR=/etc/pam.d \
- -DCONF_DIR=%{TZ_SYS_ETC}/krate \
-DICON_DIR="%{TZ_SYS_RO_ICONS}/krate" \
-DAPP_INSTALL_PREFIX="%{TZ_SYS_RO_APP}" \
-DAPP_SHARE_PACKAGES_DIR="%{TZ_SYS_RO_PACKAGES}"
#include <tzplatform_config.h>
#include <auth-passwd-admin.h>
#include <gum/gum-user.h>
+#include <gum/gum-user-service.h>
#include <gum/common/gum-user-types.h>
#include <klay/error.h>
#include <klay/process.h>
return 0;
}
-void initializeCreatedKrateList() {
- try {
- runtime::DirectoryIterator iter(CONF_PATH "/"), end;
+void initializeCreatedKrateList()
+{
+ const gchar *type[] = {"security", NULL};
+ gchar *username;
+ GumUserService *service;
+ GumUserList *users;
+ GumUser *user;
+
+ service = gum_user_service_create_sync(FALSE);
+ if (!service) {
+ return;
+ }
+
+ users = gum_user_service_get_user_list_sync(service, type);
+ if (!users) {
+ return;
+ }
- while (iter != end) {
- const std::string& file = iter->getName();
- const std::string& name(file.substr(0, file.rfind(".xml")));
- createdKrateList.push_back(name);
- ++iter;
+ for (GumUserList *src_list = users; src_list != NULL; src_list = g_list_next(src_list)) {
+ user = (GumUser*) src_list->data;
+ if (user) {
+ g_object_get(G_OBJECT(user), "username", &username, NULL);
+ createdKrateList.push_back(username);
+ g_free(username);
}
- } catch (runtime::Exception& e) {}
+ }
+
+ gum_user_service_list_free(users);
+ g_object_unref(service);
}
#define NT_TITLE NOTIFICATION_TEXT_TYPE_TITLE
maskUserServices(user);
+ ::tzplatform_set_user(user.getUid());
+ runtime::File confDir(std::string(::tzplatform_getenv(TZ_USER_HOME)) + "/.config/krate");
+ ::tzplatform_reset_user();
+ if (!confDir.exists()) {
+ confDir.makeDirectory(true);
+ confDir.chmod(700);
+ }
+
manifestFile.reset(xml::Parser::parseString(manifest));
//write container author info
if (!pkgId.empty()) {
std::cout << manifestFile->getRootNode().getName() << std::endl;
manifestFile->getRootNode().addNewChild("author").setContent(pkgId);
}
- manifestFile->write(CONF_PATH "/" + name + ".xml", "UTF-8", true);
+ manifestFile->write(confDir.getPath() + "/" + name + ".xml", "UTF-8", true);
//unlock the user
setKrateState(user.getUid(), 1);
std::unique_ptr<xml::Document> manifestFile;
bool canRemove = false;
- manifestFile.reset(xml::Parser::parseFile(CONF_PATH "/" + name + ".xml"));
+ runtime::User user(name);
+ ::tzplatform_set_user(user.getUid());
+ std::string confPath(::tzplatform_getenv(TZ_USER_HOME));
+ confPath += "/.config/krate";
+ ::tzplatform_reset_user();
+
+ manifestFile.reset(xml::Parser::parseFile(confPath + "/" + name + ".xml"));
xml::Node::NodeList authors = manifestFile->evaluate("/manifest/author");
for (const xml::Node& author : authors) {
if (author.getContent() == pkgId) {