diff options
Diffstat (limited to 'src/extensions/tizen')
-rw-r--r-- | src/extensions/tizen/Makefile.am | 25 | ||||
-rw-r--r-- | src/extensions/tizen/Makefile.in | 634 | ||||
-rw-r--r-- | src/extensions/tizen/tizen-access-control-manager.c | 208 | ||||
-rw-r--r-- | src/extensions/tizen/tizen-access-control-manager.h | 103 | ||||
-rw-r--r-- | src/extensions/tizen/tizen-extension.c | 166 | ||||
-rw-r--r-- | src/extensions/tizen/tizen-extension.h | 72 | ||||
-rw-r--r-- | src/extensions/tizen/tizen-secret-storage.c | 58 | ||||
-rw-r--r-- | src/extensions/tizen/tizen-secret-storage.h | 73 | ||||
-rw-r--r-- | src/extensions/tizen/tizen-storage-manager.c | 341 | ||||
-rw-r--r-- | src/extensions/tizen/tizen-storage-manager.h | 73 |
10 files changed, 1753 insertions, 0 deletions
diff --git a/src/extensions/tizen/Makefile.am b/src/extensions/tizen/Makefile.am new file mode 100644 index 0000000..bab7a13 --- /dev/null +++ b/src/extensions/tizen/Makefile.am @@ -0,0 +1,25 @@ +include $(top_srcdir)/common.mk +extensions_LTLIBRARIES = libextension-tizen.la + +libextension_tizen_la_CPPFLAGS = \ + -I$(top_builddir) \ + -I$(top_srcdir)/include \ + $(GSIGNOND_CFLAGS) \ + $(LIBSMACK_CFLAGS) \ + $(LIBECRYPTFS_CFLAGS) + +libextension_tizen_la_LIBADD = \ + $(GSIGNOND_LIBS) \ + $(LIBSMACK_LIBS) \ + $(LIBECRYPTFS_LIBS) + +libextension_tizen_la_SOURCES = \ + tizen-access-control-manager.h \ + tizen-access-control-manager.c \ + tizen-extension.h \ + tizen-extension.c \ + tizen-secret-storage.h \ + tizen-secret-storage.c \ + tizen-storage-manager.h \ + tizen-storage-manager.c + diff --git a/src/extensions/tizen/Makefile.in b/src/extensions/tizen/Makefile.in new file mode 100644 index 0000000..82335fe --- /dev/null +++ b/src/extensions/tizen/Makefile.in @@ -0,0 +1,634 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/common.mk +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 +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(extensionsdir)" +LTLIBRARIES = $(extensions_LTLIBRARIES) +am__DEPENDENCIES_1 = +libextension_tizen_la_DEPENDENCIES = $(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 \ + libextension_tizen_la-tizen-secret-storage.lo \ + libextension_tizen_la-tizen-storage-manager.lo +libextension_tizen_la_OBJECTS = $(am_libextension_tizen_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +DEFAULT_INCLUDES = +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +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) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DBUS_INTERFACES_DIR = @DBUS_INTERFACES_DIR@ +DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GREP = @GREP@ +GSIGNOND_CFLAGS = @GSIGNOND_CFLAGS@ +GSIGNOND_LIBS = @GSIGNOND_LIBS@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTestDBus_CFLAGS = @GTestDBus_CFLAGS@ +GTestDBus_LIBS = @GTestDBus_LIBS@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBECRYPTFS_CFLAGS = @LIBECRYPTFS_CFLAGS@ +LIBECRYPTFS_LIBS = @LIBECRYPTFS_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSMACK_CFLAGS = @LIBSMACK_CFLAGS@ +LIBSMACK_LIBS = @LIBSMACK_LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MESSAGE_BUS_TYPE = @MESSAGE_BUS_TYPE@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +ifGNUmake = @ifGNUmake@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +extensionsdir = $(pkglibdir)/extensions +pluginsdir = $(pkglibdir)/plugins +extensions_LTLIBRARIES = libextension-tizen.la +libextension_tizen_la_CPPFLAGS = \ + -I$(top_builddir) \ + -I$(top_srcdir)/include \ + $(GSIGNOND_CFLAGS) \ + $(LIBSMACK_CFLAGS) \ + $(LIBECRYPTFS_CFLAGS) + +libextension_tizen_la_LIBADD = \ + $(GSIGNOND_LIBS) \ + $(LIBSMACK_LIBS) \ + $(LIBECRYPTFS_LIBS) + +libextension_tizen_la_SOURCES = \ + tizen-access-control-manager.h \ + tizen-access-control-manager.c \ + tizen-extension.h \ + tizen-extension.c \ + tizen-secret-storage.h \ + tizen-secret-storage.c \ + tizen-storage-manager.h \ + tizen-storage-manager.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/extensions/tizen/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/extensions/tizen/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/common.mk: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(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 \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + 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)"; \ + } + +uninstall-extensionsLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(extensions_LTLIBRARIES)'; test -n "$(extensionsdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(extensionsdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(extensionsdir)/$$f"; \ + done + +clean-extensionsLTLIBRARIES: + -test -z "$(extensions_LTLIBRARIES)" || rm -f $(extensions_LTLIBRARIES) + @list='$(extensions_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libextension-tizen.la: $(libextension_tizen_la_OBJECTS) $(libextension_tizen_la_DEPENDENCIES) $(EXTRA_libextension_tizen_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) -rpath $(extensionsdir) $(libextension_tizen_la_OBJECTS) $(libextension_tizen_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextension_tizen_la-tizen-access-control-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextension_tizen_la-tizen-extension.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextension_tizen_la-tizen-secret-storage.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libextension_tizen_la-tizen-storage-manager.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libextension_tizen_la-tizen-access-control-manager.lo: tizen-access-control-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextension_tizen_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libextension_tizen_la-tizen-access-control-manager.lo -MD -MP -MF $(DEPDIR)/libextension_tizen_la-tizen-access-control-manager.Tpo -c -o libextension_tizen_la-tizen-access-control-manager.lo `test -f 'tizen-access-control-manager.c' || echo '$(srcdir)/'`tizen-access-control-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextension_tizen_la-tizen-access-control-manager.Tpo $(DEPDIR)/libextension_tizen_la-tizen-access-control-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tizen-access-control-manager.c' object='libextension_tizen_la-tizen-access-control-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextension_tizen_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libextension_tizen_la-tizen-access-control-manager.lo `test -f 'tizen-access-control-manager.c' || echo '$(srcdir)/'`tizen-access-control-manager.c + +libextension_tizen_la-tizen-extension.lo: tizen-extension.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextension_tizen_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libextension_tizen_la-tizen-extension.lo -MD -MP -MF $(DEPDIR)/libextension_tizen_la-tizen-extension.Tpo -c -o libextension_tizen_la-tizen-extension.lo `test -f 'tizen-extension.c' || echo '$(srcdir)/'`tizen-extension.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextension_tizen_la-tizen-extension.Tpo $(DEPDIR)/libextension_tizen_la-tizen-extension.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tizen-extension.c' object='libextension_tizen_la-tizen-extension.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextension_tizen_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libextension_tizen_la-tizen-extension.lo `test -f 'tizen-extension.c' || echo '$(srcdir)/'`tizen-extension.c + +libextension_tizen_la-tizen-secret-storage.lo: tizen-secret-storage.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextension_tizen_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libextension_tizen_la-tizen-secret-storage.lo -MD -MP -MF $(DEPDIR)/libextension_tizen_la-tizen-secret-storage.Tpo -c -o libextension_tizen_la-tizen-secret-storage.lo `test -f 'tizen-secret-storage.c' || echo '$(srcdir)/'`tizen-secret-storage.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextension_tizen_la-tizen-secret-storage.Tpo $(DEPDIR)/libextension_tizen_la-tizen-secret-storage.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tizen-secret-storage.c' object='libextension_tizen_la-tizen-secret-storage.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextension_tizen_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libextension_tizen_la-tizen-secret-storage.lo `test -f 'tizen-secret-storage.c' || echo '$(srcdir)/'`tizen-secret-storage.c + +libextension_tizen_la-tizen-storage-manager.lo: tizen-storage-manager.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextension_tizen_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libextension_tizen_la-tizen-storage-manager.lo -MD -MP -MF $(DEPDIR)/libextension_tizen_la-tizen-storage-manager.Tpo -c -o libextension_tizen_la-tizen-storage-manager.lo `test -f 'tizen-storage-manager.c' || echo '$(srcdir)/'`tizen-storage-manager.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libextension_tizen_la-tizen-storage-manager.Tpo $(DEPDIR)/libextension_tizen_la-tizen-storage-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tizen-storage-manager.c' object='libextension_tizen_la-tizen-storage-manager.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libextension_tizen_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libextension_tizen_la-tizen-storage-manager.lo `test -f 'tizen-storage-manager.c' || echo '$(srcdir)/'`tizen-storage-manager.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(extensionsdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-extensionsLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-extensionsLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-extensionsLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-extensionsLTLIBRARIES clean-generic clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-extensionsLTLIBRARIES install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-extensionsLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/extensions/tizen/tizen-access-control-manager.c b/src/extensions/tizen/tizen-access-control-manager.c new file mode 100644 index 0000000..b439643 --- /dev/null +++ b/src/extensions/tizen/tizen-access-control-manager.c @@ -0,0 +1,208 @@ +/* vi: set et sw=4 ts=4 cino=t0,(0: */ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of gsignond + * + * Copyright (C) 2013 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * Contact: Elena Reshetova <elena.reshetova@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include <stdlib.h> +#include <sys/smack.h> +#include <glib.h> +#include <gio/gio.h> + +#include "gsignond/gsignond-log.h" +#include "tizen-access-control-manager.h" + +#define EXTENSION_TIZEN_ACCESS_CONTROL_MANAGER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ + EXTENSION_TYPE_TIZEN_ACCESS_CONTROL_MANAGER, \ + ExtensionTizenAccessControlManagerPrivate)) + +#define DBUS_SERVICE_DBUS "org.freedesktop.DBus" +#define DBUS_PATH_DBUS "/org/freedesktop/DBus" +#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus" + +static const gchar keychainAppId[] = "gSignond::keychain"; + +struct _ExtensionTizenAccessControlManagerPrivate +{ +}; + +G_DEFINE_TYPE (ExtensionTizenAccessControlManager, + extension_tizen_access_control_manager, + GSIGNOND_TYPE_ACCESS_CONTROL_MANAGER); + +static void +extension_tizen_access_control_manager_class_init ( + ExtensionTizenAccessControlManagerClass *klass) +{ + + /*GObjectClass *base = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, + sizeof(ExtensionTestAccessControlManagerPrivate));*/ + + GSignondAccessControlManagerClass *parent = + GSIGNOND_ACCESS_CONTROL_MANAGER_CLASS (klass); + + parent->security_context_of_peer = extension_tizen_access_control_manager_security_context_of_peer; + parent->peer_is_allowed_to_use_identity = extension_tizen_access_control_manager_peer_is_allowed_to_use_identity; + parent->peer_is_owner_of_identity = extension_tizen_access_control_manager_peer_is_owner_of_identity; + parent->security_context_of_keychain = extension_tizen_access_control_manager_security_context_of_keychain; +} + +static void +extension_tizen_access_control_manager_init ( + ExtensionTizenAccessControlManager *self) +{ + /*self->priv = EXTENSION_TEST_ACCESS_CONTROL_MANAGER_GET_PRIVATE (self);*/ +} + +void +extension_tizen_access_control_manager_security_context_of_peer ( + GSignondAccessControlManager *self, + GSignondSecurityContext *peer_ctx, + int peer_fd, const gchar *peer_service, + const gchar *peer_app_ctx) +{ + (void) self; + + gsignond_security_context_set_system_context (peer_ctx, ""); + gsignond_security_context_set_application_context (peer_ctx, + peer_app_ctx); + if (peer_fd != -1) { + char *label = NULL; + + smack_new_label_from_socket(peer_fd, &label); + if (label) { + gsignond_security_context_set_system_context (peer_ctx, + label); + free (label); + } + } else if (peer_service != NULL) { + GError *error = NULL; + GDBusConnection *connection; + GDBusProxy *proxy; + GVariant *response = NULL; + const gchar *label; + + connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); + if (connection == NULL) { + WARN ("Failed to open connection to bus: %s", error->message); + g_error_free (error); + return; + } + + error = NULL; + proxy = g_dbus_proxy_new_sync (connection, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, + NULL, + &error); + if (proxy == NULL) { + WARN ("Error creating proxy: %s", error->message); + g_error_free (error); + goto _dbus_connection_exit; + } + + /* Call getConnectionSmackContext method, wait for reply */ + + error = NULL; + response = g_dbus_proxy_call_sync (proxy, + "GetConnectionSmackContext", + g_variant_new ("(s)", peer_service), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + if (response == NULL) { + WARN ("Error: %s", error->message); + g_error_free (error); + goto _dbus_proxy_exit; + } + + label = g_variant_get_string (response, NULL); + DBG ("Obtained label from dbus: %s", label); + if (label) + gsignond_security_context_set_system_context (peer_ctx, + label); + + g_variant_unref (response); + +_dbus_proxy_exit: + g_object_unref (proxy); +_dbus_connection_exit: + g_object_unref (connection); + } +} + +gboolean +extension_tizen_access_control_manager_peer_is_allowed_to_use_identity ( + GSignondAccessControlManager *self, + const GSignondSecurityContext *peer_ctx, + const GSignondSecurityContext *identity_owner, + const GSignondSecurityContextList *identity_acl) +{ + GSignondSecurityContext* acl_ctx = NULL; + const gchar *peer_system_ctx = gsignond_security_context_get_system_context(peer_ctx); + const gchar *owner_system_ctx = gsignond_security_context_get_system_context(identity_owner); + + (void) self; + + for ( ; identity_acl != NULL; identity_acl = g_list_next (identity_acl)) { + acl_ctx = (GSignondSecurityContext *) identity_acl->data; + if (gsignond_security_context_check (acl_ctx, peer_ctx)) { + // we have a match in acl, now we need to check is smack allows such access + /* smack_have_access() returns + * 1 = have access, + * 0 = no access, + * -1 = error + */ + return (smack_have_access (peer_system_ctx, owner_system_ctx, "x") == 1) ? TRUE : FALSE; + } + } + + return FALSE; +} + +gboolean +extension_tizen_access_control_manager_peer_is_owner_of_identity ( + GSignondAccessControlManager *self, + const GSignondSecurityContext *peer_ctx, + const GSignondSecurityContext *identity_owner) +{ + (void) self; + + return (gsignond_security_context_compare (peer_ctx, identity_owner) == 0); +} + +GSignondSecurityContext * +extension_tizen_access_control_manager_security_context_of_keychain ( + GSignondAccessControlManager *self) +{ + (void) self; + + return gsignond_security_context_new_from_values (keychainAppId, NULL); +} diff --git a/src/extensions/tizen/tizen-access-control-manager.h b/src/extensions/tizen/tizen-access-control-manager.h new file mode 100644 index 0000000..cf4c664 --- /dev/null +++ b/src/extensions/tizen/tizen-access-control-manager.h @@ -0,0 +1,103 @@ +/* vi: set et sw=4 ts=4 cino=t0,(0: */ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of gsignond + * + * Copyright (C) 2013 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * Contact: Elena Reshetova <elena.reshetova@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef _TIZEN_ACCESS_CONTROL_MANAGER_H_ +#define _TIZEN_ACCESS_CONTROL_MANAGER_H_ + +#include <glib-object.h> +#include <gsignond/gsignond-extension-interface.h> + +G_BEGIN_DECLS + +#define EXTENSION_TYPE_TIZEN_ACCESS_CONTROL_MANAGER \ + (extension_tizen_access_control_manager_get_type ()) +#define EXTENSION_TIZEN_ACCESS_CONTROL_MANAGER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + EXTENSION_TYPE_TIZEN_ACCESS_CONTROL_MANAGER, \ + ExtensionTizenAccessControlManager)) +#define EXTENSION_IS_TIZEN_ACCESS_CONTROL_MANAGER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + EXTENSION_TYPE_TIZEN_ACCESS_CONTROL_MANAGER)) +#define EXTENSION_TIZEN_ACCESS_CONTROL_MANAGER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + EXTENSION_TYPE_TIZEN_ACCESS_CONTROL_MANAGER, \ + ExtensionTizenAccessControlManagerClass)) +#define EXTENSION_IS_TIZEN_ACCESS_CONTROL_MANAGER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + EXTENSION_TYPE_TIZEN_ACCESS_CONTROL_MANAGER)) +#define EXTENSION_TIZEN_ACCESS_CONTROL_MANAGER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + EXTENSION_TYPE_TIZEN_ACCESS_CONTROL_MANAGER, \ + ExtensionTizenAccessControlManagerClass)) + +typedef struct _ExtensionTizenAccessControlManager + ExtensionTizenAccessControlManager; +typedef struct _ExtensionTizenAccessControlManagerClass + ExtensionTizenAccessControlManagerClass; +typedef struct _ExtensionTizenAccessControlManagerPrivate + ExtensionTizenAccessControlManagerPrivate; + +struct _ExtensionTizenAccessControlManager +{ + GSignondAccessControlManager parent_instance; + ExtensionTizenAccessControlManagerPrivate *priv; +}; + +struct _ExtensionTizenAccessControlManagerClass +{ + GSignondAccessControlManagerClass parent_class; +}; + +GType extension_tizen_access_control_manager_get_type (); + +void +extension_tizen_access_control_manager_security_context_of_peer ( + GSignondAccessControlManager *self, + GSignondSecurityContext *peer_ctx, + int peer_fd, const gchar *peer_service, + const gchar *peer_app_ctx); + +gboolean +extension_tizen_access_control_manager_peer_is_allowed_to_use_identity ( + GSignondAccessControlManager *self, + const GSignondSecurityContext *peer_ctx, + const GSignondSecurityContext *identity_owner, + const GSignondSecurityContextList *identity_acl); + +gboolean +extension_tizen_access_control_manager_peer_is_owner_of_identity ( + GSignondAccessControlManager *self, + const GSignondSecurityContext *peer_ctx, + const GSignondSecurityContext *identity_owner); + +GSignondSecurityContext * +extension_tizen_access_control_manager_security_context_of_keychain ( + GSignondAccessControlManager *self); + +G_END_DECLS + +#endif /* _TIZEN_ACCESS_CONTROL_MANAGER_H_ */ + diff --git a/src/extensions/tizen/tizen-extension.c b/src/extensions/tizen/tizen-extension.c new file mode 100644 index 0000000..059e461 --- /dev/null +++ b/src/extensions/tizen/tizen-extension.c @@ -0,0 +1,166 @@ +/* vi: set et sw=4 ts=4 cino=t0,(0: */ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of gsignond + * + * Copyright (C) 2013 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include "tizen-extension.h" +#include "tizen-storage-manager.h" +#include "tizen-secret-storage.h" +#include "tizen-access-control-manager.h" + +G_DEFINE_TYPE (ExtensionTizen, extension_tizen, GSIGNOND_TYPE_EXTENSION); + +#define EXTENSION_TIZEN_PRIV(obj) G_TYPE_INSTANCE_GET_PRIVATE ((obj), EXTENSION_TYPE_TIZEN, ExtensionTizenPrivate) + +struct _ExtensionTizenPrivate +{ + GSignondAccessControlManager *access_control_manager; + GSignondStorageManager *storage_manager; + GSignondSecretStorage *secret_storage; +}; + +static void +_dispose (GObject *obj) +{ + ExtensionTizen *self = EXTENSION_TIZEN (obj); + if (!self) return; + + ExtensionTizenPrivate *priv = self->priv; + + if (priv) { + g_clear_object (&priv->access_control_manager); + g_clear_object (&priv->secret_storage); + g_clear_object (&priv->storage_manager); + } + + G_OBJECT_CLASS (extension_tizen_parent_class)->dispose (obj); +} + +static const gchar * +_get_extension_name (GSignondExtension *self) +{ + (void) self; + + return "tizen"; +} + +static guint32 +_get_extension_version (GSignondExtension *self) +{ + (void) self; + + return 0x01000000; +} + +static GSignondStorageManager * +_get_storage_manager (GSignondExtension *self, GSignondConfig *config) +{ + g_return_val_if_fail (self && EXTENSION_IS_TIZEN(self), NULL); + + ExtensionTizenPrivate *priv = EXTENSION_TIZEN(self)->priv; + + if (!priv->storage_manager) { + priv->storage_manager = + g_object_new (EXTENSION_TYPE_TIZEN_STORAGE_MANAGER, + "config", config, NULL); + } + return priv->storage_manager; +} + +static GSignondSecretStorage * +_get_secret_storage (GSignondExtension *self, GSignondConfig *config) +{ + g_return_val_if_fail (self && EXTENSION_IS_TIZEN(self), NULL); + + ExtensionTizenPrivate *priv = EXTENSION_TIZEN(self)->priv; + + if (!priv->secret_storage) { + priv->secret_storage = + g_object_new (EXTENSION_TYPE_TIZEN_SECRET_STORAGE, + "config", config, NULL); + } + + return priv->secret_storage; +} + +static GSignondAccessControlManager * +_get_access_control_manager (GSignondExtension *self, GSignondConfig *config) +{ + g_return_val_if_fail (self && EXTENSION_IS_TIZEN(self), NULL); + + ExtensionTizenPrivate *priv = EXTENSION_TIZEN(self)->priv; + + if (!priv->access_control_manager) { + priv->access_control_manager = + g_object_new (EXTENSION_TYPE_TIZEN_ACCESS_CONTROL_MANAGER, + "config", config, NULL); + } + + return priv->access_control_manager; +} + +static void +extension_tizen_class_init (ExtensionTizenClass *klass) +{ + GSignondExtensionClass *parent_class = GSIGNOND_EXTENSION_CLASS (klass); + + g_type_class_add_private (G_OBJECT_CLASS(klass), sizeof (ExtensionTizenPrivate)); + + G_OBJECT_CLASS (klass)->dispose = _dispose; + parent_class->get_extension_name = _get_extension_name; + parent_class->get_extension_version = _get_extension_version; + parent_class->get_storage_manager = _get_storage_manager; + parent_class->get_secret_storage = _get_secret_storage; + parent_class->get_access_control_manager = _get_access_control_manager; +} + +static void +extension_tizen_init (ExtensionTizen *self) +{ + self->priv = EXTENSION_TIZEN_PRIV (self); + + self->priv->storage_manager = NULL; + self->priv->secret_storage = NULL; + self->priv->access_control_manager = NULL; +} + +static void +_on_object_dispose (gpointer data, GObject *object) +{ + if (data) *(ExtensionTizen **)data = NULL; +} + +GSignondExtension * +tizen_extension_init () +{ + static GSignondExtension *tizen_extension = NULL; + + if (!tizen_extension) { + tizen_extension = g_object_new (EXTENSION_TYPE_TIZEN, NULL); + + g_object_weak_ref (G_OBJECT (tizen_extension), _on_object_dispose, &tizen_extension); + } + + return tizen_extension; +} + diff --git a/src/extensions/tizen/tizen-extension.h b/src/extensions/tizen/tizen-extension.h new file mode 100644 index 0000000..fe9d4f5 --- /dev/null +++ b/src/extensions/tizen/tizen-extension.h @@ -0,0 +1,72 @@ +/* vi: set et sw=4 ts=4 cino=t0,(0: */ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of gsignond + * + * Copyright (C) 2013 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef _TIZEN_EXTENSION_H_ +#define _TIZEN_EXTENSION_H_ + +#include <glib-object.h> +#include <gsignond/gsignond-extension-interface.h> + +G_BEGIN_DECLS + +#define EXTENSION_TYPE_TIZEN \ + (extension_tizen_get_type ()) +#define EXTENSION_TIZEN(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXTENSION_TYPE_TIZEN, \ + ExtensionTizen)) +#define EXTENSION_IS_TIZEN(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXTENSION_TYPE_TIZEN)) +#define EXTENSION_TIZEN_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), EXTENSION_TYPE_TIZEN, \ + ExtensionTizenClass)) +#define EXTENSION_IS_TIZEN_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), EXTENSION_TYPE_TIZEN)) +#define EXTENSION_TIZEN_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), EXTENSION_TYPE_TIZEN, \ + ExtensionTizenClass)) + +typedef struct _ExtensionTizen ExtensionTizen; +typedef struct _ExtensionTizenClass ExtensionTizenClass; +typedef struct _ExtensionTizenPrivate ExtensionTizenPrivate; + +struct _ExtensionTizen +{ + GSignondExtension parent_instance; + ExtensionTizenPrivate *priv; +}; + +struct _ExtensionTizenClass +{ + GSignondExtensionClass parent_class; +}; + +GType extension_tizen_get_type (); + +GSignondExtension * tizen_extension_init (); + +G_END_DECLS + +#endif /* _TIZEN_EXTENSION_H_ */ + diff --git a/src/extensions/tizen/tizen-secret-storage.c b/src/extensions/tizen/tizen-secret-storage.c new file mode 100644 index 0000000..31c743d --- /dev/null +++ b/src/extensions/tizen/tizen-secret-storage.c @@ -0,0 +1,58 @@ +/* vi: set et sw=4 ts=4 cino=t0,(0: */ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of gsignond + * + * Copyright (C) 2013 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include "tizen-secret-storage.h" + +#define EXTENSION_TIZEN_SECRET_STORAGE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ + EXTENSION_TYPE_TIZEN_SECRET_STORAGE, \ + ExtensionTizenSecretStoragePrivate)) + +struct _ExtensionTizenSecretStoragePrivate +{ +}; + +G_DEFINE_TYPE (ExtensionTizenSecretStorage, + extension_tizen_secret_storage, + GSIGNOND_TYPE_SECRET_STORAGE); + +static void +extension_tizen_secret_storage_class_init ( + ExtensionTizenSecretStorageClass *klass) +{ + (void) klass; + + /*GObjectClass *base = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, + sizeof(ExtensionTestSecretStoragePrivate));*/ +} + +static void +extension_tizen_secret_storage_init (ExtensionTizenSecretStorage *self) +{ + /*self->priv = EXTENSION_TEST_SECRET_STORAGE_GET_PRIVATE (self);*/ +} + diff --git a/src/extensions/tizen/tizen-secret-storage.h b/src/extensions/tizen/tizen-secret-storage.h new file mode 100644 index 0000000..e59bea0 --- /dev/null +++ b/src/extensions/tizen/tizen-secret-storage.h @@ -0,0 +1,73 @@ +/* vi: set et sw=4 ts=4 cino=t0,(0: */ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of gsignond + * + * Copyright (C) 2013 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef _TIZEN_SECRET_STORAGE_H_ +#define _TIZEN_SECRET_STORAGE_H_ + +#include <glib-object.h> +#include <gsignond/gsignond-extension-interface.h> + +G_BEGIN_DECLS + +#define EXTENSION_TYPE_TIZEN_SECRET_STORAGE \ + (extension_tizen_secret_storage_get_type ()) +#define EXTENSION_TIZEN_SECRET_STORAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXTENSION_TYPE_TIZEN_SECRET_STORAGE, \ + ExtensionTizenSecretStorage)) +#define EXTENSION_IS_TIZEN_SECRET_STORAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXTENSION_TYPE_TIZEN_SECRET_STORAGE)) +#define EXTENSION_TIZEN_SECRET_STORAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), EXTENSION_TYPE_TIZEN_SECRET_STORAGE, \ + ExtensionTizenSecretStorageClass)) +#define EXTENSION_IS_TIZEN_SECRET_STORAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), EXTENSION_TYPE_TIZEN_SECRET_STORAGE)) +#define EXTENSION_TIZEN_SECRET_STORAGE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), EXTENSION_TYPE_TIZEN_SECRET_STORAGE, \ + ExtensionTizenSecretStorageClass)) + +typedef struct _ExtensionTizenSecretStorage + ExtensionTizenSecretStorage; +typedef struct _ExtensionTizenSecretStorageClass + ExtensionTizenSecretStorageClass; +typedef struct _ExtensionTizenSecretStoragePrivate + ExtensionTizenSecretStoragePrivate; + +struct _ExtensionTizenSecretStorage +{ + GSignondSecretStorage parent_instance; + ExtensionTizenSecretStoragePrivate *priv; +}; + +struct _ExtensionTizenSecretStorageClass +{ + GSignondSecretStorageClass parent_class; +}; + +GType extension_tizen_secret_storage_get_type (); + +G_END_DECLS + +#endif /* _TIZEN_SECRET_STORAGE_H_ */ + diff --git a/src/extensions/tizen/tizen-storage-manager.c b/src/extensions/tizen/tizen-storage-manager.c new file mode 100644 index 0000000..2ee01d4 --- /dev/null +++ b/src/extensions/tizen/tizen-storage-manager.c @@ -0,0 +1,341 @@ +/* vi: set et sw=4 ts=4 cino=t0,(0: */ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of gsignond + * + * Copyright (C) 2013 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include <errno.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/mount.h> +#include <glib.h> +#include <glib/gstdio.h> +#include <mntent.h> +#include <ecryptfs.h> + +#include "tizen-storage-manager.h" +#include "gsignond/gsignond-log.h" +#include "gsignond/gsignond-utils.h" + +#define EXTENSION_TIZEN_STORAGE_MANAGER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ + EXTENSION_TYPE_TIZEN_STORAGE_MANAGER, \ + ExtensionTizenStorageManagerPrivate)) + +/* these are limited by ecryptfs */ +#define KEY_BYTES 16 +#define KEY_CIPHER "aes" + +struct _ExtensionTizenStorageManagerPrivate +{ + gchar *cdir; + gchar fekey[ECRYPTFS_MAX_PASSPHRASE_BYTES + 1]; + gchar fesalt[ECRYPTFS_SALT_SIZE + 1]; + gchar ksig[ECRYPTFS_SIG_SIZE_HEX + 1]; +}; + +enum +{ + PROP_0, + PROP_FEKEY, + PROP_FESALT, + N_PROPERTIES, + PROP_CONFIG +}; + +static GParamSpec *properties[N_PROPERTIES] = { NULL, }; + +G_DEFINE_TYPE (ExtensionTizenStorageManager, + extension_tizen_storage_manager, + GSIGNOND_TYPE_STORAGE_MANAGER); + +static void +_set_config (ExtensionTizenStorageManager *self, GSignondConfig *config) +{ + GSignondStorageManager *parent = GSIGNOND_STORAGE_MANAGER (self); + g_assert (parent->config == NULL); + 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); + + self->priv->cdir = g_strdup_printf ("%s.efs", parent->location); + DBG ("location %s encryption point %s", parent->location, self->priv->cdir); +} + +static void +_set_property (GObject *object, guint prop_id, const GValue *value, + GParamSpec *pspec) +{ + ExtensionTizenStorageManager *self = + EXTENSION_TIZEN_STORAGE_MANAGER (object); + ExtensionTizenStorageManagerPrivate *priv = self->priv; + + switch (prop_id) { + case PROP_CONFIG: + _set_config (self, GSIGNOND_CONFIG (g_value_dup_object (value))); + break; + case PROP_FEKEY: + g_strlcpy (priv->fekey, + g_value_get_string (value), + sizeof(priv->fekey)); + break; + case PROP_FESALT: + g_strlcpy (priv->fesalt, + g_value_get_string (value), + sizeof(priv->fesalt)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +{ + ExtensionTizenStorageManager *self = + EXTENSION_TIZEN_STORAGE_MANAGER (object); + ExtensionTizenStorageManagerPrivate *priv = self->priv; + + switch (prop_id) { + case PROP_CONFIG: + g_value_set_object (value, + GSIGNOND_STORAGE_MANAGER (self)->config); + break; + case PROP_FEKEY: + g_value_set_string (value, priv->fekey); + break; + case PROP_FESALT: + g_value_set_string (value, priv->fesalt); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +_dispose (GObject *object) +{ + G_OBJECT_CLASS (extension_tizen_storage_manager_parent_class)->dispose (object); +} + +static void +_finalize (GObject *object) +{ + ExtensionTizenStorageManager *self = + EXTENSION_TIZEN_STORAGE_MANAGER (object); + ExtensionTizenStorageManagerPrivate *priv = self->priv; + + if (priv) + memset(priv->ksig, 0x00, sizeof(priv->ksig)); + g_free (priv->cdir); + + G_OBJECT_CLASS (extension_tizen_storage_manager_parent_class)->finalize (object); +} + +static gboolean +_initialize_storage (GSignondStorageManager *parent) +{ + ExtensionTizenStorageManager *self = + EXTENSION_TIZEN_STORAGE_MANAGER (parent); + ExtensionTizenStorageManagerPrivate *priv = self->priv; + + g_return_val_if_fail (parent->location, FALSE); + DBG ("create mount point %s", parent->location); + if (g_mkdir_with_parents (parent->location, S_IRWXU)) + return FALSE; + + 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; +} + +static gboolean +_storage_is_initialized (GSignondStorageManager *parent) +{ + ExtensionTizenStorageManager *self = + EXTENSION_TIZEN_STORAGE_MANAGER (parent); + ExtensionTizenStorageManagerPrivate *priv = self->priv; + + g_return_val_if_fail (priv->cdir, FALSE); + + if (g_access (priv->cdir, 0) || g_access (parent->location, 0)) + return FALSE; + + return TRUE; +} + +static const gchar * +_mount_filesystem (GSignondStorageManager *parent) +{ + gchar *retval = NULL; + ExtensionTizenStorageManager *self = + EXTENSION_TIZEN_STORAGE_MANAGER (parent); + ExtensionTizenStorageManagerPrivate *priv = self->priv; + + DBG ("add passphrase to kernel keyring"); + if (ecryptfs_add_passphrase_key_to_keyring (priv->ksig, + priv->fekey, + priv->fesalt) < 0) + return NULL; + + gchar *mntopts = g_strdup_printf ( + "ecryptfs_check_dev_ruid" \ + ",ecryptfs_cipher=%s" \ + ",ecryptfs_key_bytes=%d" \ + ",ecryptfs_unlink_sigs" \ + ",ecryptfs_sig=%s", + KEY_CIPHER, KEY_BYTES, + 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"); + DBG ("perform mount %s -> %s", priv->cdir, parent->location); + if (mount (priv->cdir, parent->location, + "ecryptfs", MS_NOSUID | MS_NODEV, mntopts)) { + INFO ("mount failed %d: %s", errno, strerror(errno)); + goto _mount_exit; + } + + DBG ("mount succeeded at %s", parent->location); + retval = parent->location; + +_mount_exit: + g_free (mntopts); + if (setreuid (-1, uid)) + WARN ("setreuid() failed"); + if (setregid (-1, gid)) + WARN ("setregid() failed"); + + return retval; +} + +static gboolean +_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); + umount (parent->location); + setreuid (-1, uid); + setregid (-1, gid); + + return TRUE; +} + +static gboolean +_filesystem_is_mounted (GSignondStorageManager *parent) +{ + gboolean retval = FALSE; + FILE *mntf = setmntent("/proc/mounts", "r"); + g_return_val_if_fail (mntf != NULL, FALSE); + + struct mntent *me; + while ((me = getmntent(mntf))) { + if (g_strcmp0 (parent->location, me->mnt_dir) == 0) { + retval = TRUE; + break; + } + } + + endmntent(mntf); + + return retval; +} + +static gboolean +_delete_storage (GSignondStorageManager *parent) +{ + ExtensionTizenStorageManager *self = + EXTENSION_TIZEN_STORAGE_MANAGER (parent); + ExtensionTizenStorageManagerPrivate *priv = self->priv; + + g_return_val_if_fail (priv->cdir, FALSE); + g_return_val_if_fail (!_filesystem_is_mounted(parent), FALSE); + + return (gsignond_wipe_directory (priv->cdir) && + gsignond_wipe_directory (parent->location)); +} + +static void +extension_tizen_storage_manager_class_init ( + ExtensionTizenStorageManagerClass *klass) +{ + GObjectClass *base = G_OBJECT_CLASS (klass); + + base->set_property = _set_property; + base->get_property = _get_property; + base->dispose = _dispose; + base->finalize = _finalize; + + properties[PROP_FEKEY] = g_param_spec_string ("fekey", + "fekey", + "File encryption key", + "0123456789", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + properties[PROP_FESALT] = g_param_spec_string ("fesalt", + "fesalt", + "File encryption salt", + "9876543210", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_properties (base, N_PROPERTIES, properties); + g_object_class_override_property (base, PROP_CONFIG, "config"); + + g_type_class_add_private (klass, + sizeof(ExtensionTizenStorageManagerPrivate)); + + GSignondStorageManagerClass *parent_class = + GSIGNOND_STORAGE_MANAGER_CLASS (klass); + parent_class->initialize_storage = _initialize_storage; + parent_class->delete_storage = _delete_storage; + parent_class->storage_is_initialized = _storage_is_initialized; + parent_class->mount_filesystem = _mount_filesystem; + parent_class->unmount_filesystem = _unmount_filesystem; + parent_class->filesystem_is_mounted = _filesystem_is_mounted; +} + +static void +extension_tizen_storage_manager_init (ExtensionTizenStorageManager *self) +{ + ExtensionTizenStorageManagerPrivate *priv = + EXTENSION_TIZEN_STORAGE_MANAGER_GET_PRIVATE (self); + self->priv = priv; + + g_strlcpy (priv->fekey, "1234567890", sizeof(priv->fekey)); + g_strlcpy (priv->fesalt, "0987654321", sizeof(priv->fesalt)); +} + diff --git a/src/extensions/tizen/tizen-storage-manager.h b/src/extensions/tizen/tizen-storage-manager.h new file mode 100644 index 0000000..bbfe9c0 --- /dev/null +++ b/src/extensions/tizen/tizen-storage-manager.h @@ -0,0 +1,73 @@ +/* vi: set et sw=4 ts=4 cino=t0,(0: */ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of gsignond + * + * Copyright (C) 2013 Intel Corporation. + * + * Contact: Jussi Laako <jussi.laako@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef _TIZEN_STORAGE_MANAGER_H_ +#define _TIZEN_STORAGE_MANAGER_H_ + +#include <glib-object.h> +#include <gsignond/gsignond-extension-interface.h> + +G_BEGIN_DECLS + +#define EXTENSION_TYPE_TIZEN_STORAGE_MANAGER \ + (extension_tizen_storage_manager_get_type ()) +#define EXTENSION_TIZEN_STORAGE_MANAGER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXTENSION_TYPE_TIZEN_STORAGE_MANAGER, \ + ExtensionTizenStorageManager)) +#define EXTENSION_IS_TIZEN_STORAGE_MANAGER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EXTENSION_TYPE_TIZEN_STORAGE_MANAGER)) +#define EXTENSION_TIZEN_STORAGE_MANAGER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), EXTENSION_TYPE_TIZEN_STORAGE_MANAGER, \ + ExtensionTizenStorageManagerClass)) +#define EXTENSION_IS_TIZEN_STORAGE_MANAGER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), EXTENSION_TYPE_TIZEN_STORAGE_MANAGER)) +#define EXTENSION_TIZEN_STORAGE_MANAGER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), EXTENSION_TYPE_TIZEN_STORAGE_MANAGER, \ + ExtensionTizenStorageManagerClass)) + +typedef struct _ExtensionTizenStorageManager + ExtensionTizenStorageManager; +typedef struct _ExtensionTizenStorageManagerClass + ExtensionTizenStorageManagerClass; +typedef struct _ExtensionTizenStorageManagerPrivate + ExtensionTizenStorageManagerPrivate; + +struct _ExtensionTizenStorageManager +{ + GSignondStorageManager parent_instance; + ExtensionTizenStorageManagerPrivate *priv; +}; + +struct _ExtensionTizenStorageManagerClass +{ + GSignondStorageManagerClass parent_class; +}; + +GType extension_tizen_storage_manager_get_type (); + +G_END_DECLS + +#endif /* _TIZEN_STORAGE_MANAGER_H_ */ + |