Compare commits

..

3 Commits

Author SHA1 Message Date
Marcel Hollerbach 358b445c22 entrance_wait: kill server if session was killed. 7 years ago
Marcel Hollerbach cecdf152c7 entrance: Use PT instead of ERR 7 years ago
Marcel Hollerbach e8e04b73d1 entrance_wait: do not react on closed clients 7 years ago
  1. 3
      data/entrance.conf.in
  2. 2
      src/bin/entrance_client.c
  3. 92
      src/daemon/entrance.c
  4. 1
      src/daemon/entrance_config.c
  5. 1
      src/daemon/entrance_config.h
  6. 1
      src/daemon/entrance_server.c
  7. 6
      src/daemon/entrance_wait.c

@ -69,7 +69,4 @@ group "Entrance_Config" struct {
/* Use a virtual keyboard */
value "virtual_keyboard" uchar: 0;
/* the user to log in with */
value "start_user" string: "nobody";
}

@ -52,8 +52,6 @@ main(int argc, char **argv)
eina_shutdown();
return EXIT_FAILURE;
}
if (!theme)
theme = "default";
ecore_init();
ecore_x_init(display);
elm_init(argc, argv);

@ -5,11 +5,9 @@
#include <Eina.h>
#include "Ecore_Getopt.h"
#include <xcb/xcb.h>
#include <assert.h>
#define ENTRANCE_DISPLAY ":0.0"
#define ENTRANCE_XEPHYR ":1.0"
#define ENTRANCE_CONFIG_HOME_PATH "/var/cache/entrance/client"
static Eina_Bool _open_log();
static Eina_Bool _entrance_main(const char *dname);
@ -149,7 +147,7 @@ _entrance_wait(void)
}
static Eina_Bool
_entrance_client_error(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
_entrance_client_error(void *data EINA_UNUSED, int type, void *event)
{
char buf[4096];
Ecore_Exe_Event_Data *ev;
@ -188,88 +186,26 @@ _entrance_client_data(void *d EINA_UNUSED, int t EINA_UNUSED, void *event)
static Eina_Bool
_entrance_main(const char *dname)
{
struct passwd *pwd = NULL;
const char *user;
char buf[PATH_MAX];
const char *home_path;
struct stat st;
PT("starting...");
if (!entrance_config->autologin)
{
if (!_entrance_client)
{
char buf[PATH_MAX];
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,
_entrance_client_data, NULL);
if (entrance_config->start_user
&& entrance_config->start_user[0]) {
pwd = getpwnam(entrance_config->start_user);
}
if (!pwd)
{
PT("The given user %s, is not valid."
"Falling back to nobody", entrance_config->start_user);
pwd = getpwnam("nobody");
user = "nobody";
assert(pwd);
}
else
{
user = entrance_config->start_user;
}
if (!pwd->pw_dir || !strcmp(pwd->pw_dir, "/"))
{
PT("No home directory for client");
home_path = ENTRANCE_CONFIG_HOME_PATH;
if (!ecore_file_exists(ENTRANCE_CONFIG_HOME_PATH))
{
PT("Creating new home directory for client");
ecore_file_mkdir(ENTRANCE_CONFIG_HOME_PATH);
chown(ENTRANCE_CONFIG_HOME_PATH,
pwd->pw_uid, pwd->pw_gid);
}
else
{
if (!ecore_file_is_dir(ENTRANCE_CONFIG_HOME_PATH))
{
PT("Hum a file already exists here "
ENTRANCE_CONFIG_HOME_PATH" sorry but"
"I remove it, I need it ^^");
ecore_file_remove(ENTRANCE_CONFIG_HOME_PATH);
ecore_file_mkdir(ENTRANCE_CONFIG_HOME_PATH);
chown(ENTRANCE_CONFIG_HOME_PATH,
pwd->pw_uid, pwd->pw_gid);
}
}
}
else
{
home_path = pwd->pw_dir;
}
PT("Home directory %s", home_path);
stat(home_path, &st);
if ((st.st_uid != pwd->pw_uid)
|| (st.st_gid != pwd->pw_gid))
{
PT("The permission about %s is wrong, I fix it", home_path);
chown(home_path, pwd->pw_uid, pwd->pw_gid);
}
(Ecore_Event_Handler_Cb)_entrance_client_data, NULL);
snprintf(buf, sizeof(buf),
SUDO" --user %s HOME=%s "
SUDO" -u nobody "
"LD_LIBRARY_PATH="PACKAGE_LIB_DIR" "
PACKAGE_BIN_DIR"/entrance_client -d %s -t %s",
user, home_path, dname, entrance_config->theme);
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);
_entrance_client = ecore_exe_pipe_run(buf, ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR, NULL);
}
}
else
@ -335,14 +271,11 @@ static const Ecore_Getopt options =
{
ECORE_GETOPT_STORE_TRUE('n', "nodaemon", "Don't daemonize."),
ECORE_GETOPT_STORE_TRUE('t', "test", "run in test mode."),
ECORE_GETOPT_STORE_TRUE('e', "fastexit", "Will change the way entrance"
"handles the exit of the created session. If "
"set, entrance will exit if the session quits. "
"If not, entrance will restart if the session is "
"quit because of an error, or if the environment "
"variable ENTRANCE_RESTART is set."),
ECORE_GETOPT_STORE_TRUE('x', "xephyr", "run in test mode and use "
"Xephyr."),
ECORE_GETOPT_STORE_TRUE('e', "fastexit", "Will change the way entrance \
handles the exit of the created session. If set, entrance will exit if the session \
quits. If not, entrance will restart if the session is quit because of an error, \
or if the environment variable ENTRANCE_RESTART is set."),
ECORE_GETOPT_STORE_TRUE('x', "xephyr", "run in test mode and use Xephyr."),
ECORE_GETOPT_HELP ('h', "help"),
ECORE_GETOPT_VERSION('V', "version"),
ECORE_GETOPT_COPYRIGHT('R', "copyright"),
@ -379,8 +312,7 @@ main (int argc, char ** argv)
eina_log_threads_enable();
ecore_init();
_entrance_log = eina_log_domain_register("entrance", EINA_COLOR_CYAN);
_entrance_client_log = eina_log_domain_register("entrance_client",
EINA_COLOR_CYAN);
_entrance_client_log = eina_log_domain_register("entrance_client", EINA_COLOR_CYAN);
eina_log_domain_level_set("entrance", 5);
eina_log_domain_level_set("entrance_client", 5);

@ -170,7 +170,6 @@ 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)

