tizen: release 0.0.4 72/27172/1 accepted/tizen/common/20140905.155238 accepted/tizen/ivi/20140908.110649 submit/tizen/20140905.125821
authorImran Zaman <imran.zaman@intel.com>
Fri, 5 Sep 2014 12:46:19 +0000 (15:46 +0300)
committerImran Zaman <imran.zaman@intel.com>
Fri, 5 Sep 2014 12:46:19 +0000 (15:46 +0300)
Change-Id: Ica303d78e7c40dcb8da10bf11e8e7a0d9ba447d3
Signed-off-by: Imran Zaman <imran.zaman@intel.com>
35 files changed:
.gitignore
config.h.in
configure
configure.ac
data/Makefile.am
data/Makefile.in
data/tlm-default-login [new file with mode: 0644]
data/tlm-login.debian [deleted file]
data/tlm.conf.in
dists/debian/changelog
dists/rpm/tizen/packaging/tlm.changes
dists/rpm/tizen/packaging/tlm.spec
dists/rpm/tlm-suse.spec
docs/html/api-index-full.html
docs/html/index.sgml
docs/html/tlm-General-configuration.html
docs/html/tlm.devhelp2
docs/tlm-sections.txt
packaging/tlm.changes
packaging/tlm.spec
src/common/tlm-config-general.h
src/common/tlm-config.c
src/daemon/tlm-dbus-observer.c
src/daemon/tlm-manager.c
src/daemon/tlm-seat.c
src/daemon/tlm-session-remote.c
src/sessiond/Makefile.am
src/sessiond/Makefile.in
src/sessiond/main.c
src/sessiond/tlm-auth-session.c
src/sessiond/tlm-auth-session.h
src/sessiond/tlm-session-daemon.c
src/sessiond/tlm-session.c
src/utils/Makefile.am
tools/prepare-tizen.sh

index b89b23f..40a4943 100644 (file)
@@ -34,5 +34,7 @@ examples/tlm-ui
 data/tlm.conf
 tests/tlm-test.conf
 src/daemon/tlm
+src/sessiond/tlm-sessiond
+src/utils/tlm-client
 tests/config/configtest
 tests/daemon/daemontest
index 22f1ba1..a141c6d 100644 (file)
@@ -18,6 +18,9 @@
 /* Define to 1 if you have the <security/pam_appl.h> header file. */
 #undef HAVE_SECURITY_PAM_APPL_H
 
+/* Define to 1 if you have the <security/pam_misc.h> header file. */
+#undef HAVE_SECURITY_PAM_MISC_H
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
index 3cba9a3..81224e3 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for tlm 0.0.3.
+# Generated by GNU Autoconf 2.69 for tlm 0.0.4.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='tlm'
 PACKAGE_TARNAME='tlm'
