summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2016-03-14 20:27:18 +0900
committerHwanKyu Jhun <h.jhun@samsung.com>2016-03-19 08:41:49 -0700
commitdb26fe6610cac5937b2d4f8eb0277c90634acaa2 (patch)
tree03f7b6d3d4bbab8a18bf3a018844f824c55e8c8b
parent3d29a13f586da38df8046576ddbecd321027c1e5 (diff)
downloadaul-1-submit/tizen/20160321.014821.tar.gz
aul-1-submit/tizen/20160321.014821.tar.bz2
aul-1-submit/tizen/20160321.014821.zip
- If this option is enabled, AUL API will use the default uid. - This feature is enabled in tv profile. Change-Id: Ie43c5860e10422f2198dce6050e7ea6ca284b608 Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r--CMakeLists.txt3
-rw-r--r--packaging/aul.spec20
-rw-r--r--src/aul_sock.c19
3 files changed, 38 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ce6cbbd5..a2153831 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,9 @@ ENDIF (with_wayland)
IF (with_x11)
pkg_check_modules(libpkgs REQUIRED ${AUL-1_LIB_PKG_CHECK_MODULES})
ENDIF (with_x11)
+IF(_APPFW_FEATURE_DEFAULT_USER)
+ ADD_DEFINITIONS("-D_APPFW_FEATURE_DEFAULT_USER")
+ENDIF(_APPFW_FEATURE_DEFAULT_USER)
FOREACH(flag ${libpkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
diff --git a/packaging/aul.spec b/packaging/aul.spec
index 1a7eb1e5..a80a2da7 100644
--- a/packaging/aul.spec
+++ b/packaging/aul.spec
@@ -38,6 +38,12 @@ BuildRequires: pkgconfig(tizen-extension-client)
BuildRequires: pkgconfig(libxml-2.0)
%endif
+%if "%{?profile}" == "tv"
+%define appfw_feature_default_user 1
+%else
+%define appfw_feature_default_user 0
+%endif
+
%description
Application utility library
@@ -57,7 +63,6 @@ Requires: %{name} = %{version}-%{release}
%description test
Application utility library (test tools)
-
%prep
%setup -q
sed -i 's|TZ_SYS_DB|%{TZ_SYS_DB}|g' %{SOURCE1001}
@@ -68,14 +73,21 @@ cp %{SOURCE1001} .
CFLAGS="%{optflags} -D__emul__"; export CFLAGS
%endif
+%if 0%{?appfw_feature_default_user}
+_APPFW_FEATURE_DEFAULT_USER=ON
+%endif
+
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+%cmake -DFULLVER=%{version} \
+ -DMAJORVER=${MAJORVER} \
%if %{with wayland}
--Dwith_wayland=TRUE\
+ -Dwith_wayland=TRUE \
%endif
%if %{with x}
--Dwith_x11=TRUE\
+ -Dwith_x11=TRUE \
%endif
+ -D_APPFW_FEATURE_DEFAULT_USER:BOOL=${_APPFW_FEATURE_DEFAULT_USER} \
+ .
%__make %{?_smp_mflags}
diff --git a/src/aul_sock.c b/src/aul_sock.c
index f5637efa..8ec29942 100644
--- a/src/aul_sock.c
+++ b/src/aul_sock.c
@@ -23,6 +23,9 @@
#include <sys/xattr.h>
#include <errno.h>
#include <fcntl.h>
+#ifdef _APPFW_FEATURE_DEFAULT_USER
+#include <tzplatform_config.h>
+#endif
#include "aul_api.h"
#include "aul_sock.h"
@@ -30,6 +33,12 @@
#define MAX_NR_OF_DESCRIPTORS 2
+#ifdef _APPFW_FEATURE_DEFAULT_USER
+#define REGULAR_UID_MIN 5000
+static uid_t default_uid;
+static int default_uid_initialized;
+#endif
+
static int __connect_client_sock(int sockfd, const struct sockaddr *saptr, socklen_t salen,
int nsec);
@@ -155,6 +164,16 @@ static int __create_client_sock(int pid, uid_t uid)
}
}
+#ifdef _APPFW_FEATURE_DEFAULT_USER
+ if (uid < REGULAR_UID_MIN) {
+ if (!default_uid_initialized) {
+ default_uid = tzplatform_getuid(TZ_SYS_DEFAULT_USER);
+ default_uid_initialized = 1;
+ }
+
+ uid = default_uid;
+ }
+#endif
saddr.sun_family = AF_UNIX;
if (pid == AUL_UTIL_PID)
snprintf(saddr.sun_path, sizeof(saddr.sun_path),