@ -37,7 +37,6 @@ struct _Entrance_Config
Eina_Bool autologin;
Eina_Bool custom_conf;
Eina_Bool vkbd_enabled;
const char *start_user;
};
void entrance_config_init(void);

@ -39,7 +39,6 @@ _entrance_server_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event E
eev.event.conf_gui.enabled = EINA_TRUE;
eev.event.conf_gui.bg.path = entrance_config->bg.path;
eev.event.conf_gui.bg.group = entrance_config->bg.group;
eev.event.conf_gui.theme = NULL;
entrance_event_send(&eev);
}
PT("Sending pools");

@ -15,7 +15,7 @@ static void kill_wait();
static pid_t _x_pid = 0;
static void
_entrance_wait_action(int sig __UNUSED__, siginfo_t * si __UNUSED__, void *data __UNUSED__)
_entrance_wait_action(int sig, siginfo_t * si __UNUSED__, void *data __UNUSED__)
{
kill_wait();
setenv("ENTRANCE_QUIT", "1", 1);
@ -71,11 +71,11 @@ main (int argc __UNUSED__, char **argv __UNUSED__)
kill_wait();
}
}
if (WIFEXITED(status) && WEXITSTATUS(status))
setenv("ENTRANCE_QUIT", "1", 1);
execlp(PACKAGE_SBIN_DIR"/entrance", PACKAGE_SBIN_DIR"/entrance", "--nodaemon", NULL);
return -1;
}

Loading…
Cancel
Save