-PACKAGE_VERSION='0.0.3'
-PACKAGE_STRING='tlm 0.0.3'
+PACKAGE_VERSION='0.0.4'
+PACKAGE_STRING='tlm 0.0.4'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1383,7 +1383,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures tlm 0.0.3 to adapt to many kinds of systems.
+\`configure' configures tlm 0.0.4 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1453,7 +1453,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of tlm 0.0.3:";;
+     short | recursive ) echo "Configuration of tlm 0.0.4:";;
    esac
   cat <<\_ACEOF
 
@@ -1599,7 +1599,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-tlm configure 0.0.3
+tlm configure 0.0.4
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1964,7 +1964,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by tlm $as_me 0.0.3, which was
+It was created by tlm $as_me 0.0.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2832,7 +2832,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='tlm'
- VERSION='0.0.3'
+ VERSION='0.0.4'
 
 
 cat >>confdefs.h <<_ACEOF
 
 done
 
+for ac_header in security/pam_misc.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "security/pam_misc.h" "ac_cv_header_security_pam_misc_h" "$ac_includes_default"
+if test "x$ac_cv_header_security_pam_misc_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SECURITY_PAM_MISC_H 1
+_ACEOF
+
+else
+  as_fn_error $? "\"pam-misc is required\"" "$LINENO" 5
+fi
+
+done
+
 
 TLM_CFLAGS="$GLIB_CFLAGS $GIO_CFLAGS $GMODULE_CFLAGS -D_POSIX_C_SOURCE=\"200809L\" -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -Wall -Werror"
 TLM_LIBS="$GLIB_LIBS $GIO_LIBS $GMODULE_LIBS"
@@ -14236,7 +14250,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by tlm $as_me 0.0.3, which was
+This file was extended by tlm $as_me 0.0.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -14302,7 +14316,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-tlm config.status 0.0.3
+tlm config.status 0.0.4
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index e70b357..efab755 100644 (file)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.68])
-AC_INIT([tlm], [0.0.3], [])
+AC_INIT([tlm], [0.0.4], [])
 AC_CONFIG_SRCDIR([src/daemon/tlm-main.c])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
@@ -40,6 +40,7 @@ AC_SUBST(LIBTLM_NFC_LIBS)
 AM_CONDITIONAL(HAVE_LIBTLM_NFC, [test x$have_libtlm_nfc = xyes])
 
 AC_CHECK_HEADERS([security/pam_appl.h],,[AC_MSG_ERROR("pam-devel is required")])
+AC_CHECK_HEADERS([security/pam_misc.h],,[AC_MSG_ERROR("pam-misc is required")])
 
 TLM_CFLAGS="$GLIB_CFLAGS $GIO_CFLAGS $GMODULE_CFLAGS -D_POSIX_C_SOURCE=\"200809L\" -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -Wall -Werror"
 TLM_LIBS="$GLIB_LIBS $GIO_LIBS $GMODULE_LIBS"
index 951ea75..0650e89 100644 (file)
@@ -4,6 +4,6 @@ EXTRA_DIST = \
       tlm.conf.in \
       tlm.service \
       tlm-login \
-      tlm-login.debian
+      tlm-default-login
 
 sysconf_DATA = tlm.conf
index bb8adce..d68b926 100644 (file)
@@ -289,7 +289,7 @@ EXTRA_DIST = \
       tlm.conf.in \
       tlm.service \
       tlm-login \
-      tlm-login.debian
+      tlm-default-login
 
 sysconf_DATA = tlm.conf
 all: all-am
diff --git a/data/tlm-default-login b/data/tlm-default-login
new file mode 100644 (file)
index 0000000..8138015
--- /dev/null
@@ -0,0 +1,13 @@
+#%PAM-1.0
+auth            [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
+auth            required        pam_permit.so
+account         required        pam_nologin.so
+account         include         system-auth
+password        include         system-auth
+
+session         include         system-auth
+session         required        pam_systemd.so
+session         required        pam_loginuid.so
+session         required        pam_namespace.so
+session         optional        pam_keyinit.so force revoke
+session         required        pam_smack.so
diff --git a/data/tlm-login.debian b/data/tlm-login.debian
deleted file mode 100644 (file)
index d03ac21..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-auth    required    pam_env.so readenv=1
-auth    required    pam_env.so readenv=1 envfile=/etc/default/locale
-auth    required    pam_permit.so
-#@include common-auth
-account [success=1 new_authtok_reqd=done default=ignore] pam_unix.so nullok
-#@include common-account
-#session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close
-#session required    pam_permit.so
-#session required    pam_limits.so
-#session required    pam_loginuid.so
-#session required    pam_unix.so
-#session optional    pam_systemd.so
-#session optional    pam_ck_connector.so nox11
-@include common-session
-#session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open
-@include common-password
index 3fc1113..157b249 100644 (file)
@@ -16,16 +16,19 @@ AUTO_LOGIN=1
 #
 # Prepare default/guest users before auto-login
 # Default: off
-#PREPARE_DEFAULT=1
+PREPARE_DEFAULT=1
 #
 # PAM service file to use
 PAM_SERVICE=tlm-login
 #
+# PAM service file for default user
+PAM_DEFAULT_SERVICE=tlm-default-login
+#
 # Default (guest) username or template to use
 #  %S - seat number
 #  %I - seat id string
 # Default: "guest"
-DEFAULT_USER=app
+#DEFAULT_USER=guest
 #
 # Session command : The command run after successfull login
 # Default: $SHELL
@@ -46,7 +49,7 @@ DEFAULT_USER=app
 #
 # Do not launch anything, let systemd handle it through PAM
 # Default: off
-PAUSE_SESSION=1
+#PAUSE_SESSION=1
 #
 #
 # Seat specific settings where the group name is seat id
index a330f90..11ace0d 100644 (file)
@@ -1,3 +1,18 @@
+tlm (0.0.4-1) unstable; urgency=low
+
+  * Added separate PAM configuration file for default user
+
+ -- Imran Zaman <imran.zaman@intel.com>  Tue, 26 Aug 2014 19:04:53 +0200
+
+tlm (0.0.3-2) unstable; urgency=low
+
+  * session: set umask when logging in
+  * session: with pause session, set environment before PAM open session
+  * updated gitignore file
+  * Fixed white spaces
+
+ -- Imran Zaman <imran.zaman@intel.com>  Tue, 26 Aug 2014 19:04:53 +0200
+
 tlm (0.0.3-1) unstable; urgency=low
 
   * Create a new process (tlm-sessiond) for each session
index 447b535..aa182c6 100644 (file)
@@ -1,3 +1,12 @@
+* Wed Sep 03 2014 Jussi Laako <jussi.laako@linux.intel.com>
+- Added separate PAM configuration file for default user
+
+* Tue Aug 26 2014 Imran Zaman <imran.zaman@intel.com>
+- session: set umask when logging in
+- session: with pause session, set environment before PAM open session
+- updated gitignore file
+- Fixed white spaces
+
 * Mon Aug 04 2014 Imran Zaman <imran.zaman@intel.com>
 - Updated pam configuration file and fixed bug related to dbus arguments
 
index dbebc19..1290b2b 100644 (file)
@@ -4,7 +4,7 @@
 
 Name: tlm
 Summary: Login manager for Tizen
-Version: 0.0.3
+Version: 0.0.4
 Release: 1
 Group: System/Service
 License: LGPL-2.1+
@@ -23,6 +23,10 @@ BuildRequires: pkgconfig(gmodule-2.0)
 BuildRequires: pkgconfig(libgum)
 BuildRequires: pkgconfig(elementary)
 BuildRequires: pam-devel
+%if %{debug_build} == 1
+BuildRequires: gtk-doc
+%endif
+
 
 %description
 %{summary}.
@@ -55,6 +59,7 @@ cp %{SOURCE1001} .
 
 %build
 %if %{debug_build} == 1
+./autogen.sh
 %configure --enable-gum --enable-gtk-doc --enable-examples --enable-debug
 %else
 %configure --enable-gum --enable-examples
@@ -69,6 +74,7 @@ install -m 755 -d %{buildroot}%{_unitdir}
 install -m 644 data/tlm.service %{buildroot}%{_unitdir}
 install -m 755 -d %{buildroot}%{_sysconfdir}/pam.d
 install -m 644 data/tlm-login %{buildroot}%{_sysconfdir}/pam.d/
+install -m 644 data/tlm-default-login %{buildroot}%{_sysconfdir}/pam.d/
 
 
 %post
@@ -77,7 +83,8 @@ install -m 644 data/tlm-login %{buildroot}%{_sysconfdir}/pam.d/
 /usr/bin/systemctl daemon-reload
 
 
-%postun -p /sbin/ldconfig
+%postun
+/sbin/ldconfig
 /usr/bin/systemctl disable tlm
 /usr/bin/systemctl daemon-reload
 
@@ -94,6 +101,7 @@ install -m 644 data/tlm-login %{buildroot}%{_sysconfdir}/pam.d/
 %{_unitdir}/tlm.service
 %config(noreplace) %{_sysconfdir}/tlm.conf
 %config %{_sysconfdir}/pam.d/tlm-login
+%config %{_sysconfdir}/pam.d/tlm-default-login
 
 
 %files devel
index 276b0da..52e2481 100644 (file)
@@ -5,7 +5,7 @@
 Name: tlm
 Summary: Login manager for Tizen
 Version: 0.0.3
-Release: 1
+Release: 2
 Group: System/Daemons
 License: LGPL-2.1+
 Source: %{name}-%{version}.tar.gz
@@ -99,6 +99,15 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Wed Sep 03 2014 Jussi Laako <jussi.laako@linux.intel.com>
+- Added separate PAM configuration file for default user
+
+* Tue Aug 26 2014 Imran Zaman <imran.zaman@intel.com>
+- session: set umask when logging in
+- session: with pause session, set environment before PAM open session
+- updated gitignore file
+- Fixed white spaces
+
 * Mon Jul 21 2014 Imran Zaman <imran.zaman@intel.com>
 - Update to 0.0.3; create a new process (tlm-sessiond) for each session
 
index 81c040a..a2f30ad 100644 (file)
 </dt>
 <dd></dd>
 <dt>
+<a class="link" href="tlm-General-configuration.html#TLM-CONFIG-GENERAL-DEFAULT-PAM-SERVICE:CAPS" title="TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE">TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE</a>, macro in <a class="link" href="tlm-General-configuration.html" title="General configuration">General configuration</a>
+</dt>
+<dd></dd>
+<dt>
 <a class="link" href="tlm-General-configuration.html#TLM-CONFIG-GENERAL-DEFAULT-USER:CAPS" title="TLM_CONFIG_GENERAL_DEFAULT_USER">TLM_CONFIG_GENERAL_DEFAULT_USER</a>, macro in <a class="link" href="tlm-General-configuration.html" title="General configuration">General configuration</a>
 </dt>
 <dd></dd>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="tlm-Errors.html#TlmError" title="enum TlmError">TlmError</a>, enum in <a class="link" href="tlm-Errors.html" title="Errors">Errors</a>
+<a class="link" href="tlm-Errors.html#TLM-ERROR:CAPS" title="TLM_ERROR">TLM_ERROR</a>, macro in <a class="link" href="tlm-Errors.html" title="Errors">Errors</a>
 </dt>
 <dd></dd>
 <dt>
-<a class="link" href="tlm-Errors.html#TLM-ERROR:CAPS" title="TLM_ERROR">TLM_ERROR</a>, macro in <a class="link" href="tlm-Errors.html" title="Errors">Errors</a>
+<a class="link" href="tlm-Errors.html#TlmError" title="enum TlmError">TlmError</a>, enum in <a class="link" href="tlm-Errors.html" title="Errors">Errors</a>
 </dt>
 <dd></dd>
 <dt>
index 4d65742..45a55e0 100644 (file)
@@ -34,6 +34,7 @@
 <ANCHOR id="TLM-CONFIG-GENERAL-AUTO-LOGIN:CAPS" href="tlm/tlm-General-configuration.html#TLM-CONFIG-GENERAL-AUTO-LOGIN:CAPS">
 <ANCHOR id="TLM-CONFIG-GENERAL-PREPARE-DEFAULT:CAPS" href="tlm/tlm-General-configuration.html#TLM-CONFIG-GENERAL-PREPARE-DEFAULT:CAPS">
 <ANCHOR id="TLM-CONFIG-GENERAL-PAM-SERVICE:CAPS" href="tlm/tlm-General-configuration.html#TLM-CONFIG-GENERAL-PAM-SERVICE:CAPS">
+<ANCHOR id="TLM-CONFIG-GENERAL-DEFAULT-PAM-SERVICE:CAPS" href="tlm/tlm-General-configuration.html#TLM-CONFIG-GENERAL-DEFAULT-PAM-SERVICE:CAPS">
 <ANCHOR id="TLM-CONFIG-GENERAL-DEFAULT-USER:CAPS" href="tlm/tlm-General-configuration.html#TLM-CONFIG-GENERAL-DEFAULT-USER:CAPS">
 <ANCHOR id="TLM-CONFIG-GENERAL-SETUP-TERMINAL:CAPS" href="tlm/tlm-General-configuration.html#TLM-CONFIG-GENERAL-SETUP-TERMINAL:CAPS">
 <ANCHOR id="TLM-CONFIG-GENERAL-TERMINATE-TIMEOUT:CAPS" href="tlm/tlm-General-configuration.html#TLM-CONFIG-GENERAL-TERMINATE-TIMEOUT:CAPS">
index d484b18..84284ed 100644 (file)
 </tr>
 <tr>
 <td class="define_keyword">#define</td>
+<td class="function_name"><a class="link" href="tlm-General-configuration.html#TLM-CONFIG-GENERAL-DEFAULT-PAM-SERVICE:CAPS" title="TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE">TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE</a></td>
+</tr>
+<tr>
+<td class="define_keyword">#define</td>
 <td class="function_name"><a class="link" href="tlm-General-configuration.html#TLM-CONFIG-GENERAL-DEFAULT-USER:CAPS" title="TLM_CONFIG_GENERAL_DEFAULT_USER">TLM_CONFIG_GENERAL_DEFAULT_USER</a></td>
 </tr>
 <tr>
@@ -177,6 +181,13 @@ user's account before auto-login.</p>
 </div>
 <hr>
 <div class="refsect2">
+<a name="TLM-CONFIG-GENERAL-DEFAULT-PAM-SERVICE:CAPS"></a><h3>TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE</h3>
+<pre class="programlisting">#define TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE "DEFAULT_PAM_SERVICE"
+</pre>
+<p>PAM service file to use for default user authentication and session setup. Default value: "tlm-default-login".</p>
+</div>
+<hr>
+<div class="refsect2">
 <a name="TLM-CONFIG-GENERAL-DEFAULT-USER:CAPS"></a><h3>TLM_CONFIG_GENERAL_DEFAULT_USER</h3>
 <pre class="programlisting">#define TLM_CONFIG_GENERAL_DEFAULT_USER     "DEFAULT_USER"
 </pre>
index 127ecd8..cbbe5cc 100644 (file)
@@ -48,6 +48,7 @@
     <keyword type="macro" name="TLM_CONFIG_GENERAL_AUTO_LOGIN" link="tlm-General-configuration.html#TLM-CONFIG-GENERAL-AUTO-LOGIN:CAPS"/>
     <keyword type="macro" name="TLM_CONFIG_GENERAL_PREPARE_DEFAULT" link="tlm-General-configuration.html#TLM-CONFIG-GENERAL-PREPARE-DEFAULT:CAPS"/>
     <keyword type="macro" name="TLM_CONFIG_GENERAL_PAM_SERVICE" link="tlm-General-configuration.html#TLM-CONFIG-GENERAL-PAM-SERVICE:CAPS"/>
+    <keyword type="macro" name="TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE" link="tlm-General-configuration.html#TLM-CONFIG-GENERAL-DEFAULT-PAM-SERVICE:CAPS"/>
     <keyword type="macro" name="TLM_CONFIG_GENERAL_DEFAULT_USER" link="tlm-General-configuration.html#TLM-CONFIG-GENERAL-DEFAULT-USER:CAPS"/>
     <keyword type="macro" name="TLM_CONFIG_GENERAL_SETUP_TERMINAL" link="tlm-General-configuration.html#TLM-CONFIG-GENERAL-SETUP-TERMINAL:CAPS"/>
     <keyword type="macro" name="TLM_CONFIG_GENERAL_TERMINATE_TIMEOUT" link="tlm-General-configuration.html#TLM-CONFIG-GENERAL-TERMINATE-TIMEOUT:CAPS"/>
index ebfb276..204481e 100644 (file)
@@ -95,6 +95,7 @@ TLM_CONFIG_GENERAL_DATA_DIRS
 TLM_CONFIG_GENERAL_AUTO_LOGIN
 TLM_CONFIG_GENERAL_PREPARE_DEFAULT
 TLM_CONFIG_GENERAL_PAM_SERVICE
+TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE
 TLM_CONFIG_GENERAL_DEFAULT_USER
 TLM_CONFIG_GENERAL_SETUP_TERMINAL
 TLM_CONFIG_GENERAL_TERMINATE_TIMEOUT
index 447b535..aa182c6 100644 (file)
@@ -1,3 +1,12 @@
+* Wed Sep 03 2014 Jussi Laako <jussi.laako@linux.intel.com>
+- Added separate PAM configuration file for default user
+
+* Tue Aug 26 2014 Imran Zaman <imran.zaman@intel.com>
+- session: set umask when logging in
+- session: with pause session, set environment before PAM open session
+- updated gitignore file
+- Fixed white spaces
+
 * Mon Aug 04 2014 Imran Zaman <imran.zaman@intel.com>
 - Updated pam configuration file and fixed bug related to dbus arguments
 
index dbebc19..1290b2b 100644 (file)
@@ -4,7 +4,7 @@
 
 Name: tlm
 Summary: Login manager for Tizen
-Version: 0.0.3
+Version: 0.0.4
 Release: 1
 Group: System/Service
 License: LGPL-2.1+
@@ -23,6 +23,10 @@ BuildRequires: pkgconfig(gmodule-2.0)
 BuildRequires: pkgconfig(libgum)
 BuildRequires: pkgconfig(elementary)
 BuildRequires: pam-devel
+%if %{debug_build} == 1
+BuildRequires: gtk-doc
+%endif
+
 
 %description
 %{summary}.
@@ -55,6 +59,7 @@ cp %{SOURCE1001} .
 
 %build
 %if %{debug_build} == 1
+./autogen.sh
 %configure --enable-gum --enable-gtk-doc --enable-examples --enable-debug
 %else
 %configure --enable-gum --enable-examples
@@ -69,6 +74,7 @@ install -m 755 -d %{buildroot}%{_unitdir}
 install -m 644 data/tlm.service %{buildroot}%{_unitdir}
 install -m 755 -d %{buildroot}%{_sysconfdir}/pam.d
 install -m 644 data/tlm-login %{buildroot}%{_sysconfdir}/pam.d/
+install -m 644 data/tlm-default-login %{buildroot}%{_sysconfdir}/pam.d/
 
 
 %post
@@ -77,7 +83,8 @@ install -m 644 data/tlm-login %{buildroot}%{_sysconfdir}/pam.d/
 /usr/bin/systemctl daemon-reload
 
 
-%postun -p /sbin/ldconfig
+%postun
+/sbin/ldconfig
 /usr/bin/systemctl disable tlm
 /usr/bin/systemctl daemon-reload
 
@@ -94,6 +101,7 @@ install -m 644 data/tlm-login %{buildroot}%{_sysconfdir}/pam.d/
 %{_unitdir}/tlm.service
 %config(noreplace) %{_sysconfdir}/tlm.conf
 %config %{_sysconfdir}/pam.d/tlm-login
+%config %{_sysconfdir}/pam.d/tlm-default-login
 
 
 %files devel
index 40ccaef..0c5dc23 100644 (file)
 #define TLM_CONFIG_GENERAL_PAM_SERVICE      "PAM_SERVICE"
 
 /**
+ * TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE:
+ *
+ * PAM service file to use for default user authentication and session setup. Default value: "tlm-default-login".
+ */
+#define TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE "DEFAULT_PAM_SERVICE"
+
+/**
  * TLM_CONFIG_GENERAL_DEFAULT_USER:
  *
  * Default username for autologin. Default value: "guest".
index 1c22d03..1d5b985 100644 (file)
@@ -263,6 +263,16 @@ _set_defaults (
                                "tlm-login");
     }
 
+    /* default user PAM service => tlm-default-login */
+    if (!tlm_config_has_key (self,
+                             TLM_CONFIG_GENERAL,
+                             TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE)) {
+        tlm_config_set_string (self,
+                               TLM_CONFIG_GENERAL,
+                               TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE,
+                               "tlm-default-login");
+    }
+
     /* default user => guest */
     if (!tlm_config_has_key (self,
                              TLM_CONFIG_GENERAL,
index 49c0c9f..073f019 100644 (file)
@@ -153,10 +153,10 @@ _on_seat_dispose (
     _disconnect_seat (self, TLM_SEAT (dead));
     if (self->priv->active_request &&
         G_OBJECT(self->priv->active_request->seat) == dead) {
-       self->priv->active_request->seat = NULL;
+        self->priv->active_request->seat = NULL;
     }
     if (G_OBJECT(self->priv->seat) == dead)
-       self->priv->seat = NULL;
+        self->priv->seat = NULL;
 }
 
 static void
@@ -182,9 +182,9 @@ _create_request (
     request->dbus_request = dbus_req;
     request->seat = seat;
     if (request->seat) {
-       _connect_seat (self, request->seat);
-       g_object_weak_ref (G_OBJECT (request->seat),
-                       (GWeakNotify)_on_seat_dispose, self);
+        _connect_seat (self, request->seat);
+        g_object_weak_ref (G_OBJECT (request->seat),
+                (GWeakNotify)_on_seat_dispose, self);
     }
     return request;
 }
@@ -199,13 +199,13 @@ _dispose_request (
     if (request->dbus_request) {
         tlm_dbus_login_adapter_request_completed (request->dbus_request, NULL);
         tlm_dbus_utils_dispose_request (request->dbus_request);
-       request->dbus_request = NULL;
+        request->dbus_request = NULL;
     }
     if (request->seat) {
-       _disconnect_seat (self, request->seat);
-       g_object_weak_unref (G_OBJECT (request->seat),
-                       (GWeakNotify)_on_seat_dispose, self);
-       request->seat = NULL;
+        _disconnect_seat (self, request->seat);
+        g_object_weak_unref (G_OBJECT (request->seat),
+                (GWeakNotify)_on_seat_dispose, self);
+        request->seat = NULL;
     }
     g_free (request);
 }
@@ -270,7 +270,7 @@ _on_dbus_adapter_dispose (
     /* check for active request */
     if (self->priv->active_request &&
         G_OBJECT (self->priv->active_request->dbus_request->dbus_adapter) ==
-                       dead) {
+                dead) {
         DBG ("removing the request for dead dbus adapter");
         _dispose_request (self, self->priv->active_request);
         self->priv->active_request = NULL;
@@ -425,7 +425,7 @@ _process_request (
         dbus_req = req->dbus_request;
         if (!_is_request_supported (self, dbus_req->type)) {
             WARN ("Request not supported -- req-type %d flags %d",
-                       dbus_req->type, self->priv->enable_flags);
+                    dbus_req->type, self->priv->enable_flags);
             err = TLM_GET_ERROR_FOR_ID (TLM_ERROR_DBUS_REQ_NOT_SUPPORTED,
                     "Dbus request not supported");
             goto _finished;
@@ -434,15 +434,15 @@ _process_request (
         seat = self->priv->seat;
         if (!seat && self->priv->manager) {
             seat = tlm_manager_get_seat (self->priv->manager,
-                       dbus_req->seat_id);
+                    dbus_req->seat_id);
             req->seat = seat;
             /* NOTE: When no seat is set at dbus object creation time,
              * seat is connected on per dbus request basis and then
              * disconnected when the dbus request is completed or aborted */
             if (seat) {
-               _connect_seat (self, seat);
-               g_object_weak_ref (G_OBJECT (seat),
-                               (GWeakNotify)_on_seat_dispose, self);
+                _connect_seat (self, seat);
+                g_object_weak_ref (G_OBJECT (seat),
+                        (GWeakNotify)_on_seat_dispose, self);
             }
         }
 
@@ -457,14 +457,14 @@ _process_request (
         switch(dbus_req->type) {
         case TLM_DBUS_REQUEST_TYPE_LOGIN_USER:
             ret = tlm_seat_create_session (seat, NULL, dbus_req->username,
-                       dbus_req->password, dbus_req->environment);
+                    dbus_req->password, dbus_req->environment);
             break;
         case TLM_DBUS_REQUEST_TYPE_LOGOUT_USER:
             ret = tlm_seat_terminate_session (seat);
             break;
         case TLM_DBUS_REQUEST_TYPE_SWITCH_USER:
             ret = tlm_seat_switch_user (seat, NULL, dbus_req->username,
-                       dbus_req->password, dbus_req->environment);
+                    dbus_req->password, dbus_req->environment);
             break;
         }
         if (!ret) {
@@ -482,7 +482,7 @@ _finished:
         }
     }
     if (!self->priv->active_request)
-       _process_next_request_in_idle (self);
+        _process_next_request_in_idle (self);
 
     return FALSE;
 }
@@ -522,9 +522,9 @@ _handle_seat_session_created (
     /* Login/switch request should only be completed on session created
      * signal from seat */
     if (!self->priv->active_request ||
-       !self->priv->active_request->dbus_request ||
+        !self->priv->active_request->dbus_request ||
         self->priv->active_request->dbus_request->type ==
-                       TLM_DBUS_REQUEST_TYPE_LOGOUT_USER)
+                TLM_DBUS_REQUEST_TYPE_LOGOUT_USER)
         return;
 
     _complete_request (self, self->priv->active_request, NULL);
@@ -549,11 +549,11 @@ _handle_seat_session_terminated (
     if (!self->priv->active_request ||
         !self->priv->active_request->dbus_request ||
         self->priv->active_request->dbus_request->type !=
-                       TLM_DBUS_REQUEST_TYPE_LOGOUT_USER)
+                TLM_DBUS_REQUEST_TYPE_LOGOUT_USER)
         return FALSE;
 
     _disconnect_dbus_adapter (self, TLM_DBUS_LOGIN_ADAPTER (
-               self->priv->active_request->dbus_request->dbus_adapter));
+            self->priv->active_request->dbus_request->dbus_adapter));
 
     _complete_request (self, self->priv->active_request, NULL);
     self->priv->active_request = NULL;
@@ -652,9 +652,9 @@ _stop_dbus_server (TlmDbusObserver *self)
     self->priv->active_request = NULL;
 
     if (self->priv->request_queue) {
-       g_queue_foreach (self->priv->request_queue,
+        g_queue_foreach (self->priv->request_queue,
                            (GFunc) _clear_request, self);
-       g_queue_free (self->priv->request_queue);
+        g_queue_free (self->priv->request_queue);
         self->priv->request_queue = NULL;
     }
 
@@ -690,14 +690,14 @@ tlm_dbus_observer_dispose (GObject *object)
 
     _stop_dbus_server (self);
     if (self->priv->manager) {
-       g_object_weak_unref (G_OBJECT (self->priv->manager),
-                       (GWeakNotify)_on_manager_dispose, self);
+        g_object_weak_unref (G_OBJECT (self->priv->manager),
+                (GWeakNotify)_on_manager_dispose, self);
         self->priv->manager = NULL;
     }
 
     if (self->priv->seat) {
-       g_object_weak_unref (G_OBJECT (self->priv->seat),
-                               (GWeakNotify)_on_seat_dispose, self);
+        g_object_weak_unref (G_OBJECT (self->priv->seat),
+                (GWeakNotify)_on_seat_dispose, self);
         self->priv->seat = NULL;
     }
     DBG("disposing dbus_observer DONE: %p", self);
@@ -751,9 +751,9 @@ tlm_dbus_observer_new (
     DBG ("%p", dbus_observer);
 
     if (manager) {
-       dbus_observer->priv->manager = manager;
-       g_object_weak_ref (G_OBJECT (manager), (GWeakNotify)_on_manager_dispose,
-                       dbus_observer);
+        dbus_observer->priv->manager = manager;
+        g_object_weak_ref (G_OBJECT (manager), (GWeakNotify)_on_manager_dispose,
+                dbus_observer);
     }
     /* NOTE: When no seat is set at dbus object creation time,
      * seat is connected on per dbus request basis and then
@@ -761,7 +761,7 @@ tlm_dbus_observer_new (
     if (seat) {
         dbus_observer->priv->seat = seat;
         g_object_weak_ref (G_OBJECT (seat), (GWeakNotify)_on_seat_dispose,
-                       dbus_observer);
+                dbus_observer);
     }
     dbus_observer->priv->enable_flags = enable_flags;
 
index 9f05c33..914f9e4 100644 (file)
@@ -655,7 +655,7 @@ _session_terminated_cb (GObject *emitter, const gchar *seat_id,
 
     g_hash_table_remove (manager->priv->seats, seat_id);
     if (g_hash_table_size (manager->priv->seats) == 0) {
-       DBG ("signalling stopped");
+        DBG ("signalling stopped");
         g_signal_emit (manager, signals[SIG_MANAGER_STOPPED], 0);
     }
 
index c209f82..c36e06d 100644 (file)
@@ -91,9 +91,6 @@ typedef struct _DelayClosure
 static void
 _disconnect_session_signals (
         TlmSeat *seat);
-static void
-_destroy_dbus_observer (
-        TlmDbusObserver **dbus_observer);
 
 static void
 _reset_next (TlmSeatPrivate *priv)
@@ -119,7 +116,7 @@ _handle_session_created (
 
     g_signal_emit (self, signals[SIG_SESSION_CREATED], 0, self->priv->id);
 
-    _destroy_dbus_observer (&self->priv->prev_dbus_observer);
+    g_clear_object (&self->priv->prev_dbus_observer);
 }
 
 static void
@@ -154,7 +151,7 @@ _handle_session_terminated (
         DBG ("no relogin or switch user");
         return;
     }
-    _destroy_dbus_observer (&priv->dbus_observer);
+    g_clear_object (&priv->dbus_observer);
 
     if (tlm_config_get_boolean (priv->config,
                                 TLM_CONFIG_GENERAL,
@@ -197,7 +194,7 @@ _handle_error (
         error->code == TLM_ERROR_SESSION_TERMINATION_FAILURE) {
         DBG ("Destroy the session in case of creation/termination failure");
         _close_active_session (self);
-        _destroy_dbus_observer (&self->priv->dbus_observer);
+        g_clear_object (&self->priv->dbus_observer);
     }
 }
 
@@ -232,17 +229,6 @@ _connect_session_signals (
             G_CALLBACK(_handle_error), seat);
 }
 
-static void
-_destroy_dbus_observer (
-        TlmDbusObserver **dbus_observer)
-{
-    DBG ("destroy dbus obs: %p", *dbus_observer);
-    if (*dbus_observer) {
-        g_object_unref (*dbus_observer);
-        *dbus_observer = NULL;
-    }
-}
-
 static gboolean
 _create_dbus_observer (
         TlmSeat *seat,
@@ -274,8 +260,8 @@ tlm_seat_dispose (GObject *self)
 
     DBG("disposing seat: %s", seat->priv->id);
 
-    _destroy_dbus_observer (&seat->priv->dbus_observer);
-    _destroy_dbus_observer (&seat->priv->prev_dbus_observer);
+    g_clear_object (&seat->priv->dbus_observer);
+    g_clear_object (&seat->priv->prev_dbus_observer);
 
     _disconnect_session_signals (seat);
     if (seat->priv->session)
@@ -570,11 +556,11 @@ tlm_seat_create_session (TlmSeat *seat,
     if (!service) {
         service = tlm_config_get_string (priv->config,
                                          priv->id,
-                                         TLM_CONFIG_GENERAL_PAM_SERVICE);
+                                         username ? TLM_CONFIG_GENERAL_PAM_SERVICE : TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE);
         if (!service)
             service = tlm_config_get_string (priv->config,
                                              TLM_CONFIG_GENERAL,
-                                             TLM_CONFIG_GENERAL_PAM_SERVICE);
+                                             username ? TLM_CONFIG_GENERAL_PAM_SERVICE : TLM_CONFIG_GENERAL_DEFAULT_PAM_SERVICE);
     }
     if (!username) {
         const gchar *name_tmpl =
index 1f1ea31..0eeb84a 100644 (file)
@@ -119,7 +119,7 @@ tlm_session_remote_set_property (
 {
     TlmSessionRemote *self = TLM_SESSION_REMOTE (object);
     switch (property_id) {
-       case PROP_CONFIG:
+        case PROP_CONFIG:
            self->priv->config = g_value_dup_object (value);
            break;
                case PROP_SEATID:
@@ -146,18 +146,18 @@ tlm_session_remote_get_property (
     TlmSessionRemote *self = TLM_SESSION_REMOTE (object);
 
     switch (property_id) {
-       case PROP_CONFIG:
-               g_value_set_object (value, self->priv->config);
-               break;
-               case PROP_SEATID:
-               case PROP_USERNAME:
-               case PROP_SERVICE:
-               case PROP_SESSIONID: {
-                       if (self->priv->dbus_session_proxy) {
-                               g_object_get_property (G_OBJECT(self->priv->dbus_session_proxy),
-                                               pspec->name, value);
-                       }
-                       break;
+        case PROP_CONFIG:
+            g_value_set_object (value, self->priv->config);
+            break;
+        case PROP_SEATID:
+        case PROP_USERNAME:
+        case PROP_SERVICE:
+        case PROP_SESSIONID: {
+            if (self->priv->dbus_session_proxy) {
+                g_object_get_property (G_OBJECT(self->priv->dbus_session_proxy),
+                        pspec->name, value);
+            }
+            break;
                }
         default:
             G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -193,7 +193,7 @@ _terminate_timeout (gpointer user_data)
             return G_SOURCE_CONTINUE;
         case SIGKILL:
             DBG ("child %u didn't respond to SIGKILL, "
-                       "process is stuck in kernel",  priv->cpid);
+                    "process is stuck in kernel",  priv->cpid);
             priv->timer_id = 0;
             if (self->priv->can_emit_signal) {
                 GError *error = TLM_GET_ERROR_FOR_ID (
@@ -547,7 +547,7 @@ gboolean
 tlm_session_remote_terminate (
         TlmSessionRemote *self)
 {
-    g_return_if_fail (self && TLM_IS_SESSION_REMOTE(self));
+    g_return_val_if_fail (self && TLM_IS_SESSION_REMOTE(self), FALSE);
     TlmSessionRemotePrivate *priv = TLM_SESSION_REMOTE_PRIV(self);
 
     if (!priv->is_sessiond_up) {
@@ -566,4 +566,3 @@ tlm_session_remote_terminate (
     return TRUE;
 }
 
-
index 09647a2..ab887f4 100644 (file)
@@ -16,7 +16,7 @@ libtlm_session_daemon_la_CPPFLAGS = \
 libtlm_session_daemon_la_LIBADD =    \
         $(top_builddir)/src/common/libtlm-common.la \
         $(top_builddir)/src/common/dbus/libtlm-dbus-glue.la \
-        -lpam \
+        -lpam -lpam_misc \
         $(TLM_LIBS)
 
 libtlm_session_daemon_la_SOURCES = \
index b2db726..06b761a 100644 (file)
@@ -381,7 +381,7 @@ libtlm_session_daemon_la_CPPFLAGS = \
 libtlm_session_daemon_la_LIBADD = \
         $(top_builddir)/src/common/libtlm-common.la \
         $(top_builddir)/src/common/dbus/libtlm-dbus-glue.la \
-        -lpam \
+        -lpam -lpam_misc \
         $(TLM_LIBS)
 
 libtlm_session_daemon_la_SOURCES = \
index a29e65d..e0fa033 100644 (file)
@@ -59,7 +59,7 @@ _handle_quit_signal (gpointer user_data)
     return FALSE;
 }
 
-static void 
+static void
 _install_sighandlers (GMainLoop *main_loop)
 {
     GSource *source = NULL;
index f7929cc..bf8878c 100644 (file)
@@ -3,7 +3,7 @@
 /*
  * This file is part of tlm (Tizen Login Manager)
  *
- * Copyright (C) 2013 Intel Corporation.
+ * Copyright (C) 2013-2014 Intel Corporation.
  *
  * Contact: Amarnath Valluri <amarnath.valluri@linux.intel.com>
  *          Jussi Laako <jussi.laako@linux.intel.com>
 #include <stdio.h>
 #include <stdlib.h>
 #include <malloc.h>
-#include <string.h> 
+#include <string.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <security/pam_appl.h>
+#include <security/pam_misc.h>
 #include <gio/gio.h>
 
 #include "tlm-auth-session.h"
@@ -128,7 +129,7 @@ _auth_session_set_property (GObject *obj,
     TlmAuthSessionPrivate *priv = TLM_AUTH_SESSION_PRIV (auth_session);
 
     switch (property_id) {
-        case PROP_SERVICE: 
+        case PROP_SERVICE:
             priv->service = g_value_dup_string (value);
             break;
         case PROP_USERNAME:
@@ -153,7 +154,7 @@ _auth_session_get_property (GObject *obj,
     TlmAuthSessionPrivate *priv = TLM_AUTH_SESSION_PRIV (auth_session);
 
     switch (property_id) {
-        case PROP_SERVICE: 
+        case PROP_SERVICE:
             g_value_set_string (value, priv->service);
             break;
         case PROP_USERNAME:
@@ -209,7 +210,7 @@ static void
 tlm_auth_session_init (TlmAuthSession *auth_session)
 {
     TlmAuthSessionPrivate *priv = TLM_AUTH_SESSION_PRIV (auth_session);
-    
+
     priv->service = priv->username = NULL;
 
     auth_session->priv = priv;
@@ -366,9 +367,9 @@ tlm_auth_session_authenticate (TlmAuthSession *auth_session, GError **error)
         WARN ("PAM authentication failure: %s",
               pam_strerror (priv->pam_handle, res));
         if (error)
-               *error = TLM_GET_ERROR_FOR_ID (TLM_ERROR_PAM_AUTH_FAILURE,
-                               "pam authenticaton failed : %s",
-                               pam_strerror (priv->pam_handle, res));
+            *error = TLM_GET_ERROR_FOR_ID (TLM_ERROR_PAM_AUTH_FAILURE,
+                    "pam authenticaton failed : %s",
+                    pam_strerror (priv->pam_handle, res));
         return FALSE;
     }
 
@@ -379,7 +380,7 @@ gboolean
 tlm_auth_session_open (TlmAuthSession *auth_session, GError **error)
 {
     int res;
-    g_return_val_if_fail (auth_session && 
+    g_return_val_if_fail (auth_session &&
                 TLM_IS_AUTH_SESSION(auth_session), FALSE);
 
     TlmAuthSessionPrivate *priv = TLM_AUTH_SESSION_PRIV (auth_session);
@@ -396,22 +397,22 @@ tlm_auth_session_open (TlmAuthSession *auth_session, GError **error)
 
     res = pam_setcred (priv->pam_handle, PAM_ESTABLISH_CRED);
     if (res != PAM_SUCCESS) {
-        WARN ("Failed to establish pam credentials: %s", 
-            pam_strerror (priv->pam_handle, res));
+        WARN ("Failed to establish pam credentials: %s",
+                pam_strerror (priv->pam_handle, res));
         return FALSE;
     }
 
     res = pam_open_session (priv->pam_handle, 0);
     if (res != PAM_SUCCESS) {
         WARN ("Failed to open pam session: %s",
-            pam_strerror (priv->pam_handle, res));
+                pam_strerror (priv->pam_handle, res));
         return FALSE;
     }
 
     res = pam_setcred (priv->pam_handle, PAM_REINITIALIZE_CRED);
     if (res != PAM_SUCCESS) {
-        WARN ("Failed to reinitialize pam credentials: %s", 
-            pam_strerror (priv->pam_handle, res));
+        WARN ("Failed to reinitialize pam credentials: %s",
+                pam_strerror (priv->pam_handle, res));
         pam_close_session (priv->pam_handle, 0);
         return FALSE;
     }
@@ -472,7 +473,17 @@ tlm_auth_session_get_sessionid (TlmAuthSession *auth_session)
 gchar **
 tlm_auth_session_get_envlist (TlmAuthSession *auth_session)
 {
-       g_return_val_if_fail(TLM_IS_AUTH_SESSION(auth_session), NULL);
+       g_return_val_if_fail(TLM_IS_AUTH_SESSION (auth_session), NULL);
 
-    return (gchar **)pam_getenvlist(auth_session->priv->pam_handle);
+    return (gchar **) pam_getenvlist(auth_session->priv->pam_handle);
 }
+
+void
+tlm_auth_session_set_env (TlmAuthSession *auth_session, const gchar *key,
+                          const gchar *value)
+{
+    g_return_if_fail (TLM_IS_AUTH_SESSION (auth_session));
+
+    pam_misc_setenv (auth_session->priv->pam_handle, key, value, 0);
+}
+
index db75386..4ddddf4 100644 (file)
@@ -3,7 +3,7 @@
 /*
  * This file is part of tlm (Tizen Login Manager)
  *
- * Copyright (C) 2013 Intel Corporation.
+ * Copyright (C) 2013-2014 Intel Corporation.
  *
  * Contact: Amarnath Valluri <amarnath.valluri@linux.intel.com>
  *          Jussi Laako <jussi.laako@linux.intel.com>
@@ -84,6 +84,10 @@ tlm_auth_session_get_sessionid (TlmAuthSession *auth_session);
 gchar **
 tlm_auth_session_get_envlist (TlmAuthSession *auth_session);
 
+void
+tlm_auth_session_set_env (TlmAuthSession *auth_session, const gchar *key,
+                          const gchar *value);
+
 G_END_DECLS
 
 #endif /* _TLM_AUTH_SESSION_H */
index d9257cc..0d7eba1 100644 (file)
@@ -142,10 +142,10 @@ _handle_session_create_from_dbus (
 
     data = tlm_dbus_utils_hash_table_from_variant (environment);
     g_object_get (self->priv->dbus_session, "seatid", &seatid,
-               "username", &username, "service", &service, NULL);
+            "username", &username, "service", &service, NULL);
 
     tlm_session_start (self->priv->session, seatid, service, username,
-               password, data);
+            password, data);
 
     g_hash_table_unref (data);
     g_free (seatid);
index dfa0a0b..da86357 100644 (file)
@@ -93,6 +93,7 @@ struct _TlmSessionPrivate
     gchar *sessionid;
     gboolean can_emit_signal;
     gboolean is_child_up;
+    gboolean session_pause;
 };
 
 static void
@@ -127,15 +128,13 @@ static void
 tlm_session_dispose (GObject *self)
 {
     TlmSession *session = TLM_SESSION(self);
-    DBG("disposing session: %s", session->priv->service);
-    session->priv->can_emit_signal = FALSE;
-
-    if (session->priv->is_child_up) {
-        tlm_session_terminate (session);
-        while (session->priv->is_child_up)
-            g_main_context_iteration(NULL, TRUE);
-        DBG ("child DESTROYED");
-    }
+    TlmSessionPrivate *priv = session->priv;
+    DBG("disposing session: %s", priv->service);
+    priv->can_emit_signal = FALSE;
+
+    tlm_session_terminate (session);
+    while (priv->is_child_up)
+        g_main_context_iteration(NULL, TRUE);
 
     g_clear_object (&session->priv->config);
 
@@ -166,7 +165,7 @@ _session_set_property (GObject *obj,
             g_free (priv->seat_id);
             priv->seat_id = g_value_dup_string (value);
             break;
-        case PROP_SERVICE: 
+        case PROP_SERVICE:
             priv->service = g_value_dup_string (value);
             break;
         case PROP_USERNAME:
@@ -198,7 +197,7 @@ _session_get_property (GObject *obj,
         case PROP_SEAT:
             g_value_set_string (value, priv->seat_id);
             break;
-        case PROP_SERVICE: 
+        case PROP_SERVICE:
             g_value_set_string (value, priv->service);
             break;
         case PROP_USERNAME:
@@ -258,22 +257,22 @@ tlm_session_class_init (TlmSessionClass *klass)
     g_object_class_install_properties (g_klass, N_PROPERTIES, pspecs);
 
     signals[SIG_SESSION_CREATED] = g_signal_new ("session-created",
-                                                       TLM_TYPE_SESSION, G_SIGNAL_RUN_LAST,
+                                TLM_TYPE_SESSION, G_SIGNAL_RUN_LAST,
                                 0, NULL, NULL, NULL, G_TYPE_NONE,
                                 1, G_TYPE_STRING);
 
     signals[SIG_SESSION_TERMINATED] = g_signal_new ("session-terminated",
-                                                       TLM_TYPE_SESSION, G_SIGNAL_RUN_LAST,
+                                TLM_TYPE_SESSION, G_SIGNAL_RUN_LAST,
                                 0, NULL, NULL, NULL, G_TYPE_NONE,
                                 0, G_TYPE_NONE);
 
     signals[SIG_AUTHENTICATED] = g_signal_new ("authenticated",
-                                                       TLM_TYPE_SESSION, G_SIGNAL_RUN_LAST,
+                                TLM_TYPE_SESSION, G_SIGNAL_RUN_LAST,
                                 0, NULL, NULL, NULL, G_TYPE_NONE,
                                 0, G_TYPE_NONE);
 
     signals[SIG_SESSION_ERROR] = g_signal_new ("session-error",
-                                                       TLM_TYPE_SESSION, G_SIGNAL_RUN_LAST,
+                                TLM_TYPE_SESSION, G_SIGNAL_RUN_LAST,
                                 0, NULL, NULL, NULL, G_TYPE_NONE,
                                 1, G_TYPE_ERROR);
 
@@ -283,7 +282,7 @@ static void
 tlm_session_init (TlmSession *session)
 {
     TlmSessionPrivate *priv = TLM_SESSION_PRIV (session);
-    
+
     priv->service = NULL;
     priv->env_hash = NULL;
     priv->auth_session = NULL;
@@ -312,10 +311,16 @@ tlm_session_init (TlmSession *session)
 }
 
 static void
-_setenv_to_session (gpointer key, gpointer val, gpointer user_data)
+_setenv_to_session (const gchar *key, const gchar *val,
+                    TlmSessionPrivate *user_data)
 {
-    /*TlmSessionPrivate *priv = (TlmSessionPrivate *) user_data;*/
-    setenv ((const char *) key, (const char *) val, 1);
+    TlmSessionPrivate *priv = (TlmSessionPrivate *) user_data;
+    if (priv->session_pause)
+        tlm_auth_session_set_env (priv->auth_session,
+                                  (const gchar *) key,
+                                  (const gchar *) val);
+    else
+        setenv ((const char *) key, (const char *) val, 1);
 }
 
 static gboolean
@@ -382,16 +387,16 @@ static gboolean
 _set_environment (TlmSessionPrivate *priv)
 {
        gchar **envlist = tlm_auth_session_get_envlist(priv->auth_session);
-       const gchar *home_dir=NULL, *shell=NULL;
+       const gchar *home_dir = NULL, *shell = NULL;
 
     if (envlist) {
-       gchar **env = 0;
-       for (env = envlist; *env != NULL; ++env) {
-               DBG ("ENV : %s", *env);
-               putenv(*env);
-               g_free (*env);
-       }
-       g_free (envlist);
+        gchar **env = 0;
+        for (env = envlist; *env != NULL; ++env) {
+            DBG ("ENV : %s", *env);
+            putenv(*env);
+            g_free (*env);
+        }
+        g_free (envlist);
     }
 
     const gchar *path = tlm_config_get_string (priv->config,
@@ -399,15 +404,15 @@ _set_environment (TlmSessionPrivate *priv)
                                                TLM_CONFIG_GENERAL_SESSION_PATH);
     if (!path)
         path = "/usr/local/bin:/usr/bin:/bin";
-    setenv ("PATH", path, 1);
+    _setenv_to_session ("PATH", path, priv);
 
-    setenv ("USER", priv->username, 1);
-    setenv ("LOGNAME", priv->username, 1);
+    _setenv_to_session ("USER", priv->username, priv);
+    _setenv_to_session ("LOGNAME", priv->username, priv);
     home_dir = tlm_user_get_home_dir (priv->username);
-    if (home_dir) setenv ("HOME", home_dir, 1);
+    if (home_dir) _setenv_to_session ("HOME", home_dir, priv);
     shell = tlm_user_get_shell (priv->username);
-    if (shell) setenv ("SHELL", shell, 1);
-    setenv ("XDG_SEAT", priv->seat_id, 1);
+    if (shell) _setenv_to_session ("SHELL", shell, priv);
+    _setenv_to_session ("XDG_SEAT", priv->seat_id, priv);
 
     const gchar *xdg_data_dirs =
         tlm_config_get_string (priv->config,
@@ -415,11 +420,11 @@ _set_environment (TlmSessionPrivate *priv)
                                TLM_CONFIG_GENERAL_DATA_DIRS);
     if (!xdg_data_dirs)
         xdg_data_dirs = "/usr/share:/usr/local/share";
-    setenv ("XDG_DATA_DIRS", xdg_data_dirs, 1);
+    _setenv_to_session ("XDG_DATA_DIRS", xdg_data_dirs, priv);
 
     if (priv->env_hash)
         g_hash_table_foreach (priv->env_hash,
-                              _setenv_to_session,
+                              (GHFunc) _setenv_to_session,
                               priv);
 
     return TRUE;
@@ -462,7 +467,7 @@ _exec_user_session (
     priv = session->priv;
     if (!priv->username)
         priv->username = g_strdup (tlm_auth_session_get_username (
-                       priv->auth_session));
+                priv->auth_session));
     DBG ("session ID : %s", priv->sessionid);
 
     priv->child_pid = fork ();
@@ -483,7 +488,7 @@ _exec_user_session (
     //close all open descriptors other than stdin, stdout, stderr
     open_max = sysconf (_SC_OPEN_MAX);
     for (fd = 3; fd < open_max; fd++)
-       fcntl (fd, F_SETFD, FD_CLOEXEC);
+        fcntl (fd, F_SETFD, FD_CLOEXEC);
 
     uid_t target_uid = tlm_user_get_uid (priv->username);
     gid_t target_gid = tlm_user_get_gid (priv->username);
@@ -530,23 +535,15 @@ _exec_user_session (
     DBG (" state:\n\truid=%d, euid=%d, rgid=%d, egid=%d (%s)",
          getuid(), geteuid(), getgid(), getegid(), priv->username);
     _set_environment (priv);
+    umask(0700);
 
     home = getenv("HOME");
     if (home) {
         DBG ("changing directory to : %s", home);
-       if (chdir (home) < 0)
+        if (chdir (home) < 0)
             WARN ("Failed to change directroy : %s", strerror (errno));
     } else WARN ("Could not get home directory");
 
-    if (tlm_config_get_boolean (priv->config,
-                                TLM_CONFIG_GENERAL,
-                                TLM_CONFIG_GENERAL_PAUSE_SESSION,
-                                FALSE)) {
-        pause ();
-        exit (0);
-        return;  /* this should be unreachable */
-    }
-
     shell = tlm_config_get_string (priv->config,
                                    TLM_CONFIG_GENERAL,
                                    TLM_CONFIG_GENERAL_SESSION_CMD);
@@ -639,46 +636,56 @@ tlm_session_start (TlmSession *session,
             password);
 
     if (!priv->auth_session) {
-       error = TLM_GET_ERROR_FOR_ID (TLM_ERROR_SESSION_CREATION_FAILURE,
-                       "Unable to create PAM sesssion");
-       g_signal_emit (session, signals[SIG_SESSION_ERROR], 0, error);
-       g_error_free (error);
-       return FALSE;
+        error = TLM_GET_ERROR_FOR_ID (TLM_ERROR_SESSION_CREATION_FAILURE,
+                "Unable to create PAM sesssion");
+        g_signal_emit (session, signals[SIG_SESSION_ERROR], 0, error);
+        g_error_free (error);
+        return FALSE;
     }
 
     tlm_auth_session_putenv (priv->auth_session, "XDG_SEAT", priv->seat_id);
 
     if (!tlm_auth_session_authenticate (priv->auth_session, &error)) {
-       if (error) {
-           //consistant error message flow
-               GError *err = TLM_GET_ERROR_FOR_ID (
-                       TLM_ERROR_SESSION_CREATION_FAILURE,
-                               "%d:%s", error->code, error->message);
-               g_error_free (error);
-               error = err;
-       } else {
+        if (error) {
+            //consistant error message flow
+            GError *err = TLM_GET_ERROR_FOR_ID (
+                    TLM_ERROR_SESSION_CREATION_FAILURE,
+                    "%d:%s", error->code, error->message);
+            g_error_free (error);
+            error = err;
+        } else {
             error = TLM_GET_ERROR_FOR_ID (TLM_ERROR_SESSION_CREATION_FAILURE,
                     "Unable to authenticate PAM sesssion");
-       }
-       g_signal_emit (session, signals[SIG_SESSION_ERROR], 0, error);
-       g_error_free (error);
-       return FALSE;
+        }
+        g_signal_emit (session, signals[SIG_SESSION_ERROR], 0, error);
+        g_error_free (error);
+        return FALSE;
     }
     g_signal_emit (session, signals[SIG_AUTHENTICATED], 0);
 
+    priv->session_pause =  tlm_config_get_boolean (priv->config,
+                                             TLM_CONFIG_GENERAL,
+                                             TLM_CONFIG_GENERAL_PAUSE_SESSION,
+                                             FALSE);
+    if (priv->session_pause) {
+        _set_environment (priv);
+        umask(0700);
+    }
+
     if (!tlm_auth_session_open (priv->auth_session, &error)) {
-       if (!error) {
-               error = TLM_GET_ERROR_FOR_ID (TLM_ERROR_SESSION_CREATION_FAILURE,
-                               "Unable to open PAM sesssion");
-       }
-       g_signal_emit (session, signals[SIG_SESSION_ERROR], 0, error);
-       g_error_free (error);
-       return FALSE;
+        if (!error) {
+            error = TLM_GET_ERROR_FOR_ID (TLM_ERROR_SESSION_CREATION_FAILURE,
+                    "Unable to open PAM sesssion");
+        }
+        g_signal_emit (session, signals[SIG_SESSION_ERROR], 0, error);
+        g_error_free (error);
+        return FALSE;
     }
     priv->sessionid = g_strdup (tlm_auth_session_get_sessionid (
-               priv->auth_session));
+            priv->auth_session));
     tlm_utils_log_utmp_entry (priv->username);
-    _exec_user_session (session);
+    if (!priv->session_pause)
+        _exec_user_session (session);
     g_signal_emit (session, signals[SIG_SESSION_CREATED], 0, priv->sessionid);
     return TRUE;
 }
index 84204da..688bc37 100644 (file)
@@ -10,7 +10,7 @@ tlm_client_CFLAGS = \
     $(TLM_CFLAGS) \
     -DTLM_BIN_DIR='"$(bindir)"' \
     $(DEPS_CFLAGS)
-       
+
 tlm_client_LDADD = \
        $(DEPS_LIBS) \
        $(top_builddir)/src/common/libtlm-common.la \
index 8719522..735e51e 100755 (executable)
@@ -9,6 +9,9 @@ if [ $# -ne 2 -o -z "$1" -o -z "$2" ]; then
     exit
 fi
 
+currdir=`pwd`;
+echo "CURR dir = $currdir"
+
 mkdir -p $2 && \
 cd $2 && \
 git rm -f -r *; rm -rf packaging;
@@ -17,4 +20,5 @@ mkdir -p packaging && \
 cp dists/rpm/tizen/packaging/tlm.spec packaging/ && \
 cp dists/rpm/tizen/packaging/tlm.manifest packaging/ && \
 cp dists/rpm/tizen/packaging/tlm.changes packaging/ && \
-git add -f *;
+cp $currdir/.gitignore $2/;
+git add -f *; git add .gitignore;