bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/misc/entrance.git/commit/?id=babe4d980704e7f6fa2a564d87bede5700d8e2c4

commit babe4d980704e7f6fa2a564d87bede5700d8e2c4
Author: Marcel Hollerbach <marcel-hollerb...@t-online.de>
Date:   Sat Aug 8 14:56:55 2015 +0200

    entrance: let the greeter user be configurable
---
 data/entrance.conf.in        |  3 +++
 src/daemon/entrance.c        | 17 +++++++++++++++--
 src/daemon/entrance_config.c |  1 +
 src/daemon/entrance_config.h |  1 +
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/data/entrance.conf.in b/data/entrance.conf.in
index fe636dc..ac143da 100644
--- a/data/entrance.conf.in
+++ b/data/entrance.conf.in
@@ -69,4 +69,7 @@ group "Entrance_Config" struct {
 
     /* Use a virtual keyboard */
     value "virtual_keyboard" uchar: 0;
+
+    /* the user to log in with */
+    value "start_user" string: "entrance";
 }
diff --git a/src/daemon/entrance.c b/src/daemon/entrance.c
index 9592cda..a1d2010 100644
--- a/src/daemon/entrance.c
+++ b/src/daemon/entrance.c
@@ -192,17 +192,30 @@ _entrance_main(const char *dname)
         if (!_entrance_client)
           {
              char buf[PATH_MAX];
+             const char *user = NULL;
              ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
                                      _entrance_client_del, NULL);
              ecore_event_handler_add(ECORE_EXE_EVENT_ERROR,
                                      _entrance_client_error, NULL);
              ecore_event_handler_add(ECORE_EXE_EVENT_DATA,
                                      
(Ecore_Event_Handler_Cb)_entrance_client_data, NULL);
+             if (entrance_config->start_user && entrance_config->start_user[0])
+               {
+                  if (getpwnam(entrance_config->start_user))
+                    user = entrance_config->start_user;
+               }
+
+             if (!user)
+               {
+                 PT("The given user %s, is not not valid. Falling back to 
nobody user, possible that this wont work, set up a correct start_user in 
entrance.conf", entrance_config->start_user);
+                 user = "nobody";
+               }
+
              snprintf(buf, sizeof(buf),
-                      SUDO" -u nobody "
+                      SUDO" -u %s "
                       "LD_LIBRARY_PATH="PACKAGE_LIB_DIR" "
                       PACKAGE_BIN_DIR"/entrance_client -d %s -t %s",
-                      dname, entrance_config->theme);
+                      user, dname, entrance_config->theme);
              PT("Exec entrance_client: %s", buf);
 
              _entrance_client = ecore_exe_pipe_run(buf, ECORE_EXE_PIPE_READ | 
ECORE_EXE_PIPE_ERROR, NULL);
diff --git a/src/daemon/entrance_config.c b/src/daemon/entrance_config.c
index d6fe5e9..1e0fc76 100644
--- a/src/daemon/entrance_config.c
+++ b/src/daemon/entrance_config.c
@@ -170,6 +170,7 @@ entrance_config_init()
    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "elementary_profile", 
elm_profile, EET_T_STRING);
    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "virtual_keyboard", 
vkbd_enabled, EET_T_UCHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "custom_conf", 
custom_conf, EET_T_UCHAR);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Entrance_Config, "start_user", 
start_user, EET_T_STRING);
    _entrance_config_descriptor = edd;
 
    if (stat( "/var/cache/"PACKAGE"/"ENTRANCE_CONFIG_FILE, &cache) == -1)
diff --git a/src/daemon/entrance_config.h b/src/daemon/entrance_config.h
index 65e37db..155a687 100644
--- a/src/daemon/entrance_config.h
+++ b/src/daemon/entrance_config.h
@@ -37,6 +37,7 @@ struct _Entrance_Config
    Eina_Bool autologin;
    Eina_Bool custom_conf;
    Eina_Bool vkbd_enabled;
+   const char *start_user;
 };
 
 void entrance_config_init(void);

-- 


Reply via email to