summaryrefslogtreecommitdiff
path: root/src/extensions/tizen
diff options
context:
space:
mode:
Diffstat (limited to 'src/extensions/tizen')
-rw-r--r--src/extensions/tizen/Makefile.am1
-rw-r--r--src/extensions/tizen/Makefile.in41
-rw-r--r--src/extensions/tizen/tizen-storage-manager.c80
3 files changed, 88 insertions, 34 deletions
diff --git a/src/extensions/tizen/Makefile.am b/src/extensions/tizen/Makefile.am
index bab7a13..b7301bf 100644
--- a/src/extensions/tizen/Makefile.am
+++ b/src/extensions/tizen/Makefile.am
@@ -9,6 +9,7 @@ libextension_tizen_la_CPPFLAGS = \
$(LIBECRYPTFS_CFLAGS)
libextension_tizen_la_LIBADD = \
+ $(top_builddir)/src/common/libgsignond-common.la \
$(GSIGNOND_LIBS) \
$(LIBSMACK_LIBS) \
$(LIBECRYPTFS_LIBS)
diff --git a/src/extensions/tizen/Makefile.in b/src/extensions/tizen/Makefile.in
index 82335fe..147fd88 100644
--- a/src/extensions/tizen/Makefile.in
+++ b/src/extensions/tizen/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -16,6 +16,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -39,9 +56,10 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
subdir = src/extensions/tizen
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_gnu_make.m4 \
- $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -78,8 +96,10 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(extensionsdir)"
LTLIBRARIES = $(extensions_LTLIBRARIES)
am__DEPENDENCIES_1 =
-libextension_tizen_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+libextension_tizen_la_DEPENDENCIES = \
+ $(top_builddir)/src/common/libgsignond-common.la \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
am_libextension_tizen_la_OBJECTS = \
libextension_tizen_la-tizen-access-control-manager.lo \
libextension_tizen_la-tizen-extension.lo \
@@ -117,6 +137,11 @@ am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libextension_tizen_la_SOURCES)
DIST_SOURCES = $(libextension_tizen_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -269,6 +294,7 @@ libextension_tizen_la_CPPFLAGS = \
$(LIBECRYPTFS_CFLAGS)
libextension_tizen_la_LIBADD = \
+ $(top_builddir)/src/common/libgsignond-common.la \
$(GSIGNOND_LIBS) \
$(LIBSMACK_LIBS) \
$(LIBECRYPTFS_LIBS)
@@ -320,7 +346,6 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
install-extensionsLTLIBRARIES: $(extensions_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(extensionsdir)" || $(MKDIR_P) "$(DESTDIR)$(extensionsdir)"
@list='$(extensions_LTLIBRARIES)'; test -n "$(extensionsdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -328,6 +353,8 @@ install-extensionsLTLIBRARIES: $(extensions_LTLIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(extensionsdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(extensionsdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(extensionsdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(extensionsdir)"; \
}
diff --git a/src/extensions/tizen/tizen-storage-manager.c b/src/extensions/tizen/tizen-storage-manager.c
index 2ee01d4..d098e9e 100644
--- a/src/extensions/tizen/tizen-storage-manager.c
+++ b/src/extensions/tizen/tizen-storage-manager.c
@@ -77,12 +77,19 @@ _set_config (ExtensionTizenStorageManager *self, GSignondConfig *config)
g_assert (self->priv->cdir == NULL);
parent->config = config;
- parent->location = g_strdup (gsignond_config_get_string (config,
- GSIGNOND_CONFIG_GENERAL_SECURE_DIR));
- if (!parent->location)
- parent->location = g_build_filename (g_get_user_data_dir (),
- "gsignond", NULL);
-
+ gchar *user_dir = g_strdup_printf ("gsignond.%s", g_get_user_name ());
+ const gchar *storage_path = gsignond_config_get_string (
+ config,
+ GSIGNOND_CONFIG_GENERAL_STORAGE_PATH);
+ if (storage_path)
+ parent->location = g_build_filename (storage_path,
+ user_dir,
+ NULL);
+ else
+ parent->location = g_build_filename ("/var/db",
+ user_dir,
+ NULL);
+ g_free (user_dir);
self->priv->cdir = g_strdup_printf ("%s.efs", parent->location);
DBG ("location %s encryption point %s", parent->location, self->priv->cdir);
}
@@ -165,16 +172,41 @@ _initialize_storage (GSignondStorageManager *parent)
ExtensionTizenStorageManagerPrivate *priv = self->priv;
g_return_val_if_fail (parent->location, FALSE);
+ g_return_val_if_fail (priv->cdir, FALSE);
+
+ if (g_access (parent->location, R_OK) == 0 &&
+ g_access (priv->cdir, R_OK) == 0)
+ return TRUE;
+
+ gboolean res = FALSE;
+
+ uid_t uid = getuid ();
+ if (seteuid (0))
+ WARN ("seteuid() failed");
+
DBG ("create mount point %s", parent->location);
- if (g_mkdir_with_parents (parent->location, S_IRWXU))
- return FALSE;
+ if (g_mkdir_with_parents (parent->location, S_IRWXU | S_IRWXG))
+ goto init_exit;
- g_return_val_if_fail (priv->cdir, FALSE);
DBG ("create storage point %s", priv->cdir);
- if (g_mkdir_with_parents (priv->cdir, S_IRWXU))
- return FALSE;
-
- return TRUE;
+ if (g_mkdir_with_parents (priv->cdir, S_IRWXU | S_IRWXG))
+ goto init_exit;
+
+ if (chown (parent->location, 0, getegid ()))
+ WARN ("chown() failed");
+ if (chmod (parent->location, S_IRWXU | S_IRWXG))
+ WARN ("chmod() failed");
+ if (chown (priv->cdir, 0, getegid ()))
+ WARN ("chown() failed");
+ if (chmod (priv->cdir, S_IRWXU | S_IRWXG))
+ WARN ("chmod() failed");
+ res = TRUE;
+
+init_exit:
+ if (seteuid (uid))
+ WARN ("seteuid() failed");
+
+ return res;
}
static gboolean
@@ -216,11 +248,8 @@ _mount_filesystem (GSignondStorageManager *parent)
priv->ksig);
DBG ("mount options: %s", mntopts);
uid_t uid = getuid ();
- gid_t gid = getgid ();
- if (setreuid (-1, 0))
- WARN ("setreuid() failed");
- if (setregid (-1, 0))
- WARN ("setregid() failed");
+ if (seteuid (0))
+ WARN ("seteuid() failed");
DBG ("perform mount %s -> %s", priv->cdir, parent->location);
if (mount (priv->cdir, parent->location,
"ecryptfs", MS_NOSUID | MS_NODEV, mntopts)) {
@@ -233,10 +262,8 @@ _mount_filesystem (GSignondStorageManager *parent)
_mount_exit:
g_free (mntopts);
- if (setreuid (-1, uid))
- WARN ("setreuid() failed");
- if (setregid (-1, gid))
- WARN ("setregid() failed");
+ if (seteuid (uid))
+ WARN ("seteuid() failed");
return retval;
}
@@ -247,12 +274,11 @@ _unmount_filesystem (GSignondStorageManager *parent)
g_return_val_if_fail (parent != NULL, FALSE);
uid_t uid = getuid ();
- gid_t gid = getgid ();
- setreuid (-1, 0);
- setregid (-1, 0);
+ if (seteuid (0))
+ WARN ("seteuid() failed");
umount (parent->location);
- setreuid (-1, uid);
- setregid (-1, gid);
+ if (seteuid (uid))
+ WARN ("seteuid() failed");
return TRUE;
}